WordPress Share Buttons Plugin – AddThis - Version 2.4.0

Version Description

  • Refactor how we add code to pages which should eliminate how many times it is added
  • Numerous Bug Fixes and a few new filters
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.4.0

addthis_settings_functions.php CHANGED
@@ -19,6 +19,7 @@ function addthis_kses($string)
19
  $mytags = $allowedposttags;
20
  $mytags['a'][ 'gplusonesize' ] = array();
21
  $mytags['a'][ 'gplusonecount' ]= array();
 
22
  $mytags['a'][ 'fblikelayout' ]= array();
23
  $mytags['a'][ 'fblikesend' ]= array();
24
  $mytags['a'][ 'fblikeshow_faces' ]= array();
@@ -109,6 +110,8 @@ function addthis_kses($string)
109
  $checked = 'checked="checked"';
110
  $class = '';
111
  }
 
 
112
  echo "<div class='$name"."_option select_row $class '><span class='radio'><input $checked type='radio' value='".$k."' name='addthis_settings[$name]' /></span><img alt='".$k."' src='". $imgLocationBase . $v['img'] ."' align='left' /><div class='clear'></div></div>";
113
  }
114
 
@@ -117,31 +120,31 @@ function addthis_kses($string)
117
  if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ){
118
  $checked = 'checked="checked"';
119
  $class = '';
120
- }
121
-
122
- echo "<div class='$name"."_option select_row $class mt20'><span class='radio mt4'><input $checked type='radio' value='custom' name='addthis_settings[$name]' id='$name"."_custom_button' /></span> Build your own<div class='clear'></div></div>";
123
-
124
- echo "<ul class='$name"."_option_custom hidden'>";
125
- $custom_16 = ($custom_size == 16) ? 'selected="selected"' : '' ;
126
- $custom_32 = ($custom_size == 32) ? 'selected="selected"' : '' ;
127
-
128
- echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[$name"."_custom_size]'><option value='16' $custom_16 >16x16</option><option value='32' $custom_32 >32x32</option></select><br/><span class='description'>The size of the icons to display</span></li>";
129
- echo "<li><input $do_custom_services class='at_do_custom' type='checkbox' name='addthis_settings[$name"."_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[$name"."_custom_services]' value='$custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>";
130
- echo "<li><input type='checkbox' $do_custom_preferred class='at_do_custom' name='addthis_settings[$name"."_do_custom_preferred]' value='true' /><span class='at_custom_label'>Automatically personalized:</span>
131
- <select name='addthis_settings[$name"."_custom_preferred]' class='at_custom_input'>";
132
- for($i=0; $i <= 11; $i++)
133
- {
134
- $selected = '';
135
- if ($custom_preferred == $i)
136
- $selected = 'selected="selected"';
137
- echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
138
 
139
- }
140
- echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
141
- $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
142
-
143
- echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
144
- echo "</ul></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  $class = 'hidden';
147
  $checked = '';
@@ -152,12 +155,13 @@ function addthis_kses($string)
152
  }
153
 
154
  echo "<div class='$name"."_option select_row $class '><span class='radio mt4'><input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' /></span> Custom button<div class='clear'></div></div>";
155
- echo "<textarea rows='5' cols='120' name='addthis_settings[$name"."_custom_string]' id='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
 
156
 
157
  echo '</div>';
158
  ?>
159
- <div class="select_row description"><span class='radio mt0'><input type="radio" name="addthis_settings[<?php echo $name; ?>]" <?php echo ('none' == $option) ? 'checked="checked"' : '';?> value='none' /></span>None</div>
160
- <p><a class="<?php echo $name;?>_option" href="#<?php echo $name;?>_more" id="<?php echo $name;?>_more">More options</a></p>
161
 
162
  </fieldset>
163
  </td>
19
  $mytags = $allowedposttags;
20
  $mytags['a'][ 'gplusonesize' ] = array();
21
  $mytags['a'][ 'gplusonecount' ]= array();
22
+ $mytags['a'][ 'gplusoneannotation' ]= array();
23
  $mytags['a'][ 'fblikelayout' ]= array();
24
  $mytags['a'][ 'fblikesend' ]= array();
25
  $mytags['a'][ 'fblikeshow_faces' ]= array();
110
  $checked = 'checked="checked"';
111
  $class = '';
112
  }
113
+ if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true)
114
+ continue;
115
  echo "<div class='$name"."_option select_row $class '><span class='radio'><input $checked type='radio' value='".$k."' name='addthis_settings[$name]' /></span><img alt='".$k."' src='". $imgLocationBase . $v['img'] ."' align='left' /><div class='clear'></div></div>";
116
  }
117
 
120
  if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ){
121
  $checked = 'checked="checked"';
122
  $class = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
+ echo "<div class='$name"."_option select_row $class mt20'><span class='radio mt4'><input $checked type='radio' value='custom' name='addthis_settings[$name]' id='$name"."_custom_button' /></span> Build your own<div class='clear'></div></div>";
125
+
126
+ echo "<ul class='$name"."_option_custom hidden'>";
127
+ $custom_16 = ($custom_size == 16) ? 'selected="selected"' : '' ;
128
+ $custom_32 = ($custom_size == 32) ? 'selected="selected"' : '' ;
129
+
130
+ echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[$name"."_custom_size]'><option value='16' $custom_16 >16x16</option><option value='32' $custom_32 >32x32</option></select><br/><span class='description'>The size of the icons to display</span></li>";
131
+ echo "<li><input $do_custom_services class='at_do_custom' type='checkbox' name='addthis_settings[$name"."_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[$name"."_custom_services]' value='$custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>";
132
+ echo "<li><input type='checkbox' $do_custom_preferred class='at_do_custom' name='addthis_settings[$name"."_do_custom_preferred]' value='true' /><span class='at_custom_label'>Automatically personalized:</span>
133
+ <select name='addthis_settings[$name"."_custom_preferred]' class='at_custom_input'>";
134
+ for($i=0; $i <= 11; $i++)
135
+ {
136
+ $selected = '';
137
+ if ($custom_preferred == $i)
138
+ $selected = 'selected="selected"';
139
+ echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
140
+
141
+ }
142
+ echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
143
+ $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
144
+
145
+ echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
146
+ echo "</ul></div>";
147
+ }
148
 
