AddToAny Share Buttons - Version 1.6.2

Version Description

  • Support AJAX loading from admin-ajax.php
  • Fix Google+ follow button URL by removing the hardcoded + (thanks foxtucker)
    • Be sure to add the + to your ID if you have a Google+ custom URL.
  • Update CSS to fix alignment issues in some themes with button images and the Facebook Like button
  • Add small follow icons (Instagram, YouTube, Vimeo, Flickr, Foursquare, Behance, and RSS PNGs)
  • Add Known
  • Remove obsoleted detection of page.js versus feed.js
Download this release

Release Info

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

Code changes from version 1.6.1 to 1.6.2

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.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
@@ -99,7 +99,7 @@ In your Admin panel, go to `Settings` > `AddToAny`. Among other options, you can
99
 
100
  To place the buttons as a "widget" in your theme (if your theme supports WordPress Widgets), go to `Appearance` > `Widgets`, then drag AddToAny to an available Widget Area and click `Save`.
101
 
102
- To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one (or just a few) lines of JavaScript code into "Additional Options" box. The Additional Options box is in `Settings` > `AddToAny`.
103
 
104
  = Something is wrong. What should I try first? =
105
 
@@ -160,7 +160,7 @@ If you want to hardcode the shared current URL and modify the title (server-side
160
  } ?>`
161
 
162
  = How can I add a new custom standalone service? =
163
- You can create a plugin or customize the following PHP sample code to add to your theme's function.php file:
164
 
165
  `function addtoany_add_services( $services ) {
166
  $services['example_service'] = array(
@@ -222,7 +222,7 @@ add_filter( 'addtoany_sharing_disabled', 'addtoany_disable_sharing_on_my_custom_
222
 
223
  = How can I position a vertical floating share buttons bar relative to content? =
224
 
225
- In settings, disable the default placement of the Vertical Buttons. In your theme's file(s), find the parent element that you want to position the vertical bar to (the parent element should have a specified width), then add the following PHP sample code as a child of that parent element:
226
 
227
  `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_FLOATING' ) ) {
228
  ADDTOANY_SHARE_SAVE_FLOATING( array(
@@ -260,7 +260,7 @@ Fire the standard `post-load` event to have the plugin initiate AddToAny buttons
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
 
@@ -283,6 +283,15 @@ Upload the plugin directory (including all files and directories within) to the
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)
@@ -1292,6 +1301,9 @@ Upload the plugin directory (including all files and directories within) to the
1292
 
1293
  == Upgrade Notice ==
1294
 
 
 
 
1295
  = 1.6 =
1296
  Follow buttons are now available! Look for the AddToAny Follow widget in Appearance > Customize or Appearance > Widgets.
1297
 
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.2
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
99
 
100
  To place the buttons as a "widget" in your theme (if your theme supports WordPress Widgets), go to `Appearance` > `Widgets`, then drag AddToAny to an available Widget Area and click `Save`.
101
 
102
+ To further customize AddToAny, see the <a href="https://www.addtoany.com/buttons/customize/wordpress">WordPress sharing documentation</a> for the AddToAny plugin. Many customizations will have you copy & paste one or more lines of JavaScript code into "Additional Options" box. The Additional Options box is in `Settings` > `AddToAny`.
103
 
104
  = Something is wrong. What should I try first? =
105
 
160
  } ?>`
161
 
162
  = How can I add a new custom standalone service? =
163
+ You can create a plugin or customize the following example PHP code to add to your theme's function.php file:
164
 
165
  `function addtoany_add_services( $services ) {
166
  $services['example_service'] = array(
222
 
223
  = How can I position a vertical floating share buttons bar relative to content? =
224
 
225
+ In settings, disable the default placement of the Vertical Buttons. In your theme's file(s), find the parent element that you want to position the vertical bar to (the parent element should have a specified width), then add the following example PHP code as a child of that parent element:
226
 
227
  `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_FLOATING' ) ) {
228
  ADDTOANY_SHARE_SAVE_FLOATING( array(
260
 
261
  A few prerequisites:
262
 
263
+ * The request 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
 
283
 
284
  == Changelog ==
285
 
286
+ = 1.6.2 =
287
+ * Support AJAX loading from `admin-ajax.php`
288
+ * Fix Google+ follow button URL by removing the hardcoded `+` (thanks foxtucker)
289
+ * Be sure to add the `+` to your `ID` if you have a Google+ custom URL.
290
+ * Update CSS to fix alignment issues in some themes with button images and the Facebook Like button
291
+ * Add small follow icons (Instagram, YouTube, Vimeo, Flickr, Foursquare, Behance, and RSS PNGs)
292
+ * Add Known
293
+ * Remove obsoleted detection of page.js versus feed.js
294
+
295
  = 1.6.1 =
296
  * Titles with special characters are sanitized differently
297
  * Using `wp_json_encode` (or `json_encode`) instead of `esc_js` for sanitizing JavaScript strings (thanks Nigel Fish)
1301
 
1302
  == Upgrade Notice ==
1303
 
1304
+ = 1.6.2 =
1305
+ If you configured a Google+ follow button through an AddToAny Follow widget, the automatic `+` in your URL has been removed to permit default Google+ URLs which do not have a `+` preceding the ID number. Be sure to add the `+` back if you have a Google+ custom URL.
1306
+
1307
  = 1.6 =
1308
  Follow buttons are now available! Look for the AddToAny Follow widget in Appearance > Customize or Appearance > Widgets.
1309
 
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.1
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
@@ -434,9 +434,12 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
434
  // Hook to disable script output
435
  // Example: add_filter( 'addtoany_script_disabled', '__return_true' );
436
  $script_disabled = apply_filters( 'addtoany_script_disabled', false );
 
 
437
 
438
- // If not a feed, not admin, and script is not disabled
439
- if ( ! $is_feed && ! is_admin() && ! $script_disabled ) {
 
440
  if ($use_current_page) {
441
  $button_config = "\n{title:document.title,"
442
  . "url:location.href}";
@@ -450,7 +453,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
450
  }
451
 
452
  // If doing AJAX (the DOING_AJAX constant can be unreliable)
453
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
454
  $javascript_button_config = "<script type=\"text/javascript\"><!--\n"
455
  . "if(wpa2a.targets)wpa2a.targets.push("
456
  . $button_config
@@ -468,15 +471,17 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
468
  }
469
 
470
  $javascript_button_config .= "\n//--></script>\n";
 
 
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";
 
 
478
  }
479
- else $javascript_load_early = "";
480
 
481
  $button_html .= $javascript_load_early . $javascript_button_config;
482
  $_addtoany_init = true;
@@ -755,10 +760,8 @@ function A2A_SHARE_SAVE_head_script() {
755
  . "wpa2a.script_load=function(){};"
756
  . "},"
757
  . "script_onready:function(){"
758
- . "if(a2a.type=='page'){" // Check a2a internal var to ensure script loaded is page.js not feed.js
759
- . "wpa2a.script_ready=true;"
760
- . "if(wpa2a.html_done)wpa2a.init();"
761
- . "}"
762
  . "},"
763
  . "init:function(){"
764
  . "for(var i=0,el,target,targets=wpa2a.targets,length=targets.length;i<length;i++){"
@@ -1006,7 +1009,7 @@ function A2A_SHARE_SAVE_stylesheet() {
1006
  // Use stylesheet?
1007
  if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' && ! is_admin() ) {
1008
 
1009
- wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.9' );
1010
 
1011
  // wp_add_inline_style requires WP 3.3+
1012
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
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.2
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
434
  // Hook to disable script output
435
  // Example: add_filter( 'addtoany_script_disabled', '__return_true' );
436
  $script_disabled = apply_filters( 'addtoany_script_disabled', false );
437
+ // Doing AJAX? (the DOING_AJAX constant can be unreliable)
438
+ $ajax = ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false;
439
 
440
+ // If not a feed and script is not disabled,
441
+ // and not admin (unless doing AJAX, probably through admin-ajax.php)
442
+ if ( ! $is_feed && ! $script_disabled && ( ! is_admin() || $ajax ) ) {
443
  if ($use_current_page) {
444
  $button_config = "\n{title:document.title,"
445
  . "url:location.href}";
453
  }
454
 
455
  // If doing AJAX (the DOING_AJAX constant can be unreliable)
456
+ if ( $ajax ) {
457
  $javascript_button_config = "<script type=\"text/javascript\"><!--\n"
458
  . "if(wpa2a.targets)wpa2a.targets.push("
459
  . $button_config
471
  }
472
 
473
  $javascript_button_config .= "\n//--></script>\n";
474
+ } else {
475
+ $javascript_button_config = '';
476
  }
 
477
 
478
  if ( ! $_addtoany_init ) {
479
  $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
480
  . "wpa2a.script_load();"
481
  . "\n//--></script>\n";
482
+ } else {
483
+ $javascript_load_early = "";
484
  }
 
485
 
486
  $button_html .= $javascript_load_early . $javascript_button_config;
487
  $_addtoany_init = true;
760
  . "wpa2a.script_load=function(){};"
761
  . "},"
762
  . "script_onready:function(){"
763
+ . "wpa2a.script_ready=true;"
764
+ . "if(wpa2a.html_done)wpa2a.init();"
 
 
765
  . "},"
766
  . "init:function(){"
767
  . "for(var i=0,el,target,targets=wpa2a.targets,length=targets.length;i<length;i++){"
1009
  // Use stylesheet?
1010
  if ( ! isset( $options['inline_css'] ) || $options['inline_css'] != '-1' && ! is_admin() ) {
1011
 
1012
+ wp_enqueue_style( 'A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.10' );
1013
 
1014
  // wp_add_inline_style requires WP 3.3+
1015
  if ( '3.3' <= get_bloginfo( 'version' ) ) {
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{border:0;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;height:auto;opacity:1;overflow:hidden;vertical-align:top;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 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 span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{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{border:0;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:top;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 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{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.services.php CHANGED
@@ -190,6 +190,10 @@ $A2A_SHARE_SAVE_services = array(
190
  "name" => "Kindle It",
191
  "icon" => "kindle",
192
  ),
 
 
 
 
193
  "line" => array(
194
  "name" => "Line",
195
  "icon" => "line",
190
  "name" => "Kindle It",
191
  "icon" => "kindle",
192
  ),
193
+ "known" => array(
194
+ "name" => "Known",
195
+ "icon" => "known",
196
+ ),
197
  "line" => array(
198
  "name" => "Line",
199
  "icon" => "line",
icons/behance.png ADDED
Binary file
icons/feed.png ADDED
Binary file
icons/flickr.png ADDED
Binary file
icons/foursquare.png ADDED
Binary file
icons/instagram.png ADDED
Binary file
icons/known.png ADDED
Binary file
icons/vimeo.png ADDED
Binary file
icons/youtube.png ADDED
Binary file