AddToAny Share Buttons - Version 1.2.7.2

Version Description

  • Support infinite scrolling of post content in themes
  • Support AJAX loading (on a post-load event)
Download this release

Release Info

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

Code changes from version 1.2.7.1 to 1.2.7.2

Files changed (2) hide show
  1. README.txt +11 -6
  2. add-to-any.php +42 -11
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, sidebar, widget, email, e-mail, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, messenger, stumbleupon, technorati, lockerz, addthis, sexybookmarks, sociable, sharedaddy, shareaholic, icon, icons, vector, SVG, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.7
6
- Stable tag: 1.2.7.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
@@ -11,16 +11,16 @@ Share buttons for WordPress including AddToAny's universal sharing button, Faceb
11
 
12
  The WordPress sharing plugin to help people **share**, **bookmark**, and **email** your posts and pages using any service, such as Facebook, Twitter, Pinterest, Google, Reddit, Tumblr, StumbleUpon, LinkedIn, and well over 100 more sharing and social bookmarking sites.
13
 
 
 
 
 
14
  3rd party buttons include the **Facebook Like Button**, **Twitter Tweet Button**, **Pinterest Pin It Button**, **Google+ Share Button** and **Google +1 Button**.
15
 
16
  This sharing plugin lets you customize the AddToAny universal Smart Menu, which places the services visitors use at the top of the menu based on each visitor's usage.
17
 
18
- <a href="http://www.addtoany.com/" title="Sharing buttons">Share Buttons</a> (demo)
19
-
20
  The Email tab makes it easy to share via Google Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web-based emailer or desktop program.
21
 
22
- Social **share icons** let you optimize your blog posts & pages for specific social sites. Choose from over 100 individual services.
23
-
24
  * **New**: Large vector sharing buttons!
25
  * SVG sharing icons for the most popular services (and more to come)
26
  * Smart Menu & Kit with individual share links
@@ -29,7 +29,8 @@ Social **share icons** let you optimize your blog posts & pages for specific soc
29
  * WordPress optimized with asynchronous script loading
30
  * Localized in English, Chinese, Spanish, Arabic, French, Portuguese, Japanese, Italian, Dutch, Danish, Catalan, Persian, Russian, Turkish, Albanian, Romanian, Belarusian, Greek, Irish
31
  * Easily customizable for beginners or advanced users, and highly extensible for developers and designers
32
- * Many more publisher and user features!
 
33
 
34
  With **years of active development**, over **2.6 million downloads**, and **ongoing support from the community**, this plugin still strives to be the best WordPress plugin for sharing. Thanks for your feedback!
35
 
@@ -233,6 +234,10 @@ Upload the plugin directory (including all files and directories within) to the
233
 
234
  == Changelog ==
235
 
 
 
 
 
236
  = 1.2.7.1 =
237
  * Wrap addtoany shortcode with .addtoany_shortcode to enable specific styling
238
  * Add Flipboard
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, sidebar, widget, email, e-mail, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, messenger, stumbleupon, technorati, lockerz, addthis, sexybookmarks, sociable, sharedaddy, shareaholic, icon, icons, vector, SVG, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.7
6
+ Stable tag: 1.2.7.2
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more.
9
 
11
 
12
  The WordPress sharing plugin to help people **share**, **bookmark**, and **email** your posts and pages using any service, such as Facebook, Twitter, Pinterest, Google, Reddit, Tumblr, StumbleUpon, LinkedIn, and well over 100 more sharing and social bookmarking sites.
13
 
14
+ Social **share icons** let you optimize your blog posts & pages for specific social sites. Choose from over 100 individual services.
15
+
16
+ <a href="http://www.addtoany.com/" title="Sharing buttons">Share Buttons</a> (demo)
17
+
18
  3rd party buttons include the **Facebook Like Button**, **Twitter Tweet Button**, **Pinterest Pin It Button**, **Google+ Share Button** and **Google +1 Button**.
19
 
20
  This sharing plugin lets you customize the AddToAny universal Smart Menu, which places the services visitors use at the top of the menu based on each visitor's usage.
21
 
 
 
22
  The Email tab makes it easy to share via Google Gmail, Yahoo! Mail, Outlook.com (Hotmail), AOL Mail, and any other web-based emailer or desktop program.
23
 
 
 
24
  * **New**: Large vector sharing buttons!
25
  * SVG sharing icons for the most popular services (and more to come)