149
  $class = 'hidden';
150
  $checked = '';
155
  }
156
 
157
  echo "<div class='$name"."_option select_row $class '><span class='radio mt4'><input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' /></span> Custom button<div class='clear'></div></div>";
158
+ _e( sprintf("<div style='max-width: 748px;' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name ),'addthis_trans_domain');
159
+ echo "<textarea style='max-width:748px;' rows='5' cols='120' name='addthis_settings[$name"."_custom_string]' class='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
160
 
161
  echo '</div>';
162
  ?>
163
+ <div class="select_row description"><span class='radio mt0'><input type="radio" class='always' name="addthis_settings[<?php echo $name; ?>]" <?php echo ('none' == $option) ? 'checked="checked"' : '';?> value='none' /></span>None</div>
164
+ <p><a class="<?php echo $name;?>_option" href="#<?php echo $name;?>_more" id="<?php echo $name;?>_more"><span>More options</span><span class='hidden'>Less options</span></a></p>
165
 
166
  </fieldset>
167
  </td>
addthis_social_widget.php CHANGED
@@ -2,7 +2,7 @@
2
  /* vim: set expandtab tabstop=4 shiftwidth=4: */
3
  /*
4
  * +--------------------------------------------------------------------------+
5
- * | Copyright (c) 2008-2009 Add This, LLC |
6
  * +--------------------------------------------------------------------------+
7
  * | This program is free software; you can redistribute it and/or modify |
8
  * | it under the terms of the GNU General Public License as published by |
@@ -19,21 +19,35 @@
19
  * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
20
  * +--------------------------------------------------------------------------+
21
  */
22
- if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
23
- else return;
24
-
25
  /**
26
  * Plugin Name: AddThis Social Bookmarking Widget
27
  * Plugin URI: http://www.addthis.com
28
  * 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.
29
- * Version: 2.3.2
30
  *
31
  * Author: The AddThis Team
32
  * Author URI: http://www.addthis.com/blog
33
  */
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  define( 'addthis_style_default' , 'small_toolbox_with_share');
36
- define( 'ADDTHIS_PLUGIN_VERSION', '2.3.2');
37
 
38
  $addthis_settings = array();
39
  $addthis_settings['isdropdown'] = 'true';
@@ -58,27 +72,28 @@ $addthis_styles = array(
58
  );
59
  $addthis_new_styles = array(
60
 
61
- 'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
 
 
62
  ), // 32x32
63
- 'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %s ><a class="addthis_button_google_plusone" g:plusone:size="medium" ></a><a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden'), // +1
64
- 'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="//addthis.com/bookmark.php?v=250&amp;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden'
65
- ), // Plus sign share | four buttons
66
- 'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => ''
67
  ), // 32x32
68
- 'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => 'hidden', 'below' => 'hidden'
69
- ), // facebook tweet share counter
70
- 'fb_tw_p1_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-p1-sc.jpg' , 'name' => 'Like, Tweet, +1, Share', 'above' => '', 'below' => 'hidden'
 
 
71
  ), // facebook tweet share counter
72
- 'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="//addthis.com/bookmark.php?v=250&amp;username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden'
73
  ), // Plus sign share
74
  'button' => array( 'src' => '<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" %s><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
75
  ), // classic
76
- 'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden'
77
  ),
78
  );
79
 
80
 
81
- add_filter('the_title', 'at_title_check');
82
  function at_title_check($title)
