Completed
Push — social-icons-widget ( 777dae...5516d5 )
by
unknown
08:28
created

Jetpack_Widget_Social_Icons::widget()   C

Complexity

Conditions 9
Paths 6

Size

Total Lines 62
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
eloc 39
nc 6
nop 2
dl 0
loc 62
rs 6.6867
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(
19
			'jetpack_widget_social_icons',
20
			/** This filter is documented in modules/widgets/facebook-likebox.php */
21
			apply_filters( 'jetpack_widget_name', __( 'Social Icons', 'jetpack' ) ),
22
			$widget_ops
23
		);
24
25
		$this->defaults = array(
26
			'title'     => __( 'Follow Us', 'jetpack' ),
27
			'icon-size' => 'medium',
28
			'new-tab'   => false,
29
			'icons'     => array(
30
				array(
31
					'url' => '',
32
				),
33
			),
34
		);
35
36
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
37
		add_action( 'admin_print_footer_scripts', array( $this, 'render_admin_js' ) );
38
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_icon_scripts' ) );
39
		add_action( 'wp_footer', array( $this, 'include_svg_icons' ), 9999 );
40
	}
41
42
	/**
43
	 * Script & styles for admin widget form.
44
	 */
45
	public function enqueue_admin_scripts( $hook ) {
46
		global $wp_customize;
47
48
		if ( isset( $wp_customize ) || 'widgets.php' === $hook ) {
49
			wp_enqueue_script( 'jetpack-widget-social-icons-script', plugins_url( 'social-icons/social-icons-admin.js', __FILE__ ), array( 'jquery-ui-sortable' ), '20170506' );
50
			wp_enqueue_style( 'jetpack-widget-social-icons-admin', plugins_url( 'social-icons/social-icons-admin.css', __FILE__ ), array(), '20170506' );
51
		}
52
	}
53
54
	/**
55
	 * Styles for front-end widget.
56
	 */
57
	public function enqueue_icon_scripts() {
58
		wp_enqueue_style( 'jetpack-widget-social-icons-styles', plugins_url( 'social-icons/social-icons.css', __FILE__ ), array(), '20170506' );
59
	}
60
61
	/**
62
	 * JavaScript for admin widget form.
63
	 */
64
	public function render_admin_js() {
65
		global $wp_customize;
66
		global $pagenow;
67
68
		if ( ! isset( $wp_customize ) && 'widgets.php' !== $pagenow ) {
69
			return;
70
		}
71
	?>
72
		<script type="text/html" id="tmpl-jetpack-widget-social-icons-template">
73
			<?php self::render_icons_template(); ?>
74
		</script>
75
	<?php
76
	}
77
78
	/**
79
	 * Add SVG definitions to the footer.
80
	 */
81
	public function include_svg_icons() {
82
		if ( ! is_active_widget( false, $this->id, $this->id_base, true ) ) {
83
			return;
84
		}
85
86
		// Define SVG sprite file in Jetpack
87
		$svg_icons = dirname( dirname( __FILE__ ) ) . '/theme-tools/social-menu/social-menu.svg';
88
89
		// Define SVG sprite file in WPCOM
90
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
91
			$svg_icons = dirname( dirname( __FILE__ ) ) . '/social-menu/social-menu.svg';
92
		}
93
94
		// If it exists, include it.
95
		if ( is_file( $svg_icons ) ) {
96
			require_once( $svg_icons );
97
		}
98
	}
99
100
	/**
101
	 * Front-end display of widget.
102
	 *
103
	 * @see WP_Widget::widget()
104
	 *
105
	 * @param array $args Widget arguments.
106
	 * @param array $instance Saved values from database.
107
	 */
