AddToAny Share Buttons - Version 1.7.29

Version Description

  • Initialize AddToAny Follow buttons on the post-load event
  • Harden the local cache option to keep caches updated
  • Update official button options in admin
Download this release

Release Info

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

Code changes from version 1.7.28 to 1.7.29

Files changed (5) hide show
  1. README.txt +27 -17
  2. add-to-any.php +92 -21
  3. addtoany.admin.php +28 -19
  4. addtoany.min.css +1 -1
  5. addtoany.min.js +1 -1
README.txt CHANGED
@@ -4,26 +4,27 @@ Tags: buttons, share, icons, social media, share buttons, sharing, share button,
4
  Requires at least: 3.7
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
- Stable tag: 1.7.28
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
10
 
11
  == Description ==
12
 
13
- The AddToAny sharing plugin for WordPress increases traffic & engagement by helping people share your posts and pages to any service. Services include Facebook, Twitter, Pinterest, Google, WhatsApp, LinkedIn, Tumblr, Reddit, and over 100 more sharing and social media sites & apps.
14
 
15
- AddToAny is the universal sharing platform, and the AddToAny plugin is the most popular share plugin for WordPress, making sites social media ready since 2006.
16
 
17
- = Share Buttons & Follow Buttons =
18
 
19
- * **Counters** fast & official share counts in the same style
20
- * **Floating** share buttons — responsive & customizable, vertical & horizontal
21
- * **Vector** share & follow buttons (SVG icons)
22
- * **Universal** Share Button and Smart Menu
23
- * Individual share links and custom share icons
24
- * Official buttons including the Facebook Like Button, Twitter Tweet Button, Pinterest Pin It Button, Google+ Share Button and Google +1 Button
25
- * Universal email sharing makes it easy to share via Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web or native apps
26
- * <a href="https://www.addtoany.com/">Share Buttons</a> demo
 
27
 
28
  = Custom Placement & Appearance =
29
  * Before content, after content, or before & after content
@@ -33,8 +34,8 @@ AddToAny is the universal sharing platform, and the AddToAny plugin is the most
33
 
34
  = Analytics Integration =
35
 