83
  {
84
 
@@ -121,6 +136,8 @@ function addthis_script_to_content($content)
121
  * Converts our old many options in to one beautiful array
122
  *
123
  */
 
 
124
  if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
125
  {
126
  function addthis_options_200()
@@ -221,6 +238,26 @@ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters(
221
  update_option( 'addthis_settings', $options);
222
 
223
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
 
226
 
@@ -229,9 +266,8 @@ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters(
229
  */
230
  function cuid()
231
  {
232
- $mt = dechex(mt_rand(0,min(0xffffffff,mt_getrandmax())));
233
- $now = dechex(time());
234
- $cuid = $now . str_pad($mt, 8, '0', STR_PAD_LEFT);
235
  return $cuid;
236
  }
237
 
@@ -439,11 +475,15 @@ add_action('wp_ajax_at_show_dashboard_widget', 'addthis_render_dashboard_widget'
439
  * @see js/addthis.css
440
  */
441
  function addthis_render_dashboard_widget() {
442
- if (! current_user_can('manage_options'))
443
- {
444
- _e( 'Cheatin&#8217; uh?' );
445
- exit;
446
- }
 
 
 
 
447
  $_services = array(
448
  'netvibes' => 'Netvibes',
449
  'google' => 'Google Reader',
@@ -726,7 +766,7 @@ die();
726
  */
727
  function addthis_dashboard_init() {
728
  $options = get_option('addthis_settings');
729
- if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) )
730
  wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
731
  }
732
 
@@ -854,9 +894,11 @@ elseif ($data['below'] == 'custom_string')
854
  }
855
 
856
 
 
 
857
 
858
  // All the checkbox fields
859
- foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508','addthis_copytracking1' ) as $field)
860
  {
861
  if ( isset($data[$field]) && $data[$field] == true)
862
  $options[$field] = true;
@@ -946,7 +988,7 @@ function addthis_add_content_filters()
946
  $options = get_option('addthis_settings');
947
 
948
  if ( ! empty( $options) ){
949
- if ($options['addthis_showonexcerpts'] == true )
950
  add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
951
 
952
  add_filter('the_content', 'addthis_display_social_widget', 15);
@@ -995,9 +1037,20 @@ function addthis_init()
995
  // Upgrade to 210 from 200
996
  if ( isset($options['username']) && ! isset($options['profile']) )
997
  addthis_options_210();
 
 
 
 
998
  }
999
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
1000
 
 
 
 
 
 
 
 
1001
  $product = get_option('addthis_product');
1002
 
1003
 
@@ -1291,15 +1344,23 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1291
 
1292
  }
1293
 
 
 
 
 
 
 
 
1294
 
1295
- add_action('wp_footer', 'addthis_output_script');
 
1296
 
1297
  /**
1298
  * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1299
  *
1300
  * @return mixed
1301
  */
1302
- function addthis_output_script($return = false )
1303
  {
1304
  global $addthis_settings;
1305
 
@@ -1310,7 +1371,7 @@ function addthis_output_script($return = false )
1310
 
1311
  $script = "\n<!-- AddThis Button Begin -->\n"
1312
  .'<script type="text/javascript">'
1313
- ."var addthis_product = 'wpp-264';\n";
1314
 
1315
 
1316
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
@@ -1318,7 +1379,6 @@ function addthis_output_script($return = false )
1318
  $pub = 'wp-'.cuid();
1319
  }
1320
  $pub = urlencode($pub);
1321
-
1322
 
1323
  $addthis_config = array();
1324
  $addthis_share = array();
@@ -1338,8 +1398,21 @@ function addthis_output_script($return = false )
1338
  else
1339
  $addthis_config["data_track_addressbar"] = false;
1340
 
 
 
 
 
 
 
 
1341
  if ( isset($options['addthis_copytracking1']) && $options['addthis_copytracking1'] == true)
1342
  $addthis_config['data_track_textcopy'] = false;
 
 
 
 
 
 
1343
 
1344
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1345
  $addthis_config['ui_language'] = $options['addthis_language'];
@@ -1375,11 +1448,40 @@ function addthis_output_script($return = false )
1375
  $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1376
  $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1377
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1378
  if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1379
  $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
1380
  else
1381
  $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1382
  $script .= '</script>';
 
1383
 
1384
  $script .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1385
 
@@ -1397,6 +1499,7 @@ function addthis_output_script($return = false )
1397
  */
1398
  function addthis_social_widget($content, $onSidebar = false, $url = null, $title = null)
1399
  {
 
1400
  global $addthis_settings;
1401
 
1402
  // add nothing to RSS feed or search results; control adding to static/archive/category pages
@@ -1548,7 +1651,7 @@ function addthis_admin_menu()
1548
  'password' => '',
1549
  'style' => addthis_style_default ,
1550
  'location' => 'below',
1551
- 'below' => 'large_toolbox',
1552
  'above' => 'fb_tw_p1_sc',
1553
  'addthis_show_stats' => true,
1554
  'addthis_append_data'=> true,
@@ -1558,6 +1661,7 @@ function addthis_admin_menu()
1558
  'addthis_showoncats' => true,
1559
  'addthis_addressbar' => false,
1560
  'addthis_copytracking1' => false,
 
1561
  'addthis_brand' => '',
1562
  'toolbox' => '',
1563
  'addthis_language' => '',
@@ -1651,15 +1755,15 @@ function addthis_plugin_options_php4() {
1651
  <table class="form-table" style="width:400px;">
1652
  <tbody>
1653
  <tr valign="top">
1654
- <td><?php _e("AddThis profile ID:", 'addthis_trans_domain' ); ?></th>
1655
  <td><input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' /></td>
1656
  </tr>
1657
  <tr valign="top">
1658
- <td><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
1659
  <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
1660
  </tr>
1661
  <tr id="password_row" >
1662
- <td><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
1663
  <td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
1664
  </tr>
1665
  </tbody>
@@ -1670,54 +1774,52 @@ function addthis_plugin_options_php4() {
1670
 
1671
  <div id="tabs-2">
1672
  <table class="form-table">
1673
- <tr>
1674
- <th scope="row"><?php _e("Show stats in admin dashboard:", 'addthis_trans_domain' ); ?></th>
1675
- <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1676
- </tr>
1677
- <tr>
1678
- <th scope="row"><?php _e("Track <a href=\"//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>
1679
- <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1680
- </tr>
1681
- <tr>
1682
- <th scope="row"><?php _e("Track address bar shares:", 'addthis_trans_domain' ); ?></th>
1683
- <td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
1684
- </tr>
1685
- <tr>
1686
- <th scope="row"><?php _e("Opt Out of copy text tracking:", 'addthis_trans_domain' ); ?></th>
1687
- <td><input type="checkbox" name="addthis_settings[addthis_copytracking1]" value="true" <?php echo ( $addthis_copytracking1 == true ? 'checked="checked"' : ''); ?>/></td>
1688
- </tr>
1689
- <tr>
1690
- <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1691
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1692
  </tr>
1693
  <tr>
1694
- <th scope="row"><?php _e("Show on <a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1695
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1696
  </tr>
1697
  <tr>
1698
- <th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
1699
  <td><input type="checkbox" name="addthis_settings[addthis_showonarchives]" value="true" <?php echo ($addthis_showonarchives == true ? 'checked="checked"' : ''); ?>/></td>
1700
  </tr>
1701
  <tr>
1702
- <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
1703
  <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
1704
  </tr>
1705
  <tr>
1706
- <th scope="row"><?php _e("Show on excerpts:", 'addthis_trans_domain' ); ?></th>
1707
  <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
1708
  </tr>
 
 
 
1709
  <tr>
1710
- <th scope="row"><?php _e("Enable enhanced accessibility:", 'addthis_trans_domain' ); ?></th>
1711
- <td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
1712
  </tr>
1713
  <tr>
1714
- <th scope="row"><?php _e("Google Analytics property ID:", 'addthis_trans_domain' ); ?></th>
1715
- <td><input type="text" name="addthis_settings[data_ga_property]" value="<?php echo $data_ga_property ?>"/></td>
1716
  </tr>
1717
-
1718
- <tr valign="top">
1719
- <td colspan="2"></td>
 
 
 
 
 
1720
  </tr>
 
 
 
1721
  <tr valign="top">
1722
  <td colspan="2">For more details on the following options, see <a href="//addthis.com/customization">our customization documentation</a>.</td>
1723
  </tr>
@@ -1738,14 +1840,7 @@ function addthis_plugin_options_php4() {
1738
  <th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template:</a><br/><span class='description'>(not for tweet button)</span>", 'addthis_trans_domain' ); ?></th>
1739
  <td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
1740
  </tr>
1741
- <tr valign="top">
1742
- <th scope="row"><?php _e("Bitly login:", 'addthis_trans_domain' ); ?></th>
1743
- <td><input type="text" name="addthis_settings[addthis_bitly_login]" value="<?php echo $addthis_bitly_login; ?>" /></td>
1744
- </tr>
1745
- <tr valign="top">
1746
- <th scope="row"><?php _e("Bitly key:", 'addthis_trans_domain' ); ?></th>
1747
- <td><input type="text" name="addthis_settings[addthis_bitly_key]" value="<?php echo $addthis_bitly_key; ?>" /></td>
1748
- </tr>
1749
  <tr valign="top">
1750
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1751
  <td>
@@ -1768,6 +1863,35 @@ function addthis_plugin_options_php4() {
1768
  <th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
1769
  <td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
1770
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1771
  <tr valign="top">
1772
  <th scope="row"><?php _e("addthis_config values:<br/><span class=\"description\">(json format)</span>", 'addthis_trans_domain' ); ?></th>
1773
  <td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_config_json]" /><?php echo $addthis_config_json; ?></textarea></td>
2
  /* vim: set expandtab tabstop=4 shiftwidth=4: */
3
  /*
4
  * +--------------------------------------------------------------------------+
5
+ * | Copyright (c) 2008-2012 Add This, LLC |
6
  * +--------------------------------------------------------------------------+
7
  * | This program is free software; you can redistribute it and/or modify |
8
  * | it under the terms of the GNU General Public License as published by |
19
  * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
20
  * +--------------------------------------------------------------------------+
21
  */
 
 
 
22
  /**
23
  * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
  * 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.
26
+ * Version: 2.4.0
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
30
  */
31
 
32
+ if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
33
+ else return;
34
+
35
+
36
+ // Setup our shared resources early
37
+ add_action('init', 'addthis_early', 1);
38
+ function addthis_early(){
39
+ global $addthis_addjs;
40
+
41
+ if (! isset($addthis_addjs)){
42
+ require('includes/addthis_addjs.php');
43
+ $addthis_options = get_option('addthis_settings');
44
+ $addthis_addjs = new AddThis_addjs($addthis_options);
45
+ }
46
+ }
47
+
48
+
49
  define( 'addthis_style_default' , 'small_toolbox_with_share');
50
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.4.0');
51
 
52
  $addthis_settings = array();
53
  $addthis_settings['isdropdown'] = 'true';
72
  );
73
  $addthis_new_styles = array(
74
 
75
+ 'fb_tw_p1_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-p1-sc.jpg' , 'name' => 'Like, Tweet, +1, Share', 'above' => '', 'below' => ''
76
+ ), // facebook tweet plus 1 share counter
77
+ 'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => 'hidden'
78
  ), // 32x32
79
+ 'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
 
 
 
80
  ), // 32x32
81
+ 'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %s ><a class="addthis_button_google_plusone" g:plusone:size="medium" ></a><a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden' , 'defaultHide' => true
82
+ ), // +1
83
+ 'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="//addthis.com/bookmark.php?v=250&amp;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden' , 'defaultHide' => true
84
+ ), // Plus sign share | four buttons
85
+ 'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => 'hidden', 'below' => 'hidden', 'defaultHide' => true
86
  ), // facebook tweet share counter
87
+ 'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="//addthis.com/bookmark.php?v=250&amp;username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden', 'defaultHide' => true
88
  ), // Plus sign share
89
  'button' => array( 'src' => '<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" %s><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
90
  ), // classic
91
+ 'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden' , 'defaultHide' => true
92
  ),
93
  );
94
 
95
 
96
+ //add_filter('the_title', 'at_title_check');
97
  function at_title_check($title)
98
  {
99
 
136
  * Converts our old many options in to one beautiful array
137
  *
138
  */
139
+
140
+ // Caution: Using this filter to disable upgrades may have unexpected consiquences.
141
  if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
142
  {
143
  function addthis_options_200()
238
  update_option( 'addthis_settings', $options);
239
 
240
  }
241
+
242
+ function addthis_options_240()
243
+ {
244
+ $options = get_option('addthis_settings');
245
+
246
+ // Add An option for the AT Version
247
+ $options['atversion'] = '250';
248
+
249
+ //$options['wpfooter'] = false;
250
+ update_option( 'addthis_settings', $options);
251
+
252
+ }
253
+ }
254
+
255
+ function addthis_add_for_check_footer() {
256
+
257
+ }
258
+
259
+ function addthis_check_footer() {
260
+
261
  }
262
 
263
 
266
  */
267
  function cuid()
268
  {
269
+ $base = home_url();
270
+ $cuid = hash_hmac('md5', $base, 'addthis');
 
271
  return $cuid;
272
  }
273
 
475
  * @see js/addthis.css
476
  */
477
  function addthis_render_dashboard_widget() {
478
+ if( current_user_can('manage_options') || apply_filter('addthis_show_dashboard', __return_false() ) )
479
+ {
480
+ // we're good
481
+ }
482
+ else
483
+ {
484
+ _e( 'Cheatin&#8217; uh?' );
485
+ exit;
486
+ }
487
  $_services = array(
488
  'netvibes' => 'Netvibes',
489
  'google' => 'Google Reader',
766
  */
767
  function addthis_dashboard_init() {
768
  $options = get_option('addthis_settings');
769
+ if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) && (current_user_can('manage_options') || apply_filter('addthis_show_dashboard', __return_false() ) ) )
770
  wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
771
  }
772
 
894
  }
