Completed
Push — social-icons-widget ( 62f89e...1b19c4 )
by
unknown
09:04
created

Jetpack_Widget_Social_Icons::form()   B

Complexity

Conditions 6
Paths 24

Size

Total Lines 76
Code Lines 48

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 48
nc 24
nop 1
dl 0
loc 76
rs 8.4596
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
class Jetpack_Widget_Social_Icons extends WP_Widget {
3
	/**
4
	 * @var array Default widget options.
5
	 */
6
	protected $defaults;
7
8
	/**
9
	 * Widget constructor.
10
	 */
11
	public function __construct() {
12
		$widget_ops = array(
13
			'classname'                   => 'jetpack_widget_social_icons',
14
			'description'                 => __( 'Add social-media icons to your site.', 'jetpack' ),
15
			'customize_selective_refresh' => true,
16
		);
17
18
		parent::__construct( 'jetpack_widget_social_icons', __( 'Social Icons', 'jetpack' ), $widget_ops );
19
20
		$this->defaults = array(
21
			'title'     => __( 'Follow Us', 'jetpack' ),
22
			'icon-size' => 'medium',
23
			'new-tab'   => false,
24
			'icons'     => array(
25
				array(
26
					'url'   => '',
27
				),
28
			),
29
		);
30
31
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
32
		add_action( 'admin_print_footer_scripts', array( $this, 'render_admin_js' ) );
33
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_icon_scripts' ) );
34
		add_action( 'wp_footer', array( $this, 'include_svg_icons' ), 9999 );
35
	}
36
37
	/**
38
	 * Script & styles for admin widget form.
39
	 */
40
	public function enqueue_admin_scripts( $hook ) {
41
		global $wp_customize;
42
43
		if ( isset( $wp_customize ) || 'widgets.php' === $hook ) {
44
			wp_enqueue_script( 'jetpack-widget-social-icons-script', plugins_url( 'social-icons/social-icons-admin.js', __FILE__ ), array( 'jquery-ui-sortable' ), '20170506' );
45
			wp_enqueue_style( 'jetpack-widget-social-icons-admin', plugins_url( 'social-icons/social-icons-admin.css', __FILE__ ), array(), '20170506' );
46
		}
47
	}
48
49
	/**
50
	 * Styles for front-end widget.
51
	 */
52
	public function enqueue_icon_scripts() {
53
		wp_enqueue_style( 'jetpack-widget-social-icons-styles', plugins_url( 'social-icons/social-icons.css', __FILE__ ), array(), '20170506' );
54
	}
55
56
	/**
57
	 * JavaScript for admin widget form.
58
	 */
59
	public function render_admin_js() {
60
		global $wp_customize;
61
		global $pagenow;
62
63
		if ( ! isset( $wp_customize ) && 'widgets.php' !== $pagenow ) {
64
			return;
65
		}
66
	?>
67
		<script type="text/html" id="tmpl-jetpack-widget-social-icons-template">
68
			<?php self::render_icons_template(); ?>
69
		</script>
70
	<?php
71
	}
72
73
	/**
74
	 * Add SVG definitions to the footer.
75
	 */
76
	public function include_svg_icons() {
77
		if ( ! is_active_widget( false, $this->id, $this->id_base, true ) ) {
78
			return;
79
		}
80
81
		// Define SVG sprite file in Jetpack -- NEEDS TESTING
82
		$svg_icons = dirname( dirname( __FILE__ ) ) . '/theme-tools/social-menu/social-menu.svg';
83
84
		// Define SVG sprite file in WPCOM
85
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
86
			$svg_icons = dirname( dirname( __FILE__ ) ) . '/social-menu/social-menu.svg';
87
		}
88
89
		// If it exists, include it.
90
		if ( is_file( $svg_icons ) ) {
91
			require_once( $svg_icons );
92
		}
93
	}
94
95
	/**
96
	 * Front-end display of widget.
97
	 *
98
	 * @see WP_Widget::widget()
99
	 *
100
	 * @param array $args Widget arguments.
101
	 * @param array $instance Saved values from database.
102
	 */
