WordPress Share Buttons Plugin – AddThis - Version 1.6.3

Version Description

  • Added template tags. <?php do_action( 'addthis_widget' ); ?> in your template will print an AddThis button or toolbox, per your configuration.
  • Added clickback tracking.
  • Added "Automatic" language option. We'll auto-translate the AddThis button and menu into our supported languages depending on your users' settings.
Download this release

Release Info

Developer _mjk_
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 1.6.3
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.3

Files changed (2) hide show
  1. addthis_social_widget.php +32 -9
  2. readme.txt +14 -7
addthis_social_widget.php CHANGED
@@ -27,7 +27,7 @@ else return;
27
  * Plugin Name: AddThis Social Bookmarking Widget
28
  * Plugin URI: http://www.addthis.com
29
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
30
- * Version: 1.6.2
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com
@@ -42,7 +42,7 @@ $addthis_settings['username'] = '';
42
  $addthis_settings['fallback_username'] = '';
43
  $addthis_settings['style'] = 'share';
44
 
45
- $addthis_languages = array('af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese');
46
 
47
  $addthis_menu_types = array('static', 'dropdown', 'toolbox');
48
 
@@ -85,6 +85,12 @@ function addthis_get_wp_version() {
85
  return (float)substr(get_bloginfo('version'),0,3);
86
  }
87
 
 
 
 
 
 
 
88
 