108
	public function widget( $args, $instance ) {
109
		$instance = wp_parse_args( $instance, $this->defaults );
110
111
		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
112
		$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
113
114
		echo $args['before_widget'];
115
116
		if ( ! empty( $title ) ) {
117
			echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
118
		}
119
120
		if ( ! empty( $instance['icons'] ) ) :
121
122
			// Get supported social icons.
123
			$social_icons  = $this->get_supported_icons();
124
			$default_icon  = $this->get_svg_icon( array( 'icon' => 'chain' ) );
125
126
			if ( true === $instance['new-tab'] ) {
127
				$new_tab = ' target="_blank"';
128
			}
129
		?>
130
131
			<ul class="jetpack-social-widget-list size-<?php echo esc_attr( $instance['icon-size'] ); ?>">
132
133
				<?php foreach ( $instance['icons'] as $icon ) : ?>
134
135
					<?php if ( ! empty( $icon['url'] ) ) : ?>
136
						<li class="jetpack-social-widget-item">
137
							<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...
138
								<?php
139
									$found_icon = false;
140
141
									foreach( $social_icons as $social_icon ) {
142
										if ( false !== stripos( $icon['url'], $social_icon['url'] ) ) {
143
											echo '<span class="screen-reader-text">' . esc_attr( $social_icon['label'] ) . '</span>';
144
											echo $this->get_svg_icon( array( 'icon' => esc_attr( $social_icon['icon'] ) ) );
145
											$found_icon = true;
146
											break;
147
										}
148
									}
149
150
									if ( ! $found_icon ) {
151
										echo $default_icon;
152
									}
153
								?>
154
							</a>
155
						</li>
156
					<?php endif; ?>
157
158
				<?php endforeach; ?>
159
160
			</ul>
161
162
		<?php
163
		endif;
164
165
		echo $args['after_widget'];
166
167
		/** This action is documented in modules/widgets/gravatar-profile.php */
168
		do_action( 'jetpack_stats_extra', 'widget_view', 'social_icons' );
169
	}
170
171
	/**
172
	 * Sanitize widget form values as they are saved.
173
	 *
174
	 * @see WP_Widget::update()
175
	 *
176
	 * @param array $new_instance Values just sent to be saved.
177
	 * @param array $old_instance Previously saved values from database.
178
	 *
179
	 * @return array Updated safe values to be saved.
180
	 */
181
	public function update( $new_instance, $old_instance ) {
182
		$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...
183
		$instance['icon-size'] = $this->defaults['icon-size'];
184
185
		if ( in_array( $new_instance['icon-size'], array( 'small', 'medium', 'large' ) ) ) {
186
			$instance['icon-size'] = $new_instance['icon-size'];
187
		}
188
189
		$instance['new-tab'] = isset( $new_instance['new-tab'] ) ? (bool) $new_instance['new-tab'] : false;
190
		$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...
191
		$instance['icons']   = array();
192
193
		foreach( $new_instance['url-icons'] as $url ) {
194
			$url = filter_var( $url, FILTER_SANITIZE_URL );
195
196
			if ( ! empty( $url ) ) {
197
				$instance['icons'][] = array(
198
					'url' => $url,
199
				);
200
			}
201
		}
202
203
		return $instance;
204
	}
205
206
	/**
207
	 * Back-end widget form.
208
	 *
209
	 * @see WP_Widget::form()
210
	 *
211
	 * @param array $instance Previously saved values from database.
212
	 *
213
	 * @return string|void
214
	 */
215
	public function form( $instance ) {
216
		$instance = wp_parse_args( $instance, $this->defaults );
217
		$title    = sanitize_text_field( $instance['title'] );
218
		$sizes    = array(
219
			'small'  => __( 'Small', 'jetpack' ),
220
			'medium' => __( 'Medium', 'jetpack' ),
221
			'large'  => __( 'Large', 'jetpack' ),
222
		);
223
		$new_tab  = isset( $instance['new-tab'] ) ? (bool) $instance['new-tab'] : false;
224
		?>
225
226
		<p>
227
			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
228
			<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 ); ?>" />
229
		</p>
230
231
		<p>
232
			<label for="<?php echo $this->get_field_id( 'icon-size' ); ?>"><?php esc_html_e( 'Size:', 'jetpack' ); ?></label>
233
			<select class="widefat" name="<?php echo $this->get_field_name( 'icon-size' ); ?>">
234
				<?php foreach ( $sizes as $value => $label ) : ?>
235
					<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $instance['icon-size'] ); ?>><?php echo esc_attr( $label ); ?></option>
236
				<?php endforeach; ?>
237
			</select>
238
		</p>
239
240
		<div class="jetpack-social-icons-widget-list"
241
			data-url-icon-id="<?php echo $this->get_field_id( 'url-icons' ); ?>"
242
			data-url-icon-name="<?php echo $this->get_field_name( 'url-icons' ); ?>"
243
		>
244
245
			<?php