103
	public function widget( $args, $instance ) {
104
		$instance = wp_parse_args( $instance, $this->defaults );
105
106
		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
107
		$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
108
109
		echo $args['before_widget'];
110
111 View Code Duplication
		if ( ! empty( $title ) ) {
112
			echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
113
		}
114
115
		if ( ! empty( $instance['icons'] ) ) :
116
117
			// Get supported social icons.
118
			$social_icons  = $this->get_supported_icons();
119
			$default_icon  = $this->get_svg_icon( array( 'icon' => 'chain' ) );
120
121
			if ( true === $instance['new-tab'] ) {
122
				$new_tab = ' target="_blank"';
123
			}
124
		?>
125
126
			<ul class="jetpack-social-widget-list size-<?php echo esc_attr( $instance['icon-size'] ); ?>">
127
128
				<?php foreach ( $instance['icons'] as $icon ) : ?>
129
130
					<?php if ( ! empty( $icon['url'] ) ) : ?>
131
						<li class="jetpack-social-widget-item">
132
							<a href="<?php echo esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ); ?>"<?php echo $new_tab; ?>>
0 ignored issues
show
Bug introduced by
The variable $new_tab does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
133
								<?php
134
									$found_icon = false;
135
136
									foreach( $social_icons as $social_icon ) {
137
										if ( false !== stripos( $icon['url'], $social_icon['url'] ) ) {
138
											echo '<span class="screen-reader-text">' . esc_attr( $social_icon['label'] ) . '</span>';
139
											echo $this->get_svg_icon( array( 'icon' => esc_attr( $social_icon['icon'] ) ) );
140
											$found_icon = true;
141
											break;
142
										}
143
									}
144
145
									if ( ! $found_icon ) {
146
										echo $default_icon;
147
									}
148
								?>
149
							</a>
150
						</li>
151
					<?php endif; ?>
152
153
				<?php endforeach; ?>
154
155
			</ul>
156
157
		<?php
158
		endif;
159
160
		echo $args['after_widget'];
161
	}
162
163
	/**
164
	 * Sanitize widget form values as they are saved.
165
	 *
166
	 * @see WP_Widget::update()
167
	 *
168
	 * @param array $new_instance Values just sent to be saved.
169
	 * @param array $old_instance Previously saved values from database.
170
	 *
171
	 * @return array Updated safe values to be saved.
172
	 */
173
	public function update( $new_instance, $old_instance ) {
174
		$instance['title']     = sanitize_text_field( $new_instance['title'] );
0 ignored issues
show
Coding Style Comprehensibility introduced by
$instance was never initialized. Although not strictly required by PHP, it is generally a good practice to add $instance = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
175
		$instance['icon-size'] = $this->defaults['icon-size'];
176
177
		if ( in_array( $new_instance['icon-size'], array( 'small', 'medium', 'large' ) ) ) {
178
			$instance['icon-size'] = $new_instance['icon-size'];
179
		}
180
181
		$instance['new-tab'] = isset( $new_instance['new-tab'] ) ? (bool) $new_instance['new-tab'] : false;
182
		$icon_count          = count( $new_instance['url-icons'] );
0 ignored issues
show
Unused Code introduced by
$icon_count is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
183
		$instance['icons']   = array();
184
185
		foreach( $new_instance['url-icons'] as $url ) {
186
			$url = filter_var( $url, FILTER_SANITIZE_URL );
187
188
			if ( ! empty( $url ) ) {
189
				$instance['icons'][] = array(
190
					'url' => $url,
191
				);
192
			}
193
		}
194
195
		return $instance;
196
	}
197
198
	/**
199
	 * Back-end widget form.
200
	 *
201
	 * @see WP_Widget::form()
202
	 *
203
	 * @param array $instance Previously saved values from database.
204
	 *
205
	 * @return string|void
206
	 */
207
	public function form( $instance ) {
208
		$instance = wp_parse_args( $instance, $this->defaults );
209
		$title    = sanitize_text_field( $instance['title'] );
210
		$sizes    = array(
211
			'small'  => __( 'Small', 'jetpack' ),
212
			'medium' => __( 'Medium', 'jetpack' ),
213
			'large'  => __( 'Large', 'jetpack' ),
214
		);
215
		$new_tab  = isset( $instance['new-tab'] ) ? (bool) $instance['new-tab'] : false;
216
		?>
217
218
		<p>
219
			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
220
			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
221
		</p>
222
223
		<p>
224
			<label for="<?php echo $this->get_field_id( 'icon-size' ); ?>"><?php esc_html_e( 'Size:', 'jetpack' ); ?></label>
225
			<select class="widefat" name="<?php echo $this->get_field_name( 'icon-size' ); ?>">
226
				<?php foreach ( $sizes as $value => $label ) : ?>
227
					<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $instance['icon-size'] ); ?>><?php echo esc_attr( $label ); ?></option>
228
				<?php endforeach; ?>
229
			</select>
230
		</p>
231
232
		<div class="jetpack-social-icons-widget-list"