895
 
896
 
897
+ if (isset($data['addthis_copytrackingremove']) && $data['addthis_copytrackingremove'] == true)
898
+ unset($data['addthis_copytracking1']);
899
 
900
  // All the checkbox fields
901
+ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508','addthis_copytracking2' ) as $field)
902
  {
903
  if ( isset($data[$field]) && $data[$field] == true)
904
  $options[$field] = true;
988
  $options = get_option('addthis_settings');
989
 
990
  if ( ! empty( $options) ){
991
+ if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
992
  add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
993
 
994
  add_filter('the_content', 'addthis_display_social_widget', 15);
1037
  // Upgrade to 210 from 200
1038
  if ( isset($options['username']) && ! isset($options['profile']) )
1039
  addthis_options_210();
1040
+
1041
+ // Upgrade to 240 and add at 300
1042
+ if ( ! isset($options['atversion']) )
1043
+ addthis_options_240();
1044
  }
1045
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
1046
 
1047
+
1048
+
1049
+ }
1050
+
1051
+ function addthis_set_addthis_settings()
1052
+ {
1053
+ global $addthis_settings;
1054
  $product = get_option('addthis_product');
1055
 
1056
 
1344
 
1345
  }
1346
 
1347
+ add_action('init', 'addthis_register_script_in_addjs', 20);
1348
+
1349
+ function addthis_register_script_in_addjs(){
1350
+ global $addthis_addjs;
1351
+ $script = addthis_output_script(true, true);
1352
+ $addthis_addjs->addToScript($script);
1353
+ }
1354
 
