Version Description
- Improvement: Hardened the security of plugin
- Improvement: Compatibility with latest WordPress PHP_CodeSniffer rules
Download this release
Release Info
Developer | brainstormworg |
Plugin | Astra Widgets |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- astra-widgets.php +2 -2
- classes/class-astra-widgets-helper.php +37 -42
- classes/class-astra-widgets-loader.php +3 -3
- classes/class-astra-widgets.php +1 -1
- classes/widgets/class-astra-widget-address.php +20 -20
- classes/widgets/class-astra-widget-list-icons.php +20 -22
- classes/widgets/class-astra-widget-social-profiles.php +18 -21
- readme.txt +6 -2
astra-widgets.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Astra Widgets
|
4 |
* Plugin URI: https://wpastra.com/
|
5 |
* Description: The Fastest Way to Add More Widgets into Your WordPress Website.
|
6 |
-
* Version: 1.2.
|
7 |
* Author: Brainstorm Force
|
8 |
* Author URI: https://www.brainstormforce.com
|
9 |
* Text Domain: astra-widgets
|
@@ -25,7 +25,7 @@ define( 'ASTRA_WIDGETS_FILE', __FILE__ );
|
|
25 |
define( 'ASTRA_WIDGETS_BASE', plugin_basename( ASTRA_WIDGETS_FILE ) );
|
26 |
define( 'ASTRA_WIDGETS_DIR', plugin_dir_path( ASTRA_WIDGETS_FILE ) );
|
27 |
define( 'ASTRA_WIDGETS_URI', plugins_url( '/', ASTRA_WIDGETS_FILE ) );
|
28 |
-
define( 'ASTRA_WIDGETS_VER', '1.2.
|
29 |
define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
|
30 |
|
31 |
require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
|
3 |
* Plugin Name: Astra Widgets
|
4 |
* Plugin URI: https://wpastra.com/
|
5 |
* Description: The Fastest Way to Add More Widgets into Your WordPress Website.
|
6 |
+
* Version: 1.2.3
|
7 |
* Author: Brainstorm Force
|
8 |
* Author URI: https://www.brainstormforce.com
|
9 |
* Text Domain: astra-widgets
|
25 |
define( 'ASTRA_WIDGETS_BASE', plugin_basename( ASTRA_WIDGETS_FILE ) );
|
26 |
define( 'ASTRA_WIDGETS_DIR', plugin_dir_path( ASTRA_WIDGETS_FILE ) );
|
27 |
define( 'ASTRA_WIDGETS_URI', plugins_url( '/', ASTRA_WIDGETS_FILE ) );
|
28 |
+
define( 'ASTRA_WIDGETS_VER', '1.2.3' );
|
29 |
define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
|
30 |
|
31 |
require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
|
classes/class-astra-widgets-helper.php
CHANGED
@@ -14,7 +14,6 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
class Astra_Widgets_Helper {
|
17 |
-
|
18 |
/**
|
19 |
* Instance
|
20 |
*
|
@@ -44,7 +43,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
44 |
*/
|
45 |
public static function get_instance() {
|
46 |
if ( ! isset( self::$instance ) ) {
|
47 |
-
self::$instance = new self;
|
48 |
}
|
49 |
return self::$instance;
|
50 |
}
|
@@ -64,7 +63,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
64 |
* @param string $hook Page name.
|
65 |
* @return void
|
66 |
*/
|
67 |
-
function enqueue_admin_scripts( $hook ) {
|
68 |
|
69 |
if ( 'widgets.php' !== $hook ) {
|
70 |
return;
|
@@ -78,7 +77,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
78 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
79 |
|
80 |
wp_enqueue_style( 'wp-color-picker' );
|
81 |
-
wp_enqueue_style( 'astra-widgets-backend', $css_uri . 'astra-widgets-admin' . $file_prefix . '.css' );
|
82 |
wp_enqueue_script( 'astra-widgets-backend', $js_uri . 'astra-widgets-backend' . $file_prefix . '.js', array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker' ), ASTRA_WIDGETS_VER, true );
|
83 |
|
84 |
$font_awesome_icons = self::backend_load_font_awesome_icons();
|
@@ -113,7 +112,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
113 |
}
|
114 |
|
115 |
// Used https://gist.github.com/Balachandark/048d40f8eb18a9a9c7623dc949ff8d1a to remove unwanted data from the JSON file.
|
116 |
-
$str = file_get_contents( ASTRA_WIDGETS_DIR . 'assets/fonts/icons.json' );
|
117 |
self::$json = json_decode( $str, true ); // decode the JSON into an associative array.
|
118 |
|
119 |
return self::$json;
|
@@ -127,7 +126,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
127 |
* @param array $fields Fields array.
|
128 |
* @return boolean Repeater field exist.
|
129 |
*/
|
130 |
-
function have_repeator_field( $fields = array() ) {
|
131 |
foreach ( $fields as $key => $field ) {
|
132 |
if ( 'repeater' === $field['type'] ) {
|
133 |
return true;
|
@@ -367,7 +366,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
367 |
* @param string $repeater_id Repeater ID.
|
368 |
* @return void
|
369 |
*/
|
370 |
-
function generate( $self, $fields = array(), $repeater_id = '' ) {
|
371 |
|
372 |
$defaults = array(
|
373 |
'type' => '',
|
@@ -420,13 +419,12 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
420 |
</div>
|
421 |
|
422 |
<input class="widefat selected-icon" type="hidden"
|
423 |
-
id="<?php echo esc_attr( $field_id ); ?>"
|
424 |
name="<?php echo esc_attr( $field_name ); ?>"
|
425 |
value="<?php echo esc_attr( $encode_icon_data ); ?>"
|
426 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
|
427 |
data-icon-visible="<?php echo esc_attr( ( isset( $value['show_icon'] ) ) ? $value['show_icon'] : 'no' ); ?>"
|
428 |
/>
|
429 |
-
<span><?php echo $value['desc']; ?></span>
|
430 |
</div>
|
431 |
<?php
|
432 |
break;
|
@@ -442,10 +440,9 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
442 |
?>
|
443 |
<div class="astra-widget-field astra-widget-field-checkbox">
|
444 |
<input class="checkbox" type="checkbox"
|
445 |
-
<?php checked( $value['default'] ); ?>
|
446 |
-
id="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"
|
447 |
name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" />
|
448 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
449 |
</div>
|
450 |
<?php
|
451 |
break;
|
@@ -460,14 +457,14 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
460 |
</div>
|
461 |
</div>
|
462 |
<div class="add-new">
|
463 |
-
<button class="add-new-btn button"><?php
|
464 |
</div>
|
465 |
|
466 |
<?php
|
467 |
$repeater_id = 'widget-' . $self->id_base . '[' . $self->number . '][' . $value['id'] . ']';
|
468 |
?>
|
469 |
|
470 |
-
<div class="astra-repeater-fields" title="<?php echo $value['title']; ?>" data-id="<?php echo esc_attr( $repeater_id ); ?>" style="display: none;">
|
471 |
<?php $this->generate( $self, $value['options'], $value['id'] ); ?>
|
472 |
</div>
|
473 |
</div>
|
@@ -484,15 +481,14 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
484 |
?>
|
485 |
<div class="astra-widget-field astra-widget-field-text">
|
486 |
<label for="<?php echo esc_attr( $field_id ); ?>">
|
487 |
-
<?php echo $value['name']; ?>
|
488 |
</label>
|
489 |
-
<input class="widefat" type="text"
|
490 |
-
id="<?php echo esc_attr( $field_id ); ?>"
|
491 |
name="<?php echo esc_attr( $field_name ); ?>"
|
492 |
value="<?php echo esc_attr( $value['default'] ); ?>"
|
493 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
|
494 |
/>
|
495 |
-
<span><?php echo $value['desc']; ?></span>
|
496 |
</div>
|
497 |
<?php
|
498 |
break;
|
@@ -517,7 +513,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
517 |
<p>
|
518 |
<div class="astra-field-image-wrapper">
|
519 |
<div class="astra-field-image-title" for="<?php echo esc_attr( $field_id ); ?>">
|
520 |
-
<?php echo $value['name']; ?>
|
521 |
</div>
|
522 |
<div class="astra-field-image">
|
523 |
<div class="astra-field-image-preview">
|
@@ -530,13 +526,12 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
530 |
<?php } ?>
|
531 |
</div>
|
532 |
<input
|
533 |
-
class="astra-field-image-preview-id"
|
534 |
-
id="<?php echo esc_attr( $field_id ); ?>"
|
535 |
name="<?php echo esc_attr( $field_name ); ?>"
|
536 |
type="hidden"
|
537 |
-
value="<?php echo $value['default']; ?>"
|
538 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>">
|
539 |
-
<div class="astra-select-image button" <?php echo $button_enable; ?>>Choose Image</div>
|
540 |
</div>
|
541 |
</div>
|
542 |
</p>
|
@@ -545,7 +540,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
545 |
case 'radio':
|
546 |
?>
|
547 |
<p>
|
548 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
549 |
<?php foreach ( $value['options'] as $option ) { ?>
|
550 |
|
551 |
<?php
|
@@ -554,7 +549,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
554 |
$c = ' checked="checked" ';
|
555 |
}
|
556 |
?>
|
557 |
-
<input <?php echo $value['default']; ?> class="widefat" type="radio" <?php echo $c; ?> name="<?php echo $self->get_field_name( $value['id'] ); ?>" value="<?php echo esc_attr( $option ); ?>" />
|
558 |
<?php } ?>
|
559 |
</p>
|
560 |
<?php
|
@@ -567,15 +562,15 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
567 |
$field_name = $self->get_field_name( $value['id'] );
|
568 |
}
|
569 |
?>
|
570 |
-
<div class="astra-widget-field astra-widget-field-select astra-widget-field-<?php echo $value['id']; ?>">
|
571 |
<div class="astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
572 |
-
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo $value['name']; ?></label>
|
573 |
-
<select class="widefat"
|
574 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>">
|
575 |
<?php
|
576 |
foreach ( $value['options'] as $op_val => $op_name ) {
|
577 |
?>
|
578 |
-
<option value="<?php echo $op_val; ?>" <?php selected( $value['default'], $op_val ); ?>><?php echo $op_name; ?></option>
|
579 |
<?php } ?>
|
580 |
</select>
|
581 |
</div>
|
@@ -584,16 +579,16 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
584 |
break;
|
585 |
case 'hidden':
|
586 |
?>
|
587 |
-
<input class="<?php echo $class; ?> widefat" type="hidden"
|
588 |
<?php
|
589 |
break;
|
590 |
case 'color':
|
591 |
?>
|
592 |
|
593 |
-
<div class="astra-widget-field astra-widget-field-color astra-widget-field-<?php echo $value['id']; ?>">
|
594 |
<div class="astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
595 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
596 |
-
<input class="<?php echo $class; ?> widefat" type="text"
|
597 |
</div>
|
598 |
</div>
|
599 |
|
@@ -614,8 +609,8 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
614 |
case 'email':
|
615 |
?>
|
616 |
<p>
|
617 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
618 |
-
<input class="widefat" type="email"
|
619 |
</p>
|
620 |
<?php
|
621 |
break;
|
@@ -623,17 +618,17 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
623 |
case 'textarea':
|
624 |
?>
|
625 |
<p>
|
626 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
627 |
-
<textarea class="widefat"
|
628 |
</p>
|
629 |
<?php
|
630 |
break;
|
631 |
|
632 |
case 'number':
|
633 |
?>
|
634 |
-
<div class="astra-widget-field astra-widget-field-number astra-widget-field-<?php echo $value['id']; ?> <?php echo $class; ?> <?php echo isset( $value['unit'] ) ? 'astra-widgets-number-unit' : ''; ?> <?php echo( isset( $value['unit'] ) ) ? ' astra-widget-unit-field' : ''; ?>">
|
635 |
-
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo $value['name']; ?></label>
|
636 |
-
<input class="widefat" type="number"
|
637 |
</div>
|
638 |
<?php
|
639 |
break;
|
@@ -656,7 +651,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
656 |
* @param array $value Default value.
|
657 |
* @return void
|
658 |
*/
|
659 |
-
function generate_repeater_fields( $self, $fields, $value ) {
|
660 |
$instances = $self->get_settings();
|
661 |
|
662 |
if ( array_key_exists( $self->number, $instances ) ) {
|
@@ -682,7 +677,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
|
|
682 |
?>
|
683 |
<div class="astra-repeater-field">
|
684 |
<div class="actions">
|
685 |
-
<span class="index"><?php echo $index; ?></span>
|
686 |
<span class="dashicons dashicons-move"></span>
|
687 |
<span class="title"></span>
|
688 |
<span class="dashicons dashicons-admin-page clone"></span>
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
class Astra_Widgets_Helper {
|
|
|
17 |
/**
|
18 |
* Instance
|
19 |
*
|
43 |
*/
|
44 |
public static function get_instance() {
|
45 |
if ( ! isset( self::$instance ) ) {
|
46 |
+
self::$instance = new self();
|
47 |
}
|
48 |
return self::$instance;
|
49 |
}
|
63 |
* @param string $hook Page name.
|
64 |
* @return void
|
65 |
*/
|
66 |
+
public function enqueue_admin_scripts( $hook ) {
|
67 |
|
68 |
if ( 'widgets.php' !== $hook ) {
|
69 |
return;
|
77 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
78 |
|
79 |
wp_enqueue_style( 'wp-color-picker' );
|
80 |
+
wp_enqueue_style( 'astra-widgets-backend', $css_uri . 'astra-widgets-admin' . $file_prefix . '.css', array(), ASTRA_WIDGETS_VER );
|
81 |
wp_enqueue_script( 'astra-widgets-backend', $js_uri . 'astra-widgets-backend' . $file_prefix . '.js', array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker' ), ASTRA_WIDGETS_VER, true );
|
82 |
|
83 |
$font_awesome_icons = self::backend_load_font_awesome_icons();
|
112 |
}
|
113 |
|
114 |
// Used https://gist.github.com/Balachandark/048d40f8eb18a9a9c7623dc949ff8d1a to remove unwanted data from the JSON file.
|
115 |
+
$str = file_get_contents( ASTRA_WIDGETS_DIR . 'assets/fonts/icons.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
116 |
self::$json = json_decode( $str, true ); // decode the JSON into an associative array.
|
117 |
|
118 |
return self::$json;
|
126 |
* @param array $fields Fields array.
|
127 |
* @return boolean Repeater field exist.
|
128 |
*/
|
129 |
+
public function have_repeator_field( $fields = array() ) {
|
130 |
foreach ( $fields as $key => $field ) {
|
131 |
if ( 'repeater' === $field['type'] ) {
|
132 |
return true;
|
366 |
* @param string $repeater_id Repeater ID.
|
367 |
* @return void
|
368 |
*/
|
369 |
+
public function generate( $self, $fields = array(), $repeater_id = '' ) {
|
370 |
|
371 |
$defaults = array(
|
372 |
'type' => '',
|
419 |
</div>
|
420 |
|
421 |
<input class="widefat selected-icon" type="hidden"
|
|
|
422 |
name="<?php echo esc_attr( $field_name ); ?>"
|
423 |
value="<?php echo esc_attr( $encode_icon_data ); ?>"
|
424 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
|
425 |
data-icon-visible="<?php echo esc_attr( ( isset( $value['show_icon'] ) ) ? $value['show_icon'] : 'no' ); ?>"
|
426 |
/>
|
427 |
+
<span><?php echo esc_html( $value['desc'] ); ?></span>
|
428 |
</div>
|
429 |
<?php
|
430 |
break;
|
440 |
?>
|
441 |
<div class="astra-widget-field astra-widget-field-checkbox">
|
442 |
<input class="checkbox" type="checkbox"
|
443 |
+
<?php checked( $value['default'] ); ?>
|
|
|
444 |
name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" />
|
445 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
446 |
</div>
|
447 |
<?php
|
448 |
break;
|
457 |
</div>
|
458 |
</div>
|
459 |
<div class="add-new">
|
460 |
+
<button class="add-new-btn button"><?php esc_html_e( 'Add Item', 'astra-widgets' ); ?></button>
|
461 |
</div>
|
462 |
|
463 |
<?php
|
464 |
$repeater_id = 'widget-' . $self->id_base . '[' . $self->number . '][' . $value['id'] . ']';
|
465 |
?>
|
466 |
|
467 |
+
<div class="astra-repeater-fields" title="<?php echo esc_attr( $value['title'] ); ?>" data-id="<?php echo esc_attr( $repeater_id ); ?>" style="display: none;">
|
468 |
<?php $this->generate( $self, $value['options'], $value['id'] ); ?>
|
469 |
</div>
|
470 |
</div>
|
481 |
?>
|
482 |
<div class="astra-widget-field astra-widget-field-text">
|
483 |
<label for="<?php echo esc_attr( $field_id ); ?>">
|
484 |
+
<?php echo esc_html( $value['name'] ); ?>
|
485 |
</label>
|
486 |
+
<input class="widefat" type="text"
|
|
|
487 |
name="<?php echo esc_attr( $field_name ); ?>"
|
488 |
value="<?php echo esc_attr( $value['default'] ); ?>"
|
489 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
|
490 |
/>
|
491 |
+
<span><?php echo esc_html( $value['desc'] ); ?></span>
|
492 |
</div>
|
493 |
<?php
|
494 |
break;
|
513 |
<p>
|
514 |
<div class="astra-field-image-wrapper">
|
515 |
<div class="astra-field-image-title" for="<?php echo esc_attr( $field_id ); ?>">
|
516 |
+
<?php echo esc_html( $value['name'] ); ?>
|
517 |
</div>
|
518 |
<div class="astra-field-image">
|
519 |
<div class="astra-field-image-preview">
|
526 |
<?php } ?>
|
527 |
</div>
|
528 |
<input
|
529 |
+
class="astra-field-image-preview-id"
|
|
|
530 |
name="<?php echo esc_attr( $field_name ); ?>"
|
531 |
type="hidden"
|
532 |
+
value="<?php echo esc_attr( $value['default'] ); ?>"
|
533 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>">
|
534 |
+
<div class="astra-select-image button" <?php echo esc_attr( $button_enable ); ?>>Choose Image</div>
|
535 |
</div>
|
536 |
</div>
|
537 |
</p>
|
540 |
case 'radio':
|
541 |
?>
|
542 |
<p>
|
543 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
544 |
<?php foreach ( $value['options'] as $option ) { ?>
|
545 |
|
546 |
<?php
|
549 |
$c = ' checked="checked" ';
|
550 |
}
|
551 |
?>
|
552 |
+
<input <?php echo esc_attr( $value['default'] ); ?> class="widefat" type="radio" <?php echo esc_attr( $c ); ?> name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $option ); ?>" />
|
553 |
<?php } ?>
|
554 |
</p>
|
555 |
<?php
|
562 |
$field_name = $self->get_field_name( $value['id'] );
|
563 |
}
|
564 |
?>
|
565 |
+
<div class="astra-widget-field astra-widget-field-select astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
566 |
<div class="astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
567 |
+
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
568 |
+
<select class="widefat" name="<?php echo esc_attr( $field_name ); ?>"
|
569 |
data-field-id="<?php echo esc_attr( $value['id'] ); ?>">
|
570 |
<?php
|
571 |
foreach ( $value['options'] as $op_val => $op_name ) {
|
572 |
?>
|
573 |
+
<option value="<?php echo esc_attr( $op_val ); ?>" <?php selected( $value['default'], $op_val ); ?>><?php echo esc_html( $op_name ); ?></option>
|
574 |
<?php } ?>
|
575 |
</select>
|
576 |
</div>
|
579 |
break;
|
580 |
case 'hidden':
|
581 |
?>
|
582 |
+
<input class="<?php echo esc_attr( $class ); ?> widefat" type="hidden" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/>
|
583 |
<?php
|
584 |
break;
|
585 |
case 'color':
|
586 |
?>
|
587 |
|
588 |
+
<div class="astra-widget-field astra-widget-field-color astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
589 |
<div class="astra-widget-field-<?php echo esc_attr( $value['id'] ); ?>">
|
590 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
591 |
+
<input class="<?php echo esc_attr( $class ); ?> widefat" type="text" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/>
|
592 |
</div>
|
593 |
</div>
|
594 |
|
609 |
case 'email':
|
610 |
?>
|
611 |
<p>
|
612 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
613 |
+
<input class="widefat" type="email" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/>
|
614 |
</p>
|
615 |
<?php
|
616 |
break;
|
618 |
case 'textarea':
|
619 |
?>
|
620 |
<p>
|
621 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
622 |
+
<textarea class="widefat" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" rows="5"><?php echo esc_attr( $value['default'] ); ?></textarea>
|
623 |
</p>
|
624 |
<?php
|
625 |
break;
|
626 |
|
627 |
case 'number':
|
628 |
?>
|
629 |
+
<div class="astra-widget-field astra-widget-field-number astra-widget-field-<?php echo esc_attr( $value['id'] ); ?> <?php echo esc_attr( $class ); ?> <?php echo isset( $value['unit'] ) ? 'astra-widgets-number-unit' : ''; ?> <?php echo( isset( $value['unit'] ) ) ? ' astra-widget-unit-field' : ''; ?>">
|
630 |
+
<label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
|
631 |
+
<input class="widefat" type="number" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/><span class="astra-widgets-unit"> <?php echo ( isset( $value['unit'] ) ) ? esc_html( $value['unit'] ) : ''; ?> </span>
|
632 |
</div>
|
633 |
<?php
|
634 |
break;
|
651 |
* @param array $value Default value.
|
652 |
* @return void
|
653 |
*/
|
654 |
+
public function generate_repeater_fields( $self, $fields, $value ) {
|
655 |
$instances = $self->get_settings();
|
656 |
|
657 |
if ( array_key_exists( $self->number, $instances ) ) {
|
677 |
?>
|
678 |
<div class="astra-repeater-field">
|
679 |
<div class="actions">
|
680 |
+
<span class="index"><?php echo esc_html( $index ); ?></span>
|
681 |
<span class="dashicons dashicons-move"></span>
|
682 |
<span class="title"></span>
|
683 |
<span class="dashicons dashicons-admin-page clone"></span>
|
classes/class-astra-widgets-loader.php
CHANGED
@@ -27,7 +27,7 @@ if ( ! class_exists( 'Astra_Widgets_Loader' ) ) {
|
|
27 |
*/
|
28 |
public static function get_instance() {
|
29 |
if ( ! isset( self::$instance ) ) {
|
30 |
-
self::$instance = new self;
|
31 |
}
|
32 |
return self::$instance;
|
33 |
}
|
@@ -55,7 +55,7 @@ if ( ! class_exists( 'Astra_Widgets_Loader' ) ) {
|
|
55 |
*
|
56 |
* @return void
|
57 |
*/
|
58 |
-
function register_list_icons_widgets() {
|
59 |
register_widget( 'Astra_Widget_Address' );
|
60 |
register_widget( 'Astra_Widget_List_Icons' );
|
61 |
register_widget( 'Astra_Widget_Social_Profiles' );
|
@@ -66,7 +66,7 @@ if ( ! class_exists( 'Astra_Widgets_Loader' ) ) {
|
|
66 |
*
|
67 |
* @return void
|
68 |
*/
|
69 |
-
function enqueue_scripts_backend_and_frontend() {
|
70 |
}
|
71 |
}
|
72 |
}
|
27 |
*/
|
28 |
public static function get_instance() {
|
29 |
if ( ! isset( self::$instance ) ) {
|
30 |
+
self::$instance = new self();
|
31 |
}
|
32 |
return self::$instance;
|
33 |
}
|
55 |
*
|
56 |
* @return void
|
57 |
*/
|
58 |
+
public function register_list_icons_widgets() {
|
59 |
register_widget( 'Astra_Widget_Address' );
|
60 |
register_widget( 'Astra_Widget_List_Icons' );
|
61 |
register_widget( 'Astra_Widget_Social_Profiles' );
|
66 |
*
|
67 |
* @return void
|
68 |
*/
|
69 |
+
public function enqueue_scripts_backend_and_frontend() {
|
70 |
}
|
71 |
}
|
72 |
}
|
classes/class-astra-widgets.php
CHANGED
@@ -29,7 +29,7 @@ if ( ! class_exists( 'Astra_Widgets' ) ) :
|
|
29 |
*/
|
30 |
public static function get_instance() {
|
31 |
if ( ! isset( self::$instance ) ) {
|
32 |
-
self::$instance = new self;
|
33 |
}
|
34 |
return self::$instance;
|
35 |
}
|
29 |
*/
|
30 |
public static function get_instance() {
|
31 |
if ( ! isset( self::$instance ) ) {
|
32 |
+
self::$instance = new self();
|
33 |
}
|
34 |
return self::$instance;
|
35 |
}
|
classes/widgets/class-astra-widget-address.php
CHANGED
@@ -44,7 +44,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
44 |
*/
|
45 |
public static function get_instance() {
|
46 |
if ( ! isset( self::$instance ) ) {
|
47 |
-
self::$instance = new self;
|
48 |
}
|
49 |
return self::$instance;
|
50 |
}
|
@@ -54,7 +54,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
54 |
*
|
55 |
* @since 1.0.0
|
56 |
*/
|
57 |
-
function __construct() {
|
58 |
parent::__construct(
|
59 |
$this->id_base,
|
60 |
__( 'Astra: Address', 'astra-widgets' ),
|
@@ -74,7 +74,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
74 |
*
|
75 |
* @return void
|
76 |
*/
|
77 |
-
function register_scripts() {
|
78 |
|
79 |
/* Directory and Extension */
|
80 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
@@ -83,7 +83,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
83 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
84 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
85 |
|
86 |
-
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-address' . $file_prefix . '.css' );
|
87 |
|
88 |
}
|
89 |
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
94 |
* @param array $instance Widget instance.
|
95 |
* @return void
|
96 |
*/
|
97 |
-
function
|
98 |
|
99 |
// Set stored data.
|
100 |
$this->stored_data = $instance;
|
@@ -113,9 +113,9 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
113 |
* @param array $instance Widget instance.
|
114 |
* @return void
|
115 |
*/
|
116 |
-
function widget( $args, $instance ) {
|
117 |
|
118 |
-
$this->
|
119 |
|
120 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
121 |
$style = isset( $instance['style'] ) ? $instance['style'] : 'stack';
|
@@ -126,9 +126,9 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
126 |
$email = isset( $instance['email'] ) ? $instance['email'] : '';
|
127 |
|
128 |
// Before Widget.
|
129 |
-
echo $args['before_widget'];
|
130 |
if ( $title ) {
|
131 |
-
echo $args['before_title'] . $title . $args['after_title'];
|
132 |
} ?>
|
133 |
<?php
|
134 |
$widget_content_font_size = '15';
|
@@ -145,17 +145,17 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
145 |
<div class="widget-address-field">
|
146 |
<?php if ( $social_icons ) { ?>
|
147 |
<?php // Font Awesome 5 SVG. ?>
|
148 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo $widget_content_font_size . 'px'; ?>" height="<?php echo $widget_content_font_size . 'px'; ?>" viewBox="0 0 496 512"><path d="M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"></path>
|
149 |
</svg>
|
150 |
<?php } ?>
|
151 |
-
<span class="address-meta"><?php echo nl2br( $address ); ?></span>
|
152 |
</div>
|
153 |
<?php } ?>
|
154 |
<?php if ( ! empty( $phone ) ) { ?>
|
155 |
<div class="widget-address-field">
|
156 |
<?php if ( $social_icons ) { ?>
|
157 |
<?php // Font Awesome 5 SVG. ?>
|
158 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo $widget_content_font_size . 'px'; ?>" height="<?php echo $widget_content_font_size . 'px'; ?>" viewBox="0 0 512 512"><path d="M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"></path>
|
159 |
</svg>
|
160 |
<?php } ?>
|
161 |
<?php
|
@@ -167,7 +167,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
167 |
|
168 |
?>
|
169 |
<span class="address-meta">
|
170 |
-
<a href="tel:<?php echo $prefix . preg_replace( '/\D/', '', esc_attr( $phone ) ); ?>" ><?php echo
|
171 |
</span>
|
172 |
</div>
|
173 |
<?php } ?>
|
@@ -175,7 +175,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
175 |
<div class="widget-address-field">
|
176 |
<?php if ( $social_icons ) { ?>
|
177 |
<?php // Font Awesome 5 SVG. ?>
|
178 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo $widget_content_font_size . 'px'; ?>" height="<?php echo $widget_content_font_size . 'px'; ?>" viewBox="0 0 384 512"><path d="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"></path>
|
179 |
</svg>
|
180 |
<?php } ?>
|
181 |
<span class="address-meta"><?php echo esc_attr( $fax ); ?></span>
|
@@ -188,11 +188,11 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
188 |
<div class="widget-address-field">
|
189 |
<?php if ( $social_icons ) { ?>
|
190 |
<?php // Font Awesome 5 SVG. ?>
|
191 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo $widget_content_font_size . 'px'; ?>" height="<?php echo $widget_content_font_size . 'px'; ?>" viewBox="0 0 512 512"><path d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path>
|
192 |
</svg>
|
193 |
<?php } ?>
|
194 |
<span class="address-meta">
|
195 |
-
<a href="mailto:<?php echo antispambot( $email ); ?>" ><?php echo antispambot( $email ); ?></a>
|
196 |
</span>
|
197 |
</div>
|
198 |
<?php } ?>
|
@@ -202,7 +202,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
202 |
<?php
|
203 |
|
204 |
// After Widget.
|
205 |
-
echo $args['after_widget']
|
206 |
}
|
207 |
|
208 |
/**
|
@@ -212,7 +212,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
212 |
* @param array $old_instance Widget old instance.
|
213 |
* @return array Merged updated instance.
|
214 |
*/
|
215 |
-
function update( $new_instance, $old_instance ) {
|
216 |
|
217 |
$instance = wp_parse_args( $new_instance, $old_instance );
|
218 |
|
@@ -233,7 +233,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
233 |
* @param array $instance Widget instance.
|
234 |
* @return void
|
235 |
*/
|
236 |
-
function form( $instance ) {
|
237 |
|
238 |
$fields = array(
|
239 |
array(
|
@@ -312,7 +312,7 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
312 |
*
|
313 |
* @return string
|
314 |
*/
|
315 |
-
function get_dynamic_css() {
|
316 |
|
317 |
$dynamic_css = '';
|
318 |
$instances = get_option( 'widget_' . $this->id_base );
|
44 |
*/
|
45 |
public static function get_instance() {
|
46 |
if ( ! isset( self::$instance ) ) {
|
47 |
+
self::$instance = new self();
|
48 |
}
|
49 |
return self::$instance;
|
50 |
}
|
54 |
*
|
55 |
* @since 1.0.0
|
56 |
*/
|
57 |
+
public function __construct() {
|
58 |
parent::__construct(
|
59 |
$this->id_base,
|
60 |
__( 'Astra: Address', 'astra-widgets' ),
|
74 |
*
|
75 |
* @return void
|
76 |
*/
|
77 |
+
public function register_scripts() {
|
78 |
|
79 |
/* Directory and Extension */
|
80 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
83 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
84 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
85 |
|
86 |
+
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-address' . $file_prefix . '.css', array(), ASTRA_WIDGETS_VER );
|
87 |
|
88 |
}
|
89 |
|
94 |
* @param array $instance Widget instance.
|
95 |
* @return void
|
96 |
*/
|
97 |
+
public function front_setup( $args, $instance ) {
|
98 |
|
99 |
// Set stored data.
|
100 |
$this->stored_data = $instance;
|
113 |
* @param array $instance Widget instance.
|
114 |
* @return void
|
115 |
*/
|
116 |
+
public function widget( $args, $instance ) {
|
117 |
|
118 |
+
$this->front_setup( $args, $instance );
|
119 |
|
120 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
121 |
$style = isset( $instance['style'] ) ? $instance['style'] : 'stack';
|
126 |
$email = isset( $instance['email'] ) ? $instance['email'] : '';
|
127 |
|
128 |
// Before Widget.
|
129 |
+
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
130 |
if ( $title ) {
|
131 |
+
echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
132 |
} ?>
|
133 |
<?php
|
134 |
$widget_content_font_size = '15';
|
145 |
<div class="widget-address-field">
|
146 |
<?php if ( $social_icons ) { ?>
|
147 |
<?php // Font Awesome 5 SVG. ?>
|
148 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" height="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" viewBox="0 0 496 512"><path d="M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"></path>
|
149 |
</svg>
|
150 |
<?php } ?>
|
151 |
+
<span class="address-meta"><?php echo nl2br( $address ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
|
152 |
</div>
|
153 |
<?php } ?>
|
154 |
<?php if ( ! empty( $phone ) ) { ?>
|
155 |
<div class="widget-address-field">
|
156 |
<?php if ( $social_icons ) { ?>
|
157 |
<?php // Font Awesome 5 SVG. ?>
|
158 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" height="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" viewBox="0 0 512 512"><path d="M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"></path>
|
159 |
</svg>
|
160 |
<?php } ?>
|
161 |
<?php
|
167 |
|
168 |
?>
|
169 |
<span class="address-meta">
|
170 |
+
<a href="tel:<?php echo esc_attr( $prefix ) . esc_attr( preg_replace( '/\D/', '', esc_attr( $phone ) ) ); ?>" ><?php echo esc_html( $phone ); ?></a>
|
171 |
</span>
|
172 |
</div>
|
173 |
<?php } ?>
|
175 |
<div class="widget-address-field">
|
176 |
<?php if ( $social_icons ) { ?>
|
177 |
<?php // Font Awesome 5 SVG. ?>
|
178 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" height="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" viewBox="0 0 384 512"><path d="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"></path>
|
179 |
</svg>
|
180 |
<?php } ?>
|
181 |
<span class="address-meta"><?php echo esc_attr( $fax ); ?></span>
|
188 |
<div class="widget-address-field">
|
189 |
<?php if ( $social_icons ) { ?>
|
190 |
<?php // Font Awesome 5 SVG. ?>
|
191 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="address-icons" width="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" height="<?php echo esc_attr( $widget_content_font_size ) . 'px'; ?>" viewBox="0 0 512 512"><path d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path>
|
192 |
</svg>
|
193 |
<?php } ?>
|
194 |
<span class="address-meta">
|
195 |
+
<a href="mailto:<?php echo esc_attr( antispambot( $email ) ); ?>" ><?php echo esc_html( antispambot( $email ) ); ?></a>
|
196 |
</span>
|
197 |
</div>
|
198 |
<?php } ?>
|
202 |
<?php
|
203 |
|
204 |
// After Widget.
|
205 |
+
echo $args['after_widget'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
206 |
}
|
207 |
|
208 |
/**
|
212 |
* @param array $old_instance Widget old instance.
|
213 |
* @return array Merged updated instance.
|
214 |
*/
|
215 |
+
public function update( $new_instance, $old_instance ) {
|
216 |
|
217 |
$instance = wp_parse_args( $new_instance, $old_instance );
|
218 |
|
233 |
* @param array $instance Widget instance.
|
234 |
* @return void
|
235 |
*/
|
236 |
+
public function form( $instance ) {
|
237 |
|
238 |
$fields = array(
|
239 |
array(
|
312 |
*
|
313 |
* @return string
|
314 |
*/
|
315 |
+
public function get_dynamic_css() {
|
316 |
|
317 |
$dynamic_css = '';
|
318 |
$instances = get_option( 'widget_' . $this->id_base );
|
classes/widgets/class-astra-widget-list-icons.php
CHANGED
@@ -54,7 +54,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
54 |
*/
|
55 |
public static function get_instance() {
|
56 |
if ( ! isset( self::$instance ) ) {
|
57 |
-
self::$instance = new self;
|
58 |
}
|
59 |
return self::$instance;
|
60 |
}
|
@@ -64,7 +64,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
64 |
*
|
65 |
* @since 1.0.0
|
66 |
*/
|
67 |
-
function __construct() {
|
68 |
parent::__construct(
|
69 |
$this->id_base,
|
70 |
__( 'Astra: List Icons', 'astra-widgets' ),
|
@@ -86,7 +86,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
86 |
*
|
87 |
* @return void
|
88 |
*/
|
89 |
-
function register_admin_scripts() {
|
90 |
|
91 |
/* Directory and Extension */
|
92 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
@@ -95,7 +95,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
95 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
96 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
97 |
|
98 |
-
wp_enqueue_script( 'astra-widgets-' . $this->id_base, $js_uri . 'astra-widget-list-icons' . $file_prefix . '.js', array(), ASTRA_WIDGETS_VER );
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -103,7 +103,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
103 |
*
|
104 |
* @return void
|
105 |
*/
|
106 |
-
function register_scripts() {
|
107 |
|
108 |
/* Directory and Extension */
|
109 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
@@ -112,7 +112,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
112 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
113 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
114 |
|
115 |
-
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-list-icons' . $file_prefix . '.css' );
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -122,7 +122,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
122 |
* @param mixed $default Widget field default value.
|
123 |
* @return mixed stored/default widget field value.
|
124 |
*/
|
125 |
-
function get_fields( $field = '', $default = '' ) {
|
126 |
|
127 |
// Emtpy stored values.
|
128 |
if ( empty( $this->stored_data ) ) {
|
@@ -148,7 +148,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
148 |
* @param array $instance Widget instance.
|
149 |
* @return void
|
150 |
*/
|
151 |
-
function
|
152 |
|
153 |
// Set stored data.
|
154 |
$this->stored_data = $instance;
|
@@ -168,9 +168,9 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
168 |
* @param array $instance Widget instance.
|
169 |
* @return void
|
170 |
*/
|
171 |
-
function widget( $args, $instance ) {
|
172 |
|
173 |
-
$this->
|
174 |
|
175 |
$width = $instance['width'] ? $instance['width'] : '';
|
176 |
$icon_color = $instance['icon_color'] ? $instance['icon_color'] : '';
|
@@ -185,11 +185,10 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
185 |
$title = apply_filters( 'widget_title', $this->get_fields( 'title' ) );
|
186 |
|
187 |
// Before Widget.
|
188 |
-
echo $args['before_widget']
|
189 |
if ( $title ) {
|
190 |
-
echo $args['before_title'] . $title . $args['after_title']
|
191 |
} ?>
|
192 |
-
|
193 |
<div id="astra-widget-list-icons-wrapper" class="astra-widget-list-icons clearfix">
|
194 |
<?php if ( ! empty( $list ) ) { ?>
|
195 |
<ul class="list-items-wrapper">
|
@@ -197,18 +196,17 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
197 |
foreach ( $list as $index => $list ) {
|
198 |
|
199 |
$list_data = json_decode( $list['icon'] );
|
200 |
-
|
201 |
-
$
|
202 |
-
$rel = ( 'enable' === $list['nofollow'] ) ? 'noopener nofollow' : '';
|
203 |
?>
|
204 |
<li>
|
205 |
<div class="link">
|
206 |
<a href="<?php echo esc_attr( $list['link'] ); ?>" class="list-item-link" target="<?php echo esc_attr( $target ); ?>" rel="<?php echo esc_attr( $rel ); ?>" aria-label="<?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
207 |
<?php if ( 'icon' === $list['imageoricon'] ) { ?>
|
208 |
<div class="icon">
|
209 |
-
<span class="<?php echo ( is_object( $list_data ) ) ?
|
210 |
<?php if ( ! empty( $list_data->viewbox ) && ! empty( $list_data->path ) ) { ?>
|
211 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="list-icon" fill="<?php echo esc_attr( $icon_color ); ?>" width="<?php echo ( '' !== $width ) ? esc_attr( $width ) : '
|
212 |
<?php } ?>
|
213 |
</span>
|
214 |
</div>
|
@@ -230,7 +228,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
230 |
<?php
|
231 |
|
232 |
// After Widget.
|
233 |
-
echo $args['after_widget']
|
234 |
}
|
235 |
|
236 |
/**
|
@@ -240,7 +238,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
240 |
* @param array $old_instance Widget old instance.
|
241 |
* @return array Merged updated instance.
|
242 |
*/
|
243 |
-
function update( $new_instance, $old_instance ) {
|
244 |
return wp_parse_args( $new_instance, $old_instance );
|
245 |
}
|
246 |
|
@@ -250,7 +248,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
250 |
* @param array $instance Widget instance.
|
251 |
* @return void
|
252 |
*/
|
253 |
-
function form( $instance ) {
|
254 |
|
255 |
$custom_css = " .body{ background: '#000'; }";
|
256 |
wp_enqueue_script( 'astra-widgets-' . $this->id_base );
|
@@ -423,7 +421,7 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
423 |
*
|
424 |
* @return string
|
425 |
*/
|
426 |
-
function get_dynamic_css() {
|
427 |
|
428 |
$dynamic_css = '';
|
429 |
|
54 |
*/
|
55 |
public static function get_instance() {
|
56 |
if ( ! isset( self::$instance ) ) {
|
57 |
+
self::$instance = new self();
|
58 |
}
|
59 |
return self::$instance;
|
60 |
}
|
64 |
*
|
65 |
* @since 1.0.0
|
66 |
*/
|
67 |
+
public function __construct() {
|
68 |
parent::__construct(
|
69 |
$this->id_base,
|
70 |
__( 'Astra: List Icons', 'astra-widgets' ),
|
86 |
*
|
87 |
* @return void
|
88 |
*/
|
89 |
+
public function register_admin_scripts() {
|
90 |
|
91 |
/* Directory and Extension */
|
92 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
95 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
96 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
97 |
|
98 |
+
wp_enqueue_script( 'astra-widgets-' . $this->id_base, $js_uri . 'astra-widget-list-icons' . $file_prefix . '.js', false, array(), ASTRA_WIDGETS_VER, false );
|
99 |
}
|
100 |
|
101 |
/**
|
103 |
*
|
104 |
* @return void
|
105 |
*/
|
106 |
+
public function register_scripts() {
|
107 |
|
108 |
/* Directory and Extension */
|
109 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
112 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
113 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
114 |
|
115 |
+
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-list-icons' . $file_prefix . '.css', array(), ASTRA_WIDGETS_VER );
|
116 |
}
|
117 |
|
118 |
/**
|
122 |
* @param mixed $default Widget field default value.
|
123 |
* @return mixed stored/default widget field value.
|
124 |
*/
|
125 |
+
public function get_fields( $field = '', $default = '' ) {
|
126 |
|
127 |
// Emtpy stored values.
|
128 |
if ( empty( $this->stored_data ) ) {
|
148 |
* @param array $instance Widget instance.
|
149 |
* @return void
|
150 |
*/
|
151 |
+
public function front_setup( $args, $instance ) {
|
152 |
|
153 |
// Set stored data.
|
154 |
$this->stored_data = $instance;
|
168 |
* @param array $instance Widget instance.
|
169 |
* @return void
|
170 |
*/
|
171 |
+
public function widget( $args, $instance ) {
|
172 |
|
173 |
+
$this->front_setup( $args, $instance );
|
174 |
|
175 |
$width = $instance['width'] ? $instance['width'] : '';
|
176 |
$icon_color = $instance['icon_color'] ? $instance['icon_color'] : '';
|
185 |
$title = apply_filters( 'widget_title', $this->get_fields( 'title' ) );
|
186 |
|
187 |
// Before Widget.
|
188 |
+
echo $args['before_widget'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
189 |
if ( $title ) {
|
190 |
+
echo $args['before_title'] . $title . $args['after_title'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
191 |
} ?>
|
|
|
192 |
<div id="astra-widget-list-icons-wrapper" class="astra-widget-list-icons clearfix">
|
193 |
<?php if ( ! empty( $list ) ) { ?>
|
194 |
<ul class="list-items-wrapper">
|
196 |
foreach ( $list as $index => $list ) {
|
197 |
|
198 |
$list_data = json_decode( $list['icon'] );
|
199 |
+
$target = ( 'same-page' === $list['link-target'] ) ? '_self' : '_blank';
|
200 |
+
$rel = ( 'enable' === $list['nofollow'] ) ? 'noopener nofollow' : '';
|
|
|
201 |
?>
|
202 |
<li>
|
203 |
<div class="link">
|
204 |
<a href="<?php echo esc_attr( $list['link'] ); ?>" class="list-item-link" target="<?php echo esc_attr( $target ); ?>" rel="<?php echo esc_attr( $rel ); ?>" aria-label="<?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
205 |
<?php if ( 'icon' === $list['imageoricon'] ) { ?>
|
206 |
<div class="icon">
|
207 |
+
<span class="<?php echo ( is_object( $list_data ) ) ? esc_attr( $list_data->name ) : ''; ?>">
|
208 |
<?php if ( ! empty( $list_data->viewbox ) && ! empty( $list_data->path ) ) { ?>
|
209 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="list-icon" fill="<?php echo esc_attr( $icon_color ); ?>" width="<?php echo ( '' !== $width ) ? esc_attr( $width ) : '15px'; ?>" height="<?php echo ( '' !== $width ) ? esc_attr( $width ) : '15px'; ?>" viewBox="<?php echo ( isset( $list_data->viewbox ) ) ? esc_attr( $list_data->viewbox ) : ''; ?>"><path d="<?php echo ( isset( $list_data->path ) ) ? esc_attr( $list_data->path ) : ''; ?>"></path></svg>
|
210 |
<?php } ?>
|
211 |
</span>
|
212 |
</div>
|
228 |
<?php
|
229 |
|
230 |
// After Widget.
|
231 |
+
echo $args['after_widget'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
232 |
}
|
233 |
|
234 |
/**
|
238 |
* @param array $old_instance Widget old instance.
|
239 |
* @return array Merged updated instance.
|
240 |
*/
|
241 |
+
public function update( $new_instance, $old_instance ) {
|
242 |
return wp_parse_args( $new_instance, $old_instance );
|
243 |
}
|
244 |
|
248 |
* @param array $instance Widget instance.
|
249 |
* @return void
|
250 |
*/
|
251 |
+
public function form( $instance ) {
|
252 |
|
253 |
$custom_css = " .body{ background: '#000'; }";
|
254 |
wp_enqueue_script( 'astra-widgets-' . $this->id_base );
|
421 |
*
|
422 |
* @return string
|
423 |
*/
|
424 |
+
public function get_dynamic_css() {
|
425 |
|
426 |
$dynamic_css = '';
|
427 |
|
classes/widgets/class-astra-widget-social-profiles.php
CHANGED
@@ -54,7 +54,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
54 |
*/
|
55 |
public static function get_instance() {
|
56 |
if ( ! isset( self::$instance ) ) {
|
57 |
-
self::$instance = new self;
|
58 |
}
|
59 |
return self::$instance;
|
60 |
}
|
@@ -64,7 +64,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
64 |
*
|
65 |
* @since 1.6.0
|
66 |
*/
|
67 |
-
function __construct() {
|
68 |
parent::__construct(
|
69 |
$this->id_base,
|
70 |
__( 'Astra: Social Profiles', 'astra-widgets' ),
|
@@ -87,7 +87,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
87 |
*
|
88 |
* @return void
|
89 |
*/
|
90 |
-
function register_admin_scripts() {
|
91 |
/* Directory and Extension */
|
92 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
93 |
$dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
|
@@ -95,8 +95,8 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
95 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
96 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
97 |
|
98 |
-
wp_enqueue_script( 'astra-widgets-' . $this->id_base, $js_uri . 'astra-widget-social-profiles' . $file_prefix . '.js', array(), ASTRA_WIDGETS_VER );
|
99 |
-
wp_register_style( 'astra-widget-social-profiles-admin', $css_uri . 'astra-widget-social-profiles-admin' . $file_prefix . '.css' );
|
100 |
}
|
101 |
|
102 |
/**
|
@@ -104,7 +104,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
104 |
*
|
105 |
* @return void
|
106 |
*/
|
107 |
-
function register_scripts() {
|
108 |
/* Directory and Extension */
|
109 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
110 |
$dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
|
@@ -112,7 +112,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
112 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
113 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
114 |
|
115 |
-
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-social-profiles' . $file_prefix . '.css' );
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -122,7 +122,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
122 |
* @param mixed $default Widget field default value.
|
123 |
* @return mixed stored/default widget field value.
|
124 |
*/
|
125 |
-
function get_fields( $field = '', $default = '' ) {
|
126 |
|
127 |
// Emtpy stored values.
|
128 |
if ( empty( $this->stored_data ) ) {
|
@@ -148,7 +148,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
148 |
* @param array $instance Widget instance.
|
149 |
* @return void
|
150 |
*/
|
151 |
-
function
|
152 |
|
153 |
// Set stored data.
|
154 |
$this->stored_data = $instance;
|
@@ -165,7 +165,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
165 |
*
|
166 |
* @return string Dynamic CSS.
|
167 |
*/
|
168 |
-
function get_dynamic_css() {
|
169 |
|
170 |
$dynamic_css = '';
|
171 |
|
@@ -210,9 +210,6 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
210 |
$id_base . ' .astra-widget-social-profiles-inner.icon-official-color.simple li .' . $name . '.ast-widget-icon svg' => array(
|
211 |
'fill' => esc_attr( $icon_bg_color_official ),
|
212 |
),
|
213 |
-
// $id_base . ' .astra-widget-social-profiles-inner.icon-official-color.simple li .' . $name . '.ast-widget-icon' => array(
|
214 |
-
// 'background-color' => esc_attr( $icon_bg_color_official ),
|
215 |
-
// ),
|
216 |
$id_base . ' .astra-widget-social-profiles-inner.icon-official-color li .' . $name . '.ast-widget-icon svg' => array(
|
217 |
'fill' => esc_attr( $icon_color_official ),
|
218 |
),
|
@@ -313,9 +310,9 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
313 |
* @param array $instance Widget instance.
|
314 |
* @return void
|
315 |
*/
|
316 |
-
function widget( $args, $instance ) {
|
317 |
|
318 |
-
$this->
|
319 |
wp_enqueue_style( 'astra-widgets-font-style' );
|
320 |
|
321 |
$list = $this->get_fields( 'list', array() );
|
@@ -332,9 +329,9 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
332 |
$title = apply_filters( 'widget_title', $this->get_fields( 'title' ) );
|
333 |
|
334 |
// Before Widget.
|
335 |
-
echo $args['before_widget']
|
336 |
if ( $title ) {
|
337 |
-
echo $args['before_title'] . $title . $args['after_title']
|
338 |
} ?>
|
339 |
|
340 |
<div class="astra-widget-social-profiles-inner clearfix <?php echo esc_attr( $align ); ?> <?php echo esc_attr( $icon_style ); ?> <?php echo 'icon-' . esc_attr( $color_type ); ?>">
|
@@ -353,7 +350,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
353 |
<a href="<?php echo esc_attr( $list['link'] ); ?>" target="<?php echo esc_attr( $target ); ?>" rel="<?php echo esc_attr( $rel ); ?>" aria-label="<?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
354 |
<span class="ast-widget-icon <?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
355 |
<?php if ( ! empty( $list_data->viewbox ) && ! empty( $list_data->path ) ) { ?>
|
356 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="<?php echo ( isset( $list_data->viewbox ) ) ? $list_data->viewbox : ''; ?>" width=<?php echo esc_attr( $icon_width ); ?> height=<?php echo esc_attr( $icon_width ); ?> ><path d="<?php echo ( isset( $list_data->path ) ) ? $list_data->path : ''; ?>"></path></svg>
|
357 |
<?php } ?>
|
358 |
</span>
|
359 |
<?php if ( $display_title ) { ?>
|
@@ -369,7 +366,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
369 |
<?php
|
370 |
|
371 |
// After Widget.
|
372 |
-
echo $args['after_widget']
|
373 |
}
|
374 |
|
375 |
/**
|
@@ -379,7 +376,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
379 |
* @param array $old_instance Widget old instance.
|
380 |
* @return array Merged updated instance.
|
381 |
*/
|
382 |
-
function update( $new_instance, $old_instance ) {
|
383 |
|
384 |
$instance = wp_parse_args( $new_instance, $old_instance );
|
385 |
|
@@ -400,7 +397,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
|
|
400 |
* @param array $instance Widget instance.
|
401 |
* @return void
|
402 |
*/
|
403 |
-
function form( $instance ) {
|
404 |
|
405 |
wp_enqueue_script( 'astra-widgets-' . $this->id_base );
|
406 |
wp_enqueue_style( 'astra-widget-social-profiles-admin' );
|
54 |
*/
|
55 |
public static function get_instance() {
|
56 |
if ( ! isset( self::$instance ) ) {
|
57 |
+
self::$instance = new self();
|
58 |
}
|
59 |
return self::$instance;
|
60 |
}
|
64 |
*
|
65 |
* @since 1.6.0
|
66 |
*/
|
67 |
+
public function __construct() {
|
68 |
parent::__construct(
|
69 |
$this->id_base,
|
70 |
__( 'Astra: Social Profiles', 'astra-widgets' ),
|
87 |
*
|
88 |
* @return void
|
89 |
*/
|
90 |
+
public function register_admin_scripts() {
|
91 |
/* Directory and Extension */
|
92 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
93 |
$dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
|
95 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
96 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
97 |
|
98 |
+
wp_enqueue_script( 'astra-widgets-' . $this->id_base, $js_uri . 'astra-widget-social-profiles' . $file_prefix . '.js', false, array(), ASTRA_WIDGETS_VER, false );
|
99 |
+
wp_register_style( 'astra-widget-social-profiles-admin', $css_uri . 'astra-widget-social-profiles-admin' . $file_prefix . '.css', array(), ASTRA_WIDGETS_VER );
|
100 |
}
|
101 |
|
102 |
/**
|
104 |
*
|
105 |
* @return void
|
106 |
*/
|
107 |
+
public function register_scripts() {
|
108 |
/* Directory and Extension */
|
109 |
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
|
110 |
$dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
|
112 |
$js_uri = ASTRA_WIDGETS_URI . 'assets/js/' . $dir_name . '/';
|
113 |
$css_uri = ASTRA_WIDGETS_URI . 'assets/css/' . $dir_name . '/';
|
114 |
|
115 |
+
wp_register_style( 'astra-widgets-' . $this->id_base, $css_uri . 'astra-widget-social-profiles' . $file_prefix . '.css', array(), ASTRA_WIDGETS_VER );
|
116 |
}
|
117 |
|
118 |
/**
|
122 |
* @param mixed $default Widget field default value.
|
123 |
* @return mixed stored/default widget field value.
|
124 |
*/
|
125 |
+
public function get_fields( $field = '', $default = '' ) {
|
126 |
|
127 |
// Emtpy stored values.
|
128 |
if ( empty( $this->stored_data ) ) {
|
148 |
* @param array $instance Widget instance.
|
149 |
* @return void
|
150 |
*/
|
151 |
+
public function front_setup( $args, $instance ) {
|
152 |
|
153 |
// Set stored data.
|
154 |
$this->stored_data = $instance;
|
165 |
*
|
166 |
* @return string Dynamic CSS.
|
167 |
*/
|
168 |
+
public function get_dynamic_css() {
|
169 |
|
170 |
$dynamic_css = '';
|
171 |
|
210 |
$id_base . ' .astra-widget-social-profiles-inner.icon-official-color.simple li .' . $name . '.ast-widget-icon svg' => array(
|
211 |
'fill' => esc_attr( $icon_bg_color_official ),
|
212 |
),
|
|
|
|
|
|
|
213 |
$id_base . ' .astra-widget-social-profiles-inner.icon-official-color li .' . $name . '.ast-widget-icon svg' => array(
|
214 |
'fill' => esc_attr( $icon_color_official ),
|
215 |
),
|
310 |
* @param array $instance Widget instance.
|
311 |
* @return void
|
312 |
*/
|
313 |
+
public function widget( $args, $instance ) {
|
314 |
|
315 |
+
$this->front_setup( $args, $instance );
|
316 |
wp_enqueue_style( 'astra-widgets-font-style' );
|
317 |
|
318 |
$list = $this->get_fields( 'list', array() );
|
329 |
$title = apply_filters( 'widget_title', $this->get_fields( 'title' ) );
|
330 |
|
331 |
// Before Widget.
|
332 |
+
echo $args['before_widget'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
333 |
if ( $title ) {
|
334 |
+
echo $args['before_title'] . $title . $args['after_title'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
335 |
} ?>
|
336 |
|
337 |
<div class="astra-widget-social-profiles-inner clearfix <?php echo esc_attr( $align ); ?> <?php echo esc_attr( $icon_style ); ?> <?php echo 'icon-' . esc_attr( $color_type ); ?>">
|
350 |
<a href="<?php echo esc_attr( $list['link'] ); ?>" target="<?php echo esc_attr( $target ); ?>" rel="<?php echo esc_attr( $rel ); ?>" aria-label="<?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
351 |
<span class="ast-widget-icon <?php echo ( is_object( $list_data ) ) ? esc_html( $list_data->name ) : ''; ?>">
|
352 |
<?php if ( ! empty( $list_data->viewbox ) && ! empty( $list_data->path ) ) { ?>
|
353 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="<?php echo ( isset( $list_data->viewbox ) ) ? esc_attr( $list_data->viewbox ) : ''; ?>" width=<?php echo esc_attr( $icon_width ); ?> height=<?php echo esc_attr( $icon_width ); ?> ><path d="<?php echo ( isset( $list_data->path ) ) ? esc_attr( $list_data->path ) : ''; ?>"></path></svg>
|
354 |
<?php } ?>
|
355 |
</span>
|
356 |
<?php if ( $display_title ) { ?>
|
366 |
<?php
|
367 |
|
368 |
// After Widget.
|
369 |
+
echo $args['after_widget'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
370 |
}
|
371 |
|
372 |
/**
|
376 |
* @param array $old_instance Widget old instance.
|
377 |
* @return array Merged updated instance.
|
378 |
*/
|
379 |
+
public function update( $new_instance, $old_instance ) {
|
380 |
|
381 |
$instance = wp_parse_args( $new_instance, $old_instance );
|
382 |
|
397 |
* @param array $instance Widget instance.
|
398 |
* @return void
|
399 |
*/
|
400 |
+
public function form( $instance ) {
|
401 |
|
402 |
wp_enqueue_script( 'astra-widgets-' . $this->id_base );
|
403 |
wp_enqueue_style( 'astra-widget-social-profiles-admin' );
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: brainstormforce
|
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: Address widget, Social profile widget, List icon widget, Social media, Add widget
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.2
|
8 |
-
Stable tag: 1.2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -76,6 +76,10 @@ In your WordPress admin dashboard go to Appearance -> Widgets, drag the Astra :
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
79 |
= 1.2.2 =
|
80 |
- Fix: Plus prefix appearing when more than one tel number added.
|
81 |
- Fix: Color picker's clear button position issue.
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: Address widget, Social profile widget, List icon widget, Social media, Add widget
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.4
|
7 |
Requires PHP: 5.2
|
8 |
+
Stable tag: 1.2.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 1.2.3 =
|
80 |
+
- Improvement: Hardened the security of plugin
|
81 |
+
- Improvement: Compatibility with latest WordPress PHP_CodeSniffer rules
|
82 |
+
|
83 |
= 1.2.2 =
|
84 |
- Fix: Plus prefix appearing when more than one tel number added.
|
85 |
- Fix: Color picker's clear button position issue.
|