233
			data-url-icon-id="<?php echo $this->get_field_id( 'url-icons' ); ?>"
234
			data-url-icon-name="<?php echo $this->get_field_name( 'url-icons' ); ?>"
235
		>
236
237
			<?php
238
				foreach ( $instance['icons'] as $icon ) {
239
					self::render_icons_template( array(
240
						'url-icon-id'   => $this->get_field_id( 'url-icons' ),
241
						'url-icon-name' => $this->get_field_name( 'url-icons' ),
242
						'url-value'     => $icon['url'],
243
					) );
244
				}
245
			?>
246
247
		</div>
248
249
		<p class="jetpack-social-icons-widget add-button">
250
			<button type="button" class="button jetpack-social-icons-add-button">
251
				<?php esc_html_e( 'Add an icon', 'jetpack' ); ?>
252
			</button>
253
		</p>
254
255
		<?php
256
			switch ( get_locale() ) {
257
				case 'es':
258
					$support = 'https://es.support.wordpress.com/social-media-icons-widget/#iconos-disponibles';
259
					break;
260
261
				case 'pt-br':
262
					$support = 'https://br.support.wordpress.com/widgets/widget-de-icones-sociais/#ícones-disponíveis';
263
					break;
264
265
				default:
266
					$support = 'https://en.support.wordpress.com/widgets/social-media-icons-widget/#available-icons';
267
			}
268
		?>
269
270
		<p>
271
			<em><a href="<?php echo esc_url( $support ); ?>" target="_blank">
272
				<?php esc_html_e( 'View available icons', 'jetpack' ); ?>
273
			</a></em>
274
		</p>
275
276
		<p>
277
			<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'new-tab' ); ?>" name="<?php echo $this->get_field_name( 'new-tab' ); ?>" <?php checked( $new_tab ); ?> />
278
			<label for="<?php echo $this->get_field_id( 'new-tab' ); ?>"><?php esc_html_e( 'Open link in a new tab', 'jetpack' ); ?></label>
279
		</p>
280
281
	<?php
282
	}
283
284
	/**
285
	 * Generates template to add icons.
286
	 *
287
	 * @param array $args Template arguments
288
	 */
289
	static function render_icons_template( $args = array() ) {
290
		$defaults = array(
291
			'url-icon-id'   => '',
292
			'url-icon-name' => '',
293
			'url-value'     => '',
294
		);
295
296
		$args = wp_parse_args( $args, $defaults );
297
		?>
298
299
		<div class="jetpack-social-icons-widget-item">
300
			<div class="jetpack-social-icons-widget-item-wrapper">
301
				<div class="handle"></div>
302
303
				<p class="jetpack-widget-social-icons-url">
304
					<?php
305
						printf( '<input class="widefat id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
306
							esc_attr( $args['url-icon-id'] ),
307
							esc_attr( $args['url-icon-name'] ),
308
							esc_attr__( 'Account URL', 'jetpack' ),
309
							esc_url( $args['url-value'], array( 'http', 'https', 'mailto', 'skype' ) )
310
						);
311
					?>
312
				</p>
313
314
				<p class="jetpack-widget-social-icons-remove-item">
315
					<a class="jetpack-widget-social-icons-remove-item-button" href="javascript:;">
316
						<?php esc_html_e( 'Remove', 'jetpack' ); ?>
317
					</a>
318
				</p>
319
			</div>
320
		</div>
321
322
		<?php
323
	}
324
325
	/**
326
	 * Return SVG markup.
327
	 *
328
	 * @param array $args {
329
	 *     Parameters needed to display an SVG.
330
	 *
331
	 *     @type string $icon  Required SVG icon filename.
332
	 * }
333
	 * @return string SVG markup.
334
	 */
335
	public function get_svg_icon( $args = array() ) {
336
		// Make sure $args are an array.
337
		if ( empty( $args ) ) {
338
			return esc_html__( 'Please define default parameters in the form of an array.', 'jetpack' );
339
		}
340
341
		// Set defaults.
342
		$defaults = array(
343
			'icon' => '',
344
		);
345
346
		// Parse args.
347
		$args = wp_parse_args( $args, $defaults );
348
349
		// Define an icon.
350
		if ( false === array_key_exists( 'icon', $args ) ) {
351
			return esc_html__( 'Please define an SVG icon filename.', 'jetpack' );
352
		}
353
354
		// Set aria hidden.
355
		$aria_hidden = ' aria-hidden="true"';
356
357
		// Begin SVG markup.
358
		$svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="img">';
359
360
		/*
361
		 * Display the icon.
362
		 *
363
		 * The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
364
		 *
365
		 * See https://core.trac.wordpress.org/ticket/38387.
366
		 */
367
		$svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> ';
368
369
		$svg .= '</svg>';
370
371
		return $svg;
372
	}
