AddToAny Share Buttons - Version 1.6.1

Version Description

  • Titles with special characters are sanitized differently
    • Using wp_json_encode (or json_encode) instead of esc_js for sanitizing JavaScript strings (thanks Nigel Fish)
  • Fix issue where the new feed button pointed to an example URL instead of the saved URL (thanks debij)
  • Resolve Follow widget notice when widget is empty in debug mode
Download this release

Release Info

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

Code changes from version 1.6.0.1 to 1.6.1

Files changed (4) hide show
  1. README.txt +18 -1
  2. add-to-any.php +15 -6
  3. addtoany.admin.php +1 -1
  4. addtoany.widgets.php +4 -4
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat, addtoany
3
  Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, google +1, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 4.3
6
- Stable tag: 1.6.0.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
@@ -253,6 +253,17 @@ If you use the Facebook Like, Twitter Tweet or Google +1 buttons in an HTML5 the
253
 
254
  Regardless of circumstances for passing W3C tests, the plugin will always output semantically valid and robot-readable code, so publishers do not have to worry about search engine crawler errors due to invalid code. Both <a href="https://en.wikipedia.org/wiki/Web_standards">web standards</a> and <a href="https://en.wikipedia.org/wiki/Cross-browser">cross-browser</a> compatibility are taken seriously.
255
 
 
 
 
 
 
 
 
 
 
 
 
256
  = Why does the menu appear behind embedded objects (like Flash)? =
257
 
258
  Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/wordpress/hide_embeds">hide intersecting embedded objects</a>.
@@ -272,6 +283,12 @@ Upload the plugin directory (including all files and directories within) to the
272
 
273
  == Changelog ==
274
 
 
 
 
 
 
 
275
  = 1.6.0.1 =
276
  * Resolve notices in debug mode
277
 
3
  Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, google +1, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 4.3
6
+ Stable tag: 1.6.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
253
 
254
  Regardless of circumstances for passing W3C tests, the plugin will always output semantically valid and robot-readable code, so publishers do not have to worry about search engine crawler errors due to invalid code. Both <a href="https://en.wikipedia.org/wiki/Web_standards">web standards</a> and <a href="https://en.wikipedia.org/wiki/Cross-browser">cross-browser</a> compatibility are taken seriously.
255
 
256
+ = How can I load the buttons after content insertion with AJAX and infinite scroll? =
257
+
258
+ Fire the standard `post-load` event to have the plugin initiate AddToAny buttons:
259
+ `jQuery( 'body' ).trigger( 'post-load' );`
260
+
261
+ A few prerequisites:
262
+
263
+ * The response has an `HTTP_X_REQUESTED_WITH` header set to `xmlhttprequest`
264
+ * `jQuery` available
265
+ * AddToAny script blocks in the response need to execute, so don't use jQuery's `load` method *with a selector expression*. Selector expression usage with that method will cause script blocks in the response <a href="https://api.jquery.com/load/#script-execution">to be stripped out</a>
266
+
267
  = Why does the menu appear behind embedded objects (like Flash)? =
268
 
269
  Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/wordpress/hide_embeds">hide intersecting embedded objects</a>.
283
 
284
  == Changelog ==
285
 
286
+ = 1.6.1 =
287
+ * Titles with special characters are sanitized differently
288
+ * Using `wp_json_encode` (or `json_encode`) instead of `esc_js` for sanitizing JavaScript strings (thanks Nigel Fish)
289
+ * Fix issue where the new feed button pointed to an example URL instead of the saved URL (thanks debij)
290
+ * Resolve Follow widget notice when widget is empty in debug mode
291
+
292
  = 1.6.0.1 =
293
  * Resolve notices in debug mode
294
 
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Share Buttons by AddToAny
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.6.0.1
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
@@ -266,7 +266,14 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
266
  // If Follow kit and HREF specified
267
  if ( $is_follow && isset( $service['href'] ) ) {
268
  $follow_id = $buttons[ $active_service ]['id'];
269
- $href = str_replace( '${id}', $follow_id, $service['href'] );
 
 
 
 
 
 
 
270
  // Else if Share Kit and HREF specified, presume custom service
271
  } elseif ( isset( $service['href'] ) ) {
272
  $custom_service = true;
@@ -435,8 +442,10 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
435
  . "url:location.href}";
436
  $_addtoany_targets[] = $button_config;
437
  } else {
438
- $button_config = "\n{title:'". esc_js($linkname) . "',"
439
- . "url:'" . $linkurl . "'}";
 
 
440
  $_addtoany_targets[] = $button_config;
441
  }
442
 
@@ -447,7 +456,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
447
  . $button_config
448
  . ");\n";
449
 