246
				foreach ( $instance['icons'] as $icon ) {
247
					self::render_icons_template( array(
248
						'url-icon-id'   => $this->get_field_id( 'url-icons' ),
249
						'url-icon-name' => $this->get_field_name( 'url-icons' ),
250
						'url-value'     => $icon['url'],
251
					) );
252
				}
253
			?>
254
255
		</div>
256
257
		<p class="jetpack-social-icons-widget add-button">
258
			<button type="button" class="button jetpack-social-icons-add-button">
259
				<?php esc_html_e( 'Add an icon', 'jetpack' ); ?>
260
			</button>
261
		</p>
262
263
		<?php
264
			switch ( get_locale() ) {
265
				case 'es':
266
					$support = 'https://es.support.wordpress.com/social-media-icons-widget/#iconos-disponibles';
267
					break;
268
269
				case 'pt-br':
270
					$support = 'https://br.support.wordpress.com/widgets/widget-de-icones-sociais/#ícones-disponíveis';
271
					break;
272
273
				default:
274
					$support = 'https://en.support.wordpress.com/widgets/social-media-icons-widget/#available-icons';
275
			}
276
		?>
277
278
		<p>
279
			<em><a href="<?php echo esc_url( $support ); ?>" target="_blank">
280
				<?php esc_html_e( 'View available icons', 'jetpack' ); ?>
281
			</a></em>
282
		</p>
283
284
		<p>
285
			<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 ); ?> />
286
			<label for="<?php echo $this->get_field_id( 'new-tab' ); ?>"><?php esc_html_e( 'Open link in a new tab', 'jetpack' ); ?></label>
287
		</p>
288
289
	<?php
290
	}
291
292
	/**
293
	 * Generates template to add icons.
294
	 *
295
	 * @param array $args Template arguments
296
	 */
297
	static function render_icons_template( $args = array() ) {
298
		$defaults = array(
299
			'url-icon-id'   => '',
300
			'url-icon-name' => '',
301
			'url-value'     => '',
302
		);
303
304
		$args = wp_parse_args( $args, $defaults );
305
		?>
306
307
		<div class="jetpack-social-icons-widget-item">
308
			<div class="jetpack-social-icons-widget-item-wrapper">
309
				<div class="handle"></div>
310
311
				<p class="jetpack-widget-social-icons-url">
312
					<?php
313
						printf( '<input class="widefat id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
314
							esc_attr( $args['url-icon-id'] ),
315
							esc_attr( $args['url-icon-name'] ),
316
							esc_attr__( 'Account URL', 'jetpack' ),
317
							esc_url( $args['url-value'], array( 'http', 'https', 'mailto', 'skype' ) )
318
						);
319
					?>
320
				</p>
321
322
				<p class="jetpack-widget-social-icons-remove-item">
323
					<a class="jetpack-widget-social-icons-remove-item-button" href="javascript:;">
324
						<?php esc_html_e( 'Remove', 'jetpack' ); ?>
325
					</a>
326
				</p>
327
			</div>
328
		</div>
329
330
		<?php
331
	}
332
333
	/**
334
	 * Return SVG markup.
335
	 *
336
	 * @param array $args {
337
	 *     Parameters needed to display an SVG.
338
	 *
339
	 *     @type string $icon  Required SVG icon filename.
340
	 * }
341
	 * @return string SVG markup.
342
	 */
343
	public function get_svg_icon( $args = array() ) {
344
		// Make sure $args are an array.
345
		if ( empty( $args ) ) {
346
			return esc_html__( 'Please define default parameters in the form of an array.', 'jetpack' );
347
		}
348
349
		// Set defaults.
350
		$defaults = array(
351
			'icon' => '',
352
		);
353
354
		// Parse args.
355
		$args = wp_parse_args( $args, $defaults );
356
357
		// Define an icon.
358
		if ( false === array_key_exists( 'icon', $args ) ) {
359
			return esc_html__( 'Please define an SVG icon filename.', 'jetpack' );
360
		}
361
362
		// Set aria hidden.
363
		$aria_hidden = ' aria-hidden="true"';
364
365
		// Begin SVG markup.
366
		$svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="img">';
367
368
		/*
369
		 * Display the icon.
370
		 *
371
		 * The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
372
		 *
373
		 * See https://core.trac.wordpress.org/ticket/38387.
374
		 */
375
		$svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> ';
376
377
		$svg .= '</svg>';
378
379
		return $svg;
380
	}