373
374
	/**
375
	 * Returns an array of supported social links (URL, icon, and label).
376
	 *
377
	 * @return array $social_links_icons
378
	 */
379
	public function get_supported_icons() {
380
		$social_links_icons = array(
381
			array(
382
				'url'   => '500px.com',
383
				'icon'  => '500px',
384
				'label' => '500px',
385
			),
386
			array(
387
				'url'   => 'amazon.cn',
388
				'icon'  => 'amazon',
389
				'label' => 'Amazon',
390
			),
391
			array(
392
				'url'   => 'amazon.in',
393
				'icon'  => 'amazon',
394
				'label' => 'Amazon',
395
			),
396
			array(
397
				'url'   => 'amazon.fr',
398
				'icon'  => 'amazon',
399
				'label' => 'Amazon',
400
			),
401
			array(
402
				'url'   => 'amazon.de',
403
				'icon'  => 'amazon',
404
				'label' => 'Amazon',
405
			),
406
			array(
407
				'url'   => 'amazon.it',
408
				'icon'  => 'amazon',
409
				'label' => 'Amazon',
410
			),
411
			array(
412
				'url'   => 'amazon.nl',
413
				'icon'  => 'amazon',
414
				'label' => 'Amazon',
415
			),
416
			array(
417
				'url'   => 'amazon.es',
418
				'icon'  => 'amazon',
419
				'label' => 'Amazon',
420
			),
421
			array(
422
				'url'   => 'amazon.co',
423
				'icon'  => 'amazon',
424
				'label' => 'Amazon',
425
			),
426
			array(
427
				'url'   => 'amazon.ca',
428
				'icon'  => 'amazon',
429
				'label' => 'Amazon',
430
			),
431
			array(
432
				'url'   => 'amazon.com',
433
				'icon'  => 'amazon',
434
				'label' => 'Amazon',
435
			),
436
			array(
437
				'url'   => 'apple.com',
438
				'icon'  => 'apple',
439
				'label' => 'Apple',
440
			),
441
			array(
442
				'url'   => 'itunes.com',
443
				'icon'  => 'apple',
444
				'label' => 'iTunes',
445
			),
446
			array(
447
				'url'   => 'bandcamp.com',
448
				'icon'  => 'bandcamp',
449
				'label' => 'Bandcamp',
450
			),
451
			array(
452
				'url'   => 'behance.net',
453
				'icon'  => 'behance',
454
				'label' => 'Behance',
455
			),
456
			array(
457
				'url'   => 'codepen.io',
458
				'icon'  => 'codepen',
459
				'label' => 'CodePen',
460
			),
461
			array(
462
				'url'   => 'deviantart.com',
463
				'icon'  => 'deviantart',
464
				'label' => 'DeviantArt',
465
			),
466
			array(
467
				'url'   => 'digg.com',
468
				'icon'  => 'digg',
469
				'label' => 'Digg',
470
			),
471
			array(
472
				'url'   => 'dribbble.com',
473
				'icon'  => 'dribbble',
474
				'label' => 'Dribbble',
475
			),
476
			array(
477
				'url'   => 'dropbox.com',
478
				'icon'  => 'dropbox',
479
				'label' => 'Dropbox',
480
			),
481
			array(
482
				'url'   => 'etsy.com',
483
				'icon'  => 'etsy',
484
				'label' => 'Etsy',
485
			),
486
			array(
487
				'url'   => 'facebook.com',
488
				'icon'  => 'facebook',
489
				'label' => 'Facebook',
490
			),
491
			array(
492
				'url'   => '/feed/',
493
				'icon'  => 'feed',
494
				'label' => __( 'RSS Feed', 'jetpack' ),
495
			),
496
			array(
497
				'url'   => 'flickr.com',
498
				'icon'  => 'flickr',
499
				'label' => 'Flickr',
500
			),
501
			array(
502
				'url'   => 'foursquare.com',
503
				'icon'  => 'foursquare',
504
				'label' => 'Foursquare',
505
			),
506
			array(
507
				'url'   => 'goodreads.com',
508
				'icon'  => 'goodreads',
509
				'label' => 'Goodreads',
510
			),
511
			array(
512
				'url'   => 'google.com/+',
513
				'icon'  => 'google-plus',
514
				'label' => 'Google +',
515
			),
516
			array(
517
				'url'   => 'plus.google.com',
518
				'icon'  => 'google-plus',
519
				'label' => 'Google +',
520
			),
521
			array(
522
				'url'   => 'google.com',
523
				'icon'  => 'google',
524
				'label' => 'Google',
525
			),
526
			array(
527
				'url'   => 'github.com',
528
				'icon'  => 'github',
529
				'label' => 'GitHub',
530
			),
531
			array(
532
				'url'   => 'instagram.com',
533
				'icon'  => 'instagram',
534
				'label' => 'Instagram',
535
			),
536
			array(
537
				'url'   => 'linkedin.com',
538
				'icon'  => 'linkedin',
539
				'label' => 'LinkedIn',
540
			),
541
			array(
542
				'url'   => 'mailto:',
543
				'icon'  => 'mail',
544
				'label' => __( 'Email', 'jetpack' ),
545
			),
546
			array(
547
				'url'   => 'meetup.com',
548
				'icon'  => 'meetup',
549
				'label' => 'Meetup',
550
			),
551
			array(
552
				'url'   => 'medium.com',
553
				'icon'  => 'medium',
554
				'label' => 'Medium',
555
			),
556
			array(
557
				'url'   => 'pinterest.com',
558
				'icon'  => 'pinterest',
559
				'label' => 'Pinterest',
560
			),
561
			array(
562
				'url'   => 'getpocket.com',
563
				'icon'  => 'pocket',
564
				'label' => 'Pocket',
565
			),
566
			array(
567
				'url'   => 'reddit.com',
568
				'icon'  => 'reddit',
569
				'label' => 'Reddit',
570
			),
571
			array(
572
				'url'   => 'skype.com',
573
				'icon'  => 'skype',
574
				'label' => 'Skype',
575
			),
576
			array(
577
				'url'   => 'skype:',
578
				'icon'  => 'skype',
579
				'label' => 'Skype',
580
			),
581
			array(
582
				'url'   => 'slideshare.net',
583
				'icon'  => 'slideshare',
584
				'label' => 'SlideShare',
585
			),
586
			array(
587
				'url'   => 'snapchat.com',
588
				'icon'  => 'snapchat',
589
				'label' => 'Snapchat',
590
			),
591
			array(
592
				'url'   => 'soundcloud.com',
593
				'icon'  => 'soundcloud',
594
				'label' => 'SoundCloud',
595
			),
596
			array(
597
				'url'   => 'spotify.com',
598
				'icon'  => 'spotify',
599
				'label' => 'Spotify',
600
			),
601
			array(
602
				'url'   => 'stumbleupon.com',
603
				'icon'  => 'stumbleupon',
604
				'label' => 'StumbleUpon',
605
			),
606
			array(
607
				'url'   => 'tumblr.com',
608
				'icon'  => 'tumblr',
609
				'label' => 'Tumblr',
610
			),
611
			array(
612
				'url'   => 'twitch.tv',
613
				'icon'  => 'twitch',
614
				'label' => 'Twitch',
615
			),
616
			array(
617
				'url'   => 'twitter.com',
618
				'icon'  => 'twitter',
619
				'label' => 'Twitter',
620
			),
621
			array(
622
				'url'   => 'vimeo.com',
623
				'icon'  => 'vimeo',
624
				'label' => 'Vimeo',
625
			),
626
			array(
627
				'url'   => 'vk.com',
628
				'icon'  => 'vk',
629
				'label' => 'VK',
630
			),
631
			array(
632
				'url'   => 'wordpress.com',
633
				'icon'  => 'wordpress',
634
				'label' => 'WordPress.com',
635
			),
636
			array(
637
				'url'   => 'wordpress.org',
638
				'icon'  => 'wordpress',
639
				'label' => 'WordPress',
640
			),
641
			array(
642
				'url'   => 'yelp.com',
643
				'icon'  => 'yelp',
644
				'label' => 'Yelp',
645
			),
646
			array(
647
				'url'   => 'youtube.com',
648
				'icon'  => 'youtube',
649
				'label' => 'YouTube',
650
			),
651
		);
652
653
		return $social_links_icons;
654
	}
655
} // Jetpack_Widget_Social_Icons
656
657
/**
658
 * Register and load the widget.
659
 *
660
 * @access public
661
 * @return void
662
 */
663
function jetpack_widget_social_icons_load() {
664
	register_widget( 'Jetpack_Widget_Social_Icons' );
665
}
666
add_action( 'widgets_init', 'jetpack_widget_social_icons_load' );
667