AddToAny Share Buttons - Version 1.7.11

Version Description

  • Add icon size option to Follow buttons widget
  • Replace "Large" and "Small" icon size options with single field
  • Replace old universal buttons with custom button URLs
  • Update CSS to apply style to custom icon sizes
  • Always use HTTPS script and endpoints
Download this release

Release Info

Developer micropat
Plugin Icon 128x128 AddToAny Share Buttons
Version 1.7.11
Comparing to
See all releases

Code changes from version 1.7.10 to 1.7.11

README.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: micropat, addtoany
3
  Tags: AddToAny, share, sharing, social, share buttons, share button, social media, media, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed, icons
4
  Requires at least: 3.7
5
- Tested up to: 4.7
6
- Stable tag: 1.7.10
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
@@ -216,17 +216,17 @@ See the [supported follow services](https://www.addtoany.com/buttons/customize/f
216
  = How can I add a custom standalone share button? =
217
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
218
 
219
- `function addtoany_add_services( $services ) {
220
  $services['example_share_service'] = array(
221
  'name' => 'Example Share Service',
222
- 'icon_url' => 'https://www.google.com/favicon.ico',
223
  'icon_width' => 32,
224
  'icon_height' => 32,
225
- 'href' => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME',
226
  );
227
  return $services;
228
  }
229
- add_filter( 'A2A_SHARE_SAVE_services', 'addtoany_add_services', 10, 1 );`
230
 
231
  = How can I add a custom follow button? =
232
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
@@ -234,7 +234,7 @@ You can create a plugin or customize the following example PHP code to add to yo
234
  `function addtoany_add_follow_services( $services ) {
235
  $services['example_follow_service'] = array(
236
  'name' => 'Example Follow Service',
237
- 'icon_url' => 'https://www.google.com/favicon.ico',
238
  'icon_width' => 32,
239
  'icon_height' => 32,
240
  'href' => 'https://www.example.com/ID',
@@ -346,6 +346,13 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
346
 
347
  == Changelog ==
348
 
 
 
 
 
 
 
 
349
  = 1.7.10 =
350
  * Fix vertical floating bar's class name and media query from the previous release
351
 
2
  Contributors: micropat, addtoany
3
  Tags: AddToAny, share, sharing, social, share buttons, share button, social media, media, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed, icons
4
  Requires at least: 3.7
5
+ Tested up to: 4.8
6
+ Stable tag: 1.7.11
7
 
8
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
9
 
216
  = How can I add a custom standalone share button? =
217
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
218
 
219
+ `function addtoany_add_share_services( $services ) {
220
  $services['example_share_service'] = array(
221
  'name' => 'Example Share Service',
222
+ 'icon_url' => 'https://www.example.com/my-icon.svg',
223
  'icon_width' => 32,
224
  'icon_height' => 32,
225
+ 'href' => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME',
226
  );
227
  return $services;
228
  }
229
+ add_filter( 'A2A_SHARE_SAVE_services', 'addtoany_add_share_services', 10, 1 );`
230
 
231
  = How can I add a custom follow button? =
232
  You can create a plugin or customize the following example PHP code to add to your theme's functions.php file:
234
  `function addtoany_add_follow_services( $services ) {
235
  $services['example_follow_service'] = array(
236
  'name' => 'Example Follow Service',
237
+ 'icon_url' => 'https://www.example.com/my-icon.svg',
238
  'icon_width' => 32,
239
  'icon_height' => 32,
240
  'href' => 'https://www.example.com/ID',
346
 
347
  == Changelog ==
348
 
349
+ = 1.7.11 =
350
+ * Add icon size option to Follow buttons widget
351
+ * Replace "Large" and "Small" icon size options with single field
352
+ * Replace old universal buttons with custom button URLs
353
+ * Update CSS to apply style to custom icon sizes
354
+ * Always use HTTPS script and endpoints
355
+
356
  = 1.7.10 =
357
  * Fix vertical floating bar's class name and media query from the previous release
358
 
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AddToAny Share Buttons
4
  Plugin URI: https://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
6
- Version: 1.7.10
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -24,22 +24,32 @@ $A2A_SHARE_SAVE_plugin_url_path = is_ssl() ? str_replace( 'http:', 'https:', $A2
24
  // Set AddToAny locale (JavaScript)
25
  $A2A_locale = ! isset ( $A2A_locale ) ? '' : $A2A_locale;
26
  // Set plugin options
27
- $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' );
28
 
29
- include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.compat.php' );
30
- include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.services.php' );
31
 
32
  function A2A_SHARE_SAVE_init() {
33
- global $A2A_SHARE_SAVE_plugin_url_path,
34
  $A2A_SHARE_SAVE_plugin_basename,
35
  $A2A_SHARE_SAVE_options;
36
 
37
- if ( get_option( 'A2A_SHARE_SAVE_button' ) ) {
38
- A2A_SHARE_SAVE_migrate_options();
39
- $A2A_SHARE_SAVE_options = get_option( 'addtoany_options' );
40
- }
41
-
42
  load_plugin_textdomain( 'add-to-any', false, $A2A_SHARE_SAVE_plugin_basename . '/languages/' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
  add_filter( 'init', 'A2A_SHARE_SAVE_init' );
45
 
@@ -80,7 +90,7 @@ function A2A_SHARE_SAVE_link_vars( $linkname = false, $linkurl = false, $linkmed
80
 
81
  // Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON
82
  function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
83
- $options = get_option( 'addtoany_options' );
84
 
85
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
86
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
@@ -94,7 +104,6 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
94
  'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32',
95
  );
96
 
97
-
98
  $args = wp_parse_args( $args, $defaults );
99
  extract( $args );
100
 
@@ -120,7 +129,7 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
120
  $kit_additional_classes .= ' ' . $args['kit_additional_classes'];
121
  }
122
 
123
- // Set a2a_kit_size_## class name unless "icon_size" is set to '16'
124
  if ( $custom_icons ) {
125
  // If vertical style (.a2a_vertical_style)
126
  if ( strpos( $kit_additional_classes, 'a2a_vertical_style' ) !== false ) {
@@ -182,7 +191,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
182
  $A2A_FOLLOW_services,
183
  $A2A_SHARE_SAVE_amp_icons_css;
184
 
185
- $options = get_option( 'addtoany_options' );
186
 
187
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
188
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
@@ -211,7 +220,6 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
211
  $args = wp_parse_args( $args, $defaults );
212
  extract( $args );
213
 
214
- $https_or_http = is_ssl() ? 'https' : 'http';
215
  $is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
216
  $amp_css = '.a2a_dd img{background-color:#0166FF;}';
217
 
@@ -227,9 +235,9 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
227
  $icons_height = ( isset( $options['custom_icons_height'] ) ) ? $options['custom_icons_height'] : '';
228
  $custom_icons = true;
229
  } else {
230
- // Packaged 16px icons
231
  $icons_dir = $A2A_SHARE_SAVE_plugin_url_path . '/icons/';
232
- $icons_type = 'png';
233
  }
234
 
235
  // If Follow kit
@@ -328,7 +336,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
328
 
329
  $amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . $safe_name . ' img{background-color:#' . $service['color'] . ';}' : '';
330
 
331
- $url = ( isset( $href ) ) ? $href : $https_or_http . '://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&linkname=' . $linkname_enc;
332
  $src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
333
  $counter = ( $counter_enabled ) ? ' a2a_counter' : '';
334
  $class_attr = ( $custom_service ) ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
@@ -373,7 +381,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
373
 
374
  global $A2A_SHARE_SAVE_plugin_url_path;
375
 
376
- $options = get_option( 'addtoany_options' );
377
 
378
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
379
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
@@ -398,7 +406,6 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
398
  'html_content' => '',
399
  'button_additional_classes' => '',
400
  'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32',
401
- 'no_small_icons' => false,
402
  'no_universal_button' => false,
403
  );
404
 
@@ -416,67 +423,46 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
416
 
417
  // If universal button is enabled
418
  if ( ! $args['no_universal_button'] ) {
419
-
420
- if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button']
421
- // Or, no_small_icons is true and a custom universal icon is not enabled (permitting a custom universal button in floating bar)
422
- || isset( $no_small_icons ) && true == $no_small_icons && ( ! isset( $options['button'] ) || 'CUSTOM' != $options['button'] )
423
- ) {
424
- // If AMP (Accelerated Mobile Page)
425
- if ( $is_amp ) {
426
- $button_src = 'https://static.addtoany.com/buttons/a2a.svg';
427
- $button_width = ! empty( $icon_size ) ? ' width="' . $icon_size .'"' : ' width="32"';
428
- $button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"' : ' height="32"';
429
- } else {
430
- // Skip button IMG for A2A icon insertion
431
- $button_text = '';
432
- }
433
- } else if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) {
434
  $button_src = $options['button_custom'];
435
  $button_width = '';
436
  $button_height = '';
437
  } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) {
 
438
  $button_text = stripslashes( $options[ 'button_text'] );
439
- // Do not display universal icon (when large icons are used)
440
  $button_class .= ' addtoany_no_icon';
441
  } else {
442
- $button_attrs = explode( '|', $options['button'] );
443
- $button_fname = $button_attrs[0];
444
- $button_width = ' width="' . $button_attrs[1] . '"';
445
- $button_height = ' height="' . $button_attrs[2] . '"';
446
- $button_src = $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname;
447
- $button_text = ( isset( $options['button_text'] ) ) ? stripslashes( $options['button_text'] ) : 'Share' ;
448
- }
449
-
450
- // Add additional classNames to .a2a_dd
451
- $button_additional_classes = ! empty( $args['button_additional_classes'] ) ? ' ' . $args['button_additional_classes'] : '';
452
-
453
- $style = '';
454
-
455
- if ( isset( $button_fname ) && ( $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) ) {
456
- if ( ! $is_feed ) {
457
- $style_bg = 'background:url(' . $A2A_SHARE_SAVE_plugin_url_path . '/' . $button_fname . ') no-repeat scroll 4px 0px;';
458
- $style = ' style="' . $style_bg . 'padding:0 0 0 25px;display:inline-block;height:16px;vertical-align:middle"'; // padding-left:21+4 (4=other icons padding)
459
-
460
- // Wrap in <span> to avoid showing the core-AddToAny Kit icon in addition to plugin's icon
461
- $button_text = ( isset( $button_text ) ) ? '<span>' . $button_text . '</span>' : '<span></span>';
462
  }
463
  }
464
 
465
  if ( ! empty( $html_content ) ) {
466
  $button = $html_content;
467
- } elseif ( isset( $button_text ) && ( ! isset( $button_fname) || ! $button_fname || $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) ) {
468
  $button = $button_text;
 
 
469
  } else {
470
- $style = '';
471
- $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share"/>';
472
  }
473
 
 
 
 
474
  if ( isset( $options['button_show_count'] ) && $options['button_show_count'] == '1' ) {
475
  $button_class .= ' a2a_counter';
476
  }
477
 
478
  $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . $button_additional_classes . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"'
479
- . $button_data_url . $button_data_title . $button_data_media . $style . $button_target
480
  . '>' . $button . '</a>';
481
 
482
  } else {
@@ -500,7 +486,7 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
500
  return;
501
  }
502
 
503
- $options = get_option( 'addtoany_options' );
504
 
505
  $linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : false;
506
  $linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] : false;
@@ -582,6 +568,8 @@ if ( ! function_exists( 'A2A_menu_locale' ) ) {
582
  }
583
 
584
  function ADDTOANY_FOLLOW_KIT( $args = array() ) {
 
 
585
  // Args are passed on to ADDTOANY_SHARE_SAVE_KIT
586
  $defaults = array(
587
  'buttons' => array(),
@@ -595,9 +583,9 @@ function ADDTOANY_FOLLOW_KIT( $args = array() ) {
595
  'is_kit' => true,
596
  'no_special_services' => true,
597
  'no_universal_button' => true,
598
- //'no_small_icons' => true,
599
  'kit_additional_classes' => '',
600
  'kit_style' => '',
 
601
  'services' => array(),
602
  );
603
 
@@ -622,7 +610,7 @@ function ADDTOANY_FOLLOW_KIT( $args = array() ) {
622
  }
623
 
624
  function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
625
- $options = get_option( 'addtoany_options' );
626
 
627
  $floating_html = '';
628
 
@@ -654,7 +642,6 @@ function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
654
  'is_kit' => true,
655
  'no_addtoany_list_classname' => true,
656
  'no_special_services' => true,
657
- 'no_small_icons' => true,
658
  'kit_additional_classes' => '',
659
  'kit_style' => '',
660
  );
@@ -738,14 +725,12 @@ function A2A_SHARE_SAVE_head_script() {
738
  if ( is_admin() || is_feed() || $script_disabled )
739
  return;
740
 
741
- $options = get_option( 'addtoany_options' );
742
-
743
- $https_or_http = is_ssl() ? 'https' : 'http';
744
 
745
  // Use local cache?
746
  $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false;
747
  $upload_dir = wp_upload_dir();
748
- $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : $https_or_http . '://static.addtoany.com/menu';
749
 
750
  // Enternal script call + initial JS + set-once variables
751
  $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
@@ -806,7 +791,7 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
806
  }
807
 
808
  $is_feed = is_feed();
809
- $options = get_option( 'addtoany_options' );
810
  $post_type = get_post_type( get_the_ID() );
811
 
812
  if (
@@ -930,7 +915,7 @@ function A2A_SHARE_SAVE_stylesheet() {
930
  // Use stylesheet?
931
  if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' && ! is_admin() ) {
932
 
933
- wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.13' );
934
 
935
  // wp_add_inline_style requires WP 3.3+
936
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
@@ -1068,7 +1053,7 @@ function A2A_SHARE_SAVE_unschedule_cache() {
1068
  */
1069
 
1070
  if ( is_admin() ) {
1071
- include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.admin.php' );
1072
  }
1073
 
1074
  function A2A_SHARE_SAVE_add_menu_link() {
@@ -1089,7 +1074,7 @@ add_filter( 'admin_menu', 'A2A_SHARE_SAVE_add_menu_link' );
1089
  function A2A_SHARE_SAVE_widgets_init() {
1090
  global $A2A_SHARE_SAVE_plugin_dir;
1091
 
1092
- include_once( $A2A_SHARE_SAVE_plugin_dir . '/addtoany.widgets.php' );
1093
  register_widget( 'A2A_SHARE_SAVE_Widget' );
1094
  register_widget( 'A2A_Follow_Widget' );
1095
  }
3
  Plugin Name: AddToAny Share Buttons
4
  Plugin URI: https://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
6
+ Version: 1.7.11
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
24
  // Set AddToAny locale (JavaScript)
25
  $A2A_locale = ! isset ( $A2A_locale ) ? '' : $A2A_locale;
26
  // Set plugin options
27
+ $A2A_SHARE_SAVE_options = get_option( 'addtoany_options', array() );
28
 
29
+ include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.compat.php';
30
+ include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.services.php';
31
 
32
  function A2A_SHARE_SAVE_init() {
33
+ global $A2A_SHARE_SAVE_plugin_dir,
34
  $A2A_SHARE_SAVE_plugin_basename,
35
  $A2A_SHARE_SAVE_options;
36
 
37
+ // Load the textdomain for translations
 
 
 
 
38
  load_plugin_textdomain( 'add-to-any', false, $A2A_SHARE_SAVE_plugin_basename . '/languages/' );
39
+
40
+ // Update plugin options
41
+ $options = $A2A_SHARE_SAVE_options;
42
+ $old_buttons = array(
43
+ 'share_save_256_24.gif|256|24', 'share_save_171_16.gif|171|16', 'share_save_120_16.gif|120|16',
44
+ 'share_save_256_24.png|256|24', 'share_save_171_16.png|171|16', 'share_save_120_16.png|120|16',
45
+ 'share_16_16.png|16|16', 'favicon.png|16|16',
46
+ );
47
+
48
+ // If old button enabled
49
+ if ( ! empty( $options['button'] ) && in_array( $options['button'], $old_buttons ) ) {
50
+ include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.update.php';
51
+ addtoany_update_options();
52
+ }
53
  }
54
  add_filter( 'init', 'A2A_SHARE_SAVE_init' );
55
 
90
 
91
  // Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON
92
  function ADDTOANY_SHARE_SAVE_KIT( $args = array() ) {
93
+ $options = get_option( 'addtoany_options', array() );
94
 
95
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
96
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
104
  'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32',
105
  );
106
 
 
107
  $args = wp_parse_args( $args, $defaults );
108
  extract( $args );
109
 
129
  $kit_additional_classes .= ' ' . $args['kit_additional_classes'];
130
  }
131
 
132
+ // Set a2a_kit_size_## class name
133
  if ( $custom_icons ) {
134
  // If vertical style (.a2a_vertical_style)
135
  if ( strpos( $kit_additional_classes, 'a2a_vertical_style' ) !== false ) {
191
  $A2A_FOLLOW_services,
192
  $A2A_SHARE_SAVE_amp_icons_css;
193
 
194
+ $options = get_option( 'addtoany_options', array() );
195
 
196
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
197
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
220
  $args = wp_parse_args( $args, $defaults );
221
  extract( $args );
222
 
 
223
  $is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
224
  $amp_css = '.a2a_dd img{background-color:#0166FF;}';
225
 
235
  $icons_height = ( isset( $options['custom_icons_height'] ) ) ? $options['custom_icons_height'] : '';
236
  $custom_icons = true;
237
  } else {
238
+ // Default to local SVGs (not an option currently)
239
  $icons_dir = $A2A_SHARE_SAVE_plugin_url_path . '/icons/';
240
+ $icons_type = 'svg';
241
  }
242
 
243
  // If Follow kit
336
 
337
  $amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . $safe_name . ' img{background-color:#' . $service['color'] . ';}' : '';
338
 
339
+ $url = ( isset( $href ) ) ? $href : 'https://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&amp;linkname=' . $linkname_enc;
340
  $src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
341
  $counter = ( $counter_enabled ) ? ' a2a_counter' : '';
342
  $class_attr = ( $custom_service ) ? '' : ' class="a2a_button_' . $safe_name . $counter . '"';
381
 
382
  global $A2A_SHARE_SAVE_plugin_url_path;
383
 
384
+ $options = get_option( 'addtoany_options', array() );
385
 
386
  $linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
387
  $linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
406
  'html_content' => '',
407
  'button_additional_classes' => '',
408
  'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32',
 
409
  'no_universal_button' => false,
410
  );
411
 
423
 
424
  // If universal button is enabled
425
  if ( ! $args['no_universal_button'] ) {
426
+
427
+ if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) {
428
+ // Custom button
 
 
 
 
 
 
 
 
 
 
 
 
429
  $button_src = $options['button_custom'];
430
  $button_width = '';
431
  $button_height = '';
432
  } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) {
433
+ // Text-only button
434
  $button_text = stripslashes( $options[ 'button_text'] );
435
+ // Do not display universal icon
436
  $button_class .= ' addtoany_no_icon';
437
  } else {
438
+ // Default AddToAny button
439
+ if ( $is_amp ) {
440
+ // AMP (Accelerated Mobile Page)
441
+ $button_src = 'https://static.addtoany.com/buttons/a2a.svg';
442
+ $button_width = ! empty( $icon_size ) ? ' width="' . $icon_size .'"' : ' width="32"';
443
+ $button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"' : ' height="32"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  }
445
  }
446
 
447
  if ( ! empty( $html_content ) ) {
448
  $button = $html_content;
449
+ } elseif ( ! empty( $button_text ) ) {
450
  $button = $button_text;
451
+ } elseif ( ! empty( $button_src ) ) {
452
+ $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share">';
453
  } else {
454
+ $button = '';
 
455
  }
456
 
457
+ // Add additional classNames to .a2a_dd
458
+ $button_additional_classes = ! empty( $args['button_additional_classes'] ) ? ' ' . $args['button_additional_classes'] : '';
459
+
460
  if ( isset( $options['button_show_count'] ) && $options['button_show_count'] == '1' ) {
461
  $button_class .= ' a2a_counter';
462
  }
463
 
464
  $button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . $button_additional_classes . ' addtoany_share_save" href="https://www.addtoany.com/share' .$button_href_querystring . '"'
465
+ . $button_data_url . $button_data_title . $button_data_media . $button_target
466
  . '>' . $button . '</a>';
467
 
468
  } else {
486
  return;
487
  }
488
 
489
+ $options = get_option( 'addtoany_options', array() );
490
 
491
  $linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : false;
492
  $linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] : false;
568
  }
569
 
570
  function ADDTOANY_FOLLOW_KIT( $args = array() ) {
571
+ $options = get_option( 'addtoany_options', array() );
572
+
573
  // Args are passed on to ADDTOANY_SHARE_SAVE_KIT
574
  $defaults = array(
575
  'buttons' => array(),
583
  'is_kit' => true,
584
  'no_special_services' => true,
585
  'no_universal_button' => true,
 
586
  'kit_additional_classes' => '',
587
  'kit_style' => '',
588
+ 'icon_size' => isset( $options['icon_size'] ) ? $options['icon_size'] : '32',
589
  'services' => array(),
590
  );
591
 
610
  }
611
 
612
  function ADDTOANY_SHARE_SAVE_FLOATING( $args = array() ) {
613
+ $options = get_option( 'addtoany_options', array() );
614
 
615
  $floating_html = '';
616
 
642
  'is_kit' => true,
643
  'no_addtoany_list_classname' => true,
644
  'no_special_services' => true,
 
645
  'kit_additional_classes' => '',
646
  'kit_style' => '',
647
  );
725
  if ( is_admin() || is_feed() || $script_disabled )
726
  return;
727
 
728
+ $options = get_option( 'addtoany_options', array() );
 
 
729
 
730
  // Use local cache?
731
  $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false;
732
  $upload_dir = wp_upload_dir();
733
+ $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu';
734
 
735
  // Enternal script call + initial JS + set-once variables
736
  $additional_js = ( isset( $options['additional_js_variables'] ) ) ? $options['additional_js_variables'] : '' ;
791
  }
792
 
793
  $is_feed = is_feed();
794
+ $options = get_option( 'addtoany_options', array() );
795
  $post_type = get_post_type( get_the_ID() );
796
 
797
  if (
915
  // Use stylesheet?
916
  if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' && ! is_admin() ) {
917
 
918
+ wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.14' );
919
 
920
  // wp_add_inline_style requires WP 3.3+
921
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
1053
  */
1054
 
1055
  if ( is_admin() ) {
1056
+ include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.admin.php';
1057
  }
1058
 
1059
  function A2A_SHARE_SAVE_add_menu_link() {
1074
  function A2A_SHARE_SAVE_widgets_init() {
1075
  global $A2A_SHARE_SAVE_plugin_dir;
1076
 
1077
+ include_once $A2A_SHARE_SAVE_plugin_dir . '/addtoany.widgets.php';
1078
  register_widget( 'A2A_SHARE_SAVE_Widget' );
1079
  register_widget( 'A2A_Follow_Widget' );
1080
  }
addtoany.admin.php CHANGED
@@ -6,7 +6,7 @@
6
  function A2A_SHARE_SAVE_add_meta_box() {
7
  $post_types = get_post_types( array( 'public' => true ) );
8
 
9
- $options = get_option( 'addtoany_options' );
10
 
11
  $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) );
12
  foreach( $post_types as $post_type ) {
@@ -70,59 +70,6 @@ add_action( 'admin_init', 'A2A_SHARE_SAVE_add_meta_box' );
70
  add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' );
71
  add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' );
72
 
73
- /**
74
- * Migrate old AddToAny options
75
- */
76
- function A2A_SHARE_SAVE_migrate_options() {
77
-
78
- $options = array(
79
- 'inline_css' => '1', // Modernly used for "Use CSS Stylesheet?"
80
- 'cache' => '-1',
81
- 'display_in_posts_on_front_page' => '1',
82
- 'display_in_posts_on_archive_pages' => '1',
83
- 'display_in_posts' => '1',
84
- 'display_in_pages' => '1',
85
- 'display_in_feed' => '1',
86
- 'onclick' => '-1',
87
- 'button' => 'A2A_SVG_32',
88
- 'button_custom' => '',
89
- 'additional_js_variables' => '',
90
- 'button_text' => 'Share',
91
- 'display_in_excerpts' => '1',
92
- 'active_services' => Array(),
93
- );
94
-
95
- $namespace = 'A2A_SHARE_SAVE_';
96
-
97
- foreach ( $options as $option_name => $option_value ) {
98
- $old_option_name = $namespace . $option_name;
99
- $old_option_value = get_option( $old_option_name );
100
-
101
- if( $old_option_value === false ) {
102
- // Default value
103
- $options[ $option_name ] = $option_value;
104
- } else {
105
- // Old value
106
- $options[ $option_name ] = $old_option_value;
107
- }
108
-
109
- delete_option( $old_option_name );
110
- }
111
-
112
- update_option( 'addtoany_options', $options );
113
-
114
- $deprecated_options = array(
115
- 'button_opens_new_window',
116
- 'hide_embeds',
117
- 'show_title',
118
- );
119
-
120
- foreach ( $deprecated_options as $option_name ) {
121
- delete_option( $namespace . $option_name );
122
- }
123
-
124
- }
125
-
126
  /**
127
  * Adds a WordPress pointer to Settings menu, so user knows where to configure AddToAny
128
  */
@@ -285,7 +232,7 @@ function A2A_SHARE_SAVE_options_page() {
285
  $new_options['display_in_attachments'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_attachments'] ) && $_POST['A2A_SHARE_SAVE_display_in_attachments'] == '1' ) ? '1' : '-1';
286
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
287
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
288
- $new_options['icon_size'] = ( isset( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '';
289
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
290
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
291
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
@@ -315,13 +262,8 @@ function A2A_SHARE_SAVE_options_page() {
315
  A2A_SHARE_SAVE_unschedule_cache();
316
  }
317
 
318
- // Store desired text if 16 x 16px buttons or text-only is chosen:
319
- if ( $new_options['button'] == 'favicon.png|16|16' )
320
- $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text'];
321
- elseif ( $new_options['button'] == 'share_16_16.png|16|16' )
322
- $new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_share_16_16_text'];
323
- else
324
- $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any');
325
 
326
  // Store chosen individual services to make active
327
  $active_services = array();
@@ -361,7 +303,7 @@ function A2A_SHARE_SAVE_options_page() {
361
  }
362
 
363
  // Get all existing AddToAny options
364
- $existing_options = get_option( 'addtoany_options' );
365
 
366
  // Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs
367
  if ( $existing_options ) {
@@ -381,7 +323,7 @@ function A2A_SHARE_SAVE_options_page() {
381
  delete_option( 'addtoany_options' );
382
  }
383
 
384
- $options = get_option( 'addtoany_options' );
385
 
386
  function position_in_content( $options, $option_box = false ) {
387
 
@@ -444,13 +386,7 @@ function A2A_SHARE_SAVE_options_page() {
444
  <tr valign="top">
445
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
446
  <td><fieldset>
447
- <label title="32px"><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="32"<?php if ( ! isset( $options['icon_size'] ) || '32' == $options['icon_size'] ) echo ' checked="checked"'; ?>> <?php _e('Large', 'add-to-any'); ?></label>
448
- <br>
449
- <label title="16px"><input type="radio" name="A2A_SHARE_SAVE_icon_size" value="16"<?php if ( isset( $options['icon_size'] ) && '16' == $options['icon_size'] ) echo ' checked="checked"'; ?>> <?php _e('Small', 'add-to-any'); ?></label>
450
- <br>
451
- <label><input type="radio" name="A2A_SHARE_SAVE_icon_size"<?php if ( isset( $options['icon_size'] ) && ! in_array( $options['icon_size'], array( '32', '16' ) ) ) echo ' value="' . $options['icon_size'] . '" checked="checked"'; ?>> <?php _e('Custom', 'add-to-any'); ?></label>
452
- <input class="addtoany_icon_size_custom small-text" id="A2A_SHARE_SAVE_icon_size_custom" maxlength="3" type="text" onclick="document.getElementsByName('A2A_SHARE_SAVE_icon_size')[2].checked=true" value="<?php if ( isset( $options['icon_size'] ) && ! in_array( $options['icon_size'], array( '32', '16' ) ) ) echo $options['icon_size']; ?>">
453
- <label class="addtoany_icon_size_custom" for="A2A_SHARE_SAVE_icon_size_custom">pixels</label>
454
  </fieldset></td>
455
  </tr>
456
 
@@ -511,35 +447,6 @@ function A2A_SHARE_SAVE_options_page() {
511
  <br>
512
  </div>
513
 
514
- <div class="addtoany_icon_size_small">
515
- <label>
516
- <input name="A2A_SHARE_SAVE_button" value="favicon.png|16|16" id="A2A_SHARE_SAVE_button_is_favicon_16" type="radio"<?php if ( isset( $options['button'] ) && 'favicon.png|16|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
517
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/favicon.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
518
- </label>
519
- <input name="A2A_SHARE_SAVE_button_favicon_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_favicon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && '' != trim( $options['button_text'] ) ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
520
- <label style="padding-left:9px">
521
- <input name="A2A_SHARE_SAVE_button" value="share_16_16.png|16|16" id="A2A_SHARE_SAVE_button_is_share_icon_16" type="radio"<?php if ( isset( $options['button'] ) && 'share_16_16.png|16|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
522
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_16_16.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share','add-to-any'); ?>" title="+ <?php _e('Share','add-to-any'); ?>" onclick="this.parentNode.firstChild.checked=true"/>
523
- </label>
524
- <input name="A2A_SHARE_SAVE_button_share_16_16_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_share_icon_16').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && '' != trim( $options['button_text'] ) ) ? stripslashes($options['button_text']) : __('Share','add-to-any'); ?>" />
525
- <br>
526
- <label>
527
- <input name="A2A_SHARE_SAVE_button" value="share_save_120_16.png|120|16" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_120_16.png|120|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
528
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_120_16.png'; ?>" width="120" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
529
- </label>
530
- <br>
531
- <label>
532
- <input name="A2A_SHARE_SAVE_button" value="share_save_171_16.png|171|16" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_171_16.png|171|16' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
533
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_171_16.png'; ?>" width="171" height="16" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
534
- </label>
535
- <br>
536
- <label>
537
- <input name="A2A_SHARE_SAVE_button" value="share_save_256_24.png|256|24" type="radio"<?php if ( isset( $options['button'] ) && 'share_save_256_24.png|256|24' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
538
- <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_256_24.png'; ?>" width="256" height="24" border="0" style="padding:9px;vertical-align:middle" onclick="this.parentNode.firstChild.checked=true"/>
539
- </label>
540
- <br>
541
- </div>
542
-
543
  <label>
544
  <input name="A2A_SHARE_SAVE_button" value="CUSTOM" id="A2A_SHARE_SAVE_button_is_custom" type="radio"<?php if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
545
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
@@ -704,9 +611,9 @@ function A2A_SHARE_SAVE_options_page() {
704
  <label for="A2A_SHARE_SAVE_custom_icons_type"><?php _e('Filename extension', 'add-to-any'); ?></label>
705
  <input name="A2A_SHARE_SAVE_custom_icons_type" type="text" class="code" size="5" maxlength="4" placeholder="png" value="<?php if ( isset( $options['custom_icons_type'] ) ) echo $options['custom_icons_type']; else echo 'png'; ?>" />
706
  <label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width'); ?></label>
707
- <input name="A2A_SHARE_SAVE_custom_icons_width" type="number" step="1" min="0" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) echo $options['custom_icons_width']; ?>" class="small-text" />
708
  <label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height'); ?></label>
709
- <input name="A2A_SHARE_SAVE_custom_icons_height" type="number" step="1" min="0" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) echo $options['custom_icons_height']; ?>" class="small-text" />
710
  <p class="description">
711
  <?php _e("Specify the URL of the directory containing your custom icons. For example, a URL of <code>//example.com/blog/uploads/addtoany/icons/custom/</code> containing <code>facebook.png</code> and <code>twitter.png</code>. Be sure that custom icon filenames match the icon filenames in <code>plugins/add-to-any/icons</code>. For AddToAny's Universal Button, select Image URL and specify the URL of your AddToAny universal share icon (<a href=\"#\" onclick=\"document.getElementsByName('A2A_SHARE_SAVE_button_custom')[0].focus();return false\">above</a>).", 'add-to-any'); ?>
712
  </p>
@@ -755,26 +662,26 @@ function A2A_SHARE_SAVE_options_page() {
755
  <label>
756
  <input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php
757
  if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
758
- Only display when screen is larger than <input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_responsive_max_width'] ) ) echo $options['floating_vertical_responsive_max_width']; else echo '980'; ?>" class="small-text" /> pixels wide
759
  </label>
760
  </fieldset></td>
761
  </tr>
762
  <tr valign="top">
763
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
764
  <td><fieldset>
765
- <label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_position'] ) ) echo $options['floating_vertical_position']; else echo '100'; ?>" class="small-text" /> pixels from top</label>
766
  </fieldset></td>
767
  </tr>
768
  <tr valign="top">
769
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
770
  <td><fieldset>
771
- <label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_offset'] ) ) echo $options['floating_vertical_offset']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
772
  </fieldset></td>
773
  </tr>
774
  <tr valign="top">
775
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
776
  <td><fieldset>
777
- <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" maxlength="3" type="number" step="1" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
778
  </fieldset></td>
779
  </tr>
780
  </table>
@@ -797,26 +704,26 @@ function A2A_SHARE_SAVE_options_page() {
797
  <label>
798
  <input id="A2A_SHARE_SAVE_floating_horizontal_responsive" name="A2A_SHARE_SAVE_floating_horizontal_responsive" type="checkbox"<?php
799
  if ( ! isset( $options['floating_horizontal_responsive'] ) || $options['floating_horizontal_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
800
- Only display when screen is smaller than <input name="A2A_SHARE_SAVE_floating_horizontal_responsive_min_width" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_responsive_min_width'] ) ) echo $options['floating_horizontal_responsive_min_width']; else echo '981'; ?>" class="small-text" /> pixels wide
801
  </label>
802
  </fieldset></td>
803
  </tr>
804
  <tr valign="top">
805
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
806
  <td><fieldset>
807
- <label><input name="A2A_SHARE_SAVE_floating_horizontal_position" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_position'] ) ) echo $options['floating_horizontal_position']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
808
  </fieldset></td>
809
  </tr>
810
  <tr valign="top">
811
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
812
  <td><fieldset>
813
- <label><input name="A2A_SHARE_SAVE_floating_horizontal_offset" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_offset'] ) ) echo $options['floating_horizontal_offset']; else echo '0'; ?>" class="small-text" /> pixels from bottom</label>
814
  </fieldset></td>
815
  </tr>
816
  <tr valign="top">
817
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
818
  <td><fieldset>
819
- <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" maxlength="3" type="number" step="1" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
820
  </fieldset></td>
821
  </tr>
822
  </table>
@@ -855,58 +762,12 @@ function A2A_SHARE_SAVE_options_page() {
855
  function A2A_SHARE_SAVE_admin_head() {
856
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'addtoany' ) {
857
 
858
- $options = get_option( 'addtoany_options' );
859
 
860
  ?>
861
  <script type="text/javascript"><!--
862
  jQuery(document).ready(function(){
863
 
864
- var show_appropriate_universal_buttons = function() {
865
-
866
- // Note the currently checkmarked radio button
867
- jQuery('input[name="A2A_SHARE_SAVE_button"]:visible').removeClass('addtoany_last_universal_selected').filter(':checked').addClass('addtoany_last_universal_selected');
868
-
869
- var select_proper_radio = function() {
870
- // Select the last-selected visible radio
871
- jQuery('input[name="A2A_SHARE_SAVE_button"].addtoany_last_universal_selected:radio:visible').attr('checked', true);
872
-
873
- // Otherwise select the first visible radio
874
- if ( jQuery('input[name="A2A_SHARE_SAVE_button"]:visible:checked').length < 1 )
875
- jQuery('input[name="A2A_SHARE_SAVE_button"]:radio:visible:first').attr('checked', true);
876
- };
877
-
878
- var icon_size_value = jQuery('input[name="A2A_SHARE_SAVE_icon_size"]:checked').val();
879
-
880
- if ( '16' == icon_size_value ) {
881
- // Hide large universal buttons
882
- jQuery('.addtoany_icon_size_large').hide('fast');
883
- // Show small universal button
884
- jQuery('.addtoany_icon_size_small').show('fast', select_proper_radio);
885
- }
886
- else {
887
- // Hide small universal buttons
888
- jQuery('.addtoany_icon_size_small').hide('fast');
889
- // Show large universal button
890
- jQuery('.addtoany_icon_size_large').show('fast', select_proper_radio);
891
- }
892
-
893
- if ( 0 < icon_size_value.length && 16 != icon_size_value && 32 != icon_size_value ) {
894
- jQuery('.addtoany_icon_size_custom').show('fast');
895
- }
896
- };
897
-
898
- show_appropriate_universal_buttons();
899
-
900
- // Display buttons/icons of the selected icon size
901
- jQuery('input[name="A2A_SHARE_SAVE_icon_size"]').bind('change', function(e){
902
- show_appropriate_universal_buttons();
903
- });
904
-
905
- // Set value on radio from custom text input
906
- jQuery('#A2A_SHARE_SAVE_icon_size_custom').bind('change', function(e){
907
- jQuery('input[name="A2A_SHARE_SAVE_icon_size"]').eq(2).val( jQuery('#A2A_SHARE_SAVE_icon_size_custom').val() );
908
- });
909
-
910
  // Toggle child options of 'Display in posts'
911
  jQuery('#A2A_SHARE_SAVE_display_in_posts').bind('change click', function(e){
912
  if (jQuery(this).is(':checked'))
@@ -1002,20 +863,14 @@ function A2A_SHARE_SAVE_admin_head() {
1002
  }
1003
  }
1004
 
1005
- var icon_size = jQuery('input:radio[name=A2A_SHARE_SAVE_icon_size]:checked').val();
1006
- icon_size = ('16' == icon_size) ? '16' : '32';
1007
-
1008
  var new_service = this_service.toggleClass('addtoany_selected')
1009
  .unbind('click', moveToSortableList)
1010
  .bind('click', moveToSelectableList)
1011
  .clone();
1012
 
1013
- new_service.data('a2a_16_icon_html', this_service.find('img').clone().attr('alt', this_service.attr('title')).wrap('<p>').parent().html() + configurable_html);
1014
-
1015
- // Set the same HTML as used for '16px icon size'
1016
- new_service.data( 'a2a_32_icon_html', new_service.data('a2a_16_icon_html') );
1017
 
1018
- new_service.html( new_service.data('a2a_' + icon_size + '_icon_html') )
1019
  .click(function(){
1020
  jQuery(this).not('.addtoany_special_service_options_selected').find('.special_options').slideDown('fast').parent().addClass('addtoany_special_service_options_selected');
1021
  })
@@ -1152,10 +1007,6 @@ function A2A_SHARE_SAVE_admin_head() {
1152
  .addtoany_admin_list{list-style:none;padding:0;margin:0;}
1153
  .addtoany_admin_list li{border-radius:6px;}
1154
 
1155
- .addtoany_icon_size_custom,
1156
- /* Override WP display */
1157
- .form-table td fieldset label.addtoany_icon_size_custom{display:none;}
1158
-
1159
  #addtoany_services_selectable{clear:left;display:none;}
1160
  #addtoany_services_selectable li{cursor:pointer;float:left;width:150px;font-size:12px;line-height:24px;margin:0;padding:6px;border:1px solid transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
1161
  #addtoany_services_selectable li:hover, #addtoany_services_selectable li.addtoany_selected{border:1px solid #CCC;background-color:#FFF;}
6
  function A2A_SHARE_SAVE_add_meta_box() {
7
  $post_types = get_post_types( array( 'public' => true ) );
8
 
9
+ $options = get_option( 'addtoany_options', array() );
10
 
11
  $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) );
12
  foreach( $post_types as $post_type ) {
70
  add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' );
71
  add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' );
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Adds a WordPress pointer to Settings menu, so user knows where to configure AddToAny
75
  */
232
  $new_options['display_in_attachments'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_attachments'] ) && $_POST['A2A_SHARE_SAVE_display_in_attachments'] == '1' ) ? '1' : '-1';
233
  $new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
234
  $new_options['onclick'] = ( isset( $_POST['A2A_SHARE_SAVE_onclick'] ) && $_POST['A2A_SHARE_SAVE_onclick'] == '1' ) ? '1' : '-1';
235
+ $new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
236
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
237
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
238
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
262
  A2A_SHARE_SAVE_unschedule_cache();
263
  }
264
 
265
+ // Store desired text for text-only:
266
+ $new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share','add-to-any');
 
 
 
 
 
267
 
268
  // Store chosen individual services to make active
269
  $active_services = array();
303
  }
304
 
305
  // Get all existing AddToAny options
306
+ $existing_options = get_option( 'addtoany_options', array() );
307
 
308
  // Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs
309
  if ( $existing_options ) {
323
  delete_option( 'addtoany_options' );
324
  }
325
 
326
+ $options = get_option( 'addtoany_options', array() );
327
 
328
  function position_in_content( $options, $option_box = false ) {
329
 
386
  <tr valign="top">
387
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
388
  <td><fieldset>
389
+ <label><input class="small-text" name="A2A_SHARE_SAVE_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo ! empty( $options['icon_size'] ) ? $options['icon_size'] : '32'; ?>"> pixels</label>
 
 
 
 
 
 
390
  </fieldset></td>
391
  </tr>
392
 
447
  <br>
448
  </div>
449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  <label>
451
  <input name="A2A_SHARE_SAVE_button" value="CUSTOM" id="A2A_SHARE_SAVE_button_is_custom" type="radio"<?php if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
452
  <span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
611
  <label for="A2A_SHARE_SAVE_custom_icons_type"><?php _e('Filename extension', 'add-to-any'); ?></label>
612
  <input name="A2A_SHARE_SAVE_custom_icons_type" type="text" class="code" size="5" maxlength="4" placeholder="png" value="<?php if ( isset( $options['custom_icons_type'] ) ) echo $options['custom_icons_type']; else echo 'png'; ?>" />
613
  <label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width'); ?></label>
614
+ <input name="A2A_SHARE_SAVE_custom_icons_width" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) echo $options['custom_icons_width']; ?>" class="small-text" />
615
  <label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height'); ?></label>
616
+ <input name="A2A_SHARE_SAVE_custom_icons_height" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) echo $options['custom_icons_height']; ?>" class="small-text" />
617
  <p class="description">
618
  <?php _e("Specify the URL of the directory containing your custom icons. For example, a URL of <code>//example.com/blog/uploads/addtoany/icons/custom/</code> containing <code>facebook.png</code> and <code>twitter.png</code>. Be sure that custom icon filenames match the icon filenames in <code>plugins/add-to-any/icons</code>. For AddToAny's Universal Button, select Image URL and specify the URL of your AddToAny universal share icon (<a href=\"#\" onclick=\"document.getElementsByName('A2A_SHARE_SAVE_button_custom')[0].focus();return false\">above</a>).", 'add-to-any'); ?>
619
  </p>
662
  <label>
663
  <input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php
664
  if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
665
+ Only display when screen is larger than <input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" value="<?php if ( isset( $options['floating_vertical_responsive_max_width'] ) ) echo $options['floating_vertical_responsive_max_width']; else echo '980'; ?>" class="small-text" /> pixels wide
666
  </label>
667
  </fieldset></td>
668
  </tr>
669
  <tr valign="top">
670
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
671
  <td><fieldset>
672
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" value="<?php if ( isset( $options['floating_vertical_position'] ) ) echo $options['floating_vertical_position']; else echo '100'; ?>" class="small-text" /> pixels from top</label>
673
  </fieldset></td>
674
  </tr>
675
  <tr valign="top">
676
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
677
  <td><fieldset>
678
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" value="<?php if ( isset( $options['floating_vertical_offset'] ) ) echo $options['floating_vertical_offset']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
679
  </fieldset></td>
680
  </tr>
681
  <tr valign="top">
682
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
683
  <td><fieldset>
684
+ <label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo $options['floating_vertical_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
685
  </fieldset></td>
686
  </tr>
687
  </table>
704
  <label>
705
  <input id="A2A_SHARE_SAVE_floating_horizontal_responsive" name="A2A_SHARE_SAVE_floating_horizontal_responsive" type="checkbox"<?php
706
  if ( ! isset( $options['floating_horizontal_responsive'] ) || $options['floating_horizontal_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
707
+ Only display when screen is smaller than <input name="A2A_SHARE_SAVE_floating_horizontal_responsive_min_width" type="number" value="<?php if ( isset( $options['floating_horizontal_responsive_min_width'] ) ) echo $options['floating_horizontal_responsive_min_width']; else echo '981'; ?>" class="small-text" /> pixels wide
708
  </label>
709
  </fieldset></td>
710
  </tr>
711
  <tr valign="top">
712
  <th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
713
  <td><fieldset>
714
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_position" type="number" value="<?php if ( isset( $options['floating_horizontal_position'] ) ) echo $options['floating_horizontal_position']; else echo '0'; ?>" class="small-text" /> pixels from left or right</label>
715
  </fieldset></td>
716
  </tr>
717
  <tr valign="top">
718
  <th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
719
  <td><fieldset>
720
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_offset" type="number" value="<?php if ( isset( $options['floating_horizontal_offset'] ) ) echo $options['floating_horizontal_offset']; else echo '0'; ?>" class="small-text" /> pixels from bottom</label>
721
  </fieldset></td>
722
  </tr>
723
  <tr valign="top">
724
  <th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
725
  <td><fieldset>
726
+ <label><input name="A2A_SHARE_SAVE_floating_horizontal_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_horizontal_icon_size'] ) ) echo $options['floating_horizontal_icon_size']; else echo '32'; ?>" class="small-text"> pixels</label>
727
  </fieldset></td>
728
  </tr>
729
  </table>
762
  function A2A_SHARE_SAVE_admin_head() {
763
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'addtoany' ) {
764
 
765
+ $options = get_option( 'addtoany_options', array() );
766
 
767
  ?>
768
  <script type="text/javascript"><!--
769
  jQuery(document).ready(function(){
770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
  // Toggle child options of 'Display in posts'
772
  jQuery('#A2A_SHARE_SAVE_display_in_posts').bind('change click', function(e){
773
  if (jQuery(this).is(':checked'))
863
  }
864
  }
865
 
 
 
 
866
  var new_service = this_service.toggleClass('addtoany_selected')
867
  .unbind('click', moveToSortableList)
868
  .bind('click', moveToSelectableList)
869
  .clone();
870
 
871
+ new_service.data('a2a_32_icon_html', this_service.find('img').clone().attr('alt', this_service.attr('title')).wrap('<p>').parent().html() + configurable_html);
 
 
 
872
 
873
+ new_service.html( new_service.data('a2a_32_icon_html') )
874
  .click(function(){
875
  jQuery(this).not('.addtoany_special_service_options_selected').find('.special_options').slideDown('fast').parent().addClass('addtoany_special_service_options_selected');
876
  })
1007
  .addtoany_admin_list{list-style:none;padding:0;margin:0;}
1008
  .addtoany_admin_list li{border-radius:6px;}
1009
 
 
 
 
 
1010
  #addtoany_services_selectable{clear:left;display:none;}
1011
  #addtoany_services_selectable li{cursor:pointer;float:left;width:150px;font-size:12px;line-height:24px;margin:0;padding:6px;border:1px solid transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
1012
  #addtoany_services_selectable li:hover, #addtoany_services_selectable li.addtoany_selected{border:1px solid #CCC;background-color:#FFF;}
addtoany.min.css CHANGED
@@ -1 +1 @@
1
- .addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a,.widget .addtoany_list a{border:0;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;display:inline-block;height:auto;opacity:1;overflow:hidden;vertical-align:baseline;width:auto}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a > span{border-radius:4px;display:inline-block;height:32px;line-height:32px;opacity:1;width:32px}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover,.widget .addtoany_list a:hover{border:0;box-shadow:none}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service iframe,.addtoany_special_service div.fb_iframe_widget,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{display:inline;max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto}
1
+ .addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a,.widget .addtoany_list a{border:0;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;display:inline-block;opacity:1;overflow:hidden;vertical-align:baseline}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a>span{height:32px;line-height:32px;width:32px}.addtoany_list a>span{border-radius:4px;display:inline-block;opacity:1}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover,.widget .addtoany_list a:hover{border:0;box-shadow:none}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service div.fb_iframe_widget,.addtoany_special_service iframe,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{display:inline;max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto}
addtoany.update.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Migrate old AddToAny options
5
+ */
6
+ function addtoany_update_options() {
7
+
8
+ $options_old = get_option( 'addtoany_options', array() );
9
+ $options_new = $options_old;
10
+
11
+ $old_buttons = array(
12
+ 'share_save_256_24.gif|256|24', 'share_save_171_16.gif|171|16', 'share_save_120_16.gif|120|16',
13
+ 'share_save_256_24.png|256|24', 'share_save_171_16.png|171|16', 'share_save_120_16.png|120|16',
14
+ 'share_16_16.png|16|16', 'favicon.png|16|16',
15
+ );
16
+
17
+ // If old button enabled
18
+ if ( ! empty( $options_old['button'] ) && in_array( $options_old['button'], $old_buttons) ) {
19
+ // Switch to custom button URL
20
+ $options_new['button'] = 'CUSTOM';
21
+ $options_new['button_custom'] = 'https://static.addtoany.com/buttons/' . current( explode( '|', $options_old['button'] ) );
22
+ }
23
+
24
+ update_option( 'addtoany_options', $options_new );
25
+
26
+ }
addtoany.widgets.php CHANGED
@@ -74,7 +74,7 @@ class A2A_SHARE_SAVE_Widget extends WP_Widget {
74
  */
75
  public function update( $new_instance, $old_instance ) {
76
  $instance = $old_instance;
77
- $instance['title'] = strip_tags( $new_instance['title'] );
78
  return $instance;
79
  }
80
 
@@ -130,7 +130,6 @@ class A2A_Follow_Widget extends WP_Widget {
130
  * @param array $instance
131
  */
132
  public function widget( $args = array(), $instance ) {
133
-
134
  global $A2A_SHARE_SAVE_plugin_url_path;
135
 
136
  $defaults = array(
@@ -145,7 +144,9 @@ class A2A_Follow_Widget extends WP_Widget {
145
 
146
  echo $before_widget;
147
 
148
- if ( isset( $instance ) && ! empty( $instance['title'] ) ) {
 
 
149
  $title = apply_filters( 'widget_title', $instance['title'] );
150
  echo $before_title . $title . $after_title;
151
  }
@@ -164,6 +165,7 @@ class A2A_Follow_Widget extends WP_Widget {
164
 
165
  ADDTOANY_FOLLOW_KIT( array(
166
  'buttons' => $active_services,
 
167
  ) );
168
 
169
  echo $after_widget;
@@ -175,15 +177,16 @@ class A2A_Follow_Widget extends WP_Widget {
175
  * @return array
176
  */
177
  public function update( $new_instance, $old_instance ) {
178
- $instance = $old_instance;
179
- $instance['title'] = strip_tags( $new_instance['title'] );
 
180
 
181
  // Accept service IDs
182
  $services = $this->get_follow_services();
183
  foreach ( $services as $code => $service ) {
184
  $code_id = $code . '_id';
185
  if ( isset( $new_instance[ $code_id ] ) ) {
186
- $instance[ $code_id ] = strip_tags( $new_instance[ $code_id ] );
187
  }
188
  }
189
 
@@ -194,14 +197,31 @@ class A2A_Follow_Widget extends WP_Widget {
194
  * @param array $instance
195
  */
196
  public function form( $instance ) {
 
 
197
  $services = $this->get_follow_services();
198
 
199
- $title = isset( $instance ) && ! empty( $instance['title'] ) ? __( $instance['title'] ) : '';
 
 
 
 
 
 
 
 
 
 
200
  ?>
201
  <p>
202
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
203
  <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 ); ?>" />
204
  </p>
 
 
 
 
 
205
  <?php foreach ( $services as $code => $service ) :
206
  $code_id = $code . '_id';
207
  $id_value = ! empty( $instance[ $code_id ] ) ? $instance[ $code_id ] : '';
74
  */
75
  public function update( $new_instance, $old_instance ) {
76
  $instance = $old_instance;
77
+ $instance['title'] = sanitize_text_field( $new_instance['title'] );
78
  return $instance;
79
  }
80
 
130
  * @param array $instance
131
  */
132
  public function widget( $args = array(), $instance ) {
 
133
  global $A2A_SHARE_SAVE_plugin_url_path;
134
 
135
  $defaults = array(
144
 
145
  echo $before_widget;
146
 
147
+ $instance = is_array( $instance ) ? $instance : array();
148
+
149
+ if ( ! empty( $instance['title'] ) ) {
150
  $title = apply_filters( 'widget_title', $instance['title'] );
151
  echo $before_title . $title . $after_title;
152
  }
165
 
166
  ADDTOANY_FOLLOW_KIT( array(
167
  'buttons' => $active_services,
168
+ 'icon_size' => ! empty( $instance['icon_size'] ) ? $instance['icon_size'] : '32',
169
  ) );
170
 
171
  echo $after_widget;
177
  * @return array
178
  */
179
  public function update( $new_instance, $old_instance ) {
180
+ $instance = (array) $old_instance;
181
+ $instance['title'] = sanitize_text_field( $new_instance['title'] );
182
+ $instance['icon_size'] = sanitize_text_field( $new_instance['icon_size'] );
183
 
184
  // Accept service IDs
185
  $services = $this->get_follow_services();
186
  foreach ( $services as $code => $service ) {
187
  $code_id = $code . '_id';
188
  if ( isset( $new_instance[ $code_id ] ) ) {
189
+ $instance[ $code_id ] = sanitize_text_field( $new_instance[ $code_id ] );
190
  }
191
  }
192
 
197
  * @param array $instance
198
  */
199
  public function form( $instance ) {
200
+ $instance = is_array( $instance ) ? $instance : array();
201
+ $options = get_option( 'addtoany_options', array() );
202
  $services = $this->get_follow_services();
203
 
204
+ $title = ! empty( $instance['title'] ) ? __( $instance['title'] ) : '';
205
+
206
+ if ( ! empty( $instance['icon_size'] ) ) {
207
+ $icon_size = $instance['icon_size'];
208
+ } elseif ( ! empty( $options['icon_size'] ) ) {
209
+ // Fallback to standard icon size if saved
210
+ $icon_size = $options['icon_size'];
211
+ } else {
212
+ $icon_size = '32';
213
+ }
214
+
215
  ?>
216
  <p>
217
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
218
  <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 ); ?>" />
219
  </p>
220
+ <p>
221
+ <label for="<?php echo $this->get_field_id( 'icon_size' ); ?>"><?php _e( 'Icon Size:', 'add-to-any' ); ?></label>
222
+ <input class="widefat" id="<?php echo $this->get_field_id( 'icon_size' ); ?>" name="<?php echo $this->get_field_name( 'icon_size' ); ?>" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo $icon_size; ?>">
223
+ <small>Pixels</small>
224
+ </p>
225
  <?php foreach ( $services as $code => $service ) :
226
  $code_id = $code . '_id';
227
  $id_value = ! empty( $instance[ $code_id ] ) ? $instance[ $code_id ] : '';
favicon.png DELETED
Binary file
share_16_16.png DELETED
Binary file
share_save_120_16.gif DELETED
Binary file
share_save_120_16.png DELETED
Binary file
share_save_171_16.gif DELETED
Binary file
share_save_171_16.png DELETED
Binary file
share_save_256_24.gif DELETED
Binary file
share_save_256_24.png DELETED
Binary file