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