PluginProbe ʕ •ᴥ•ʔ
Jetpack – WP Security, Backup, Speed, & Growth / 12.4.2
Jetpack – WP Security, Backup, Speed, & Growth v12.4.2
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 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 14.5.1 14.6.1 14.7.1 14.8.1 14.9.2 15.0.3 15.1.2 15.2.1 15.3.2 15.4.1 15.5.1 15.6.1 15.7.2 15.8.1 15.9.2 16.0.2 16.1.3 16.2-a.5 16.2-a.3 16.1.2 16.2-a.1 16.1.1 16.1 16.1-beta 16.1-beta.2 16.1-beta.3 16.1-a.5 16.1-a.3 16.0.1 16.1-a.1 16.0 16.0-beta 16.0-a.7 16.0-a.5 15.9.1 16.0-a.3 16.0-a.1 15.9 15.9-beta 15.9-a.7 15.9-a.5 15.9-a.3 15.9-a.1 15.8 15.8-beta 15.8-a.7 15.8-a.5 5.2.5 5.3.4 5.4.4 5.5.5 5.6.5 5.7.5 5.8.4 5.9.4 6.0.4 6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.2 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.4 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 6.5 6.5.1 6.5.2 6.5.3 6.5.4 6.6 6.6.1 6.6.2 6.6.3 6.6.4 6.6.5 6.7 6.7.1 6.7.2 6.7.3 6.7.4 6.8 6.8.1 6.8.2 6.8.3 6.8.4 6.8.5 6.9 6.9.1 6.9.2 6.9.3 6.9.4 7.0 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2 7.2.1 7.2.1.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3 7.3.0.1 7.3.1 7.3.1.1 7.3.2 7.3.3 7.3.4 7.3.5 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.4.5 7.5 7.5.0.1 7.5.1 7.5.2 7.5.3 7.5.4 7.5.5 7.5.6 7.5.7 7.6 7.6.1 7.6.2 7.6.3 7.6.4 7.7 7.7.1 7.7.2 7.7.3 7.7.4 7.7.5 7.7.6 7.8 7.8.1 7.8.2 7.8.3 7.8.4 7.9 7.9.1 7.9.2 7.9.3 7.9.4 8.0 8.0.1 8.0.2 8.0.3 8.1 8.1.1 8.1.2 8.1.3 8.1.4 8.2 8.2.0.1 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.3 8.3.1 8.3.2 8.3.3 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.5 8.5.1 8.5.2 8.5.3 8.6 8.6.1 8.6.2 8.6.3 8.6.4 8.7 8.7.0.1 8.7.1 8.7.2 8.7.3 8.7.4 8.8 8.8.1 8.8.2 8.8.3 8.8.4 8.8.5 8.9 8.9.1 8.9.2 8.9.3 8.9.4 9.0 9.0.1 9.0.2 9.0.3 9.0.4 9.0.5 9.1 9.1.1 9.1.2 9.1.3 9.2 9.2.1 9.2.2 9.2.3 9.2.4 9.3 9.3.1 9.3.2 9.3.3 9.3.4 9.3.5 9.4 9.4.1 9.4.2 9.4.3 9.4.4 9.5 9.5.1 9.5.2 9.5.3 9.5.4 9.5.5 9.6 9.6.1 9.6.2 9.6.3 9.6.4 9.7 9.7.1 9.7.2 15.7-beta.2 9.7.3 15.7.1 9.8 15.8-a.1 9.8.1 15.8-a.3 9.8.2 2.0.9 9.8.3 2.1.7 9.9 2.2.10 9.9.1 2.3.10 9.9.2 2.4.7 9.9.3 2.5.5 2.6.6 2.7.5 2.8.5 2.9.6 3.0.6 3.1.5 3.2.5 3.3.6 3.4.6 3.5.6 3.6.4 3.7.5 3.8.5 3.9.10 4.0.7 4.1.4 4.2.5 4.3.5 4.4.5 4.5.3 4.6.3 4.7.4 4.8.5 4.9.3 5.0.3 5.1.4 trunk 10.0 10.0.1 10.0.2 10.1 10.1.1 10.1.2 10.2 10.2.1 10.2.2 10.2.3 10.3 10.3.1 10.3.2 10.4 10.4.1 10.4.2 10.5 10.5.1 10.5.2 10.5.3 10.6 10.6.1 10.6.2 10.7 10.7.1 10.7.2 10.8 10.8.1 10.8.2 10.9 10.9.1 10.9.2 10.9.3 11.0 11.0.1 11.0.2 11.1 11.1.1 11.1.2 11.1.3 11.1.4 11.2 11.2.1 11.2.2 11.3 11.3.1 11.3.2 11.3.3 11.3.4 11.4 11.4.1 11.4.2 11.5 11.5.1 11.5.2 11.5.3 11.6 11.6.1 11.6.2 11.7 11.7.1 11.7.2 11.7.3 11.8 11.8.3 11.8.4 11.8.5 11.8.6 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / modules / widgets / social-icons.php
jetpack / modules / widgets Last commit date
authors 8 years ago contact-info 5 years ago eu-cookie-law 4 years ago facebook-likebox 11 years ago flickr 4 years ago gallery 4 years ago goodreads 5 years ago google-translate 4 years ago image-widget 8 years ago instagram 6 years ago migrate-to-core 3 years ago milestone 3 years ago my-community 8 years ago simple-payments 4 years ago social-icons 4 years ago social-media-icons 5 years ago top-posts 8 years ago wordpress-post-widget 3 years ago authors.php 3 years ago blog-stats.php 3 years ago class-jetpack-eu-cookie-law-widget.php 3 years ago class-jetpack-instagram-widget.php 3 years ago contact-info.php 3 years ago customizer-controls.css 9 years ago customizer-utils.js 6 years ago facebook-likebox.php 3 years ago flickr.php 3 years ago gallery.php 3 years ago goodreads.php 3 years ago google-translate.php 3 years ago gravatar-profile.css 10 years ago gravatar-profile.php 3 years ago image-widget.php 3 years ago internet-defense-league.php 3 years ago mailchimp.php 3 years ago milestone.php 5 years ago my-community.php 3 years ago rsslinks-widget.php 3 years ago simple-payments.php 3 years ago social-icons.php 3 years ago social-media-icons.php 3 years ago top-posts.php 3 years ago twitter-timeline-admin.js 6 years ago twitter-timeline.php 3 years ago upcoming-events.php 3 years ago wordpress-post-widget.php 4 years ago
social-icons.php
799 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3 // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
4
5 /**
6 * Social Icons Widget.
7 */
8 class Jetpack_Widget_Social_Icons extends WP_Widget {
9
10 const ID_BASE = 'jetpack_widget_social_icons';
11
12 /**
13 * Default widget options.
14 *
15 * @var array Default widget options.
16 */
17 protected $defaults;
18
19 /**
20 * Widget constructor.
21 */
22 public function __construct() {
23 global $pagenow;
24
25 $widget_ops = array(
26 'classname' => 'jetpack_widget_social_icons',
27 'description' => __( 'Add social-media icons to your site.', 'jetpack' ),
28 'show_instance_in_rest' => true,
29 'customize_selective_refresh' => true,
30 );
31
32 parent::__construct(
33 'jetpack_widget_social_icons',
34 /** This filter is documented in modules/widgets/facebook-likebox.php */
35 apply_filters( 'jetpack_widget_name', __( 'Social Icons', 'jetpack' ) ),
36 $widget_ops
37 );
38
39 $this->defaults = array(
40 'title' => __( 'Follow Us', 'jetpack' ),
41 'icon-size' => 'medium',
42 'new-tab' => false,
43 'icons' => array(
44 array(
45 'url' => '',
46 ),
47 ),
48 );
49
50 // Enqueue admin scrips and styles, only in the customizer or the old widgets page.
51 if ( is_customize_preview() || 'widgets.php' === $pagenow ) {
52 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
53 add_action( 'admin_print_footer_scripts', array( $this, 'render_admin_js' ) );
54 }
55
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 add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) );
63 }
64
65 /**
66 * Remove the "Social Icons" widget from the Legacy Widget block
67 *
68 * @param array $widget_types List of widgets that are currently removed from the Legacy Widget block.
69 * @return array $widget_types New list of widgets that will be removed.
70 */
71 public function hide_widget_in_block_editor( $widget_types ) {
72 $widget_types[] = self::ID_BASE;
73 return $widget_types;
74 }
75
76 /**
77 * Script & styles for admin widget form.
78 */
79 public function enqueue_admin_scripts() {
80 wp_enqueue_script(
81 'jetpack-widget-social-icons-script',
82 plugins_url( 'social-icons/social-icons-admin.js', __FILE__ ),
83 array( 'jquery', 'jquery-ui-sortable' ),
84 '20170506',
85 true
86 );
87 wp_enqueue_style(
88 'jetpack-widget-social-icons-admin',
89 plugins_url( 'social-icons/social-icons-admin.css', __FILE__ ),
90 array(),
91 '20170506'
92 );
93 }
94
95 /**
96 * Styles for front-end widget.
97 */
98 public function enqueue_icon_scripts() {
99 wp_enqueue_style( 'jetpack-widget-social-icons-styles', plugins_url( 'social-icons/social-icons.css', __FILE__ ), array(), '20170506' );
100 }
101
102 /**
103 * JavaScript for admin widget form.
104 */
105 public function render_admin_js() {
106 ?>
107 <script type="text/html" id="tmpl-jetpack-widget-social-icons-template">
108 <?php self::render_icons_template(); ?>
109 </script>
110 <?php
111 }
112
113 /**
114 * Add SVG definitions to the footer.
115 */
116 public function include_svg_icons() {
117 // Define SVG sprite file in Jetpack.
118 $svg_icons = dirname( __DIR__ ) . '/theme-tools/social-menu/social-menu.svg';
119
120 // Define SVG sprite file in WPCOM.
121 if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
122 $svg_icons = dirname( __DIR__ ) . '/social-menu/social-menu.svg';
123 }
124
125 // If it exists, include it.
126 if ( is_file( $svg_icons ) ) {
127 require_once $svg_icons;
128 }
129 }
130
131 /**
132 * Front-end display of widget.
133 *
134 * @see WP_Widget::widget()
135 *
136 * @param array $args Widget arguments.
137 * @param array $instance Saved values from database.
138 */
139 public function widget( $args, $instance ) {
140 $instance = wp_parse_args( $instance, $this->defaults );
141
142 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
143 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
144
145 echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
146
147 if ( ! empty( $title ) ) {
148 echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
149 }
150
151 if ( ! empty( $instance['icons'] ) ) :
152
153 // Get supported social icons.
154 $social_icons = $this->get_supported_icons();
155 $default_icon = $this->get_svg_icon( array( 'icon' => 'chain' ) );
156
157 ?>
158
159 <ul class="jetpack-social-widget-list size-<?php echo esc_attr( $instance['icon-size'] ); ?>">
160
161 <?php foreach ( $instance['icons'] as $icon ) : ?>
162
163 <?php if ( ! empty( $icon['url'] ) ) : ?>
164 <li class="jetpack-social-widget-item">
165 <?php
166 printf(
167 '<a href="%1$s" %2$s>',
168 esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ),
169 true === $instance['new-tab'] ?
170 'target="_blank" rel="noopener noreferrer"' :
171 'target="_self"'
172 );
173
174 $found_icon = false;
175
176 foreach ( $social_icons as $social_icon ) {
177 foreach ( $social_icon['url'] as $url_fragment ) {
178 /*
179 * url_fragment can be a URL host, or a regex, starting with #.
180 * Let's check for both scenarios.
181 */
182 if (
183 // First Regex.
184 (
185 '#' === substr( $url_fragment, 0, 1 ) && '#' === substr( $url_fragment, -1 )
186 && preg_match( $url_fragment, $icon['url'] )
187 )
188 // Then, regular host name.
189 || false !== strpos( $icon['url'], $url_fragment )
190 ) {
191 printf(
192 '<span class="screen-reader-text">%1$s</span>%2$s',
193 esc_attr( $social_icon['label'] ),
194 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
195 $this->get_svg_icon(
196 array(
197 'icon' => esc_attr( $social_icon['icon'] ),
198 )
199 )
200 );
201 $found_icon = true;
202 break 2;
203 }
204 }
205 }
206
207 if ( ! $found_icon ) {
208 echo $default_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
209 }
210 ?>
211 </a>
212 </li>
213 <?php endif; ?>
214
215 <?php endforeach; ?>
216
217 </ul>
218
219 <?php
220 endif;
221
222 echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
223
224 /** This action is documented in modules/widgets/gravatar-profile.php */
225 do_action( 'jetpack_stats_extra', 'widget_view', 'social_icons' );
226 }
227
228 /**
229 * Sanitize widget form values as they are saved.
230 *
231 * @see WP_Widget::update()
232 *
233 * @param array $new_instance Values just sent to be saved.
234 * @param array $old_instance Previously saved values from database.
235 *
236 * @return array Updated safe values to be saved.
237 */
238 public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
239 $instance = array();
240
241 $instance['title'] = sanitize_text_field( $new_instance['title'] );
242 $instance['icon-size'] = $this->defaults['icon-size'];
243 $instance['url-icons'] = array_key_exists( 'url-icons', $new_instance ) ? $new_instance['url-icons'] : array();
244
245 if ( in_array( $new_instance['icon-size'], array( 'small', 'medium', 'large' ), true ) ) {
246 $instance['icon-size'] = $new_instance['icon-size'];
247 }
248
249 $instance['new-tab'] = isset( $new_instance['new-tab'] ) ? (bool) $new_instance['new-tab'] : false;
250 $instance['icons'] = array();
251
252 if ( array_key_exists( 'url-icons', $new_instance ) ) {
253 foreach ( $new_instance['url-icons'] as $url ) {
254 $url = filter_var( $url, FILTER_SANITIZE_URL );
255
256 if ( ! empty( $url ) ) {
257 $instance['icons'][] = array(
258 'url' => $url,
259 );
260 }
261 }
262 }
263
264 return $instance;
265 }
266
267 /**
268 * Back-end widget form.
269 *
270 * @see WP_Widget::form()
271 *
272 * @param array $instance Previously saved values from database.
273 *
274 * @return string|void
275 */
276 public function form( $instance ) {
277 $instance = wp_parse_args( $instance, $this->defaults );
278 $title = sanitize_text_field( $instance['title'] );
279 $sizes = array(
280 'small' => __( 'Small', 'jetpack' ),
281 'medium' => __( 'Medium', 'jetpack' ),
282 'large' => __( 'Large', 'jetpack' ),
283 );
284 $new_tab = isset( $instance['new-tab'] ) ? (bool) $instance['new-tab'] : false;
285 ?>
286
287 <p>
288 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
289 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
290 </p>
291
292 <p>
293 <label for="<?php echo esc_attr( $this->get_field_id( 'icon-size' ) ); ?>"><?php esc_html_e( 'Size:', 'jetpack' ); ?></label>
294 <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'icon-size' ) ); ?>">
295 <?php foreach ( $sizes as $value => $label ) : ?>
296 <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $instance['icon-size'] ); ?>><?php echo esc_attr( $label ); ?></option>
297 <?php endforeach; ?>
298 </select>
299 </p>
300
301 <div class="jetpack-social-icons-widget-list"
302 data-url-icon-id="<?php echo esc_attr( $this->get_field_id( 'url-icons' ) ); ?>"
303 data-url-icon-name="<?php echo esc_attr( $this->get_field_name( 'url-icons' ) ); ?>"
304 >
305
306 <?php
307 foreach ( $instance['icons'] as $icon ) {
308 self::render_icons_template(
309 array(
310 'url-icon-id' => $this->get_field_id( 'url-icons' ),
311 'url-icon-name' => $this->get_field_name( 'url-icons' ),
312 'url-value' => $icon['url'],
313 )
314 );
315 }
316 ?>
317
318 </div>
319
320 <p class="jetpack-social-icons-widget add-button">
321 <button type="button" class="button jetpack-social-icons-add-button">
322 <?php esc_html_e( 'Add an icon', 'jetpack' ); ?>
323 </button>
324 </p>
325
326 <?php
327 switch ( get_locale() ) {
328 case 'es':
329 $support = 'https://es.support.wordpress.com/social-media-icons-widget/#iconos-disponibles';
330 break;
331
332 case 'pt-br':
333 $support = 'https://br.support.wordpress.com/widgets/widget-de-icones-sociais/#ícones-disponíveis';
334 break;
335
336 default:
337 $support = 'https://en.support.wordpress.com/widgets/social-media-icons-widget/#available-icons';
338 }
339 ?>
340
341 <p>
342 <em><a href="<?php echo esc_url( $support ); ?>" target="_blank" rel="noopener noreferrer">
343 <?php esc_html_e( 'View available icons', 'jetpack' ); ?>
344 </a></em>
345 </p>
346
347 <p>
348 <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'new-tab' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'new-tab' ) ); ?>" <?php checked( $new_tab ); ?> />
349 <label for="<?php echo esc_attr( $this->get_field_id( 'new-tab' ) ); ?>"><?php esc_html_e( 'Open link in a new tab', 'jetpack' ); ?></label>
350 </p>
351
352 <?php
353 }
354
355 /**
356 * Generates template to add icons.
357 *
358 * @param array $args Template arguments.
359 */
360 private static function render_icons_template( $args = array() ) {
361 $defaults = array(
362 'url-icon-id' => '',
363 'url-icon-name' => '',
364 'url-value' => '',
365 );
366
367 $args = wp_parse_args( $args, $defaults );
368 ?>
369
370 <div class="jetpack-social-icons-widget-item">
371 <div class="jetpack-social-icons-widget-item-wrapper">
372 <div class="handle"></div>
373
374 <p class="jetpack-widget-social-icons-url">
375 <?php
376 printf(
377 '<input class="widefat" id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
378 esc_attr( $args['url-icon-id'] ),
379 esc_attr( $args['url-icon-name'] ),
380 esc_attr__( 'Account URL', 'jetpack' ),
381 esc_url( $args['url-value'], array( 'http', 'https', 'mailto', 'skype' ) )
382 );
383 ?>
384 </p>
385
386 <p class="jetpack-widget-social-icons-remove-item">
387 <a class="jetpack-widget-social-icons-remove-item-button" href="javascript:;">
388 <?php esc_html_e( 'Remove', 'jetpack' ); ?>
389 </a>
390 </p>
391 </div>
392 </div>
393
394 <?php
395 }
396
397 /**
398 * Return SVG markup.
399 *
400 * @param array $args {
401 * Parameters needed to display an SVG.
402 *
403 * @type string $icon Required SVG icon filename.
404 * }
405 * @return string SVG markup.
406 */
407 public function get_svg_icon( $args = array() ) {
408 // Make sure $args are an array.
409 if ( empty( $args ) ) {
410 return esc_html__( 'Please define default parameters in the form of an array.', 'jetpack' );
411 }
412
413 // Set defaults.
414 $defaults = array(
415 'icon' => '',
416 );
417
418 // Parse args.
419 $args = wp_parse_args( $args, $defaults );
420
421 // Define an icon.
422 if ( false === array_key_exists( 'icon', $args ) ) {
423 return esc_html__( 'Please define an SVG icon filename.', 'jetpack' );
424 }
425
426 // Set aria hidden.
427 $aria_hidden = ' aria-hidden="true"';
428
429 // Begin SVG markup.
430 $svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="presentation">';
431
432 /*
433 * Display the icon.
434 *
435 * The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
436 *
437 * See https://core.trac.wordpress.org/ticket/38387.
438 */
439 $svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> ';
440
441 $svg .= '</svg>';
442
443 return $svg;
444 }
445
446 /**
447 * Returns an array of supported social links (URL, icon, and label).
448 *
449 * @return array $social_links_icons
450 */
451 public function get_supported_icons() {
452 $social_links_icons = array(
453 array(
454 'url' => array( '500px.com' ),
455 'icon' => '500px',
456 'label' => '500px',
457 ),
458 array(
459 'url' => array(
460 '#https?:\/\/(www\.)?amazon\.(com|cn|in|fr|de|it|nl|es|co|ca)\/#',
461 ),
462 'icon' => 'amazon',
463 'label' => 'Amazon',
464 ),
465 array(
466 'url' => array( 'apple.com' ),
467 'icon' => 'apple',
468 'label' => 'Apple',
469 ),
470 array(
471 'url' => array( 'itunes.com' ),
472 'icon' => 'apple',
473 'label' => 'iTunes',
474 ),
475 array(
476 'url' => array( 'bandcamp.com' ),
477 'icon' => 'bandcamp',
478 'label' => 'Bandcamp',
479 ),
480 array(
481 'url' => array( 'behance.net' ),
482 'icon' => 'behance',
483 'label' => 'Behance',
484 ),
485 array(
486 'url' => array(
487 'blogger.com',
488 'blogspot.com',
489 ),
490 'icon' => 'blogger',
491 'label' => 'Blogger',
492 ),
493 array(
494 'url' => array( 'codepen.io' ),
495 'icon' => 'codepen',
496 'label' => 'CodePen',
497 ),
498 array(
499 'url' => array( 'deviantart.com' ),
500 'icon' => 'deviantart',
501 'label' => 'DeviantArt',
502 ),
503 array(
504 'url' => array( 'digg.com' ),
505 'icon' => 'digg',
506 'label' => 'Digg',
507 ),
508 array(
509 'url' => array( '#discord\.gg|discordapp\.com#' ),
510 'icon' => 'discord',
511 'label' => 'Discord',
512 ),
513 array(
514 'url' => array( 'dribbble.com' ),
515 'icon' => 'dribbble',
516 'label' => 'Dribbble',
517 ),
518 array(
519 'url' => array( 'dropbox.com' ),
520 'icon' => 'dropbox',
521 'label' => 'Dropbox',
522 ),
523 array(
524 'url' => array( 'etsy.com' ),
525 'icon' => 'etsy',
526 'label' => 'Etsy',
527 ),
528 array(
529 'url' => array( 'eventbrite.com' ),
530 'icon' => 'eventbrite',
531 'label' => 'Eventbrite',
532 ),
533 array(
534 'url' => array( 'facebook.com' ),
535 'icon' => 'facebook',
536 'label' => 'Facebook',
537 ),
538 array(
539 'url' => array( 'flickr.com' ),
540 'icon' => 'flickr',
541 'label' => 'Flickr',
542 ),
543 array(
544 'url' => array( 'foursquare.com' ),
545 'icon' => 'foursquare',
546 'label' => 'Foursquare',
547 ),
548 array(
549 'url' => array( 'ghost.org' ),
550 'icon' => 'ghost',
551 'label' => 'Ghost',
552 ),
553 array(
554 'url' => array( 'goodreads.com' ),
555 'icon' => 'goodreads',
556 'label' => 'Goodreads',
557 ),
558 array(
559 'url' => array( '#google\.(com|co\.uk|ca|cn|it)#' ),
560 'icon' => 'google',
561 'label' => 'Google',
562 ),
563 array(
564 'url' => array( 'github.com' ),
565 'icon' => 'github',
566 'label' => 'GitHub',
567 ),
568 array(
569 'url' => array( 'instagram.com' ),
570 'icon' => 'instagram',
571 'label' => 'Instagram',
572 ),
573 array(
574 'url' => array( 'linkedin.com' ),
575 'icon' => 'linkedin',
576 'label' => 'LinkedIn',
577 ),
578 array(
579 'url' => array( 'mailto:' ),
580 'icon' => 'mail',
581 'label' => __( 'Email', 'jetpack' ),
582 ),
583 array(
584 'url' => jetpack_mastodon_get_instance_list(),
585 'icon' => 'mastodon',
586 'label' => 'Mastodon',
587 ),
588 array(
589 'url' => array( 'meetup.com' ),
590 'icon' => 'meetup',
591 'label' => 'Meetup',
592 ),
593 array(
594 'url' => array( 'medium.com' ),
595 'icon' => 'medium',
596 'label' => 'Medium',
597 ),
598 array(
599 'url' => array( 'nextdoor.com' ),
600 'icon' => 'nextdoor',
601 'label' => 'Nextdoor',
602 ),
603 array(
604 'url' => array( 'patreon.com' ),
605 'icon' => 'patreon',
606 'label' => 'Patreon',
607 ),
608 array(
609 'url' => array( 'pinterest.' ),
610 'icon' => 'pinterest',
611 'label' => 'Pinterest',
612 ),
613 array(
614 'url' => array( 'getpocket.com' ),
615 'icon' => 'pocket',
616 'label' => 'Pocket',
617 ),
618 array(
619 'url' => array( 'ravelry.com' ),
620 'icon' => 'ravelry',
621 'label' => 'Ravelry',
622 ),
623 array(
624 'url' => array( 'reddit.com' ),
625 'icon' => 'reddit',
626 'label' => 'Reddit',
627 ),
628 array(
629 'url' => array( 'skype.com' ),
630 'icon' => 'skype',
631 'label' => 'Skype',
632 ),
633 array(
634 'url' => array( 'skype:' ),
635 'icon' => 'skype',
636 'label' => 'Skype',
637 ),
638 array(
639 'url' => array( 'slideshare.net' ),
640 'icon' => 'slideshare',
641 'label' => 'SlideShare',
642 ),
643 array(
644 'url' => array( 'snapchat.com' ),
645 'icon' => 'snapchat',
646 'label' => 'Snapchat',
647 ),
648 array(
649 'url' => array( 'soundcloud.com' ),
650 'icon' => 'soundcloud',
651 'label' => 'SoundCloud',
652 ),
653 array(
654 'url' => array( 'spotify.com' ),
655 'icon' => 'spotify',
656 'label' => 'Spotify',
657 ),
658 array(
659 'url' => array( 'stackoverflow.com' ),
660 'icon' => 'stackoverflow',
661 'label' => 'Stack Overflow',
662 ),
663 array(
664 'url' => array( 'strava.com' ),
665 'icon' => 'strava',
666 'label' => 'Strava',
667 ),
668 array(
669 'url' => array( 'stumbleupon.com' ),
670 'icon' => 'stumbleupon',
671 'label' => 'StumbleUpon',
672 ),
673 array(
674 'url' => array( '#https?:\/\/(www\.)?(telegram|t)\.me#' ),
675 'icon' => 'telegram',
676 'label' => 'Telegram',
677 ),
678 array(
679 'url' => array( 'threads.net' ),
680 'icon' => 'threads',
681 'label' => 'Threads',
682 ),
683 array(
684 'url' => array( 'tiktok.com' ),
685 'icon' => 'tiktok',
686 'label' => 'TikTok',
687 ),
688 array(
689 'url' => array( 'tumblr.com' ),
690 'icon' => 'tumblr',
691 'label' => 'Tumblr',
692 ),
693 array(
694 'url' => array( 'twitch.tv' ),
695 'icon' => 'twitch',
696 'label' => 'Twitch',
697 ),
698 array(
699 'url' => array( 'twitter.com' ),
700 'icon' => 'twitter',
701 'label' => 'Twitter',
702 ),
703 array(
704 'url' => array( 'vimeo.com' ),
705 'icon' => 'vimeo',
706 'label' => 'Vimeo',
707 ),
708 array(
709 'url' => array( 'vk.com' ),
710 'icon' => 'vk',
711 'label' => 'VK',
712 ),
713 array(
714 'url' => array( 'whatsapp.com' ),
715 'icon' => 'whatsapp',
716 'label' => 'WhatsApp',
717 ),
718 array(
719 'url' => array( 'woocommerce.com' ),
720 'icon' => 'woocommerce',
721 'label' => 'WooCommerce',
722 ),
723 array(
724 'url' => array( '#wordpress\.(com|org)#' ),
725 'icon' => 'wordpress',
726 'label' => 'WordPress',
727 ),
728 array(
729 'url' => array( 'yelp.com' ),
730 'icon' => 'yelp',
731 'label' => 'Yelp',
732 ),
733 array(
734 'url' => array( 'xanga.com' ),
735 'icon' => 'xanga',
736 'label' => 'Xanga',
737 ),
738 array(
739 'url' => array( 'youtube.com' ),
740 'icon' => 'youtube',
741 'label' => 'YouTube',
742 ),
743
744 // keep feed at the end so that more specific icons can take precedence.
745 array(
746 'url' => array(
747 '/feed/', // WordPress default feed url.
748 '/feeds/', // Blogspot and others.
749 '/blog/feed', // No trailing slash WordPress feed, could use /feed but may match unexpectedly.
750 'format=RSS', // Squarespace and others.
751 '/rss', // Tumblr.
752 '/.rss', // Reddit.
753 '/rss.xml', // Moveable Type, Typepad.
754 'http://rss.', // Old custom format.
755 'https://rss.', // Old custom format.
756 'rss=1',
757 '/feed=rss', // Catches feed=rss / feed=rss2.
758 '?feed=rss', // WordPress non-permalink - Catches feed=rss / feed=rss2.
759 '?feed=rdf', // WordPress non-permalink.
760 '?feed=atom', // WordPress non-permalink.
761 'http://feeds.', // FeedBurner.
762 'https://feeds.', // FeedBurner.
763 '/feed.xml', // Feedburner Alias, and others.
764 '/index.xml', // Moveable Type, and others.
765 '/atom.xml', // Typepad, Squarespace.
766 '.atom', // Shopify blog.
767 '/atom', // Some non-WordPress feeds.
768 'index.rdf', // Typepad.
769 ),
770 'icon' => 'feed',
771 'label' => __( 'RSS Feed', 'jetpack' ),
772 ),
773 );
774
775 /**
776 * Filter the list of services matching Social Media Icons available in the Social Icons SVG sprite.
777 *
778 * @since 12.3
779 *
780 * @param array $social_links_icons Array of social links icons.
781 */
782 return apply_filters(
783 'jetpack_social_icons_supported_icons',
784 $social_links_icons
785 );
786 }
787 } // Jetpack_Widget_Social_Icons
788
789 /**
790 * Register and load the widget.
791 *
792 * @access public
793 * @return void
794 */
795 function jetpack_widget_social_icons_load() {
796 register_widget( 'Jetpack_Widget_Social_Icons' );
797 }
798 add_action( 'widgets_init', 'jetpack_widget_social_icons_load' );
799