89
  /**
90
  * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
@@ -164,6 +170,7 @@ function register_addthis_settings() {
164
  register_setting('addthis', 'addthis_username');
165
  register_setting('addthis', 'addthis_fallback_username');
166
  register_setting('addthis', 'addthis_password');
 
167
  register_setting('addthis', 'addthis_show_stats');
168
  register_setting('addthis', 'addthis_style');
169
  register_setting('addthis', 'addthis_sidebar_only');
@@ -172,6 +179,7 @@ function register_addthis_settings() {
172
  register_setting('addthis', 'addthis_showonpages');
173
  register_setting('addthis', 'addthis_showoncats');
174
  register_setting('addthis', 'addthis_showonhome');
 
175
  register_setting('addthis', 'addthis_showonarchives');
176
  register_setting('addthis', 'addthis_language');
177
  register_setting('addthis', 'addthis_brand');
@@ -201,7 +209,6 @@ function addthis_init()
201
  add_action('admin_print_scripts', 'addthis_print_script');
202
  }
203
 
204
- add_filter('the_content', 'addthis_social_widget');
205
  add_filter('admin_menu', 'addthis_admin_menu');
206
 
207
  add_option('addthis_username');
@@ -212,7 +219,9 @@ function addthis_init()
212
  add_option('addthis_product', 'menu');
213
  add_option('addthis_isdropdown', 'true');
214
  add_option('addthis_menu_type', (get_option('addthis_isdropdown') !== 'true' ? 'static' : 'dropdown'));
 
215
  add_option('addthis_showonhome', 'true');
 
216
  add_option('addthis_showonpages', 'false');
217
  add_option('addthis_showoncats', 'false');
218
  add_option('addthis_showonarchives', 'false');
@@ -221,14 +230,18 @@ function addthis_init()
221
  add_option('addthis_header_color');
222
  add_option('addthis_sidebar_only', 'false');
223
  add_option('addthis_brand');
224
- add_option('addthis_language', 'en');
225
 
226
  $addthis_settings['sidebar_only'] = get_option('addthis_sidebar_only') === 'true';
227
  $addthis_settings['showstats'] = get_option('addthis_show_stats') === 'true';
228
  $addthis_settings['showonhome'] = !(get_option('addthis_showonhome') !== 'true');
 
229
  $addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true';
230
  $addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true';
231
  $addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true';
 
 
 
232
 
233
  $product = get_option('addthis_product');
234
 
@@ -247,7 +260,7 @@ function addthis_init()
247
  $language = get_option('addthis_language');
248
  $addthis_settings['language'] = $language;
249
 
250
- $advopts = array('brand', 'language', 'header_background', 'header_color');
251
  $addthis_settings['customization'] = '';
252
  for ($i = 0; $i < count($advopts); $i++)
253
  {
@@ -307,7 +320,7 @@ function addthis_social_widget($content, $sidebar = false)
307
  $title = urlencode($sidebar ? get_bloginfo('title') : the_title('', '', false));
308
  $addthis_options = $addthis_settings['options'];
309
 
310
- $content .= "\n<!-- AddThis Button BEGIN -->\n".'<script type="text/javascript">';
311
 
312
  if (strlen($addthis_settings['customization']))
313
  {
@@ -318,14 +331,15 @@ function addthis_social_widget($content, $sidebar = false)
318
  {
319
  if (strlen($addthis_options)) $content .= "var addthis_options = '$addthis_options';\n";
320
  $content .= <<<EOF
 
321
  </script>
322
  <div class="addthis_container"><a href="http://www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
323
  EOF;
324
- $content .= addthis_get_button_img() . '</a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
325
  }
326
  else if ($addthis_settings['menu_type'] === 'toolbox')
327
  {
328
- $content .= "\n</script>\n";
329
  $content .= <<<EOF
330
  <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="http://www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
331
  EOF;
@@ -348,6 +362,7 @@ EOF;
348
  $content .= addthis_get_button_img() . '</a></div>';
349
  }
350
  $content .= "\n<!-- AddThis Button END -->";
 
351
  return $content;
352
  }
353
 
@@ -472,6 +487,10 @@ function addthis_plugin_options_php4() {
472
  <?php
473
  }
474
  ?>
 
 
 
 
475
  <tr>
476
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
477
  <td><input type="checkbox" name="addthis_showonhome" value="true" <?php echo (get_option('addthis_showonhome') == 'true' ? 'checked' : ''); ?>/></td>
@@ -488,6 +507,10 @@ function addthis_plugin_options_php4() {
488
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
489
  <td><input type="checkbox" name="addthis_showoncats" value="true" <?php echo (get_option('addthis_showoncats') == 'true' ? 'checked' : ''); ?>/></td>
490
  </tr>
 
 
 
 
491
  <tr valign="top">
492
  <td colspan="2"></td>
493
  </tr>
@@ -531,7 +554,7 @@ function addthis_plugin_options_php4() {
531
  if (addthis_get_wp_version() < 2.7) {
532
  ?>
533
  <input type="hidden" name="action" value="update" />
534
- <input type="hidden" name="page_options" value="addthis_username,addthis_password,addthis_show_stats,addthis_style,addthis_sidebar_only,addthis_menu_type,addthis_showonpages,addthis_showoncats,addthis_showonhome,addthis_showonarchives,addthis_language,addthis_brand,addthis_options,addthis_header_background,addthis_header_color"/>
535
  <?php
536
  }
537
  ?>
27
  * Plugin Name: AddThis Social Bookmarking Widget
28
  * Plugin URI: http://www.addthis.com
29
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
30
+ * Version: 1.6.3
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com
42
  $addthis_settings['fallback_username'] = '';
43
  $addthis_settings['style'] = 'share';
44
 
45
+ $addthis_languages = array(''=>'Automatic','af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese');
46
 
47
  $addthis_menu_types = array('static', 'dropdown', 'toolbox');
48
 
85
  return (float)substr(get_bloginfo('version'),0,3);
86
  }
87
 
88
+ /**
89
+ * For templates, we need a wrapper for printing out the code on demand.
90
+ */
91
+ function addthis_print_widget() {
92
+ echo addthis_social_widget('', true);
93
+ }
94
 