381
382
	/**
383
	 * Returns an array of supported social links (URL, icon, and label).
384
	 *
385
	 * @return array $social_links_icons
386
	 */
387
	public function get_supported_icons() {
388
		$social_links_icons = array(
389
			array(
390
				'url'   => '500px.com',
391
				'icon'  => '500px',
392
				'label' => '500px',
393
			),
394
			array(
395
				'url'   => 'amazon.cn',
396
				'icon'  => 'amazon',
397
				'label' => 'Amazon',
398
			),
399
			array(
400
				'url'   => 'amazon.in',
401
				'icon'  => 'amazon',
402
				'label' => 'Amazon',
403
			),
404
			array(
405
				'url'   => 'amazon.fr',
406
				'icon'  => 'amazon',
407
				'label' => 'Amazon',
408
			),
409
			array(
410
				'url'   => 'amazon.de',
411
				'icon'  => 'amazon',
412
				'label' => 'Amazon',
413
			),
414
			array(
415
				'url'   => 'amazon.it',
416
				'icon'  => 'amazon',
417
				'label' => 'Amazon',
418
			),
419
			array(
420
				'url'   => 'amazon.nl',
421
				'icon'  => 'amazon',
422
				'label' => 'Amazon',
423
			),
424
			array(
425
				'url'   => 'amazon.es',
426
				'icon'  => 'amazon',
427
				'label' => 'Amazon',
428
			),
429
			array(
430
				'url'   => 'amazon.co',
431
				'icon'  => 'amazon',
432
				'label' => 'Amazon',
433
			),
434
			array(
435
				'url'   => 'amazon.ca',
436
				'icon'  => 'amazon',
437
				'label' => 'Amazon',
438
			),
439
			array(
440
				'url'   => 'amazon.com',
441
				'icon'  => 'amazon',
442
				'label' => 'Amazon',
443
			),
444
			array(
445
				'url'   => 'apple.com',
446
				'icon'  => 'apple',
447
				'label' => 'Apple',
448
			),
449
			array(
450
				'url'   => 'itunes.com',
451
				'icon'  => 'apple',
452
				'label' => 'iTunes',
453
			),
454
			array(
455
				'url'   => 'bandcamp.com',
456
				'icon'  => 'bandcamp',
457
				'label' => 'Bandcamp',
458
			),
459
			array(
460
				'url'   => 'behance.net',
461
				'icon'  => 'behance',
462
				'label' => 'Behance',
463
			),
464
			array(
465
				'url'   => 'codepen.io',
466
				'icon'  => 'codepen',
467
				'label' => 'CodePen',
468
			),
469
			array(
470
				'url'   => 'deviantart.com',
471
				'icon'  => 'deviantart',
472
				'label' => 'DeviantArt',
473
			),
474
			array(
475
				'url'   => 'digg.com',
476
				'icon'  => 'digg',
477
				'label' => 'Digg',
478
			),
479
			array(
480
				'url'   => 'dribbble.com',
481
				'icon'  => 'dribbble',
482
				'label' => 'Dribbble',
483
			),
484
			array(
485
				'url'   => 'dropbox.com',
486
				'icon'  => 'dropbox',
487
				'label' => 'Dropbox',
488
			),
489
			array(
490
				'url'   => 'etsy.com',
491
				'icon'  => 'etsy',
492
				'label' => 'Etsy',
493
			),
494
			array(
495
				'url'   => 'facebook.com',
496
				'icon'  => 'facebook',
497
				'label' => 'Facebook',
498
			),
499
			array(
500
				'url'   => '/feed/',
501
				'icon'  => 'feed',
502
				'label' => __( 'RSS Feed', 'jetpack' ),
503
			),
504
			array(
505
				'url'   => 'flickr.com',
506
				'icon'  => 'flickr',
507
				'label' => 'Flickr',
508
			),
509
			array(
510
				'url'   => 'foursquare.com',
511
				'icon'  => 'foursquare',
512
				'label' => 'Foursquare',
513
			),
514
			array(
515
				'url'   => 'goodreads.com',
516
				'icon'  => 'goodreads',
517
				'label' => 'Goodreads',
518
			),
519
			array(
520
				'url'   => 'google.com/+',
521
				'icon'  => 'google-plus',
522
				'label' => 'Google +',
523
			),
524
			array(
525
				'url'   => 'plus.google.com',
526
				'icon'  => 'google-plus',
527
				'label' => 'Google +',
528
			),
529
			array(
530
				'url'   => 'google.com',
531
				'icon'  => 'google',
532
				'label' => 'Google',
533
			),
534
			array(
535
				'url'   => 'github.com',
536
				'icon'  => 'github',
537
				'label' => 'GitHub',
538
			),
539
			array(
540
				'url'   => 'instagram.com',
541
				'icon'  => 'instagram',
542
				'label' => 'Instagram',
543
			),
544
			array(
545
				'url'   => 'linkedin.com',
546
				'icon'  => 'linkedin',
547
				'label' => 'LinkedIn',
548
			),
549
			array(
550
				'url'   => 'mailto:',
551
				'icon'  => 'mail',
552
				'label' => __( 'Email', 'jetpack' ),
553
			),
554
			array(
555
				'url'   => 'meetup.com',
556
				'icon'  => 'meetup',
557
				'label' => 'Meetup',
558
			),
559
			array(
560
				'url'   => 'medium.com',
561
				'icon'  => 'medium',
562
				'label' => 'Medium',
563
			),
564
			array(
565
				'url'   => 'pinterest.com',
566
				'icon'  => 'pinterest',
567
				'label' => 'Pinterest',
568
			),
569
			array(
570
				'url'   => 'getpocket.com',
571
				'icon'  => 'pocket',
572
				'label' => 'Pocket',
573
			),
574
			array(
575
				'url'   => 'reddit.com',
576
				'icon'  => 'reddit',
577
				'label' => 'Reddit',
578
			),
579
			array(
580
				'url'   => 'skype.com',
581
				'icon'  => 'skype',
582
				'label' => 'Skype',
583
			),
584
			array(
585
				'url'   => 'skype:',
586
				'icon'  => 'skype',
587
				'label' => 'Skype',
588
			),
589
			array(
590
				'url'   => 'slideshare.net',
591
				'icon'  => 'slideshare',
592
				'label' => 'SlideShare',
593
			),
594
			array(
595
				'url'   => 'snapchat.com',
596
				'icon'  => 'snapchat',
597
				'label' => 'Snapchat',
598
			),
599
			array(
600
				'url'   => 'soundcloud.com',
601
				'icon'  => 'soundcloud',
602
				'label' => 'SoundCloud',
603
			),
604
			array(
605
				'url'   => 'spotify.com',
606
				'icon'  => 'spotify',
607
				'label' => 'Spotify',
608
			),
609
			array(
610
				'url'   => 'stumbleupon.com',
611
				'icon'  => 'stumbleupon',
612
				'label' => 'StumbleUpon',
613
			),
614
			array(
615
				'url'   => 'tumblr.com',
616
				'icon'  => 'tumblr',
617
				'label' => 'Tumblr',
618
			),
619
			array(
620
				'url'   => 'twitch.tv',
621
				'icon'  => 'twitch',
622
				'label' => 'Twitch',
623
			),
624
			array(
625
				'url'   => 'twitter.com',
626
				'icon'  => 'twitter',
627
				'label' => 'Twitter',
628
			),
629
			array(
630
				'url'   => 'vimeo.com',
631
				'icon'  => 'vimeo',
632
				'label' => 'Vimeo',
633
			),
634
			array(
635
				'url'   => 'vk.com',
636
				'icon'  => 'vk',
637
				'label' => 'VK',
638
			),
639
			array(
640
				'url'   => 'wordpress.com',
641
				'icon'  => 'wordpress',
642
				'label' => 'WordPress.com',
643
			),
644
			array(
645
				'url'   => 'wordpress.org',
646
				'icon'  => 'wordpress',
647
				'label' => 'WordPress',
648
			),
649
			array(
650
				'url'   => 'yelp.com',
651
				'icon'  => 'yelp',
652
				'label' => 'Yelp',
653
			),
654
			array(
655
				'url'   => 'youtube.com',
656
				'icon'  => 'youtube',
657
				'label' => 'YouTube',
658
			),
659
		);
660
661
		return $social_links_icons;
662
	}
663
} // Jetpack_Widget_Social_Icons
664
665
/**
666
 * Register and load the widget.
667
 *
668
 * @access public
669
 * @return void
670
 */
671
function jetpack_widget_social_icons_load() {
672
	register_widget( 'Jetpack_Widget_Social_Icons' );
673
}
674
add_action( 'widgets_init', 'jetpack_widget_social_icons_load' );
675