PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/widgets/social-icons.php +19 -35 13.8.3 → 16.3-a.5 View file →
@@ -1,6 +1,10 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 +if ( ! defined( 'ABSPATH' ) ) {
4 + exit( 0 );
5 +}
6 +
3 7 // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
4 8
5 9 /**
6 10 * Social Icons Widget.
@@ -52,14 +56,8 @@
52 56 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
53 57 add_action( 'admin_print_footer_scripts', array( $this, 'render_admin_js' ) );
54 58 }
55 59
56 - // Enqueue scripts and styles for the display of the widget, on the frontend or in the customizer.
57 - if ( is_active_widget( false, $this->id, $this->id_base, true ) || is_customize_preview() ) {
58 - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_icon_scripts' ) );
59 - add_action( 'wp_footer', array( $this, 'include_svg_icons' ), 9999 );
60 - }
61 -
62 60 add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) );
63 61 }
64 62
65 63 /**
@@ -159,8 +157,12 @@
159 157 */
160 158 public function widget( $args, $instance ) {
161 159 $instance = wp_parse_args( $instance, $this->defaults );
162 160
161 + // Enqueue front end assets.
162 + $this->enqueue_icon_scripts();
163 + add_action( 'wp_footer', array( $this, 'include_svg_icons' ), 9999 );
164 +
163 165 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
164 166 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
165 167
166 168 echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -185,9 +187,9 @@
185 187 <li class="jetpack-social-widget-item">
186 188 <?php
187 189 printf(
188 190 '<a href="%1$s" %2$s>',
189 - esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype', 'sms' ) ),
191 + esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'sms' ) ),
190 192 true === $instance['new-tab'] ?
191 193 'target="_blank" rel="noopener noreferrer"' :
192 194 'target="_self"'
193 195 );
@@ -344,19 +346,21 @@
344 346 </button>
345 347 </p>
346 348
347 349 <?php
348 - switch ( get_locale() ) {
350 + $lang = strtolower( substr( get_locale(), 0, 2 ) );
351 + switch ( $lang ) {
349 352 case 'es':
350 - $support = 'https://es.support.wordpress.com/social-media-icons-widget/#iconos-disponibles';
353 + $support = 'https://wordpress.com/es/support/wordpress-editor/blocks/social-icons-block/display-social-profiles/#iconos-sociales-compatibles';
351 354 break;
352 355
353 - case 'pt-br':
354 - $support = 'https://br.support.wordpress.com/widgets/widget-de-icones-sociais/#ícones-disponíveis';
356 + case 'pt':
357 + $support = 'https://wordpress.com/pt-br/support/exibir-perfis-de-redes-sociais/#icones-de-redes-sociais-compativeis';
355 358 break;
356 359
357 360 default:
358 - $support = 'https://en.support.wordpress.com/widgets/social-media-icons-widget/#available-icons';
361 + $support = 'https://wordpress.com/support/wordpress-editor/blocks/social-icons-block/display-social-profiles/#supported-social-icons';
362 + break;
359 363 }
360 364 ?>
361 365
362 366 <p>
@@ -398,9 +402,9 @@
398 402 '<input class="widefat" id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
399 403 esc_attr( $args['url-icon-id'] ),
400 404 esc_attr( $args['url-icon-name'] ),
401 405 esc_attr__( 'Account URL', 'jetpack' ),
402 - esc_url( $args['url-value'], array( 'http', 'https', 'mailto', 'skype', 'sms' ) )
406 + esc_url( $args['url-value'], array( 'http', 'https', 'mailto', 'sms' ) )
403 407 );
404 408 ?>
405 409 </p>
406 410
@@ -439,9 +443,9 @@
439 443 // Parse args.
440 444 $args = wp_parse_args( $args, $defaults );
441 445
442 446 // Define an icon.
443 - if ( false === array_key_exists( 'icon', $args ) ) {
447 + if ( ! array_key_exists( 'icon', $args ) ) {
444 448 return esc_html__( 'Please define an SVG icon filename.', 'jetpack' );
445 449 }
446 450
447 451 // Set aria hidden.
@@ -636,13 +640,8 @@
636 640 'icon' => 'pinterest',
637 641 'label' => 'Pinterest',
638 642 ),
639 643 array(
640 - 'url' => array( 'getpocket.com' ),
641 - 'icon' => 'pocket',
642 - 'label' => 'Pocket',
643 - ),
644 - array(
645 644 'url' => array( 'ravelry.com' ),
646 645 'icon' => 'ravelry',
647 646 'label' => 'Ravelry',
648 647 ),
@@ -651,18 +650,8 @@
651 650 'icon' => 'reddit',
652 651 'label' => 'Reddit',
653 652 ),
654 653 array(
655 - 'url' => array( 'skype.com' ),
656 - 'icon' => 'skype',
657 - 'label' => 'Skype',
658 - ),
659 - array(
660 - 'url' => array( 'skype:' ),
661 - 'icon' => 'skype',
662 - 'label' => 'Skype',
663 - ),
664 - array(
665 654 'url' => array( 'slideshare.net' ),
666 655 'icon' => 'slideshare',
667 656 'label' => 'SlideShare',
668 657 ),
@@ -726,13 +715,8 @@
726 715 'icon' => 'twitch',
727 716 'label' => 'Twitch',
728 717 ),
729 718 array(
730 - 'url' => array( 'twitter.com' ),
731 - 'icon' => 'twitter',
732 - 'label' => 'Twitter',
733 - ),
734 - array(
735 719 'url' => array( 'vimeo.com' ),
736 720 'icon' => 'vimeo',
737 721 'label' => 'Vimeo',
738 722 ),
@@ -761,9 +745,9 @@
761 745 'icon' => 'yelp',
762 746 'label' => 'Yelp',
763 747 ),
764 748 array(
765 - 'url' => array( 'x.com' ),
749 + 'url' => array( '#^https?:\/\/(www\.)?(twitter|x)\.com#' ),
766 750 'icon' => 'x',
767 751 'label' => 'X',
768 752 ),
769 753 array(