95
  /**
96
  * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
170
  register_setting('addthis', 'addthis_username');
171
  register_setting('addthis', 'addthis_fallback_username');
172
  register_setting('addthis', 'addthis_password');
173
+ register_setting('addthis', 'addthis_append_data');
174
  register_setting('addthis', 'addthis_show_stats');
175
  register_setting('addthis', 'addthis_style');
176
  register_setting('addthis', 'addthis_sidebar_only');
179
  register_setting('addthis', 'addthis_showonpages');
180
  register_setting('addthis', 'addthis_showoncats');
181
  register_setting('addthis', 'addthis_showonhome');
182
+ register_setting('addthis', 'addthis_showonposts');
183
  register_setting('addthis', 'addthis_showonarchives');
184
  register_setting('addthis', 'addthis_language');
185
  register_setting('addthis', 'addthis_brand');
209
  add_action('admin_print_scripts', 'addthis_print_script');
210
  }
211
 
 
212
  add_filter('admin_menu', 'addthis_admin_menu');
213
 
214
  add_option('addthis_username');
219
  add_option('addthis_product', 'menu');
220
  add_option('addthis_isdropdown', 'true');
221
  add_option('addthis_menu_type', (get_option('addthis_isdropdown') !== 'true' ? 'static' : 'dropdown'));
222
+ add_option('addthis_append_data', 'false');
223
  add_option('addthis_showonhome', 'true');
224
+ add_option('addthis_showonposts', 'true');
225
  add_option('addthis_showonpages', 'false');
226
  add_option('addthis_showoncats', 'false');
227
  add_option('addthis_showonarchives', 'false');
230
  add_option('addthis_header_color');
231
  add_option('addthis_sidebar_only', 'false');
232
  add_option('addthis_brand');
233
+ add_option('addthis_language', '');
234
 
235
  $addthis_settings['sidebar_only'] = get_option('addthis_sidebar_only') === 'true';
236
  $addthis_settings['showstats'] = get_option('addthis_show_stats') === 'true';
237
  $addthis_settings['showonhome'] = !(get_option('addthis_showonhome') !== 'true');
238
+ $addthis_settings['showonposts'] = !(get_option('addthis_showonposts') !== 'true');
239
  $addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true';
240
  $addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true';
241
  $addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true';
242
+
243
+ if ($addthis_settings['showonposts']) add_filter('the_content', 'addthis_social_widget'); // true by default
244
+ add_action( 'addthis_widget', 'addthis_print_widget');
245
 
246
  $product = get_option('addthis_product');
247
 
260
  $language = get_option('addthis_language');
261
  $addthis_settings['language'] = $language;
262
 
263
+ $advopts = array('brand', 'append_data', 'language', 'header_background', 'header_color');
264
  $addthis_settings['customization'] = '';
265
  for ($i = 0; $i < count($advopts); $i++)
266
  {
320
  $title = urlencode($sidebar ? get_bloginfo('title') : the_title('', '', false));
321
  $addthis_options = $addthis_settings['options'];
322
 
323
+ $content .= "\n<!-- AddThis Button BEGIN -->\n".'<script type="text/javascript">'."\n//<!--";
324
 
325
  if (strlen($addthis_settings['customization']))
326
  {
331
  {
332
  if (strlen($addthis_options)) $content .= "var addthis_options = '$addthis_options';\n";
333
  $content .= <<<EOF
334
+ //-->
335
  </script>
336
  <div class="addthis_container"><a href="http://www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
337
  EOF;
338
+ $content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
339
  }
340
  else if ($addthis_settings['menu_type'] === 'toolbox')
341
  {
342
+ $content .= "\n//-->\n</script>\n";
343
  $content .= <<<EOF
344
  <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="http://www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
345
  EOF;
362
  $content .= addthis_get_button_img() . '</a></div>';
363
  }
364
  $content .= "\n<!-- AddThis Button END -->";
365
+
366
  return $content;
367
  }
368
 
487
  <?php
488
  }
489
  ?>
490
+ <tr>
491
+ <th scope="row"><?php _e("Track <a href=\"http://www.addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/\" target=\"_blank\">clickbacks</a>:", 'addthis_trans_domain' ); ?></th>
492
+ <td><input type="checkbox" name="addthis_append_data" value="true" <?php echo (get_option('addthis_append_data') == 'true' ? 'checked' : ''); ?>/></td>
493
+ </tr>
494
  <tr>
495
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
496
  <td><input type="checkbox" name="addthis_showonhome" value="true" <?php echo (get_option('addthis_showonhome') == 'true' ? 'checked' : ''); ?>/></td>
507
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
508
  <td><input type="checkbox" name="addthis_showoncats" value="true" <?php echo (get_option('addthis_showoncats') == 'true' ? 'checked' : ''); ?>/></td>
509
  </tr>
510
+ <tr>
511
+ <th scope="row"><?php _e("Show at end of posts:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(insert <code>&lt;?php do_action( 'addthis_widget' ); ?&gt;</code> into your template to place it dynamically)</th>
512
+ <td><input type="checkbox" name="addthis_showonposts" value="true" <?php echo (get_option('addthis_showonposts') == 'true' ? 'checked' : ''); ?>/></td>
513
+ </tr>
514
  <tr valign="top">
515
  <td colspan="2"></td>
516
  </tr>
554
  if (addthis_get_wp_version() < 2.7) {
555
  ?>
556
  <input type="hidden" name="action" value="update" />
557
+ <input type="hidden" name="page_options" value="addthis_username,addthis_password,addthis_show_stats,addthis_style,addthis_sidebar_only,addthis_menu_type,addthis_showonpages,addthis_showoncats,addthis_showonhome,addthis_append_data,addthis_showonposts,addthis_showonarchives,addthis_language,addthis_brand,addthis_options,addthis_header_background,addthis_header_color"/>
558
  <?php
559
  }
560
  ?>
readme.txt CHANGED
@@ -3,16 +3,16 @@ Contributors: _mjk_
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
4
  Requires at least: 2.3
5
  Tested up to: 2.9.1
6
- Stable tag: 1.6.2
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
10
  == Description ==
11
- Help your visitor promote your site! The AddThis Social Bookmarking Widget allows your users to bookmark your site easily with over 200 popular <a href="http://www.addthis.com/services">services</a>, and to share it with friends via email. Our button is small, unobtrusive, quick to load and recognized all over the web.
12
 
13
  Sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
14
 
15
- Over 500,000 sites have installed AddThis. Join us!
16
 
17
  == Installation ==
18
 
@@ -45,10 +45,10 @@ If you've turned on the drop-down menu (which is recommended, as it's been shown
45
  1. It's free!
46
 
47
  = Who else uses AddThis? =
48
- Over 500,000 sites have installed AddThis. With over half a billion unique users, AddThis is helping share content all over the world, in more than sixty languages. You might be surprised who's sharing their website using AddThis--<a href="http://addthis.com/features#partners">here are just a few</a>.
49
 
50
  = What services does AddThis support? =
51
- We currently support over 200 services, from email and blogging platforms to social networks and news aggregators, and we add new services every month. Want to know if your favorite service is supported? This list is accurate up to the minute: <a href="http://www.addthis.com/services">http://www.addthis.com/services</a>.
52
 
53
  == Screenshots ==
54
 
@@ -64,6 +64,11 @@ PHP 5+ is preferred; PHP 4 is supported.
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
67
  = 1.6.2 =
68
  Fixed name conflict with get_wp_version() (renamed to addthis_get_wp_version()), affecting users with the k2 theme.
69
 
@@ -72,6 +77,8 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
72
 
73
  = 1.6.0 =
74
  * Added <a href="http://addthis.com/toolbox">toolbox</a> support
75
- For WP 2.7+ only:
76
- * Added support for displaying sharing analytics to WordPress dashboard
 
 
77
 
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
4
  Requires at least: 2.3
5
  Tested up to: 2.9.1
6
+ Stable tag: 1.6.3
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
10
  == Description ==
11
+ Help your visitor promote your site! The AddThis Social Bookmarking Widget allows your users to bookmark your site easily with over 250 popular <a href="http://www.addthis.com/services">services</a>, and to share it with friends via email. Our button is small, unobtrusive, quick to load and recognized all over the web.
12
 
13
  Sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
14
 
15
+ Over 900,000 sites have installed AddThis. Join us!
16
 
17
  == Installation ==
18
 
45
  1. It's free!
46
 
47
  = Who else uses AddThis? =
48
+ Over 900,000 sites have installed AddThis. With over half a billion unique users, AddThis is helping share content all over the world, in more than sixty languages. You might be surprised who's sharing their website using AddThis--<a href="http://addthis.com/features#partners">here are just a few</a>.
49
 
50
  = What services does AddThis support? =
51
+ We currently support over 250 services, from email and blogging platforms to social networks and news aggregators, and we add new services every month. Want to know if your favorite service is supported? This list is accurate up to the minute: <a href="http://www.addthis.com/services">http://www.addthis.com/services</a>.
52
 
53
  == Screenshots ==
54
 
64
 
65
  == Changelog ==
66
 
67
+ = 1.6.3 =
68
+ * Added template tags. &lt;?php do_action( 'addthis_widget' ); ?&gt; in your template will print an AddThis button or toolbox, per your configuration.
69
+ * Added <a href="http://addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/">clickback</a> tracking.
70
+ * Added "Automatic" language option. We'll auto-translate the AddThis button and menu into our supported languages depending on your users' settings.
71
+
72
  = 1.6.2 =
73
  Fixed name conflict with get_wp_version() (renamed to addthis_get_wp_version()), affecting users with the k2 theme.
74
 
77
 
78
  = 1.6.0 =
79
  * Added <a href="http://addthis.com/toolbox">toolbox</a> support
80
+ * Added WPMU support
81
+ * For WP 2.7+ only:
82
+ * Added support for displaying basic sharing metrics in the WordPress dashboard
83
+ * Updated settings management to use nonces
84