| @@ -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. |
| @@ -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 | ?> |