36
- * Automatic Google Analytics integration (<a href="https://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
37
- * Track shared links with Bitly, the Google URL Shortener, and custom URL shorteners
38
  * Display share counts on posts and pages
39
 
40
  = WordPress Optimized =
@@ -42,7 +43,7 @@ AddToAny is the universal sharing platform, and the AddToAny plugin is the most
42
  * Loads asynchronously so your content always loads before or in parallel with AddToAny
43
  * Supports theme features such as HTML5, widgets, infinite scroll, post formats
44
  * Supports WooCommerce, multilingual sites, multisite networks, and accessibility standards
45
- * No signup, no login, no account necessary
46
 
47
  = Mobile Optimized & Retina Ready =
48
 
@@ -62,7 +63,7 @@ AddToAny is the universal sharing platform, and the AddToAny plugin is the most
62
  = Wide Support =
63
 
64
  * Over 10 years of development
65
- * Over 8 million downloads
66
  * Translated into dozens of languages
67
  * Ongoing support from the community
68
 
@@ -278,7 +279,7 @@ Go to Settings > AddToAny > uncheck "Display at the top or bottom of posts on ar
278
 
279
  = How can I programmatically remove the button(s)? =
280
 
281
- You can disable AddToAny sharing using [filter](https://developer.wordpress.org/plugins/hooks/filters/) (PHP code) that you can add to a "functionality" plugin such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin.
282
 
283
  Disable AddToAny sharing in specific categories, for example:
284
 
@@ -315,6 +316,10 @@ The Google +1 Button with 'show count' enabled is 90 pixels. You can change the
315
 
316
  The Google+ Share Button width can be changed using CSS code, for instance: `.a2a_button_google_plus_share { width:57px !important; }`
317
 
 
 
 
 
318
  = Does the plugin output W3C valid code? =
319
 
320
  Yes, this plugin outputs 100% W3C valid HTML5 and W3C valid CSS 3 by default.
@@ -345,6 +350,11 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
345
 
346
  == Changelog ==
347
 
 
 
 
 
 
348
  = 1.7.28 =
349
  * New option to hide a floating bar until scrolled past a header region
350
  * New option to hide a floating bar when scrolled to a footer region
4
  Requires at least: 3.7
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
+ Stable tag: 1.7.29
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
10
 
11
  == Description ==
12
 
13
+ The AddToAny Share Buttons plugin for WordPress increases traffic & engagement by helping people share your posts and pages to any service. Services include Facebook, Twitter, Pinterest, Google, WhatsApp, LinkedIn, Tumblr, Reddit, and over 100 more sharing and social media sites & apps.
14
 
15
+ AddToAny is the home of universal sharing, and the AddToAny plugin is the most popular share plugin for WordPress, making sites social media ready since 2006.
16
 
17
+ = Share Buttons =
18
 
19
+ * [**Standard**](https://www.addtoany.com/buttons/customize/wordpress/standalone_services) share buttons share each piece of content
20
+ * [**Floating**](https://www.addtoany.com/buttons/customize/wordpress/floating_share_buttons) share buttons — responsive & customizable, vertical & horizontal
21
+ * **Counters** fast & official [share counts](https://www.addtoany.com/buttons/customize/wordpress/share_counters) in the same style
22
+ * **Follow** buttons** [social media links](https://www.addtoany.com/buttons/customize/wordpress/follow_buttons) to your Instagram, YouTube, Snapchat
23
+ * **Image** sharing buttons - share buttons for [sharing images](https://www.addtoany.com/buttons/customize/wordpress/image_sharing)
24
+ * **Vector** share buttons & follow buttons [custom color](https://www.addtoany.com/buttons/customize/wordpress/icon_color) SVG icons
25
+ * **Custom** share icons use your own if you prefer
26
+ * Official buttons including the Facebook Like Button, Twitter Tweet Button, Pinterest Save Button, Google+ Share Button and Google +1 Button
27
+ * Universal email sharing makes it easy to share via Gmail, Yahoo Mail, Outlook.com (Hotmail), AOL Mail, and any other web or native apps
28
 
29
  = Custom Placement & Appearance =
30
  * Before content, after content, or before & after content
34
 
35
  = Analytics Integration =
36
 
37
+ * Google Analytics integration (<a href="https://www.addtoany.com/ext/google_analytics/">access guide</a>) for sharing analytics
38
+ * Track shared links with Bitly and custom URL shorteners
39
  * Display share counts on posts and pages
40
 
41
  = WordPress Optimized =
43
  * Loads asynchronously so your content always loads before or in parallel with AddToAny
44
  * Supports theme features such as HTML5, widgets, infinite scroll, post formats
45
  * Supports WooCommerce, multilingual sites, multisite networks, and accessibility standards
46
+ * AddToAny is free — no signup, no login, no accounts to manage
47
 
48
  = Mobile Optimized & Retina Ready =
49
 
63
  = Wide Support =
64
 
65
  * Over 10 years of development
66
+ * Over 9 million downloads
67
  * Translated into dozens of languages
68
  * Ongoing support from the community
69
 
279
 
280
  = How can I programmatically remove the button(s)? =
281
 
282
+ You can disable AddToAny sharing using a [filter](https://developer.wordpress.org/plugins/hooks/filters/) (PHP code) that you can add to a "functionality" plugin such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin.
283
 
284
  Disable AddToAny sharing in specific categories, for example:
285
 
316
 
317
  The Google+ Share Button width can be changed using CSS code, for instance: `.a2a_button_google_plus_share { width:57px !important; }`
318
 
319
+ = Is AddToAny GDPR compatible? =
320
+
321
+ Yes, AddToAny is [GDPR compatible by default](https://www.addtoany.com/buttons/faq/#gdpr).
322
+
323
  = Does the plugin output W3C valid code? =
324
 
325
  Yes, this plugin outputs 100% W3C valid HTML5 and W3C valid CSS 3 by default.
350
 
351
  == Changelog ==
352
 
353
+ = 1.7.29 =
354
+ * Initialize AddToAny Follow buttons on the `post-load` event
355
+ * Harden the local cache option to keep caches updated
356
+ * Update official button options in admin
357
+
358
  = 1.7.28 =
359
  * New option to hide a floating bar until scrolled past a header region
360
  * New option to hide a floating bar when scrolled to a footer region
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.28
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -503,8 +503,10 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
503
  $custom_attributes = '';
504
 
505
  if ( $special_service_code == 'facebook_like' ) {
506
- $custom_attributes .= ( isset( $options['special_facebook_like_options']['verb'] ) &&
507
- 'recommend' == $options['special_facebook_like_options']['verb'] ) ? ' data-action="recommend"' : '';
 
 
508
  $custom_attributes .= ' data-href="' . $linkurl . '"';
509
  $special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
510
  }
@@ -526,8 +528,8 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
526
  }
527
 
528
  elseif ( $special_service_code == 'pinterest_pin' ) {
529
- $custom_attributes .= ( isset( $options['special_pinterest_pin_options']['show_count'] ) &&
530
- $options['special_pinterest_pin_options']['show_count'] == '1' ) ? '' : ' data-pin-config="none"';
531
  $custom_attributes .= ' data-url="' . $linkurl . '"';
532
  $custom_attributes .= ( ! empty( $linkmedia ) ) ? ' data-media="' . $linkmedia . '"' : '';
533
  $special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
@@ -775,9 +777,27 @@ function A2A_SHARE_SAVE_head_script() {
775
  $options = get_option( 'addtoany_options', array() );
776
 
777
  // Use local cache?
778
- $cache = ( isset( $options['cache'] ) && '1' == $options['cache'] ) ? true : false;
779
  $upload_dir = wp_upload_dir();
780
- $static_server = ( $cache ) ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
 
782
  // Icon colors
783
  $icon_bg = ! empty( $options['icon_bg'] ) && in_array( $options['icon_bg'], array( 'custom', 'transparent' ) ) ? $options['icon_bg'] : false;
@@ -845,7 +865,7 @@ function A2A_SHARE_SAVE_head_script() {
845
  . 'a=d.createElement(s);'
846
  . 'b=d.getElementsByTagName(s)[0];'
847
  . 'a.async=1;'
848
- . 'a.src="' . $static_server . '/page.js";'
849
  . 'b.parentNode.insertBefore(a,b);'
850
  . '})(document,"script");'
851
  . "\n</script>\n";
@@ -1012,7 +1032,7 @@ function A2A_SHARE_SAVE_stylesheet() {
1012
  $options = $A2A_SHARE_SAVE_options;
1013
 
1014
  if ( ! is_admin() ) {
1015
- wp_enqueue_style( 'addtoany', plugins_url('/addtoany.min.css', __FILE__ ), false, '1.14' );
1016
 
1017
  // Prepare inline CSS
1018
  $inline_css = '';
@@ -1079,13 +1099,12 @@ add_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_stylesheet', 20 );
1079
 
1080
  function A2A_SHARE_SAVE_enqueue_script() {
1081
  if ( wp_script_is( 'jquery', 'registered' ) ) {
1082
- wp_enqueue_script( 'addtoany', plugins_url('/addtoany.min.js', __FILE__ ), array( 'jquery' ), '1.0' );
1083
  }
1084
  }
1085
 
1086
  add_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_script' );
1087
 
1088
-
1089
  /**
1090
  * Cache AddToAny
1091
  */
@@ -1095,10 +1114,11 @@ function A2A_SHARE_SAVE_refresh_cache() {
1095
  $file_urls = explode( "\n", $contents, 20 );
1096
  $upload_dir = wp_upload_dir();
1097
 
1098
- // Make directory if needed
1099
  if ( ! wp_mkdir_p( dirname( $upload_dir['basedir'] . '/addtoany/foo' ) ) ) {
1100
- $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) );
1101
- return array( 'error' => $message );
 
1102
  }
1103
 
1104
  if ( count( $file_urls ) > 0 ) {
@@ -1108,28 +1128,79 @@ function A2A_SHARE_SAVE_refresh_cache() {
1108
  $file_name = substr( strrchr( $file_url, '/' ), 1, 99 );
1109
 
1110
  // Place files in uploads/addtoany directory
1111
- wp_remote_get( $file_url, array(
1112
  'filename' => $upload_dir['basedir'] . '/addtoany/' . $file_name,
1113
  'stream' => true, // Required to use `filename` arg
1114
  ) );
 
 
 
 
 
 
1115
  }
1116
  }
1117
  }
1118
 
 
 
1119
  function A2A_SHARE_SAVE_schedule_cache() {
1120
- $timestamp = wp_next_scheduled( 'A2A_SHARE_SAVE_refresh_cache' );
1121
- if ( ! $timestamp) {
1122
- // Only schedule if currently unscheduled
1123
- wp_schedule_event( time(), 'daily', 'A2A_SHARE_SAVE_refresh_cache' );
 
 
 
 
 
1124
  }
1125
  }
1126
 
1127
  function A2A_SHARE_SAVE_unschedule_cache() {
1128
- $timestamp = wp_next_scheduled( 'A2A_SHARE_SAVE_refresh_cache' );
1129
- wp_unschedule_event( $timestamp, 'A2A_SHARE_SAVE_refresh_cache' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  }
1131
 
 
 
 
 
 
 
 
 
 
 
1132
 
 
1133
 
1134
  /**
1135
  * Admin Options
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.29
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
503
  $custom_attributes = '';
504
 
505
  if ( $special_service_code == 'facebook_like' ) {
506
+ $custom_attributes .= ( isset( $options['special_facebook_like_options']['verb'] )
507
+ && 'recommend' == $options['special_facebook_like_options']['verb'] ) ? ' data-action="recommend"' : '';
508
+ $custom_attributes .= ( isset( $options['special_facebook_like_options']['show_count'] )
509
+ && $options['special_facebook_like_options']['show_count'] == '1' ) ? '' : ' data-layout="button"';
510
  $custom_attributes .= ' data-href="' . $linkurl . '"';
511
  $special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
512
  }
528
  }
529
 
530
  elseif ( $special_service_code == 'pinterest_pin' ) {
531
+ $custom_attributes .= ( isset( $options['special_pinterest_pin_options']['show_count'] )
532
+ && $options['special_pinterest_pin_options']['show_count'] == '1' ) ? '' : ' data-pin-config="none"';
533
  $custom_attributes .= ' data-url="' . $linkurl . '"';
534
  $custom_attributes .= ( ! empty( $linkmedia ) ) ? ' data-media="' . $linkmedia . '"' : '';
535
  $special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
777
  $options = get_option( 'addtoany_options', array() );
778
 
779
  // Use local cache?
780
+ $cache = ! empty( $options['cache'] ) && '1' == $options['cache'] ? true : false;
781
  $upload_dir = wp_upload_dir();
782
+ $cached_file = ! empty( $upload_dir['basedir'] ) && file_exists( $upload_dir['basedir'] . '/addtoany/page.js' ) ? $upload_dir['basedir'] . '/addtoany/page.js' : false;
783
+ $querystring = '';
784
+ // Is page.js actually cached?
785
+ if ( $cache && $cached_file ) {
786
+ // Is page.js recently cached, within 2 days (172800 seconds)?
787
+ $modified_time = filemtime( $cached_file );
788
+ $cache = $modified_time && time() - $modified_time < 172800 ? true : false;
789
+ // If cache is recent
790
+ if ( $cache ) {
791
+ // Set a "ver" parameter's value to the file's modified time for cache management
792
+ $querystring = '?ver=' . $modified_time;
793
+ } else {
794
+ // Revert the cache option
795
+ A2A_SHARE_SAVE_revert_cache();
796
+ }
797
+ }
798
+
799
+ // Set static server
800
+ $static_server = $cache ? $upload_dir['baseurl'] . '/addtoany' : 'https://static.addtoany.com/menu';
801
 
802
  // Icon colors
803
  $icon_bg = ! empty( $options['icon_bg'] ) && in_array( $options['icon_bg'], array( 'custom', 'transparent' ) ) ? $options['icon_bg'] : false;
865
  . 'a=d.createElement(s);'
866
  . 'b=d.getElementsByTagName(s)[0];'
867
  . 'a.async=1;'
868
+ . 'a.src="' . $static_server . '/page.js' . $querystring . '";'
869
  . 'b.parentNode.insertBefore(a,b);'
870
  . '})(document,"script");'
871
  . "\n</script>\n";
1032
  $options = $A2A_SHARE_SAVE_options;
1033
 
1034
  if ( ! is_admin() ) {
1035
+ wp_enqueue_style( 'addtoany', plugins_url('/addtoany.min.css', __FILE__ ), false, '1.15' );
1036
 
1037
  // Prepare inline CSS
1038
  $inline_css = '';
1099
 
1100
  function A2A_SHARE_SAVE_enqueue_script() {
1101
  if ( wp_script_is( 'jquery', 'registered' ) ) {
1102
+ wp_enqueue_script( 'addtoany', plugins_url('/addtoany.min.js', __FILE__ ), array( 'jquery' ), '1.1' );
1103
  }
1104
  }
1105
 
1106
  add_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_script' );
1107
 
 
1108
  /**
1109
  * Cache AddToAny
1110
  */
1114
  $file_urls = explode( "\n", $contents, 20 );
1115
  $upload_dir = wp_upload_dir();
1116
 
1117
+ // Try to create directory if it doesn't already exist
1118
  if ( ! wp_mkdir_p( dirname( $upload_dir['basedir'] . '/addtoany/foo' ) ) ) {
1119
+ // Handle directory creation issue
1120
+ // Revert cache option
1121
+ A2A_SHARE_SAVE_revert_cache();
1122
  }
1123
 
1124
  if ( count( $file_urls ) > 0 ) {
1128
  $file_name = substr( strrchr( $file_url, '/' ), 1, 99 );
1129
 
1130
  // Place files in uploads/addtoany directory
1131
+ $response = wp_remote_get( $file_url, array(
1132
  'filename' => $upload_dir['basedir'] . '/addtoany/' . $file_name,
1133
  'stream' => true, // Required to use `filename` arg
1134
  ) );
1135
+
1136
+ // Handle error
1137
+ if ( is_wp_error( $response ) ) {
1138
+ // Revert cache option
1139
+ A2A_SHARE_SAVE_revert_cache();
1140
+ }
1141
  }
1142
  }
1143
  }
1144
 
1145
+ add_action( 'addtoany_refresh_cache', 'A2A_SHARE_SAVE_refresh_cache' );
1146
+
1147
  function A2A_SHARE_SAVE_schedule_cache() {
1148
+ // Unschedule if already scheduled
1149
+ A2A_SHARE_SAVE_unschedule_cache();
1150
+
1151
+ // Try to schedule daily cache refreshes, running once now
1152
+ $result = wp_schedule_event( time(), 'daily', 'addtoany_refresh_cache' );
1153
+
1154
+ // Revert cache option if the event didn't get scheduled
1155
+ if ( false === $result ) {
1156
+ A2A_SHARE_SAVE_revert_cache();
1157
  }
1158
  }
1159
 
1160
  function A2A_SHARE_SAVE_unschedule_cache() {
1161
+ // Unschedule if scheduled
1162
+ wp_clear_scheduled_hook( 'addtoany_refresh_cache' );
1163
+ }
1164
+
1165
+ function A2A_SHARE_SAVE_revert_cache() {
1166
+ // Unschedule
1167
+ A2A_SHARE_SAVE_unschedule_cache();
1168
+
1169
+ // Get all existing AddToAny options
1170
+ $options = get_option( 'addtoany_options', array() );
1171
+
1172
+ // Revert cache option
1173
+ $options['cache'] = '-1';
1174
+ update_option( 'addtoany_options', $options );
1175
+ }
1176
+
1177
+ /**
1178
+ * Activation hook
1179
+ */
1180
+
1181
+ function addtoany_activation() {
1182
+ // Get all existing AddToAny options
1183
+ $options = get_option( 'addtoany_options', array() );
1184
+
1185
+ // If the local cache option is enabled
1186
+ if ( isset( $options['cache'] ) && $options['cache'] == '1' ) {
1187
+ // Schedule and run the local cache refresh
1188
+ A2A_SHARE_SAVE_schedule_cache();
1189
+ }
1190
  }
1191
 
1192
+ register_activation_hook( __FILE__, 'addtoany_activation' );
1193
+
1194
+ /**
1195
+ * Deactivation hook
1196
+ */
1197
+
1198
+ function addtoany_deactivation() {
1199
+ // Unschedule if scheduled
1200
+ A2A_SHARE_SAVE_unschedule_cache();
1201
+ }
1202
 
1203
+ register_deactivation_hook( __FILE__, 'addtoany_deactivation' );
1204
 
1205
  /**
1206
  * Admin Options
addtoany.admin.php CHANGED
@@ -364,7 +364,6 @@ function A2A_SHARE_SAVE_options_page() {
364
  // Schedule cache refresh?
365
  if ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
366
  A2A_SHARE_SAVE_schedule_cache();
367
- A2A_SHARE_SAVE_refresh_cache();
368
  } else {
369
  A2A_SHARE_SAVE_unschedule_cache();
370
  }
@@ -392,7 +391,8 @@ function A2A_SHARE_SAVE_options_page() {
392
 
393
  // Store special service options
394
  $new_options['special_facebook_like_options'] = array(
395
- 'verb' => ( ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' )
 
396
  );
397
  $new_options['special_twitter_tweet_options'] = array(
398
  'show_count' => '-1' // Twitter doesn't provide counts anymore
@@ -744,7 +744,7 @@ function A2A_SHARE_SAVE_options_page() {
744
  <br>
745
  <label>
746
  Attach to <input name="A2A_SHARE_SAVE_floating_vertical_attached_to" type="text" class="regular-text code" placeholder=".content-area" value="<?php if ( isset( $options['floating_vertical_attached_to'] ) ) echo esc_attr( $options['floating_vertical_attached_to'] ); else echo esc_attr( 'main, [role="main"], article, .status-publish' ); ?>" />
747
- <p class="description">Enter a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors" class="description" rel="noopener" target="_blank">CSS selector</a>,or group of selectors, that match the HTML element you want to attach to.</p>
748
  </label>
749
  </div>
750
  </fieldset></td>
@@ -891,7 +891,7 @@ function A2A_SHARE_SAVE_options_page() {
891
  <p><?php _e('Search the <a href="https://wordpress.org/support/plugin/add-to-any">support forums</a>.','add-to-any'); ?></p>
892
  </div>
893
 
894
- <script src="http<?php if ( is_ssl() ) echo 's'; ?>://static.addtoany.com/menu/page.js"></script>
895
  <script>
896
  if ( window.a2a && a2a.svg_css ) a2a.svg_css();
897
  jQuery(document).ready( function() { if ( ! window.a2a) jQuery('<div class="error"><p><strong>Something is preventing AddToAny from loading. Try disabling content blockers such as ad-blocking add-ons, or try another web browser.</strong></p></div>').insertBefore('.nav-tab-wrapper:eq(0)'); });
@@ -964,11 +964,9 @@ function A2A_SHARE_SAVE_admin_head() {
964
 
965
  // Special service options?
966
  service_name = services_array[i].substr(7);
967
- if (service_name == 'facebook_like' || service_name == 'twitter_tweet' || service_name == 'pinterest_pin') {
968
- if (service_name == 'pinterest_pin') {
969
- show_count_value = (jQuery('#' + services_array[i] + '_show_count').is(':checked')) ? '1' : '-1' ;
970
- jQuery('#addtoany_admin_form').append('<input class="addtoany_hidden_options" name="addtoany_' + service_name + '_show_count" type="hidden" value="' + show_count_value + '"/>');
971
- }
972
 
973
  if (service_name == 'facebook_like') {
974
  fb_verb_value = (jQuery('#' + services_array[i] + '_verb').val() == 'recommend') ? 'recommend' : 'like';
@@ -1006,19 +1004,21 @@ function A2A_SHARE_SAVE_admin_head() {
1006
  jQuery('#addtoany_services_sortable').find('.dummy').hide();
1007
 
1008
  if (this_service_is_special) {
 
 
 
 
 
 
 
 
1009
  if ('facebook_like' == this_service_name) {
1010
  if (service_options[this_service_name] && service_options[this_service_name].verb)
1011
  checked = ' selected="selected"';
1012
- special_options_html = '<select id="' + this_service.attr('id') + '_verb" name="' + this_service.attr('id') + '_verb">'
1013
  + '<option value="like">Like</option>'
1014
  + '<option' + checked + ' value="recommend">Recommend</option>'
1015
  + '</select>';
1016
- } else {
1017
- // Common "Show count" for facebook, pinterest, pinterest_pin, etc.
1018
- if (service_options[this_service_name] && service_options[this_service_name].show_count) {
1019
- checked = ' checked="checked"';
1020
- }
1021
- special_options_html = '<label><input' + checked + ' id="' + this_service.attr('id') + '_show_count" name="' + this_service.attr('id') + '_show_count" type="checkbox" value="1"> Show count</label>';
1022
  }
1023
 
1024
  if (special_options_html.length > 0) {
@@ -1113,14 +1113,23 @@ function A2A_SHARE_SAVE_admin_head() {
1113
  // Special service options (enabled counters) if any
1114
  echo $counters_enabled_js;
1115
 
 
1116
  if ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend'
1117
  || ! isset( $_POST['addtoany_facebook_like_verb'] )
1118
- && isset( $options['special_facebook_like_options'] ) && $options['special_facebook_like_options']['verb'] == 'recommend' ) {
1119
- ?>service_options.facebook_like = {verb: 'recommend'};<?php
 
 
 
 
 
 
 
1120
  }
1121
  if ( isset( $_POST['addtoany_pinterest_pin_show_count'] ) && $_POST['addtoany_pinterest_pin_show_count'] == '1'
1122
  || ! isset( $_POST['addtoany_pinterest_pin_show_count'] )
1123
- && isset( $options['special_pinterest_pin_options'] ) && $options['special_pinterest_pin_options']['show_count'] == '1' ) {
 
1124
  ?>service_options.pinterest_pin = {show_count: 1};<?php
1125
  }
1126
  ?>
364
  // Schedule cache refresh?
365
  if ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
366
  A2A_SHARE_SAVE_schedule_cache();
 
367
  } else {
368
  A2A_SHARE_SAVE_unschedule_cache();
369
  }
391
 
392
  // Store special service options
393
  $new_options['special_facebook_like_options'] = array(
394
+ 'show_count' => ( ( isset( $_POST['addtoany_facebook_like_show_count'] ) && $_POST['addtoany_facebook_like_show_count'] == '1' ) ? '1' : '-1' ),
395
+ 'verb' => ( ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' ),
396
  );
397
  $new_options['special_twitter_tweet_options'] = array(
398
  'show_count' => '-1' // Twitter doesn't provide counts anymore
744
  <br>
745
  <label>
746
  Attach to <input name="A2A_SHARE_SAVE_floating_vertical_attached_to" type="text" class="regular-text code" placeholder=".content-area" value="<?php if ( isset( $options['floating_vertical_attached_to'] ) ) echo esc_attr( $options['floating_vertical_attached_to'] ); else echo esc_attr( 'main, [role="main"], article, .status-publish' ); ?>" />
747
+ <p class="description">Enter a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors" class="description" rel="noopener" target="_blank">CSS selector</a>, or group of selectors, that match the HTML element you want to attach to.</p>
748
  </label>
749
  </div>
750
  </fieldset></td>
891
  <p><?php _e('Search the <a href="https://wordpress.org/support/plugin/add-to-any">support forums</a>.','add-to-any'); ?></p>
892
  </div>
893
 
894
+ <script src="https://static.addtoany.com/menu/page.js"></script>
895
  <script>
896
  if ( window.a2a && a2a.svg_css ) a2a.svg_css();
897
  jQuery(document).ready( function() { if ( ! window.a2a) jQuery('<div class="error"><p><strong>Something is preventing AddToAny from loading. Try disabling content blockers such as ad-blocking add-ons, or try another web browser.</strong></p></div>').insertBefore('.nav-tab-wrapper:eq(0)'); });
964
 
965
  // Special service options?
966
  service_name = services_array[i].substr(7);
967
+ if (service_name == 'facebook_like' || service_name == 'pinterest_pin') {
968
+ show_count_value = (jQuery('#' + services_array[i] + '_show_count').is(':checked')) ? '1' : '-1' ;
969
+ jQuery('#addtoany_admin_form').append('<input class="addtoany_hidden_options" name="addtoany_' + service_name + '_show_count" type="hidden" value="' + show_count_value + '"/>');
 
 
970
 
971
  if (service_name == 'facebook_like') {
972
  fb_verb_value = (jQuery('#' + services_array[i] + '_verb').val() == 'recommend') ? 'recommend' : 'like';
1004
  jQuery('#addtoany_services_sortable').find('.dummy').hide();
1005
 
1006
  if (this_service_is_special) {
1007
+ if ( jQuery.inArray( this_service_name, ['facebook_like', 'pinterest_pin'] ) > -1 ) {
1008
+ // Common "Show count" for facebook, pinterest, pinterest_pin, etc.
1009
+ if (service_options[this_service_name] && service_options[this_service_name].show_count) {
1010
+ checked = ' checked="checked"';
1011
+ }
1012
+ special_options_html += '<label><input' + checked + ' id="' + this_service.attr('id') + '_show_count" name="' + this_service.attr('id') + '_show_count" type="checkbox" value="1"> Show count</label>';
1013
+ }
1014
+
1015
  if ('facebook_like' == this_service_name) {
1016
  if (service_options[this_service_name] && service_options[this_service_name].verb)
1017
  checked = ' selected="selected"';
1018
+ special_options_html += '<br><select id="' + this_service.attr('id') + '_verb" name="' + this_service.attr('id') + '_verb">'
1019
  + '<option value="like">Like</option>'
1020
  + '<option' + checked + ' value="recommend">Recommend</option>'
1021
  + '</select>';
 
 
 
 
 
 
1022
  }
1023
 
1024
  if (special_options_html.length > 0) {
1113
  // Special service options (enabled counters) if any
1114
  echo $counters_enabled_js;
1115
 
1116
+ echo 'service_options.facebook_like = {};';
1117
  if ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend'
1118
  || ! isset( $_POST['addtoany_facebook_like_verb'] )
1119
+ && isset( $options['special_facebook_like_options'] ) && isset( $options['special_facebook_like_options']['verb'] )
1120
+ && $options['special_facebook_like_options']['verb'] == 'recommend' ) {
1121
+ ?>service_options.facebook_like.verb = 'recommend';<?php
1122
+ }
1123
+ if ( isset( $_POST['addtoany_facebook_like_show_count'] ) && $_POST['addtoany_facebook_like_show_count'] == '1'
1124
+ || ! isset( $_POST['addtoany_facebook_like_show_count'] )
1125
+ && isset( $options['special_facebook_like_options'] ) && isset( $options['special_facebook_like_options']['show_count'] )
1126
+ && $options['special_facebook_like_options']['show_count'] == '1' ) {
1127
+ ?>service_options.facebook_like.show_count = 1;<?php
1128
  }
1129
  if ( isset( $_POST['addtoany_pinterest_pin_show_count'] ) && $_POST['addtoany_pinterest_pin_show_count'] == '1'
1130
  || ! isset( $_POST['addtoany_pinterest_pin_show_count'] )
1131
+ && isset( $options['special_pinterest_pin_options'] ) && isset( $options['special_pinterest_pin_options']['show_count'] )
1132
+ && $options['special_pinterest_pin_options']['show_count'] == '1' ) {
1133
  ?>service_options.pinterest_pin = {show_count: 1};<?php
1134
  }
1135
  ?>
addtoany.min.css CHANGED
@@ -1 +1 @@
1
- .addtoany_content{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.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share img{border:0;width:auto;height:auto}
1
+ .addtoany_content{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:not(.addtoany_special_service)>span{height:32px;line-height:32px;width:32px}.addtoany_list a:not(.addtoany_special_service)>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.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share img{border:0;width:auto;height:auto}
addtoany.min.js CHANGED
@@ -1 +1 @@
1
- "function"==typeof jQuery&&jQuery(document).ready(function(a){a("body").on("post-load",function(){window.a2a&&a2a.init_all("page")})});
1
+ "function"==typeof jQuery&&jQuery(document).ready(function(a){a("body").on("post-load",function(){window.a2a&&a2a.init_all()})});