PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
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-media-icons.php +19 -10 13.3.3 → 16.3-a.7 View file →
@@ -9,8 +9,12 @@
9 9 *
10 10 * @package automattic/jetpack
11 11 */
12 12
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 0 );
15 +}
16 +
13 17 // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
14 18
15 19 /**
16 20 * WPCOM_social_media_icons_widget class.
@@ -83,11 +87,8 @@
83 87 'wordpress' => array( 'WordPress.org', 'https://profiles.wordpress.org/%s/' ),
84 88 'twitch' => array( 'Twitch', 'https://www.twitch.tv/%s/' ),
85 89 'tumblr' => array( 'Tumblr', 'https://%s.tumblr.com' ),
86 90 );
87 - if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
88 - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) );
89 - }
90 91 }
91 92
92 93 /**
93 94 * Enqueue Style.
@@ -103,9 +104,9 @@
103 104 /**
104 105 * Check Genericons.
105 106 *
106 107 * @access private
107 - * @return Bool.
108 + * @return bool
108 109 */
109 110 private function check_genericons() {
110 111 global $wp_styles;
111 112 foreach ( $wp_styles->queue as $handle ) {
@@ -127,11 +128,19 @@
127 128 public function widget( $args, $instance ) {
128 129 $instance = wp_parse_args( (array) $instance, $this->defaults );
129 130 /** This filter is documented in core/src/wp-includes/default-widgets.php */
130 131 $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
132 +
133 + /*
134 + * Enqueue frontend assets.
135 + */
136 +
131 137 if ( ! $this->check_genericons() ) {
132 138 wp_enqueue_style( 'genericons' );
133 139 }
140 +
141 + $this->enqueue_style();
142 +
134 143 $index = 10;
135 144 $html = array();
136 145 /* Translators: 1. Username. 2. Service name. */
137 146 $alt_text = esc_attr__( 'View %1$s’s profile on %2$s', 'jetpack' );
@@ -243,9 +252,9 @@
243 252 * Widget Settings.
244 253 *
245 254 * @access public
246 255 * @param mixed $instance Instance.
247 - * @return void
256 + * @return string|void
248 257 */
249 258 public function form( $instance ) {
250 259 $instance = wp_parse_args( (array) $instance, $this->defaults );
251 260 ?>
@@ -288,11 +297,11 @@
288 297 /**
289 298 * Update Widget Settings.
290 299 *
291 300 * @access public
292 - * @param mixed $new_instance New Instance.
293 - * @param mixed $old_instance Old Instance.
294 - * @return Instance.
301 + * @param array $new_instance New Instance.
302 + * @param array|null $old_instance Old Instance.
303 + * @return array Instance.
295 304 */
296 305 public function update( $new_instance, $old_instance ) {
297 306 $instance = (array) $old_instance;
298 307 foreach ( $new_instance as $field => $value ) {
@@ -323,10 +332,10 @@
323 332 /**
324 333 * Remove username from value before to save stats.
325 334 *
326 335 * @access public
327 - * @param mixed $val Value.
328 - * @return Value.
336 + * @param string $val Value.
337 + * @return string Value.
329 338 */
330 339 public function remove_username( $val ) {
331 340 return str_replace( '_username', '', $val );
332 341 }