1355
+
1356
+ //add_action('wp_footer', 'addthis_output_script');
1357
 
1358
  /**
1359
  * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1360
  *
1361
  * @return mixed
1362
  */
1363
+ function addthis_output_script($return = false, $justConfig = false )
1364
  {
1365
  global $addthis_settings;
1366
 
1371
 
1372
  $script = "\n<!-- AddThis Button Begin -->\n"
1373
  .'<script type="text/javascript">'
1374
+ ."var addthis_product = 'wpp-263';\n";
1375
 
1376
 
1377
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1379
  $pub = 'wp-'.cuid();
1380
  }
1381
  $pub = urlencode($pub);
 
1382
 
1383
  $addthis_config = array();
1384
  $addthis_share = array();
1398
  else
1399
  $addthis_config["data_track_addressbar"] = false;
1400
 
1401
+ // Opt in
1402
+ if ( isset($options['addthis_copytracking2']) && $options['addthis_copytracking2'] == true)
1403
+ $addthis_config['data_track_textcopy'] = true;
1404
+ else
1405
+ $addthis_config['data_track_textcopy'] = false;
1406
+
1407
+ // Old opt out
1408
  if ( isset($options['addthis_copytracking1']) && $options['addthis_copytracking1'] == true)
1409
  $addthis_config['data_track_textcopy'] = false;
1410
+ // Opt in
1411
+ else if ( isset($options['addthis_copytracking2']) && $options['addthis_copytracking2'] == true)
1412
+ $addthis_config['data_track_textcopy'] = true;
1413
+ else
1414
+ $addthis_config['data_track_textcopy'] = false;
1415
+
1416
 
1417
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1418
  $addthis_config['ui_language'] = $options['addthis_language'];
1448
  $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1449
  $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1450
  }
1451
+
1452
+ if ($justConfig)
1453
+ {
1454
+ $return = '';
1455
+ if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1456
+ $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
1457
+ else
1458
+ $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1459
+
1460
+ $return .= "\n";
1461
+
1462
+ if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1463
+ $return .= 'var addthis_options = "'.$options['addthis_options'].'";';
1464
+
1465
+ $return .= "\n";
1466
+ if ( isset( $options['addthis_config_json'] ) && $options['addthis_config_json'] != '')
1467
+ $return .= 'var addthis_config = '. $options['addthis_config_json'] .';';
1468
+ elseif (! empty ($addthis_config) )
1469
+ $return .= 'var addthis_config = '. json_encode($addthis_config) .';';
1470
+
1471
+ $return .= "\n";
1472
+
1473
+
1474
+ return $return;
1475
+
1476
+ }
1477
+
1478
+
1479
  if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1480
  $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
1481
  else
1482
  $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1483
  $script .= '</script>';
1484
+
1485
 
1486
  $script .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1487
 
1499
  */
1500
  function addthis_social_widget($content, $onSidebar = false, $url = null, $title = null)