450
- if ( ! $_addtoany_init) {
451
  // Catch post-load event to support infinite scroll (and more?)
452
  $javascript_button_config .= "\nif('function'===typeof(jQuery))"
453
  . "jQuery(document).ready(function($){"
@@ -462,7 +471,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
462
  }
463
  else $javascript_button_config = '';
464
 
465
- if ( ! $_addtoany_init) {
466
  $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
467
  . "wpa2a.script_load();"
468
  . "\n//--></script>\n";
3
  Plugin Name: Share Buttons by AddToAny
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.6.1
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
266
  // If Follow kit and HREF specified
267
  if ( $is_follow && isset( $service['href'] ) ) {
268
  $follow_id = $buttons[ $active_service ]['id'];
269
+ if ( 'feed' == $safe_name ) {
270
+ // For "feed" service, stored ID value is actually the URL
271
+ $href = $follow_id;
272
+ } else {
273
+ // For all other services, replace
274
+ $href = str_replace( '${id}', $follow_id, $service['href'] );
275
+ }
276
+ $href = ( 'feed' == $safe_name ) ? $follow_id : $href ;
277
  // Else if Share Kit and HREF specified, presume custom service
278
  } elseif ( isset( $service['href'] ) ) {
279
  $custom_service = true;
442
  . "url:location.href}";
443
  $_addtoany_targets[] = $button_config;
444
  } else {
445
+ // wp_json_encode available since 4.1
446
+ $linkname_sanitized = function_exists( 'wp_json_encode' ) ? wp_json_encode ( $linkname ) : json_encode( $linkname );
447
+ $button_config = "\n{title:". $linkname_sanitized . ','
448
+ . 'url:"' . $linkurl . '"}';
449
  $_addtoany_targets[] = $button_config;
450
  }
451
 
456
  . $button_config
457
  . ");\n";
458
 
459
+ if ( ! $_addtoany_init ) {
460
  // Catch post-load event to support infinite scroll (and more?)
461
  $javascript_button_config .= "\nif('function'===typeof(jQuery))"
462
  . "jQuery(document).ready(function($){"
471
  }
472
  else $javascript_button_config = '';
473
 
474
+ if ( ! $_addtoany_init ) {
475
  $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
476
  . "wpa2a.script_load();"
477
  . "\n//--></script>\n";
addtoany.admin.php CHANGED
@@ -1018,7 +1018,7 @@ function A2A_SHARE_SAVE_admin_head() {
1018
  foreach ($active_services as $service) {
1019
  if ( $admin_services_saved )
1020
  $service = substr( $service, 7 ); // Remove a2a_wp_
1021
- $active_services_quoted .= '"' . esc_js( $service ) . '"';
1022
  if ( $service != $active_services_last )
1023
  $active_services_quoted .= ',';
1024
 
1018
  foreach ($active_services as $service) {
1019
  if ( $admin_services_saved )
1020
  $service = substr( $service, 7 ); // Remove a2a_wp_
1021
+ $active_services_quoted .= json_encode( $service );
1022
  if ( $service != $active_services_last )
1023
  $active_services_quoted .= ',';
1024
 
addtoany.widgets.php CHANGED
@@ -36,11 +36,11 @@ class A2A_SHARE_SAVE_Widget extends WP_Widget {
36
 
37
  $args = wp_parse_args( $args, $defaults );
38
  extract( $args );
39
- $title = apply_filters( 'widget_title', $instance['title'] );
40
 
41
  echo $before_widget;
42
 
43
- if ( $title ) {
 
44
  echo $before_title . $title . $after_title;
45
  }
46
 
@@ -101,11 +101,11 @@ class A2A_Follow_Widget extends WP_Widget {
101
 
102
  $args = wp_parse_args( $args, $defaults );
103
  extract( $args );
104
- $title = apply_filters( 'widget_title', $instance['title'] );
105
 
106
  echo $before_widget;
107
 
108
- if ( $title ) {
 
109
  echo $before_title . $title . $after_title;
110
  }
111
 
36
 
37
  $args = wp_parse_args( $args, $defaults );
38
  extract( $args );
 
39
 
40
  echo $before_widget;
41
 
42
+ if ( isset( $instance ) && ! empty( $instance['title'] ) ) {
43
+ $title = apply_filters( 'widget_title', $instance['title'] );
44
  echo $before_title . $title . $after_title;
45
  }
46
 
101
 
102
  $args = wp_parse_args( $args, $defaults );
103
  extract( $args );
 
104
 
105
  echo $before_widget;
106
 
107
+ if ( isset( $instance ) && ! empty( $instance['title'] ) ) {
108
+ $title = apply_filters( 'widget_title', $instance['title'] );
109
  echo $before_title . $title . $after_title;
110
  }
111