26
  * Smart Menu & Kit with individual share links
29
  * WordPress optimized with asynchronous script loading
30
  * Localized in English, Chinese, Spanish, Arabic, French, Portuguese, Japanese, Italian, Dutch, Danish, Catalan, Persian, Russian, Turkish, Albanian, Romanian, Belarusian, Greek, Irish
31
  * Easily customizable for beginners or advanced users, and highly extensible for developers and designers
32
+ * Supports theme features such as HTML5 & XHTML, widgets, infinte scroll, post formats
33
+ * Many more publisher and user features
34
 
35
  With **years of active development**, over **2.6 million downloads**, and **ongoing support from the community**, this plugin still strives to be the best WordPress plugin for sharing. Thanks for your feedback!
36
 
234
 
235
  == Changelog ==
236
 
237
+ = 1.2.7.2 =
238
+ * Support infinite scrolling of post content in themes
239
+ * Support AJAX loading (on a `post-load` event)
240
+
241
  = 1.2.7.1 =
242
  * Wrap addtoany shortcode with .addtoany_shortcode to enable specific styling
243
  * Add Flipboard
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.2.7.1
7
  Author: micropat
8
  Author URI: http://www.addtoany.com/
9
  */
@@ -106,7 +106,7 @@ function ADDTOANY_SHARE_SAVE_KIT( $args = false ) {
106
  $icon_size = ' a2a_kit_size_' . $options['icon_size'] . '';
107
 
108
  if ( ! isset($args['html_container_open'])) {
109
- $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . ' a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">';
110
  $args['is_kit'] = TRUE;
111
  }
112
  if ( ! isset($args['html_container_close']))
@@ -247,7 +247,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
247
 
248
  $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
249
  $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
250
- $_addtoany_targets = (isset($_addtoany_targets)) ? $_addtoany_targets : array();
251
 
252
  $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
253
 
@@ -272,7 +272,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
272
  if ( ! $args['is_kit']) {
273
  $_addtoany_counter++;
274
  $button_class = ' a2a_target';
275
- $button_id = ' id="wpa2a_' . $_addtoany_counter . '"';
276
  } else {
277
  $button_class = '';
278
  $button_id = '';
@@ -326,22 +326,44 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
326
  // If not a feed
327
  if( ! $is_feed ) {
328
  if ($use_current_page) {
329
- $_addtoany_targets[] = "\n{title:document.title,"
330
  . "url:location.href}";
 
331
  } else {
332
- $_addtoany_targets[] = "\n{title:'". esc_js($linkname) . "',"
333
  . "url:'" . $linkurl . "'}";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
 
335
 
336
  if ( ! $_addtoany_init) {
337
  $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
338
- . "wpa2a.script_load();"
339
  . "\n//--></script>\n";
340
  }
341
- else
342
- $javascript_load_early = "";
343
 
344
- $button_html .= $javascript_load_early;
345
  $_addtoany_init = TRUE;
346
  }
347
 
@@ -465,6 +487,7 @@ function A2A_SHARE_SAVE_head_script() {
465
  }
466
 
467
  $javascript_header = "\n" . '<script type="text/javascript">' . "<!--\n"
 
468
  . "var a2a_config=a2a_config||{},"
469
  . "wpa2a={done:false,"
470
  . "html_done:false,"
@@ -489,13 +512,20 @@ function A2A_SHARE_SAVE_head_script() {
489
  . "target=targets[i];"
490
  . "a2a_config.linkname=target.title;"
491
  . "a2a_config.linkurl=target.url;"
492
- . "if(el)a2a.init('page',{target:el});wpa2a.done=true;"
 
 
 
 
493
  . "}"
 
494
  . "}"
495
  . "};"
 
496
  . "a2a_config.tracking_callback=['ready',wpa2a.script_onready];"
497
  . A2A_menu_locale()
498
  . $script_configs
 
499
  . "\n//--></script>\n";
500
 
501
  echo $javascript_header;
@@ -519,6 +549,7 @@ function A2A_SHARE_SAVE_footer_script() {
519
  . "if(wpa2a.script_ready&&!wpa2a.done)wpa2a.init();" // External script may load before html_done=true, but will only init if html_done=true. So call wpa2a.init() if external script is ready, and if wpa2a.init() hasn't been called already. Otherwise, wait for callback to call wpa2a.init()
520
  . "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button. Fixes issues where first button code is processed internally but without actual code output
521
  . "\n//--></script>\n";
 
522
  echo $javascript_footer;
523
  }
524
 
3
  Plugin Name: Share Buttons by AddToAny
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, StumbleUpon and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.2.7.2
7
  Author: micropat
8
  Author URI: http://www.addtoany.com/
9
  */
106
  $icon_size = ' a2a_kit_size_' . $options['icon_size'] . '';
107
 
108
  if ( ! isset($args['html_container_open'])) {
109
+ $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . ' a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">'; // ID is later removed by JS (for AJAX)
110
  $args['is_kit'] = TRUE;
111
  }
112
  if ( ! isset($args['html_container_close']))
247
 
248
  $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
249
  $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
250
+ $_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();
251
 
252
  $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
253
 
272
  if ( ! $args['is_kit']) {
273
  $_addtoany_counter++;
274
  $button_class = ' a2a_target';
275
+ $button_id = ' id="wpa2a_' . $_addtoany_counter . '"'; // ID is later removed by JS (for AJAX)
276
  } else {
277
  $button_class = '';
278
  $button_id = '';
326
  // If not a feed
327
  if( ! $is_feed ) {
328
  if ($use_current_page) {
329
+ $button_config = "\n{title:document.title,"
330
  . "url:location.href}";
331
+ $_addtoany_targets[] = $button_config;
332
  } else {
333
+ $button_config = "\n{title:'". esc_js($linkname) . "',"
334
  . "url:'" . $linkurl . "'}";
335
+ $_addtoany_targets[] = $button_config;
336
+ }
337
+
338
+ if ( defined( 'DOING_AJAX' ) ) {
339
+ $javascript_button_config = "<script type=\"text/javascript\"><!--\n"
340
+ . "wpa2a.targets.push("
341
+ . $button_config
342
+ . ");\n";
343
+
344
+ if ( ! $_addtoany_init) {
345
+ // Catch post-load event to support infinite scroll (and more?)
346
+ $javascript_button_config .= "\nif('function'===typeof(jQuery))"
347
+ . "jQuery(document).ready(function($){"
348
+ . "$('body').on('post-load',function(){"
349
+ . "if(wpa2a.script_ready)wpa2a.init();"
350
+ . "wpa2a.script_load();" // Load external script if not already called
351
+ . "});"
352
+ . "});";
353
+ }
354
+
355
+ $javascript_button_config .= "\n//--></script>\n";
356
  }
357
+ else $javascript_button_config = '';
358
 
359
  if ( ! $_addtoany_init) {
360
  $javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
361
+ . "wpa2a.script_load();"
362
  . "\n//--></script>\n";
363
  }
364
+ else $javascript_load_early = "";
 
365
 
366
+ $button_html .= $javascript_load_early . $javascript_button_config;
367
  $_addtoany_init = TRUE;
368
  }
369
 
487
  }
488
 
489
  $javascript_header = "\n" . '<script type="text/javascript">' . "<!--\n"
490
+
491
  . "var a2a_config=a2a_config||{},"
492
  . "wpa2a={done:false,"
493
  . "html_done:false,"
512
  . "target=targets[i];"
513
  . "a2a_config.linkname=target.title;"
514
  . "a2a_config.linkurl=target.url;"
515
+ . "if(el){"
516
+ . "a2a.init('page',{target:el});"
517
+ . "el.id='';" // Remove ID so AJAX can reuse the same ID
518
+ . "}"
519
+ . "wpa2a.done=true;"
520
  . "}"
521
+ . "wpa2a.targets=[];" // Empty targets array so AJAX can reuse from index 0
522
  . "}"
523
  . "};"
524
+
525
  . "a2a_config.tracking_callback=['ready',wpa2a.script_onready];"
526
  . A2A_menu_locale()
527
  . $script_configs
528
+
529
  . "\n//--></script>\n";
530
 
531
  echo $javascript_header;
549
  . "if(wpa2a.script_ready&&!wpa2a.done)wpa2a.init();" // External script may load before html_done=true, but will only init if html_done=true. So call wpa2a.init() if external script is ready, and if wpa2a.init() hasn't been called already. Otherwise, wait for callback to call wpa2a.init()
550
  . "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button. Fixes issues where first button code is processed internally but without actual code output
551
  . "\n//--></script>\n";
552
+
553
  echo $javascript_footer;
554
  }
555