1501
  {
1502
+ addthis_set_addthis_settings();
1503
  global $addthis_settings;
1504
 
1505
  // add nothing to RSS feed or search results; control adding to static/archive/category pages
1651
  'password' => '',
1652
  'style' => addthis_style_default ,
1653
  'location' => 'below',
1654
+ 'below' => 'fb_tw_p1_sc',
1655
  'above' => 'fb_tw_p1_sc',
1656
  'addthis_show_stats' => true,
1657
  'addthis_append_data'=> true,
1661
  'addthis_showoncats' => true,
1662
  'addthis_addressbar' => false,
1663
  'addthis_copytracking1' => false,
1664
+ 'addthis_copytracking2' => false,
1665
  'addthis_brand' => '',
1666
  'toolbox' => '',
1667
  'addthis_language' => '',
1755
  <table class="form-table" style="width:400px;">
1756
  <tbody>
1757
  <tr valign="top">
1758
+ <td><?php _e("AddThis profile ID:", 'addthis_trans_domain' ); ?></td>
1759
  <td><input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' /></td>
1760
  </tr>
1761
  <tr valign="top">
1762
+ <td><?php _e("AddThis email / username:", 'addthis_trans_domain' ); ?></td>
1763
  <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
1764
  </tr>
1765
  <tr id="password_row" >
1766
+ <td><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></td>
1767
  <td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
1768
  </tr>
1769
  </tbody>
1774
 
1775
  <div id="tabs-2">
1776
  <table class="form-table">
1777
+ <tr>
1778
+ <th><h2>Show AddThis on &hellip;</h2></th>
1779
+
1780
+ </tr>
1781
+ <th scope="row"><?php _e("homepage:", 'addthis_trans_domain' ); ?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
1782
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1783
  </tr>
1784
  <tr>
1785
+ <th scope="row"><?php _e("<a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1786
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1787
  </tr>
1788
  <tr>
1789
+ <th scope="row"><?php _e("archives:", 'addthis_trans_domain' ); ?></th>
1790
  <td><input type="checkbox" name="addthis_settings[addthis_showonarchives]" value="true" <?php echo ($addthis_showonarchives == true ? 'checked="checked"' : ''); ?>/></td>
1791
  </tr>
1792
  <tr>
1793
+ <th scope="row"><?php _e("categories:", 'addthis_trans_domain' ); ?></th>
1794
  <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
1795
  </tr>
1796
  <tr>
1797
+ <th scope="row"><?php _e("excerpts:", 'addthis_trans_domain' ); ?></th>
1798
  <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
1799
  </tr>
1800
+ <tr>
1801
+ <th><h2>Have AddThis track &hellip;</h2></th>
1802
+ </tr>
1803
  <tr>
1804
+ <th scope="row"><?php _e("<a href=\"//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>
1805
+ <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1806
  </tr>
1807
  <tr>
1808
+ <th scope="row"><?php _e("address bar shares:", 'addthis_trans_domain' ); ?></th>
1809
+ <td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
1810
  </tr>
1811
+ <tr>
1812
+ <th scope="row"><?php _e("copied text:", 'addthis_trans_domain' ); ?></th>
1813
+ <?php if (isset( $addthis_copytracking1 ) && $addthis_copytracking1 == true){
1814
+ echo "<input type='hidden' name='addthis_settings[addthis_copytrackingremove' value='true'/>";
1815
+ $addthis_copytracking2 = false;
1816
+ }?>
1817
+ <!-- <td><input type="checkbox" name="addthis_settings[addthis_copytracking1]" value="true" <?php echo ( $addthis_copytracking1 == true ? 'checked="checked"' : ''); ?>/></td> -->
1818
+ <td><input type="checkbox" name="addthis_settings[addthis_copytracking2]" value="true" <?php echo ( $addthis_copytracking2 == true ? 'checked="checked"' : ''); ?>/></td>
1819
  </tr>
1820
+ <tr>
1821
+ <th><h2>Display Options</h2></th>
1822
+ </tr>
1823
  <tr valign="top">
1824
  <td colspan="2">For more details on the following options, see <a href="//addthis.com/customization">our customization documentation</a>.</td>
1825
  </tr>
1840
  <th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template:</a><br/><span class='description'>(not for tweet button)</span>", 'addthis_trans_domain' ); ?></th>
1841
  <td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
1842
  </tr>
1843
+
 
 
 
 
 
 
 
1844
  <tr valign="top">
1845
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1846
  <td>
1863
  <th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
1864
  <td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
1865
  </tr>
1866
+
1867
+ <tr>
1868
+ <th><h2>Additional Options</h2></th>
1869
+ </tr>
1870
+ <tr>
1871
+ <th scope="row"><?php _e("Show analytics in admin dashboard:", 'addthis_trans_domain' ); ?></th>
1872
+ <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1873
+ </tr>
1874
+ <tr>
1875
+ <tr>
1876
+ <th scope="row"><?php _e("Enable enhanced accessibility:", 'addthis_trans_domain' ); ?></th>
1877
+ <td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
1878
+ </tr>
1879
+ <tr>
1880
+ <th scope="row"><?php _e("Google Analytics property ID:", 'addthis_trans_domain' ); ?></th>
1881
+ <td><input type="text" name="addthis_settings[data_ga_property]" value="<?php echo $data_ga_property ?>"/></td>
1882
+ </tr>
1883
+
1884
+ <tr valign="top">
1885
+ <td colspan="2"></td>
1886
+ </tr>
1887
+ <tr valign="top">
1888
+ <th scope="row"><?php _e("Bitly login:", 'addthis_trans_domain' ); ?></th>
1889
+ <td><input type="text" name="addthis_settings[addthis_bitly_login]" value="<?php echo $addthis_bitly_login; ?>" /></td>
1890
+ </tr>
1891
+ <tr valign="top">
1892
+ <th scope="row"><?php _e("Bitly key:", 'addthis_trans_domain' ); ?></th>
1893
+ <td><input type="text" name="addthis_settings[addthis_bitly_key]" value="<?php echo $addthis_bitly_key; ?>" /></td>
1894
+ </tr>
1895
  <tr valign="top">
1896
  <th scope="row"><?php _e("addthis_config values:<br/><span class=\"description\">(json format)</span>", 'addthis_trans_domain' ); ?></th>
1897
  <td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_config_json]" /><?php echo $addthis_config_json; ?></textarea></td>
css/options-page.css CHANGED
@@ -91,6 +91,9 @@ ul.nav-tab-wrapper li.ui-tabs-selected{
91
  .submit a {
92
  margin-left: 20px;
93
  }
 
 
 
94
 
95
 
96
 
91
  .submit a {
92
  margin-left: 20px;
93
  }
94
+ .form-table tr th h2{
95
+ width: 240px;
96
+ }
97
 
98
 
99
 
includes/addthis_addjs.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ Class AddThis_addjs{
4
+ /**
5
+ * var bool check to see if we have added our JS already. Ensures that we don't add it twice
6
+ */
7
+ private $_js_added;
8
+
9
+ private $_options;
10
+
11
+ private $_cuid;
12
+
13
+ var $pubid;
14
+
15
+ var $jsToAdd;
16
+
17
+ var $atversion;
18
+
19
+ var $productCode;
20
+
21
+ const addjs_version = 1;
22
+
23
+ /**
24
+ *
25
+ */
26
+ public function __construct ($options){
27
+ if ( did_action('addthis_addjs_created') !== 0){
28
+ _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first' );
29
+ }
30
+
31
+ $this->productCode = '';
32
+
33
+ // Version of AddThis code to use
34
+ $this->atversion = '250';
35
+
36
+ // We haven't added our JS yet. Or at least better not have.
37
+ $this->_js_added = false;
38
+
39
+ $this->_options = $options;
40
+
41
+ // set the cuid
42
+ $base = home_url();
43
+ $cuid = hash_hmac('md5', $base, 'addthis');
44
+ $this->_cuid = $cuid;
45
+
46
+ // If the footer option isn't set, check for it
47
+ if (! isset($this->options['wpfooter']) && current_user_can('manage_options'))
48
+ {
49
+ add_action('admin_init',array($this, 'update_wpfooter'));
50
+ }
51
+
52
+ $this->pubid = $this->getProfileId();
53
+
54
+ // on theme swich, check for footer again
55
+ add_action('switch_theme', array($this, 'switch_theme'));
56
+
57
+ // In order for our wp_footer magic to work, we need to sometimes add our stuff
58
+ add_action('init', array($this, 'maybe_add_footer_comment'));
59
+
60
+
61
+ // Footer
62
+ if ( isset($this->_options['wpfooter']) && $this->_options['wpfooter'])
63
+ add_action('wp_footer', array($this, 'output_script') );
64
+ else
65
+ add_filter('the_content', array($this, 'output_script_filter') );
66
+
67
+ do_action('addthis_addjs_created');
68
+ }
69
+
70
+ function output_script(){
71
+ if ($this->_js_added != true)
72
+ {
73
+ $this->wrapJs();
74
+ $this->addWidgetToJs();
75
+ echo $this->jsToAdd;
76
+ $this->_js_added = true;
77
+ }
78
+ }
79
+
80
+ function output_script_filter($content){
81
+ if ($this->_js_added != true && ! is_admin() && ! is_feed() )
82
+ {
83
+ $this->wrapJs();
84
+ $this->addWidgetToJs();
85
+ $content = $content . $this->jsToAdd;
86
+ $this->_js_added = true;
87
+ }
88
+ return $content;
89
+ }
90
+
91
+ function wrapJs(){
92
+ $this->jsToAdd = '<script type="text/javascript">' . $this->jsToAdd . '</script>';
93
+ }
94
+
95
+ /* testing for wp_footer in a theme stuff */
96
+ function update_wpfooter(){
97
+ $footer = $this->check_for_footer();
98
+ $options = $this->_options;
99
+ $options['wpfooter'] = $footer;
100
+ update_option( 'addthis_settings', $options);
101
+ $this->_options = $options;
102
+ }
103
+
104
+ function check_for_footer(){
105
+ $url = add_query_arg( array( 'attest' => 'true') , home_url() );
106
+ $response = wp_remote_get( $url, array( 'sslverify' => false ) );
107
+ $code = (int) wp_remote_retrieve_response_code( $response );
108
+ if ( $code == 200 ) {
109
+ $html = preg_replace( '/[
110
+ s]/', '', wp_remote_retrieve_body( $response ) );
111
+ return (bool)( strstr( $html, '<!--wp_footer-->' ) );
112
+ }
113
+ }
114
+
115
+ function maybe_add_footer_comment(){
116
+ if ( $_GET['attest'] = 'true' )
117
+ {
118
+ add_action( 'wp_footer', array($this, 'test_footer' ), 99999 ); // Some obscene priority, make sure we run last
119
+ }
120
+ }
121
+
122
+ function test_footer(){
123
+ echo '<!--wp_footer-->';
124
+ }
125
+
126
+ /* END testing for wp_footer in a theme stuff */
127
+ function addToScript($newData){
128
+ $this->jsToAdd .= $newData;
129
+ }
130
+
131
+
132
+ function addWidgetToJs(){
133
+ $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
134
+ }
135
+
136
+
137
+ /* User name and other shared resources */
138
+ function getUsername(){
139
+ return (isset($this->_options['addthis_username']))? $this->_options['addthis_username'] : false;
140
+
141
+ }
142
+ function setUsername($username){
143
+ $this->_options['addthis_username'] = sanitize_text_field($username);
144
+ update_option( 'addthis_settings', $options);
145
+ }
146
+
147
+ function getProfileId(){
148
+ return (isset($this->_options['profile']))? $this->_options['profile'] : $this->_cuid;
149
+ }
150
+
151
+
152
+ function setProfileId($profile){
153
+ $this->_options['profile'] = sanitize_text_field($profile);
154
+ update_option( 'addthis_settings', $options);
155
+ }
156
+
157
+ function getPassword(){
158
+ return (isset($this->_options['addthis_password']))? $this->_options['addthis_password'] : $this->_cuid;
159
+ }
160
+
161
+ function setPassword($password){
162
+ $this->_options['addthis_password'] = sanitize_text_field($password);
163
+ update_option( 'addthis_settings', $options);
164
+ }
165
+
166
+
167
+ }
168
+
js/options-page.32.js CHANGED
@@ -75,13 +75,13 @@ jQuery(document).ready(function($) {
75
  });
76
 
77
  $('#above_more').click( function() {
78
- $('#above .select_row').removeClass('hidden');
79
- $(this).hide();
80
  return false;
81
  });
82
  $('#below_more').click( function() {
83
- $('#below .select_row').removeClass('hidden');
84
- $(this).hide();
85
  return false;
86
  });
87
 
@@ -105,7 +105,6 @@ jQuery(document).ready(function($) {
105
  $('.below_option').toggleClass('hide');
106
  });
107
 
108
-
109
  var aboveCustom = $('#above_custom_button');
110
  var aboveCustomShow = function(){
111
  if ( aboveCustom.prop('checked') != 'undefined' && aboveCustom.prop('checked') == true)
@@ -117,6 +116,7 @@ jQuery(document).ready(function($) {
117
  $('.above_option_custom').addClass('hidden');
118
  }
119
  };
 
120
  var belowCustom = $('#below_custom_button');
121
  var belowCustomShow = function(){
122
  if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
@@ -133,22 +133,23 @@ jQuery(document).ready(function($) {
133
  var aboveCustomStringShow = function(){
134
  if ( aboveCustomString.prop('checked') != 'undefined' && aboveCustomString.prop('checked') == true)
135
  {
136
- $('#above_custom_string_input').removeClass('hidden');
137
  }
138
  else
139
  {
140
- $('#above_custom_string_input').addClass('hidden');
141
  }
142
  };
 
143
  var belowCustomString = $('#below_custom_string');
144
  var belowCustomStringShow = function(){
145
  if ( belowCustomString.prop('checked') != 'undefined' && belowCustomString.prop('checked') == true)
146
  {
147
- $('#below_custom_string_input').removeClass('hidden');
148
  }
149
  else
150
  {
151
- $('#below_custom_string_input').addClass('hidden');
152
  }
153
  };
154
 
75
  });
76
 
77
  $('#above_more').click( function() {
78
+ $('#above .select_row').children('.radio').children('input').not(':checked').not('always').parent().parent().toggleClass('hidden');
79
+ $(this).children('span').toggleClass('hidden');
80
  return false;
81
  });
82
  $('#below_more').click( function() {
83
+ $('#below .select_row').children('.radio').children('input').not(':checked').not('always').parent().parent().toggleClass('hidden');
84
+ $(this).children('span').toggleClass('hidden');
85
  return false;
86
  });
87
 
105
  $('.below_option').toggleClass('hide');
106
  });
107
 
 
108
  var aboveCustom = $('#above_custom_button');
109
  var aboveCustomShow = function(){
110
  if ( aboveCustom.prop('checked') != 'undefined' && aboveCustom.prop('checked') == true)
116
  $('.above_option_custom').addClass('hidden');
117
  }
118
  };
119
+
120
  var belowCustom = $('#below_custom_button');
121
  var belowCustomShow = function(){
122
  if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
133
  var aboveCustomStringShow = function(){
134
  if ( aboveCustomString.prop('checked') != 'undefined' && aboveCustomString.prop('checked') == true)
135
  {
136
+ $('.above_custom_string_input').removeClass('hidden');
137
  }
138
  else
139
  {
140
+ $('.above_custom_string_input').addClass('hidden');
141
  }
142
  };
143
+
144
  var belowCustomString = $('#below_custom_string');
145
  var belowCustomStringShow = function(){
146
  if ( belowCustomString.prop('checked') != 'undefined' && belowCustomString.prop('checked') == true)
147
  {
148
+ $('.below_custom_string_input').removeClass('hidden');
149
  }
150
  else
151
  {
152
+ $('.below_custom_string_input').addClass('hidden');
153
  }
154
  };
155
 
js/options-page.js CHANGED
@@ -77,13 +77,13 @@ jQuery(document).ready(function($) {
77
  });
78
 
79
  $('#above_more').click( function() {
80
- $('#above .hidden').removeClass('hidden');
81
- $(this).hide();
82
  return false;
83
  });
84
  $('#below_more').click( function() {
85
- $('#below .hidden').removeClass('hidden');
86
- $(this).hide();
87
  return false;
88
  });
89
 
@@ -135,22 +135,22 @@ jQuery(document).ready(function($) {
135
  var aboveCustomStringShow = function(){
136
  if ( aboveCustomString.attr('checked') != 'undefined' && aboveCustomString.attr('checked') == true)
137
  {
138
- $('#above_custom_string_input').removeClass('hidden');
139
  }
140
  else
141
  {
142
- $('#above_custom_string_input').addClass('hidden');
143
  }
144
  };
145
  var belowCustomString = $('#below_custom_string');
146
  var belowCustomStringShow = function(){
147
  if ( belowCustomString.attr('checked') != 'undefined' && belowCustomString.attr('checked') == true)
148
  {
149
- $('#below_custom_string_input').removeClass('hidden');
150
  }
151
  else
152
  {
153
- $('#below_custom_string_input').addClass('hidden');
154
  }
155
  };
156
 
77
  });
78
 
79
  $('#above_more').click( function() {
80
+ $('#above .select_row').children('.radio').children('input').not(':checked').not('always').parent().parent().toggleClass('hidden');
81
+ $(this).children('span').toggleClass('hidden');
82
  return false;
83
  });
84
  $('#below_more').click( function() {
85
+ $('#below .select_row').children('.radio').children('input').not(':checked').not('always').parent().parent().toggleClass('hidden');
86
+ $(this).children('span').toggleClass('hidden');
87
  return false;
88
  });
89
 
135
  var aboveCustomStringShow = function(){
136
  if ( aboveCustomString.attr('checked') != 'undefined' && aboveCustomString.attr('checked') == true)
137
  {
138
+ $('.above_custom_string_input').removeClass('hidden');
139
  }
140
  else
141
  {
142
+ $('.above_custom_string_input').addClass('hidden');
143
  }
144
  };
145
  var belowCustomString = $('#below_custom_string');
146
  var belowCustomStringShow = function(){
147
  if ( belowCustomString.attr('checked') != 'undefined' && belowCustomString.attr('checked') == true)
148
  {
149
+ $('.below_custom_string_input').removeClass('hidden');
150
  }
151
  else
152
  {
153
+ $('.below_custom_string_input').addClass('hidden');
154
  }
155
  };
156
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === AddThis ===
2
  Contributors: _mjk_, jorbin, addthis_paul
3
- Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz
4
  Requires at least: 2.9
5
  Tested up to: 3.3.2
6
- Stable tag: 2.3.1
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with over 330 popular services.
9
 
@@ -74,8 +74,12 @@ In the screen options you can enable the AddThis meta box. Check the box and sa
74
  PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  == Changelog ==
 
 
 
 
77
  = 2.3.2 =
78
- * Add opt out for copy text tracking
79
 
80
  = 2.3.1 =
81
  * Don't strip pintrest tags from custom buttons
@@ -180,6 +184,12 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
180
 
181
 
182
  == Upgrade Notice ==
 
 
 
 
 
 
183
  = 2.3.0 =
184
  Improve the Settings interface and add Google Analytics Integration
185
 
1
  === AddThis ===
2
  Contributors: _mjk_, jorbin, addthis_paul
3
+ Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz, pintrest
4
  Requires at least: 2.9
5
  Tested up to: 3.3.2
6
+ Stable tag: 2.4.0
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with over 330 popular services.
9
 
74
  PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  == Changelog ==
77
+ = 2.4.0 =
78
+ * Refactor how we add code to pages which should eliminate how many times it is added
79
+ * Numerous Bug Fixes and a few new filters
80
+
81
  = 2.3.2 =
82
+ * Add opt out for copy tracking
83
 
84
  = 2.3.1 =
85
  * Don't strip pintrest tags from custom buttons
184
 
185
 
186
  == Upgrade Notice ==
187
+ = 2.4.0 =
188
+ Better Performance and improved UI
189
+
190
+ = 2.3.2 =
191
+ New option for opting out of copy text tracking
192
+
193
  = 2.3.0 =
194
  Improve the Settings interface and add Google Analytics Integration
195