WordPress Share Buttons Plugin – AddThis - Version 2.0.0

Version Description

  • Redesigned Settings page
  • Added Share Counter option
  • Redesigned Admin Dashboard widget
  • Updated sharing widget options
  • Updated sidebar widget to extend WP_Widget
Download this release

Release Info

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

Code changes from version 2.1.2 to 2.0.0

addthis_post_metabox.php DELETED
@@ -1,71 +0,0 @@
1
- <?php
2
- class addthis_post_metabox{
3
-
4
- function admin_init()
5
- {
6
- $screens = apply_filters('addthis_post_metabox_screens', array('post', 'page') );
7
- foreach($screens as $screen)
8
- {
9
- add_meta_box('addthis', 'AddThis', array($this, 'post_metabox'), $screen, 'side', 'default' );
10
- }
11
- add_action('save_post', array($this, 'save_post') );
12
-
13
- add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes' ) );
14
- }
15
-
16
- function default_hidden_meta_boxes($hidden)
17
- {
18
- $hidden[] = 'addthis';
19
- return $hidden;
20
- }
21
-
22
- function post_metabox(){
23
- global $post_id;
24
-
25
- if ( is_null($post_id) )
26
- $checked = '';
27
- else
28
- {
29
- $custom_fields = get_post_custom($post_id);
30
- $checked = ( isset ($custom_fields['addthis_exclude']) ) ? 'checked="checked"' : '' ;
31
- }
32
-
33
- wp_nonce_field('addthis_postmetabox_nonce', 'addthis_postmetabox_nonce');
34
- echo '<label for="addthis_show_option">';
35
- _e("Remove AddThis:", 'myplugin_textdomain' );
36
- echo '</label> ';
37
- echo '<input type="checkbox" id="addthis_show_option" name="addthis_show_option" value="1" '.$checked.'>';
38
- }
39
-
40
- function save_post($post_id)
41
- {
42
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
43
- return;
44
-
45
- if ( ! isset($_POST['addthis_postmetabox_nonce'] ) || !wp_verify_nonce( $_POST['addthis_postmetabox_nonce'], 'addthis_postmetabox_nonce' ) )
46
- return;
47
-
48
- if ( ! isset($_POST['addthis_show_option']) )
49
- {
50
- delete_post_meta($post_id, 'addthis_exclude');
51
- }
52
- else
53
- {
54
- $custom_fields = get_post_custom($post_id);
55
- if (! isset ($custom_fields['addthis_exclude'][0]) )
56
- {
57
- add_post_meta($post_id, 'addthis_exclude', 'true');
58
- }
59
- else
60
- {
61
- update_post_meta($post_id, 'addthis_exclude', 'true' , $custom_fields['addthis_exclude'][0] );
62
- }
63
- }
64
-
65
- }
66
-
67
- }
68
-
69
- $addthis_post_metabox = new addthis_post_metabox;
70
- add_action('admin_init', array($addthis_post_metabox, 'admin_init'));
71
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
addthis_sidebar_widget.php CHANGED
@@ -38,8 +38,8 @@ class AddThisSidebarWidget extends WP_Widget {
38
  if ($title)
39
  echo $before_title . $title . $after_title;
40
 
41
- printf(apply_filters('addthis_sidebar_style_output', $addthis_new_styles[$instance['style']]['src']), '');
42
-
43
  echo $after_widget;
44
 
45
  }
38
  if ($title)
39
  echo $before_title . $title . $after_title;
40
 
41
+ echo $addthis_new_styles[$instance['style']]['src'];
42
+ echo addthis_output_script();
43
  echo $after_widget;
44
 
45
  }
addthis_social_widget.php CHANGED
@@ -19,6 +19,7 @@
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
 
@@ -26,7 +27,7 @@ else return;
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.1.2
30
  *
31
  * Author: The AddThis Team
32
  * Author URI: http://www.addthis.com/blog
@@ -52,173 +53,126 @@ $addthis_styles = array(
52
  'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
53
  'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
54
  'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
 
 
55
  );
56
  $addthis_new_styles = array(
57
 
58
  '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' => ''
59
  ), // 32x32
60
- 'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %s ><a class="addthis_button_google_plusone"></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
61
- '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'
62
  ), // Plus sign share | four buttons
63
  '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' => ''
64
  ), // 32x32
65
  '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' => '', 'below' => 'hidden'
66
  ), // facebook tweet share counter
67
- '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'
68
  ), // Plus sign share
69
- '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'
70
  ), // classic
71
  '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'
72
  ),
73
  );
74
 
75
 
76
- add_filter('the_title', 'at_title_check');
77
- function at_title_check($title)
78
- {
79
-
80
- global $addthis_did_filters_added;
81
-
82
- if (!isset ($addthis_did_filters_added) || $addthis_did_filters_added != true)
83
- {
84
- addthis_add_content_filters();
85
- add_filter('the_content', 'addthis_script_to_content');
86
- }
87
- else
88
- {
89
- }
90
-
91
- return $title;
92
- }
93
-
94
-
95
- add_filter('language_attributes', 'addthis_language_attributes');
96
- function addthis_language_attributes($input)
97
- {
98
- return $input . ' xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:addthis="http://www.addthis.com/help/api-spec" ';
99
- }
100
-
101
-
102
-
103
- function addthis_script_to_content($content)
104
- {
105
- global $addthis_did_script_output;
106
-
107
- if (!isset($addthis_did_script_output) )
108
- {
109
- $addthis_did_script_output = true;
110
- $content .= addthis_output_script(true);
111
- }
112
- return $content ;
113
- }
114
 
115
  define( 'addthis_style_default' , 'small_toolbox_with_share');
116
- define( 'ADDTHIS_PLUGIN_VERSION', '2.1.2');
117
  /**
118
  * Converts our old many options in to one beautiful array
119
  *
120
  */
121
- if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
122
  {
123
- function addthis_options_200()
124
- {
125
-
126
- global $current_user;
127
- $user_id = $current_user->ID;
128
- $addthis_new_options = array();
129
- if ($username = get_option('addthis_username'))
130
- $addthis_new_options['username'] = $username;
131
 
132
- if ($password = get_option('addthis_password'))
133
- $addthis_new_options['password'] = $password;
134
 
135
- if ($show_stats = get_option('addthis_show_stats'))
136
- $addthis_new_options['addthis_show_stats'] = $show_stats;
137
-
138
- if ($append_data = get_option('addthis_append_data'))
139
- $addthis_new_options['addthis_append_data'] = $append_data;
140
-
141
- if ($showonhome = get_option('addthis_showonhome'))
142
- $addthis_new_options['addthis_showonhome'] = $showonhome;
143
-
144
- if ($showonpages = get_option('addthis_showonpages'))
145
- $addthis_new_options['addthis_showonpages'] = $showonpages;
146
-
147
- if ($showoncats = get_option('addthis_showoncats'))
148
- $addthis_new_options['addthis_showoncats'] = $showoncats;
149
-
150
- if ($showonarchives = get_option('addthis_showonarchives'))
151
- $addthis_new_options['addthis_showonarchives'] = $showonarchives;
152
 
153
- if (get_option('addthis_showonposts') != true)
154
- $addthis_new_options['below'] = 'none';
155
- elseif (get_option('addthis_sidebar_only') == true)
156
- $addthis_new_options['below'] = 'none';
 
 
 
 
157
  else
158
- {
159
- if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
160
- $addthis_new_options['below'] = 'small_toolbox_with_share';
161
- else
162
- $addthis_new_options['below'] = 'button';
163
- }
164
- if ($header_background = get_option('addthis_header_background'))
165
- $addthis_new_options['addthis_header_background'] = $header_background;
166
- if ($header_color = get_option('addthis_header_color'))
167
- $addthis_new_options['addthis_header_color'] = $header_color;
168
- if ($brand = get_option('addthis_brand'))
169
- $addthis_new_options['addthis_brand'] = $brand;
170
- if ($language = get_option('addthis_language'))
171
- $addthis_new_options['addthis_language'] = $language;
172
 
173
 
174
- // Above is new, set it to none
175
- $addthis_new_options['above'] = 'none';
176
 
177
- // Save option
178
- add_option('addthis_settings', $addthis_new_options);
179
 
180
- // if the option saved, delete the old options
181
-
182
- delete_option('addthis_show_stats');
183
- delete_option('addthis_password');
184
- delete_option('addthis_fallback_username');
185
- delete_option('addthis_options');
186
- delete_option('addthis_product');
187
- delete_option('addthis_isdropdown');
188
- delete_option('addthis_menu_type');
189
- delete_option('addthis_append_data');
190
- delete_option('addthis_showonhome');
191
- delete_option('addthis_showonposts');
192
- delete_option('addthis_showonpages');
193
- delete_option('addthis_showoncats');
194
- delete_option('addthis_showonarchives');
195
- delete_option('addthis_style');
196
- delete_option('addthis_header_background');
197
- delete_option('addthis_header_color');
198
- delete_option('addthis_sidebar_only');
199
- delete_option('addthis_brand');
200
- delete_option('addthis_language');;
201
-
202
-
203
- global $current_user;
204
- $user_id = $current_user->ID;
205
 
206
- add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
 
207
 
208
-
209
 
210
- }
211
 
212
- function addthis_options_210()
213
- {
214
- $options = get_option('addthis_settings');
215
- if ( isset( $options['username'] ) )
216
- $options['profile'] = $options['username'];
217
 
218
- update_option( 'addthis_settings', $options);
219
 
220
- }
221
- }
222
 
223
 
224
  /**
@@ -244,112 +198,10 @@ function addthis_get_wp_version() {
244
  /**
245
  * For templates, we need a wrapper for printing out the code on demand.
246
  */
247
- function addthis_print_widget($url=null, $title=null, $style = addthis_style_default ) {
248
-
249
- global $addthis_styles, $addthis_new_styles;
250
- $styles = array_merge($addthis_styles, $addthis_new_styles);
251
-
252
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
253
- $preview = true;
254
- else
255
- $options = get_option('addthis_settings');
256
-
257
- $identifier = addthis_get_identifier($url, $title);
258
-
259
- echo "\n<!-- AddThis Custom -->\n";
260
-
261
-
262
- if ( ! is_array($style) && isset($addthis_new_styles[$style]) ){
263
- echo sprintf($addthis_new_styles[$style]['src'], $identifier);
264
- }
265
- elseif ($style == 'above')
266
- {
267
- if ( isset ($styles[$options['above']]['src'] ))
268
- echo sprintf($styles[$options['above']]['src'], $identifier);
269
- }
270
- elseif ($style == 'below')
271
- {
272
- if ( isset ($styles[$options['below']]['src'] ))
273
- echo sprintf($styles[$options['below']]['src'], $identifier);
274
- }
275
- elseif (is_array($style))
276
- echo addthis_custom_toolbox($style, $url, $title);
277
- echo "\n<!-- End AddThis Custom -->\n";
278
- }
279
-
280
- /*
281
- * Generates the addthis:url and addthis:title attributes
282
- */
283
-
284
- function addthis_get_identifier($url = null, $title = null)
285
- {
286
-
287
- if (! is_null($url) )
288
- $identifier = "addthis:url='$url' ";
289
- if (! is_null($title) )
290
- $identifier .= "addthis:title='$title'";
291
-
292
- if (! isset($identifier) )
293
- $identifier = '';
294
-
295
- return $identifier;
296
-
297
- }
298
-
299
- /**
300
- * Options is an array that contains
301
- * size - either 16 or 32. Defaults to 16
302
- * services - comma sepperated list of services
303
- * preferred - number of Prefered services to be displayed after listed services
304
- * more - bool to show or not show the more icon at the end
305
- *
306
- * @param $options array
307
- */
308
-
309
- function addthis_custom_toolbox($options, $url, $title)
310
- {
311
- $identifier = addthis_get_identifier($url, $title);
312
-
313
- $outerClasses = 'addthis_toolbox addthis_default_style';
314
-
315
- if (isset($options['size']) && $options['size'] == '32')
316
- $outerClasses .= ' addthis_32x32_style';
317
-
318
- $button = '<div class="'.$outerClasses.'" '.$identifier.' >';
319
-
320
- if (isset($options['services']) )
321
- {
322
- $services = explode(',', $options['services']);
323
- foreach ($services as $service)
324
- {
325
- $service = trim($service);
326
- if ($service == 'more')
327
- $button .= '<a class="addthis_button_compact"></a>';
328
- else
329
- $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
330
- }
331
- }
332
-
333
- if (isset($options['preferred']) && is_numeric($options['preferred']))
334
- {
335
- for ($a = 1; $a <= $options['preferred']; $a++)
336
- {
337
- $button .= '<a class="addthis_button_preferred_'.$a.'"></a>';
338
- }
339
- }
340
-
341
- if (isset($options['more']) && $options['more'] == true)
342
- {
343
- $button .= '<a class="addthis_button_compact"></a>';
344
- }
345
-
346
- $button .= '</div>';
347
-
348
- return $button;
349
-
350
  }
351
 
352
-
353
  /**
354
  * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
355
  */
@@ -367,37 +219,29 @@ function addthis_print_script() {
367
  add_action('admin_notices', 'addthis_admin_notices');
368
 
369
  function addthis_admin_notices(){
370
- if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
371
  return;
372
-
373
- global $current_user ;
374
  $user_id = $current_user->ID;
375
  $options = get_option('addthis_settings');
376
 
377
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
378
  {
379
  echo '<div class="updated addthis_setup_nag"><p>';
380
- printf(__('Setup the AddThis plugin so you can start having your users share your content around the web<br /> <a href="%1$s">Setup options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'),
381
- admin_url('options-general.php?page=' . __FILE__ ),
382
- '?addthis_nag_ignore=0');
383
  echo "</p></div>";
384
  }
385
 
386
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
387
  {
388
  echo '<div class="updated addthis_setup_nag"><p>';
389
- printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s" target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'),
390
- admin_url('options-general.php?page=' . __FILE__ ),
391
- 'https://www.addthis.com/register?profile=wpp',
392
- '?addthis_nag_username_ignore=0');
393
  echo "</p></div>";
394
  }
395
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
396
  {
397
  echo '<div class="updated addthis_setup_nag"><p>';
398
- printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s">Ignore this notice</a>'),
399
- admin_url('options-general.php?page=' . __FILE__ ),
400
- '?addthis_nag_updated_ignore=0');
401
  echo "</p></div>";
402
  }
403
  }
@@ -494,16 +338,11 @@ function addthis_render_dashboard_widget() {
494
  return false;
495
  }
496
  $domain = get_home_url();
497
-
498
-
499
  $domain = str_replace(array('http://', 'https://'), '', $domain);
500
 
501
- if (isset($options['profile']))
502
- $profile = '&pubid='.urlencode($options['profile']);
503
- else
504
- $profile = '';
505
-
506
 
 
507
  $requests = array(
508
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
509
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
@@ -513,187 +352,126 @@ function addthis_render_dashboard_widget() {
513
  array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
514
  array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
515
  array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
516
- array('metric' => 'shares', 'dimension' => 'url' , 'domain' => $domain, 'period' => 'month'),
517
- array('metric' => 'clickbacks', 'dimension' => 'url', 'domain' => $domain, 'period' => 'month'),
518
  );
519
 
520
  if (! $stats = get_transient('addthis_dashboard_stats') )
521
  {
522
  add_filter('http_headers_useragent', 'addthis_plugin_useragent');
523
- foreach ($requests as $request)
524
- {
525
- $dimension = $metric = $domain = $period = '';
526
- extract($request);
527
- $dimension = ($dimension != '') ? '/'.$dimension : '';
528
- $url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
529
- 'domain='.$domain.'&period='.$period.
530
- '&username='.$username.
531
- '&password='.$password.
532
- $profile;
533
- $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
534
-
535
- if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
536
- {
537
- echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n";
538
- if (defined(WP_DEBUG) && WP_DEBUG == TRUE)
539
- echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code();
540
-
541
- exit;
542
- }
543
-
544
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
545
- {
546
- echo "The Username / Password / Profile combination you presented is not valid.<br />";
547
- echo "Please confirm that you have correctly entered your AddThis username, password and profile id.";
548
- exit;
549
- }
550
- else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
551
- {
552
- echo "Something has gone terribly wrong! This should never happen, but somehow did. We are working to correct it right now. We will get everything up again soon";
553
- exit;
554
- }
555
-
556
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
557
- {
558
- echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set ";
559
- exit;
560
- }
561
- else if ($stats[$metric.$dimension.$period]['response']['code'] != 201 )
562
- {
563
- }
564
- }
565
-
566
- if ( $stats['sharesday']['response']['code'] == 200)
567
- set_transient('addthis_dashboard_stats', $stats, '600');
568
-
569
  }
570
  if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
571
  {
572
- $shareurls = json_decode($stats['shares/urlmonth']['body']);
573
- $clickbackurls = json_decode($stats['clickbacks/urlmonth']['body']);
574
- $yesterday['shares'] = json_decode($stats['sharesday']['body']);
575
- $yesterday['shares'] = $yesterday['shares'][0]->shares;
576
- $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
577
- $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
578
- $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
579
-
580
- if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
581
- if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
582
-
583
- $decodedLastWeek = json_decode($stats['sharesweek']['body']);
584
- $lastweek['shares'] = 0;
585
- foreach ($decodedLastWeek as $share)
586
- {
587
- $lastweek['shares'] += $share->shares;
588
- }
589
- $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
590
- $lastweek['clickbacks'] = 0;
591
- foreach ($decodedLastWeek as $clickback)
592
- {
593
- $lastweek['clickbacks'] += $clickback->clickbacks;
594
- }
595
- $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
596
 
597
- $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
598
- $lastmonth['shares'] = 0;
599
- foreach ($decodedLastMonth as $share)
600
- {
601
- $lastmonth['shares'] += $share->shares;
602
- }
603
- $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
604
- $lastmonth['clickbacks'] = 0;
605
- foreach ($decodedLastMonth as $clickback)
606
- {
607
- $lastmonth['clickbacks'] += $clickback->clickbacks;
608
- }
609
- $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
610
 
611
 
612
- $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
613
- $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
614
- foreach (array('shares', 'clickbacks') as $type)
 
 
 
 
 
 
 
 
 
 
615
  {
616
- $topServiceShare = array_shift($services[$type]);
617
- $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
618
- $firstAmount = $topServiceShare->{$type};
619
- $topServiceShare = array_shift($services[$type]);
620
- $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
621
- $secondAmount = $topServiceShare->{$type};
622
- $thirdLabel = 'Others';
623
- $thirdAmount = 0;
624
- foreach($services[$type] as $service )
625
- {
626
- $thirdAmount += $service->{$type};
627
- }
628
-
629
 
630
- $servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&'.
631
- 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
632
- 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
633
- }
634
 
 
 
 
 
635
 
636
- echo "<div id='at_tabs'>";
637
- echo "<ul>";
638
- echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
639
- echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
640
- echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
641
- echo "</ul><div class='clear'>&nbsp;</div>";
642
- $tab = 0;
643
- foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
644
- {
645
- $stats = $$timePeriod;
646
- $tab++;
647
- $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
648
- echo '<div id="tab'.$tab.'">';
649
-
650
- echo
651
- '<table class="atw-table">
652
- <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
653
- <tr>';
654
- echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
655
- echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
656
- echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
657
-
658
- echo '</tr>';
659
- echo '</table>';
660
- echo '</div>';
661
- }
662
- echo "</div>";
663
-
664
- echo "<div>";
665
- echo "</div>";
666
- echo "<div id='tstab1'>";
667
- echo "<h5> Most Shared URLs (last month) </h5>";
668
- echo "<ul>";
669
- $count = count($shareurls);
670
- for($i = 0; ( $i < 5 && $i < $count ); $i++)
671
- {
672
- $url = array_shift($shareurls);
673
- $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
674
- echo "<li><span class='urlCount'>" . $url->shares . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
675
- }
676
- echo "</ul>";
677
- echo "<h5>Top Services for shares(last month)</h5>";
678
- echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
679
- echo "</div>";
680
- echo '<div id="tstab2">';
681
- echo '<h5> Most Clicked URLs (last month) </h5>';
682
- echo "<ul>";
683
- $count = count($clickbackurls);
684
- for($i = 0; ( $i < 5 && $i < $count ); $i++)
685
- {
686
- $url = array_shift($clickbackurls);
687
- $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
688
- echo "<li><span class='urlCount'>" . $url->clickbacks . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
689
- }
690
- echo "</ul>";
691
- echo "<h5>Top Services for clicks(last month)</h5>";
692
- echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
693
- echo "</div>";
694
- echo '<div class="clear">&nbsp;</div>';
695
- echo '<p><a class="button rbutton" href="//www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
696
- }
697
  elseif($stats['sharesday']['response']['code'] == 200){
698
 
699
  echo
@@ -701,19 +479,14 @@ elseif($stats['sharesday']['response']['code'] == 200){
701
  <p>We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,</p>
702
  <p>If you want some ideas for increasing your sharing, check out:</p>
703
  <ul>
704
- <li><span class='b'><a href="//www.addthis.com//blog/">The AddThis Blog</a></span></li>
705
- <li><span class='b'><a href="//www.addthis.com//blog/2010/11/09/3-tips-for-getting-the-most-shares/">Three tips for getting the most shares</a></span></li>
706
- <li><span class='b'><a href="//www.addthis.com/forum/">The AddThis Forum</a></span></li>
707
  <ul>
708
  ENDHTML;
709
  }
710
- elseif ($stats['sharesday']['response']['code'] == 401){
711
- echo "I'm sorry, but we seemed to encounter an error. Please ensure that your password, username and pubid are correct.";
712
-
713
- }
714
-
715
  else{
716
- echo "I'm sorry, but we seemed to have encountered an error when requesting your analytics. Please wait a few moments and try again.";
717
  }
718
  die();
719
  }
@@ -746,15 +519,14 @@ function addthis_save_transient() {
746
  if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
747
 
748
  // Parse Post data
 
749
  $option_array = addthis_parse_options($values);
750
-
751
  // Set Transient
752
  if (false !== get_transient('addthis_settings'))
753
  delete_transient('addthis_settings');
754
  $eh = set_transient('addthis_settings', $option_array, 120);
755
 
756
- print_r($option_array);
757
-
758
  die();
759
  }
760
 
@@ -779,22 +551,17 @@ global $addthis_styles, $addthis_new_styles;
779
 
780
  $styles = array_merge($addthis_styles, $addthis_new_styles);
781
 
782
-
783
  $options = array();
784
 
785
- // Sanitize profile, username and password
786
  if ( isset($data['addthis_username']) )
787
  $options['username'] = sanitize_text_field($data['addthis_username']);
788
 
789
- if ( isset($data['addthis_profile']) )
790
- $options['profile'] = sanitize_text_field($data['addthis_profile']);
791
-
792
  if ( isset($data['addthis_password']) )
793
  $options['password'] = sanitize_text_field($data['addthis_password']);
794
 
795
- if (! isset($data['above']) ){
796
- }
797
- elseif ( isset ($data['show_above']) )
798
  $options['above'] = 'none';
799
  elseif ( isset($styles[$data['above']]) )
800
  $options['above'] = $data['above'];
@@ -802,21 +569,8 @@ elseif ($data['above'] == 'none')
802
  {
803
  $options['above'] = 'none';
804
  }
805
- elseif ($data['above'] = 'custom')
806
- {
807
 
808
- $options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
809
- $options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
810
-
811
- $options['above'] = 'custom';
812
- $options['above_custom_size'] = ( $data['above_custom_size'] == '16' || $data['above_custom_size'] == 32 ) ? $data['above_custom_size'] : '' ;
813
- $options['above_custom_services'] = sanitize_text_field( $data['above_custom_services'] );
814
- $options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
815
- $options['above_custom_more'] = isset($data['above_custom_more']);
816
- }
817
- if ( ! isset($data['below'] )){
818
- }
819
- elseif ( isset ($data['show_below']) )
820
  $options['below'] = 'none';
821
  elseif ( isset($styles[$data['below']]) )
822
  $options['below'] = $data['below'];
@@ -824,33 +578,16 @@ elseif ($data['below'] == 'none')
824
  {
825
  $options['below'] = 'none';
826
  }
827
- elseif ($data['below'] = 'custom')
828
- {
829
- $options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
830
- $options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
831
-
832
- $options['below'] = 'custom';
833
- $options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
834
- $options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
835
- $options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
836
- $options['below_custom_more'] = isset($data['below_custom_more']);
837
- }
838
-
839
 
840
 
841
  // All the checkbox fields
842
- foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508' ) as $field)
843
  {
844
  if ( isset($data[$field]) && $data[$field] == true)
845
  $options[$field] = true;
846
- else
847
- $options[$field] = false;
848
 
849
  }
850
 
851
- //[addthis_twitter_template]
852
- if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 )
853
- $options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
854
 
855
  //[addthis_brand] =>
856
 
@@ -858,8 +595,6 @@ if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
858
  $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
859
 
860
  //[addthis_options] =>
861
- if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
862
- $options['addthis_options'] = str_replace(' ', '', esc_js( strtolower( $data['addthis_options'] ) ));
863
 
864
  //[addthis_language] =>
865
  if ( isset ($data['addthis_language']))
@@ -894,28 +629,6 @@ function register_addthis_settings() {
894
  register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
895
 
896
  }
897
- /*
898
- * Used to make sure excerpts above the head aren't displayed wrong
899
- */
900
- function addthis_add_content_filters()
901
- {
902
-
903
- global $addthis_did_filters_added;
904
- $addthis_did_filters_added = true;
905
-
906
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
907
- $preview = true;
908
- else
909
- $options = get_option('addthis_settings');
910
-
911
- if ( ! empty( $options) ){
912
- if ($options['addthis_showonexcerpts'] == true )
913
- add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
914
-
915
- add_filter('the_content', 'addthis_display_social_widget', 15);
916
- }
917
- }
918
-
919
 
920
  /**
921
  * Adds WP filter so we can append the AddThis button to post content.
@@ -924,9 +637,7 @@ function addthis_init()
924
  {
925
  global $addthis_settings;
926
 
927
- add_action( 'wp_head', 'addthis_add_content_filters');
928
-
929
- if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
930
  if ( is_admin() ) {
931
  add_action( 'admin_init', 'register_addthis_settings' );
932
  }
@@ -934,32 +645,23 @@ function addthis_init()
934
 
935
  $options = get_option('addthis_settings');
936
 
 
 
 
937
 
938
- $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
939
- $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
940
-
941
- $style_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
942
- $style_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
943
-
944
-
945
- wp_register_style( 'addthis', $style_location );
946
- wp_register_script( 'addthis', $script_location , array('jquery-ui-tabs') );
947
-
948
- add_action('admin_print_styles-index.php', 'addthis_print_style');
949
- add_action('admin_print_scripts-index.php', 'addthis_print_script');
950
 
951
  add_filter('admin_menu', 'addthis_admin_menu');
952
 
953
- if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
954
- {
955
- if ( get_option('addthis_product') !== false && ! is_array( $options ) )
956
- addthis_options_200();
957
 
958
- // Upgrade to 210 from 200
959
- if ( isset($options['username']) && ! isset($options['profile']) )
960
- addthis_options_210();
961
- }
962
- add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
963
 
964
  $product = get_option('addthis_product');
965
 
@@ -997,9 +699,7 @@ add_action('widgets_init', 'addthis_widget_init');
997
  function addthis_widget_init()
998
  {
999
  require_once('addthis_sidebar_widget.php');
1000
- //require_once('addthis_content_feed_widget.php');
1001
  register_widget('AddThisSidebarWidget');
1002
- //register_widget('AddThisContentFeedWidget');
1003
  }
1004
 
1005
  function addthis_sidebar_widget($args)
@@ -1013,26 +713,15 @@ function addthis_sidebar_widget($args)
1013
  // essentially replace wp_trim_excerpt until we have something better to use here
1014
  function addthis_remove_tag($content, $text = '')
1015
  {
1016
-
1017
-
1018
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1019
- $preview = true;
1020
- else
1021
- $options = get_option('addthis_settings');
1022
-
1023
-
1024
  $raw_excerpt = $text;
1025
  if ( '' == $text ) {
1026
-
1027
  $text = get_the_content('');
1028
- $text = strip_shortcodes( $text );
1029
 
 
1030
  remove_filter('the_content', 'addthis_display_social_widget', 15);
1031
 
1032
  $text = apply_filters('the_content', $text);
1033
-
1034
- add_filter('the_content', 'addthis_display_social_widget', 15);
1035
-
1036
  $text = str_replace(']]>', ']]&gt;', $text);
1037
  $text = strip_tags($text);
1038
  $excerpt_length = apply_filters('excerpt_length', 55);
@@ -1045,89 +734,17 @@ function addthis_remove_tag($content, $text = '')
1045
  } else {
1046
  $text = implode(' ', $words);
1047
  }
1048
- if ($options['addthis_showonexcerpts'] == false)
1049
- return $text;
1050
- return addthis_display_social_widget($text, false, false);
1051
  }
1052
  else
1053
  {
1054
  return $content;
1055
  }
1056
  }
1057
-
1058
- function addthis_late_widget($link_text)
1059
  {
1060
- remove_filter('get_the_excerpt', 'addthis_late_widget');
1061
-
1062
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1063
- $preview = true;
1064
- else
1065
- $options = get_option('addthis_settings');
1066
-
1067
- if ($options['addthis_showonexcerpts'] == false)
1068
- return $link_text;
1069
-
1070
  global $addthis_styles, $addthis_new_styles;
1071
  $styles = array_merge($addthis_styles, $addthis_new_styles);
1072
-
1073
- $url = get_permalink();
1074
- $title = get_the_title();
1075
- $url_above = '';
1076
- $url_below = '';
1077
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1078
- $preview = true;
1079
- else
1080
- $options = get_option('addthis_settings');
1081
-
1082
-
1083
- $url_below = "addthis:url='$url' ";
1084
- $url_below .= "addthis:title='$title'";
1085
-
1086
- if (has_excerpt() && ! is_attachment() && isset($options['below']) && $options['below'] == 'custom')
1087
- {
1088
- $belowOptions['size'] = $options['below_custom_size'];
1089
- if ($options['below_do_custom_services'])
1090
- $belowOptions['services'] = $options['below_custom_services'];
1091
- if ($options['below_do_custom_preferred'])
1092
- $belowOptions['preferred'] = $options['below_custom_preferred'];
1093
- $belowOptions['more'] = $options['below_custom_more'];
1094
- return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1095
- }
1096
-
1097
- elseif ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
1098
- {
1099
- $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
1100
- }
1101
- else
1102
- {
1103
- $below = apply_filters('addthis_below_content','' );
1104
- }
1105
- return $link_text . sprintf($below, $url_below);
1106
-
1107
-
1108
- }
1109
-
1110
-
1111
- function addthis_display_social_widget_excerpt($content)
1112
- {
1113
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1114
- $preview = true;
1115
- else
1116
- $options = get_option('addthis_settings');
1117
-
1118
-
1119
- if ( has_excerpt() && $options['addthis_showonexcerpts'] == true )
1120
- return addthis_display_social_widget($content, true, true);
1121
- else
1122
- return $content;
1123
- }
1124
-
1125
-
1126
- function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
1127
- {
1128
-
1129
- global $addthis_styles, $addthis_new_styles, $post;
1130
- $styles = array_merge($addthis_styles, $addthis_new_styles);
1131
 
1132
 
1133
  if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
@@ -1150,69 +767,33 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1150
  $display = true;
1151
  else
1152
  $display = false;
1153
- $custom_fields = get_post_custom($post->ID);
1154
- if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1155
- $display = false;
1156
-
1157
- $display = apply_filters('addthis_post_exclude', $display);
1158
-
1159
- remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
1160
- remove_filter('get_the_excerpt', 'addthis_late_widget');
1161
- $url = get_permalink();
1162
- $title = get_the_title();
1163
- $url_above = "addthis:url='$url' ";
1164
- $url_above .= "addthis:title='$title'";
1165
- $url_below = "addthis:url='$url' ";
1166
- $url_below .= "addthis:title='$title'";
1167
- $above = '';
1168
- $below = '';
1169
 
 
 
 
 
 
1170
  // Still here? Well let's add some social goodness
1171
  if ( $options['above'] != 'none' && $display )
1172
  {
1173
  if (isset ($styles[$options['above']]))
1174
  {
1175
  $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
1176
- }
1177
- elseif ($options['above'] == 'custom')
1178
- {
1179
- $aboveOptions['size'] = $options['above_custom_size'];
1180
- if ($options['above_do_custom_services'])
1181
- $aboveOptions['services'] = $options['above_custom_services'];
1182
- if ($options['above_do_custom_preferred'])
1183
- $aboveOptions['preferred'] = $options['above_custom_preferred'];
1184
- $aboveOptions['more'] = $options['above_custom_more'];
1185
- $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
1186
  }
1187
  }
1188
- elseif ($display)
1189
- $above = apply_filters('addthis_above_content','' );
1190
  else
1191
  $above = '';
1192
-
1193
- if ($options['below'] != 'none' && $display && ! $below_excerpt )
1194
  {
1195
  if (isset ($styles[$options['below']]))
1196
  {
1197
  $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
 
1198
  }
1199
- elseif ($options['below'] == 'custom')
1200
- {
1201
- $belowOptions['size'] = $options['below_custom_size'];
1202
- $belowOptions['services'] = $options['below_custom_services'];
1203
- $belowOptions['preferred'] = $options['below_custom_preferred'];
1204
- $belowOptions['more'] = $options['below_custom_more'];
1205
- $below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1206
- }
1207
- }
1208
- elseif ($below_excerpt && $display && $options['below'] != 'none' )
1209
- {
1210
- $below = apply_filters('addthis_below_content','' );
1211
- if ($options['addthis_showonexcerpts'] == true )
1212
- add_filter('get_the_excerpt', 'addthis_late_widget', 14);
1213
  }
1214
- elseif ($display)
1215
- $below = apply_filters('addthis_below_content','' );
1216
  else
1217
  $below = '';
1218
 
@@ -1220,12 +801,9 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1220
 
1221
  if ($display)
1222
  {
1223
- if ( isset($above) )
1224
- $content = sprintf($above, $url_above) . $content;
1225
- if ( isset($below) )
1226
- $content = $content . sprintf($below, $url_below);
1227
  if ($filtered == true)
1228
- add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
1229
  }
1230
 
1231
  return $content;
@@ -1240,7 +818,7 @@ add_action('wp_footer', 'addthis_output_script');
1240
  *
1241
  * @return mixed
1242
  */
1243
- function addthis_output_script($return = false )
1244
  {
1245
  global $addthis_settings;
1246
 
@@ -1251,10 +829,9 @@ function addthis_output_script($return = false )
1251
 
1252
  $script = "\n<!-- AddThis Button Begin -->\n"
1253
  .'<script type="text/javascript">'
1254
- ."var addthis_product = 'wpp-259';\n";
1255
-
1256
 
1257
- $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1258
  if (!$pub) {
1259
  $pub = 'wp-'.cuid();
1260
  }
@@ -1265,16 +842,7 @@ function addthis_output_script($return = false )
1265
 
1266
  if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
1267
  $addthis_config["data_track_clickback"] = true;
1268
- else
1269
- $addthis_config["data_track_clickback"] = false;
1270
-
1271
- /*/
1272
- if ( isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true)
1273
- $addthis_config["data_track_addressbar"] = true;
1274
- else
1275
- $addthis_config["data_track_addressbar"] = false;
1276
- //*/
1277
-
1278
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1279
  $addthis_config['ui_language'] = $options['addthis_language'];
1280
 
@@ -1287,40 +855,16 @@ function addthis_output_script($return = false )
1287
  if ( isset($options['addthis_brand']) )
1288
  $addthis_config['ui_cobrand'] = $options['addthis_brand'];
1289
 
1290
- if (isset($options['addthis_508']) && $options['addthis_508'] == true)
1291
- $addthis_config['ui_508_compliant'] = true;
1292
-
1293
  $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
1294
 
1295
 
1296
  if (! empty ($addthis_config) )
1297
  $script .= 'var addthis_config = '. json_encode($addthis_config) .';';
1298
-
1299
- if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1300
- $script .= 'var addthis_options = "'.$options['addthis_options'].'";';
1301
 
1302
- if (isset($options['addthis_twitter_template'])){
1303
- $addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
1304
-
1305
- }
1306
- if (isset($options['addthis_bitly_login']) && isset($options['addthis_bitly_key']) ){
1307
- $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
1308
- $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1309
- $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1310
- }
1311
-
1312
- if (isset($addthis_share))
1313
- $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1314
  $script .= '</script>';
1315
-
1316
-
1317
- $script .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1318
-
1319
-
1320
- if ( ! is_admin() && ! is_feed() )
1321
- echo $script;
1322
- elseif ($return == true && ! is_admin() && ! is_feed() )
1323
- return $script;
1324
  }
1325
 
1326
 
@@ -1371,15 +915,15 @@ function addthis_social_widget($content, $onSidebar = false, $url = null, $title
1371
  $content .= <<<EOF
1372
  //-->
1373
  </script>
1374
- <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
1375
  EOF;
1376
- $content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
1377
  }
1378
  else if ($addthis_settings['menu_type'] === 'toolbox')
1379
  {
1380
  $content .= "\n//-->\n</script>\n";
1381
  $content .= <<<EOF
1382
- <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v=250&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
1383
  EOF;
1384
  if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
1385
  $addthis_options = split(',', $addthis_options);
@@ -1389,7 +933,7 @@ EOF;
1389
  $content .= '<a class="addthis_button_'.$option.'"></a>';
1390
  }
1391
  }
1392
- $content .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
1393
  }
1394
  else
1395
  {
@@ -1398,7 +942,7 @@ EOF;
1398
  $content .= <<<EOF
1399
  //-->
1400
  </script>
1401
- <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v=250&amp;username=$pub" onclick="window.open('//www.addthis.com/bookmark.php?v=250&amp;username=$pub&amp;url=$link&amp;title=$title', 'ext_addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
1402
  EOF;
1403
  $content .= addthis_get_button_img() . '</a></div>';
1404
  }
@@ -1437,7 +981,7 @@ function addthis_get_button_img( $btnStyle = false )
1437
 
1438
  if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
1439
  $btnRecord = $addthis_styles[$btnStyle];
1440
- $btnUrl = (strpos(trim($btnRecord['img']), '//') !== 0 ? "//s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
1441
 
1442
  if (strpos($btnUrl, '%lang%') !== false)
1443
  {
@@ -1452,19 +996,12 @@ EOF;
1452
 
1453
  function addthis_options_page_scripts()
1454
  {
1455
- $script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
1456
-
1457
- $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1458
- $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1459
- wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
1460
-
1461
  }
1462
 
1463
  function addthis_options_page_style()
1464
  {
1465
- $style_location = apply_filters( 'at_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
1466
- $style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
1467
- wp_enqueue_style( 'addthis_options_page_style', $style_location);
1468
  wp_enqueue_style( 'thickbox' );
1469
  }
1470
 
@@ -1476,7 +1013,6 @@ function addthis_admin_menu()
1476
  }
1477
 
1478
  $addthis_default_options = array(
1479
- 'profile' => '',
1480
  'username' => '',
1481
  'password' => '',
1482
  'style' => addthis_style_default ,
@@ -1489,30 +1025,14 @@ function addthis_admin_menu()
1489
  'addthis_showonpages' => true,
1490
  'addthis_showonarchives' => true,
1491
  'addthis_showoncats' => true,
1492
- 'addthis_addressbar' => false,
1493
  'addthis_brand' => '',
1494
  'toolbox' => '',
1495
  'addthis_language' => '',
1496
  'addthis_header_background' => '',
1497
- 'addthis_header_color' => '',
1498
- 'addthis_options' => '',
1499
- 'addthis_showonexcerpts' => true,
1500
- 'above_custom_size' => '',
1501
- 'above_custom_services' => '',
1502
- 'above_custom_preferred' => '',
1503
- 'above_custom_more' => '',
1504
- 'below_custom_size' => '',
1505
- 'below_custom_services' => '',
1506
- 'below_custom_preferred' => '',
1507
- 'below_custom_more' => '',
1508
- 'addthis_twitter_template' => '',
1509
- 'addthis_508' => '',
1510
- 'addthis_bitly_login' => '',
1511
- 'addthis_bitly_key' => '',
1512
  );
1513
 
1514
  function addthis_plugin_options_php4() {
1515
-
1516
  global $addthis_styles;
1517
  global $addthis_languages;
1518
  global $addthis_settings;
@@ -1531,18 +1051,15 @@ function addthis_plugin_options_php4() {
1531
  <form id="addthis_settings" method="post" action="options.php">
1532
  <?php
1533
  // use the old-school settings style in older versions of wordpress
1534
- if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
1535
- settings_fields('addthis');
1536
- } else {
1537
  wp_nonce_field('update-options');
 
 
1538
  }
1539
 
1540
- $addthis_options = get_option('addthis_settings');
1541
- if ($addthis_options == false)
1542
- add_option('addthis_settings', array() );
1543
-
1544
  foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
1545
- {
1546
  if ( $addthis_options && ! isset($addthis_options[$option]) )
1547
  $addthis_options[$option] = false;
1548
  }
@@ -1553,7 +1070,7 @@ function addthis_plugin_options_php4() {
1553
  ?>
1554
 
1555
  <div class="page-header" id="tabs">
1556
- <img alt='addthis' src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
1557
  <ul class="nav-tab-wrapper">
1558
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
1559
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
@@ -1565,9 +1082,7 @@ function addthis_plugin_options_php4() {
1565
  <tr>
1566
  <td id="above" colspan="2">
1567
  <p><?php _e("Above the post", 'addthis_trans_domain') ?>&nbsp;&nbsp;<span class="description"><input type="checkbox" name="addthis_settings[show_above]" <?php echo ('none' == $above) ? 'checked="checked"' : '';?> />&nbsp;none</span></p>
1568
- <?php $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1569
- $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1570
- foreach ($addthis_new_styles as $k => $v)
1571
  {
1572
  $class = 'hidden';
1573
  $checked = '';
@@ -1575,46 +1090,9 @@ function addthis_plugin_options_php4() {
1575
  $checked = 'checked="checked"';
1576
  $class = '';
1577
  }
1578
- echo "<p class='above_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[above]' /><img alt='".$k."' src='". $imgLocationBase . $v['img'] ."'/></p>";
1579
- }
1580
-
1581
- $class = 'hidden';
1582
- $checked = '';
1583
- if ($above == 'custom' || ($above == 'none' && 'custom' == $addthis_default_options['above'] ) ){
1584
- $checked = 'checked="checked"';
1585
- $class = '';
1586
  }
1587
-
1588
- echo "<div class='above_option select_row $class '><input $checked type='radio' value='custom' name='addthis_settings[above]' id='above_custom_button' /> Custom / Build your own</input>";
1589
-
1590
- echo "<ul class='above_option_custom hidden'>";
1591
- $above_custom_16 = ($above_custom_size == 16) ? 'selected="selected"' : '' ;
1592
- $above_custom_32 = ($above_custom_size == 32) ? 'selected="selected"' : '' ;
1593
- $above_do_custom_services = ( isset( $above_do_custom_services ) && $above_do_custom_services ) ? 'checked="checked"' : '';
1594
- $above_do_custom_preferred = ( isset( $above_do_custom_preferred ) && $above_do_custom_preferred ) ? 'checked="checked"' : '';
1595
-
1596
- echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[above_custom_size]'><option value='16' $above_custom_16 >16x16</option><option value='32' $above_custom_32 >32x32</option></select><br/><span class='description'>The size of the icons you want to display</span></li>";
1597
- echo "<li><input $above_do_custom_services class='at_do_custom' type='checkbox' name='addthis_settings[above_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[above_custom_services]' value='$above_custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>";
1598
- echo "<li><input type='checkbox' $above_do_custom_preferred class='at_do_custom' name='addthis_settings[above_do_custom_preferred]' value='true' /><span class='at_custom_label'>Auto Personalized:</span>
1599
- <select name='addthis_settings[above_custom_preferred]' class='at_custom_input'>";
1600
- for($i=0; $i <= 11; $i++)
1601
- {
1602
- $selected = '';
1603
- if ($above_custom_preferred == $i)
1604
- $selected = 'selected="selected"';
1605
-
1606
- echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
1607
-
1608
- }
1609
- echo "</select><br/><span class='description'>Enter the number of automatticly user personalized items you want displayed</span></li>";
1610
- $above_custom_more = ( $above_custom_more ) ? 'checked="checked"' : '';
1611
-
1612
- echo "<li><input $above_custom_more type='checkbox' class='at_do_custom' name='addthis_settings[above_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic orange plus sign that offers sharing to over 300 destinations</span></li>";
1613
- echo "</ul></div>";
1614
-
1615
  ?>
1616
-
1617
-
1618
  <a class="above_option" href="#above_more" id="above_more">addtional style options</a>
1619
  </td>
1620
  </tr>
@@ -1630,61 +1108,22 @@ function addthis_plugin_options_php4() {
1630
  $checked = 'checked="checked"';
1631
  $class = '';
1632
  }
1633
-
1634
- echo "<p class='below_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[below]' /><img alt='".$k."' src='". $imgLocationBase . $v['img'] ."'/></p>";
1635
- }
1636
- $class = 'hidden';
1637
- $checked = '';
1638
- if ($below == 'custom' || ($below == 'none' && 'custom' == $addthis_default_options['below'] ) ){
1639
- $checked = 'checked="checked"';
1640
- $class = '';
1641
- }
1642
- echo "<div class='below_option select_row $class '><input $checked type='radio' value='custom' name='addthis_settings[below]' id='below_custom_button' /> Custom / Build your own</input>";
1643
-
1644
- echo "<ul class='below_option_custom hidden'>";
1645
- $below_custom_16 = ($below_custom_size == 16) ? 'selected="selected"' : '' ;
1646
- $below_custom_32 = ($below_custom_size == 32) ? 'selected="selected"' : '' ;
1647
- $below_do_custom_services = ( isset( $below_do_custom_services ) && $below_do_custom_services) ? 'checked="checked"' : '';
1648
- $below_do_custom_preferred = ( isset( $below_do_custom_preferred ) && $below_do_custom_preferred) ? 'checked="checked"' : '';
1649
-
1650
- echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[below_custom_size]'><option value='16' $below_custom_16 >16x16</option><option value='32' $below_custom_32 >32x32</option></select><br/><span class='description'>The size of the icons you want to display</span></li>";
1651
- echo "<li><input class='at_do_custom' type='checkbox' $below_do_custom_services name='addthis_settings[below_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[below_custom_services]' value='$below_custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>";
1652
- echo "<li><input type='checkbox' class='at_do_custom' $below_do_custom_preferred name='addthis_settings[below_do_custom_preferred]' value='true' /><span class='at_custom_label'>Auto Personalized:</span>
1653
- <select name='addthis_settings[below_custom_preferred]' class='at_custom_input'>";
1654
- for($i=0; $i <= 11; $i++)
1655
- {
1656
- $selected = '';
1657
- if ($below_custom_preferred == $i)
1658
- $selected = 'selected="selected"';
1659
-
1660
- echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
1661
-
1662
- }
1663
- echo "</select><br/><span class='description'>Enter the number of automatticly user personalized items you want displayed</span></li>";
1664
-
1665
- $below_custom_more = ($below_custom_more) ? 'checked="checked""' : '';
1666
-
1667
- echo "<li><input $below_custom_more type='checkbox' class='at_do_custom' name='addthis_settings[below_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic orange plus sign that offers sharing to over 300 destinations</span></li>";
1668
- echo "</ul></div>";
1669
-
1670
  ?>
1671
  <a class="below_option" href="#below_more" id="below_more">additional style options</a>
1672
  </td>
1673
  </tr>
1674
  <tr valign="top">
1675
- <td colspan="2"><?php _e('Enter a profile, username and password to discover how your content is being shared, and how your most influential audience members are bringing traffic back to your site. Learn what interests them – and to what degree – and how thoses interests are driving sharing. <a href="//addthis.com/features" target="_blank">Click here for more information on the benefits of register</a>.<a href="//www.addthis.com/help/faq#accounts" target="_blank">Click here for more information on usernames and profiles</a> ', 'addthis_trans_domain');?> </td>
1676
- </tr>
1677
- <tr valign="top">
1678
- <th scope="row"><?php _e("AddThis profile id:", 'addthis_trans_domain' ); ?></th>
1679
- <td><input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' /></td>
1680
  </tr>
1681
  <tr valign="top">
1682
  <th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
1683
- <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
1684
  </tr>
1685
  <tr id="password_row" >
1686
  <th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
1687
- <td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
1688
  </tr>
1689
  </tbody>
1690
  </table>
@@ -1697,19 +1136,15 @@ function addthis_plugin_options_php4() {
1697
  <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1698
  </tr>
1699
  <tr>
1700
- <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>
1701
  <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1702
  </tr>
1703
- <tr>
1704
- <th scope="row"><?php _e("Track Address Bar Shares", 'addthis_trans_domain' ); ?></th>
1705
- <td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
1706
- </tr>
1707
  <tr>
1708
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1709
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1710
  </tr>
1711
  <tr>
1712
- <th scope="row"><?php _e("Show on <a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1713
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1714
  </tr>
1715
  <tr>
@@ -1720,37 +1155,16 @@ function addthis_plugin_options_php4() {
1720
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
1721
  <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
1722
  </tr>
1723
- <tr>
1724
- <th scope="row"><?php _e("Show on excerpts:", 'addthis_trans_domain' ); ?></th>
1725
- <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
1726
- </tr>
1727
- <tr>
1728
- <th scope="row"><?php _e("Enable Enhanced Accessibility", 'addthis_trans_domain' ); ?></th>
1729
- <td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
1730
- </tr>
1731
  <tr valign="top">
1732
  <td colspan="2"></td>
1733
  </tr>
1734
  <tr valign="top">
1735
- <td colspan="2">For more details on the following options, see <a href="//addthis.com/customization">our customization docs</a>.</td>
1736
- </tr>
1737
- <tr valign="top">
1738
- <th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
1739
- 'Important: AddThis optimizes your list of services based on popularity and language, and personalizes the list for each user. You may decrease sharing by over-riding these features.'
1740
- , 'addthis_trans_domain') ?>
1741
- </span></th>
1742
- <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1743
- <span class='description'><?php _e('Enter a comma-separated list of <a href="//addthis.com/services/list">service codes</a>', 'addthis_trans_domain' ); ?></span>
1744
- </td>
1745
  </tr>
1746
  <tr valign="top">
1747
  <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
1748
  <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
1749
  </tr>
1750
- <tr valign="top">
1751
- <th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template</a>( not for tweet button) :", 'addthis_trans_domain' ); ?></th>
1752
- <td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
1753
- </tr>
1754
  <tr valign="top">
1755
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1756
  <td>
@@ -1838,36 +1252,5 @@ if (! function_exists('get_home_url'))
1838
  }
1839
  }
1840
 
1841
- if (! function_exists('__return_false'))
1842
- {
1843
- function __return_false()
1844
- {
1845
- return false;
1846
- }
1847
- }
1848
-
1849
- if (! function_exists('__return_true'))
1850
- {
1851
- function __return_true()
1852
- {
1853
- return true;
1854
- }
1855
- }
1856
-
1857
- /**
1858
- * Make sure the option gets added on registration
1859
- * @since 2.0.6
1860
- */
1861
-
1862
- function addthis_activation_hook(){
1863
- if ( get_option('addthis_settings') == false)
1864
- add_option('addthis_settings', array() );
1865
-
1866
- }
1867
-
1868
- register_activation_hook( __FILE__, 'addthis_activation_hook' );
1869
-
1870
-
1871
- require_once('addthis_post_metabox.php');
1872
 
1873
  ?>
19
  * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
20
  * +--------------------------------------------------------------------------+
21
  */
22
+
23
  if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
24
  else return;
25
 
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: 2.0.0
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com/blog
53
  'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
54
  'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
55
  'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
56
+ /* Add your own style here, like this:
57
+ , 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
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
+
64
+ 'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="http://addthis/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' => '', 'below' => 'hidden'
69
  ), // facebook tweet share counter
70
+ 'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="http://addthis/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'
71
  ), // Plus sign share
72
+ 'button' => array( 'src' => '<a class="addthis_button" href="http://addthis/bookmark.php?v=250&amp;username=xa-4d2b4cee71601c7c&amp;url=%s"><img src="http://cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
73
  ), // classic
74
  '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'
75
  ),
76
  );
77
 
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  define( 'addthis_style_default' , 'small_toolbox_with_share');
81
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.0.0');
82
  /**
83
  * Converts our old many options in to one beautiful array
84
  *
85
  */
86
+ function addthis_options_200()
87
  {
88
+
89
+ global $current_user;
90
+ $user_id = $current_user->ID;
91
+ $addthis_new_options = array();
92
+ if ($username = get_option('addthis_username'))
93
+ $addthis_new_options['username'] = $username;
 
 
94
 
95
+ if ($password = get_option('addthis_password'))
96
+ $addthis_new_options['password'] = $password;
97
 
98
+ if ($show_stats = get_option('addthis_show_stats'))
99
+ $addthis_new_options['addthis_show_stats'] = $show_stats;
100
+
101
+ if ($append_data = get_option('addthis_append_data'))
102
+ $addthis_new_options['addthis_append_data'] = $append_data;
103
+
104
+ if ($showonhome = get_option('addthis_showonhome'))
105
+ $addthis_new_options['addthis_showonhome'] = $showonhome;
106
+
107
+ if ($showonpages = get_option('addthis_showonpages'))
108
+ $addthis_new_options['addthis_showonpages'] = $showonpages;
109
+
110
+ if ($showoncats = get_option('addthis_showoncats'))
111
+ $addthis_new_options['addthis_showoncats'] = $showoncats;
112
+
113
+ if ($showonarchives = get_option('addthis_showonarchives'))
114
+ $addthis_new_options['addthis_showonarchives'] = $showonarchives;
115
 
116
+ if (get_option('addthis_showonposts') != true)
117
+ $addthis_new_options['below'] = 'none';
118
+ elseif (get_option('addthis_sidebar_only') == true)
119
+ $addthis_new_options['below'] = 'none';
120
+ else
121
+ {
122
+ if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
123
+ $addthis_new_options['below'] = 'small_toolbox_with_share';
124
  else
125
+ $addthis_new_options['below'] = 'button';
126
+ }
127
+ if ($header_background = get_option('addthis_header_background'))
128
+ $addthis_new_options['addthis_header_background'] = $header_background;
129
+ if ($header_color = get_option('addthis_header_color'))
130
+ $addthis_new_options['addthis_header_color'] = $header_color;
131
+ if ($brand = get_option('addthis_brand'))
132
+ $addthis_new_options['addthis_brand'] = $brand;
133
+ if ($language = get_option('addthis_language'))
134
+ $addthis_new_options['addthis_language'] = $language;
 
 
 
 
135
 
136
 
137
+ // Above is new, set it to none
138
+ $addthis_new_options['above'] = 'none';
139
 
140
+ // Save option
141
+ add_option('addthis_settings', $addthis_new_options);
142
 
143
+ // if the option saved, delete the old options
144
+
145
+ delete_option('addthis_show_stats');
146
+ delete_option('addthis_password');
147
+ delete_option('addthis_fallback_username');
148
+ delete_option('addthis_options');
149
+ delete_option('addthis_product');
150
+ delete_option('addthis_isdropdown');
151
+ delete_option('addthis_menu_type');
152
+ delete_option('addthis_append_data');
153
+ delete_option('addthis_showonhome');
154
+ delete_option('addthis_showonposts');
155
+ delete_option('addthis_showonpages');
156
+ delete_option('addthis_showoncats');
157
+ delete_option('addthis_showonarchives');
158
+ delete_option('addthis_style');
159
+ delete_option('addthis_header_background');
160
+ delete_option('addthis_header_color');
161
+ delete_option('addthis_sidebar_only');
162
+ delete_option('addthis_brand');
163
+ delete_option('addthis_language');;
164
+
 
 
 
165
 
166
+ global $current_user;
167
+ $user_id = $current_user->ID;
168
 
169
+ add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
170
 
171
+
172
 
173
+ }
 
 
 
 
174
 
 
175
 
 
 
176
 
177
 
178
  /**
198
  /**
199
  * For templates, we need a wrapper for printing out the code on demand.
200
  */
201
+ function addthis_print_widget($url=null, $title=null) {
202
+ echo addthis_social_widget('', true, $url, $title);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  }
204
 
 
205
  /**
206
  * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
207
  */
219
  add_action('admin_notices', 'addthis_admin_notices');
220
 
221
  function addthis_admin_notices(){
222
+ if (! current_user_can('manage_options'))
223
  return;
224
+ global $current_user;
 
225
  $user_id = $current_user->ID;
226
  $options = get_option('addthis_settings');
227
 
228
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
229
  {
230
  echo '<div class="updated addthis_setup_nag"><p>';
231
+ printf(__('Setup the AddThis plugin so you can start having your users share your content around the web<br /> <a href="%1$s">Setup options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), '?addthis_nag_ignore=0');
 
 
232
  echo "</p></div>";
233
  }
234
 
235
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
236
  {
237
  echo '<div class="updated addthis_setup_nag"><p>';
238
+ printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), 'https://www.addthis.com/register', '?addthis_nag_username_ignore=0');
 
 
 
239
  echo "</p></div>";
240
  }
241
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
242
  {
243
  echo '<div class="updated addthis_setup_nag"><p>';
244
+ printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s">Ignore this notice</a>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), '?addthis_nag_updated_ignore=0');
 
 
245
  echo "</p></div>";
246
  }
247
  }
338
  return false;
339
  }
340
  $domain = get_home_url();
341
+
 
342
  $domain = str_replace(array('http://', 'https://'), '', $domain);
343
 
 
 
 
 
 
344
 
345
+
346
  $requests = array(
347
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
348
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
352
  array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
353
  array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
354
  array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
355
+
 
356
  );
357
 
358
  if (! $stats = get_transient('addthis_dashboard_stats') )
359
  {
360
  add_filter('http_headers_useragent', 'addthis_plugin_useragent');
361
+ foreach ($requests as $request)
362
+ {
363
+ $dimension = $metric = $domain = $period = '';
364
+ extract($request);
365
+ $dimension = ($dimension != '') ? '/'.$dimension : '';
366
+ $url = 'http://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
367
+ 'domain='.$domain.'&period='.$period.
368
+ '&username='.$username.
369
+ '&password='.$password;
370
+ $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
371
+ }
372
+
373
+ set_transient('addthis_dashboard_stats', $stats, '600');
374
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
  if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
377
  {
378
+ $yesterday['shares'] = json_decode($stats['sharesday']['body']);
379
+ $yesterday['shares'] = $yesterday['shares'][0]->shares;
380
+ $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
381
+ $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
382
+ $yesterday['viral'] = ($yesterday['shares'] > 0) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 : 0;
383
+ if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
384
+ if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
385
+
386
+ $decodedLastWeek = json_decode($stats['sharesweek']['body']);
387
+ $lastweek['shares'] = 0;
388
+ foreach ($decodedLastWeek as $share)
389
+ {
390
+ $lastweek['shares'] += $share->shares;
391
+ }
392
+ $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
393
+ $lastweek['clickbacks'] = 0;
394
+ foreach ($decodedLastWeek as $clickback)
395
+ {
396
+ $lastweek['clickbacks'] += $clickback->clickbacks;
397
+ }
398
+ $lastweek['viral'] = ($lastweek['shares'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 : 0;
 
 
 
399
 
400
+ $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
401
+ $lastmonth['shares'] = 0;
402
+ foreach ($decodedLastMonth as $share)
403
+ {
404
+ $lastmonth['shares'] += $share->shares;
405
+ }
406
+ $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
407
+ $lastmonth['clickbacks'] = 0;
408
+ foreach ($decodedLastMonth as $clickback)
409
+ {
410
+ $lastmonth['clickbacks'] += $clickback->clickbacks;
411
+ }
412
+ $lastmonth['viral'] = ($lastmonth['shares'] > 0 ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 : 0;
413
 
414
 
415
+ $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
416
+ $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
417
+ foreach (array('shares', 'clickbacks') as $type)
418
+ {
419
+ $topServiceShare = array_shift($services[$type]);
420
+ $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
421
+ $firstAmount = $topServiceShare->{$type};
422
+ $topServiceShare = array_shift($services[$type]);
423
+ $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
424
+ $secondAmount = $topServiceShare->{$type};
425
+ $thirdLabel = 'Others';
426
+ $thirdAmount = 0;
427
+ foreach($services[$type] as $service )
428
  {
429
+ $thirdAmount += $service->{$type};
430
+ }
 
 
 
 
 
 
 
 
 
 
 
431
 
 
 
 
 
432
 
433
+ $servicesCharts[$type] = 'http://chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&'.
434
+ 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
435
+ 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
436
+ }
437
 
438
+ echo "<div id='at_tabs'>";
439
+ echo "<ul>";
440
+ echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
441
+ echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
442
+ echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
443
+ echo "</ul><div class='clear'>&nbsp;</div>";
444
+ $tab = 0;
445
+ foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
446
+ {
447
+ $stats = $$timePeriod;
448
+ $tab++;
449
+ echo '<div id="tab'.$tab.'">';
450
+
451
+ echo
452
+ '<table class="atw-table">
453
+ <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
454
+ <tr>';
455
+ echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
456
+ echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
457
+ echo '<td><div class="atw-cell"><h3>'.number_format( $stats['viral'],2) .'%</h3>Viral Lift</div></td>';
458
+ echo '</tr>';
459
+ echo '</table>';
460
+ echo '</div>';
461
+ }
462
+ echo "</div>";
463
+ echo "<hr />";
464
+ echo "<h5>Top Services for shares(last month)</h5>";
465
+ echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
466
+ echo "</div>";
467
+ echo '<div id="tstab2"';
468
+ echo "<h5>Top Services for clicks(last month)</h5>";
469
+ echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
470
+ echo "</div>";
471
+ echo "</div>";
472
+ echo '<div class="clear">&nbsp;</div>';
473
+ echo '<p><a class="button rbutton" href="http://www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
474
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  elseif($stats['sharesday']['response']['code'] == 200){
476
 
477
  echo
479
  <p>We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,</p>
480
  <p>If you want some ideas for increasing your sharing, check out:</p>
481
  <ul>
482
+ <li><span class='b'><a href="http://www.addthis.com//blog/">The AddThis Blog</a></span></li>
483
+ <li><span class='b'><a href="http://www.addthis.com//blog/2010/11/09/3-tips-for-getting-the-most-shares/">Three tips for getting the most shares</a></span></li>
484
+ <li><span class='b'><a href="http://www.addthis.com/forum/">The AddThis Forum</a></span></li>
485
  <ul>
486
  ENDHTML;
487
  }
 
 
 
 
 
488
  else{
489
+ echo "I'm sorry, but we seemed to encounter an error. This could be because your password is not accurate. Please check and update it.";
490
  }
491
  die();
492
  }
519
  if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
520
 
521
  // Parse Post data
522
+
523
  $option_array = addthis_parse_options($values);
 
524
  // Set Transient
525
  if (false !== get_transient('addthis_settings'))
526
  delete_transient('addthis_settings');
527
  $eh = set_transient('addthis_settings', $option_array, 120);
528
 
529
+
 
530
  die();
531
  }
532
 
551
 
552
  $styles = array_merge($addthis_styles, $addthis_new_styles);
553
 
 
554
  $options = array();
555
 
556
+ // Sanitize username and password
557
  if ( isset($data['addthis_username']) )
558
  $options['username'] = sanitize_text_field($data['addthis_username']);
559
 
 
 
 
560
  if ( isset($data['addthis_password']) )
561
  $options['password'] = sanitize_text_field($data['addthis_password']);
562
 
563
+
564
+ if ( isset ($data['show_above']) )
 
565
  $options['above'] = 'none';
566
  elseif ( isset($styles[$data['above']]) )
567
  $options['above'] = $data['above'];
569
  {
570
  $options['above'] = 'none';
571
  }
 
 
572
 
573
+ if ( isset ($data['show_below']) )
 
 
 
 
 
 
 
 
 
 
 
574
  $options['below'] = 'none';
575
  elseif ( isset($styles[$data['below']]) )
576
  $options['below'] = $data['below'];
578
  {
579
  $options['below'] = 'none';
580
  }
 
 
 
 
 
 
 
 
 
 
 
 
581
 
582
 
583
  // All the checkbox fields
584
+ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats') as $field)
585
  {
586
  if ( isset($data[$field]) && $data[$field] == true)
587
  $options[$field] = true;
 
 
588
 
589
  }
590
 
 
 
 
591
 
592
  //[addthis_brand] =>
593
 
595
  $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
596
 
597
  //[addthis_options] =>
 
 
598
 
599
  //[addthis_language] =>
600
  if ( isset ($data['addthis_language']))
629
  register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
630
 
631
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
 
633
  /**
634
  * Adds WP filter so we can append the AddThis button to post content.
637
  {
638
  global $addthis_settings;
639
 
640
+ if (addthis_get_wp_version() >= 2.7) {
 
 
641
  if ( is_admin() ) {
642
  add_action( 'admin_init', 'register_addthis_settings' );
643
  }
645
 
646
  $options = get_option('addthis_settings');
647
 
648
+ if (function_exists('wp_register_style')) {
649
+ wp_register_style( 'addthis', WP_PLUGIN_URL . '/addthis/css/addthis.css');
650
+ wp_register_script( 'addthis', WP_PLUGIN_URL . '/addthis/js/addthis.js', array('jquery-ui-tabs') );
651
 
652
+ add_action('admin_print_styles-index.php', 'addthis_print_style');
653
+ add_action('admin_print_scripts-index.php', 'addthis_print_script');
654
+ }
 
 
 
 
 
 
 
 
 
655
 
656
  add_filter('admin_menu', 'addthis_admin_menu');
657
 
658
+ if ( get_option('addthis_product') !== false &&
659
+ ! is_array( $options ) )
660
+ addthis_options_200();
 
661
 
662
+ add_filter('the_content', 'addthis_display_social_widget', 15);
663
+
664
+ add_action( 'addthis_widget', 'addthis_print_widget', 10, 2);
 
 
665
 
666
  $product = get_option('addthis_product');
667
 
699
  function addthis_widget_init()
700
  {
701
  require_once('addthis_sidebar_widget.php');
 
702
  register_widget('AddThisSidebarWidget');
 
703
  }
704
 
705
  function addthis_sidebar_widget($args)
713
  // essentially replace wp_trim_excerpt until we have something better to use here
714
  function addthis_remove_tag($content, $text = '')
715
  {
716
+
 
 
 
 
 
 
 
717
  $raw_excerpt = $text;
718
  if ( '' == $text ) {
 
719
  $text = get_the_content('');
 
720
 
721
+ $text = strip_shortcodes( $text );
722
  remove_filter('the_content', 'addthis_display_social_widget', 15);
723
 
724
  $text = apply_filters('the_content', $text);
 
 
 
725
  $text = str_replace(']]>', ']]&gt;', $text);
726
  $text = strip_tags($text);
727
  $excerpt_length = apply_filters('excerpt_length', 55);
734
  } else {
735
  $text = implode(' ', $words);
736
  }
737
+ return addthis_display_social_widget($text, false);
 
 
738
  }
739
  else
740
  {
741
  return $content;
742
  }
743
  }
744
+ function addthis_display_social_widget($content, $filtered = true)
 
745
  {
 
 
 
 
 
 
 
 
 
 
746
  global $addthis_styles, $addthis_new_styles;
747
  $styles = array_merge($addthis_styles, $addthis_new_styles);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
 
749
 
750
  if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
767
  $display = true;
768
  else
769
  $display = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
 
771
+
772
+
773
+ $url = get_permalink();
774
+ $url_above = '';
775
+ $url_below = '';
776
  // Still here? Well let's add some social goodness
777
  if ( $options['above'] != 'none' && $display )
778
  {
779
  if (isset ($styles[$options['above']]))
780
  {
781
  $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
782
+ $url_above = ($styles[$options['above']] != 'button') ? "addthis:url='$url'" : $url;
 
 
 
 
 
 
 
 
 
783
  }
784
  }
 
 
785
  else
786
  $above = '';
787
+
788
+ if ($options['below'] != 'none' && $display)
789
  {
790
  if (isset ($styles[$options['below']]))
791
  {
792
  $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
793
+ $url_below = ($styles[$options['below']] != 'button') ? "addthis:url='$url'" : $url;
794
  }
795
+
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  }
 
 
797
  else
798
  $below = '';
799
 
801
 
802
  if ($display)
803
  {
804
+ $content = sprintf($above, $url_above).'<br/>' . $content .' <br />' . sprintf($below, $url_below);
 
 
 
805
  if ($filtered == true)
806
+ add_filter('wp_trim_excerpt', 'addthis_remove_tag', 9);
807
  }
808
 
809
  return $content;
818
  *
819
  * @return mixed
820
  */
821
+ function addthis_output_script()
822
  {
823
  global $addthis_settings;
824
 
829
 
830
  $script = "\n<!-- AddThis Button Begin -->\n"
831
  .'<script type="text/javascript">'
832
+ ."var addthis_product = 'wpp-250';\n";
 
833
 
834
+ $pub = (isset($options['username'])) ? $options['username'] : false ;
835
  if (!$pub) {
836
  $pub = 'wp-'.cuid();
837
  }
842
 
843
  if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
844
  $addthis_config["data_track_clickback"] = true;
845
+
 
 
 
 
 
 
 
 
 
846
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
847
  $addthis_config['ui_language'] = $options['addthis_language'];
848
 
855
  if ( isset($options['addthis_brand']) )
856
  $addthis_config['ui_cobrand'] = $options['addthis_brand'];
857
 
 
 
 
858
  $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
859
 
860
 
861
  if (! empty ($addthis_config) )
862
  $script .= 'var addthis_config = '. json_encode($addthis_config) .';';
 
 
 
863
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  $script .= '</script>';
865
+ $script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script>';
866
+
867
+ echo $script;
 
 
 
 
 
 
868
  }
869
 
870
 
915
  $content .= <<<EOF
916
  //-->
917
  </script>
918
+ <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">
919
  EOF;
920
+ $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>';
921
  }
922
  else if ($addthis_settings['menu_type'] === 'toolbox')
923
  {
924
  $content .= "\n//-->\n</script>\n";
925
  $content .= <<<EOF
926
+ <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>
927
  EOF;
928
  if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
929
  $addthis_options = split(',', $addthis_options);
933
  $content .= '<a class="addthis_button_'.$option.'"></a>';
934
  }
935
  }
936
+ $content .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
937
  }
938
  else
939
  {
942
  $content .= <<<EOF
943
  //-->
944
  </script>
945
+ <div class="addthis_container"><a href="http://www.addthis.com/bookmark.php?v=250&amp;username=$pub" onclick="window.open('http://www.addthis.com/bookmark.php?v=250&amp;username=$pub&amp;url=$link&amp;title=$title', 'ext_addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
946
  EOF;
947
  $content .= addthis_get_button_img() . '</a></div>';
948
  }
981
 
982
  if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
983
  $btnRecord = $addthis_styles[$btnStyle];
984
+ $btnUrl = (strpos(trim($btnRecord['img']), 'http://') !== 0 ? "http://s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
985
 
986
  if (strpos($btnUrl, '%lang%') !== false)
987
  {
996
 
997
  function addthis_options_page_scripts()
998
  {
999
+ wp_enqueue_script( 'addthis_options_page_script', plugins_url( '/addthis/js/options-page.js', basename(dirname(__FILE__)) ), array('jquery-ui-tabs', 'thickbox' ));
 
 
 
 
 
1000
  }
1001
 
1002
  function addthis_options_page_style()
1003
  {
1004
+ wp_enqueue_style( 'addthis_options_page_style', plugins_url('/addthis/css/options-page.css', basename(dirname(__FILE__)) ) );
 
 
1005
  wp_enqueue_style( 'thickbox' );
1006
  }
1007
 
1013
  }
1014
 
1015
  $addthis_default_options = array(
 
1016
  'username' => '',
1017
  'password' => '',
1018
  'style' => addthis_style_default ,
1025
  'addthis_showonpages' => true,
1026
  'addthis_showonarchives' => true,
1027
  'addthis_showoncats' => true,
 
1028
  'addthis_brand' => '',
1029
  'toolbox' => '',
1030
  'addthis_language' => '',
1031
  'addthis_header_background' => '',
1032
+ 'addthis_header_color' => ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1033
  );
1034
 
1035
  function addthis_plugin_options_php4() {
 
1036
  global $addthis_styles;
1037
  global $addthis_languages;
1038
  global $addthis_settings;
1051
  <form id="addthis_settings" method="post" action="options.php">
1052
  <?php
1053
  // use the old-school settings style in older versions of wordpress
1054
+ if (addthis_get_wp_version() < 2.7) {
 
 
1055
  wp_nonce_field('update-options');
1056
+ } else {
1057
+ settings_fields('addthis');
1058
  }
1059
 
1060
+ $addthis_options = get_option('addthis_settings');
 
 
 
1061
  foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
1062
+ {
1063
  if ( $addthis_options && ! isset($addthis_options[$option]) )
1064
  $addthis_options[$option] = false;
1065
  }
1070
  ?>
1071
 
1072
  <div class="page-header" id="tabs">
1073
+ <img alt='addthis' src="http://cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
1074
  <ul class="nav-tab-wrapper">
1075
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
1076
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
1082
  <tr>
1083
  <td id="above" colspan="2">
1084
  <p><?php _e("Above the post", 'addthis_trans_domain') ?>&nbsp;&nbsp;<span class="description"><input type="checkbox" name="addthis_settings[show_above]" <?php echo ('none' == $above) ? 'checked="checked"' : '';?> />&nbsp;none</span></p>
1085
+ <?php foreach ($addthis_new_styles as $k => $v)
 
 
1086
  {
1087
  $class = 'hidden';
1088
  $checked = '';
1090
  $checked = 'checked="checked"';
1091
  $class = '';
1092
  }
1093
+ echo "<p class='above_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[above]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
 
 
 
 
 
 
 
1094
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
  ?>
 
 
1096
  <a class="above_option" href="#above_more" id="above_more">addtional style options</a>
1097
  </td>
1098
  </tr>
1108
  $checked = 'checked="checked"';
1109
  $class = '';
1110
  }
1111
+ echo "<p class='below_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[below]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
1112
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  ?>
1114
  <a class="below_option" href="#below_more" id="below_more">additional style options</a>
1115
  </td>
1116
  </tr>
1117
  <tr valign="top">
1118
+ <td colspan="2"><?php _e('Enter a username and password to discover how your content is being shared, and how your most influential audience members are bringing traffic back to your site. Learn what interests them – and to what degree – and how thoses interests are driving sharing. <a href="http://addthis.com/features" target="_blank">Click here for more information</a>. ', 'addthis_trans_domain');?> </td>
 
 
 
 
1119
  </tr>
1120
  <tr valign="top">
1121
  <th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
1122
+ <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" /></td>
1123
  </tr>
1124
  <tr id="password_row" >
1125
  <th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
1126
+ <td><input type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>"/></td>
1127
  </tr>
1128
  </tbody>
1129
  </table>
1136
  <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1137
  </tr>
1138
  <tr>
1139
+ <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>
1140
  <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1141
  </tr>
 
 
 
 
1142
  <tr>
1143
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1144
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1145
  </tr>
1146
  <tr>
1147
+ <th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1148
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1149
  </tr>
1150
  <tr>
1155
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
1156
  <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
1157
  </tr>
 
 
 
 
 
 
 
 
1158
  <tr valign="top">
1159
  <td colspan="2"></td>
1160
  </tr>
1161
  <tr valign="top">
1162
+ <td colspan="2">For more details on the following options, see <a href="http://addthis.com/customization">our customization docs</a>.</td>
 
 
 
 
 
 
 
 
 
1163
  </tr>
1164
  <tr valign="top">
1165
  <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
1166
  <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
1167
  </tr>
 
 
 
 
1168
  <tr valign="top">
1169
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1170
  <td>
1252
  }
1253
  }
1254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1255
 
1256
  ?>
css/addthis.css CHANGED
@@ -125,14 +125,14 @@ float:right;
125
  #at_tabs .at_time_period{
126
  float:left;
127
  padding: 0 7px;
128
- width: 65px;
129
  }
130
  #tstab1{
131
- width: 50%;
132
  float: left;
133
  }
134
  #tstab2{
135
- width: 50%;
136
  float:left;
137
  }
138
  #at_tabs .clear{
@@ -140,3 +140,29 @@ height: 0;
140
  margin: 0;
141
  padding: 0;
142
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  #at_tabs .at_time_period{
126
  float:left;
127
  padding: 0 7px;
128
+ width: 85px;
129
  }
130
  #tstab1{
131
+ width: 47%;
132
  float: left;
133
  }
134
  #tstab2{
135
+ width: 47%;
136
  float:left;
137
  }
138
  #at_tabs .clear{
140
  margin: 0;
141
  padding: 0;
142
  }
143
+ .urlCount {
144
+ width: 10%;
145
+ height: 20px;
146
+ clear:both;
147
+ display:block;
148
+ float:left;
149
+ font-weight: bold;
150
+ }
151
+ .urlUrl{
152
+ float:right;
153
+ width: 85%;
154
+ font-color: #777;
155
+ word-wrap: break-word;
156
+ font-size: 0.83em;
157
+ }
158
+ #tstab1 h5, #tstab2 h5{
159
+ clear:both;
160
+ padding-top: 5px;
161
+ margin-top: 5px;
162
+ }
163
+
164
+ #tstab1{
165
+ margin-right: 2%;
166
+ padding-right: 2%;
167
+ }
168
+
css/options-page.css CHANGED
@@ -82,3 +82,39 @@ height: 36px;
82
  padding: 14px 6px 15px 0;
83
  width: 36px;
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  padding: 14px 6px 15px 0;
83
  width: 36px;
84
  }
85
+ .at_custom_input{
86
+ float: left;
87
+
88
+ }
89
+ .at_custom_label{
90
+ width: 200px;
91
+ padding-left: 4px;
92
+ float: left;
93
+ }
94
+ .above_option_custom li,
95
+ .below_option_custom li{
96
+ height: 4.6em;
97
+ padding-left: 30px;
98
+ }
99
+ .above_option_custom li span.description,
100
+ .below_option_custom li span.description{
101
+ clear:both;
102
+ float:left;
103
+ }
104
+
105
+ .at_do_custom{
106
+ float:left;
107
+ clear:both;
108
+ width: 15px;
109
+ margin-left: 0;
110
+ margin-right: 0;
111
+ padding-left: 0;
112
+ padding-right: 0;
113
+ }
114
+
115
+ .above_option, .below_option{
116
+ clear:both;
117
+ }
118
+ .nocheck .at_custom_label{
119
+ margin-left:15px;
120
+ }
img/plusone-share.gif DELETED
Binary file
js/addthis.js CHANGED
@@ -3,7 +3,7 @@ jQuery(document).ready(function($) {
3
  var data = {action: "at_show_dashboard_widget"};
4
 
5
  $.post(ajaxurl, data, function(response){
6
- $( "#dashboard_addthis > .inside > .widget-loading").replaceWith(response);
7
  $( "#at_tabs").tabs();
8
  });
9
 
3
  var data = {action: "at_show_dashboard_widget"};
4
 
5
  $.post(ajaxurl, data, function(response){
6
+ $( "#dashboard_addthis > .inside ").replaceWith('<div class="inside">' + response + '</div>' );
7
  $( "#at_tabs").tabs();
8
  });
9
 
js/options-page.32.js CHANGED
@@ -117,6 +117,18 @@ 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)
@@ -128,12 +140,25 @@ jQuery(document).ready(function($) {
128
  $('.below_option_custom').addClass('hidden');
129
  }
130
  };
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  aboveCustomShow();
 
133
  belowCustomShow();
 
134
 
135
- $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow();} );
136
- $('input[name="addthis_settings[below]"]').change( function(){belowCustomShow();} );
137
-
138
 
139
  });
117
  $('.above_option_custom').addClass('hidden');
118
  }
119
  };
120
+ var aboveCustomString = $('#above_custom_string');
121
+ var aboveCustomStringShow = function(){
122
+ if (aboveCustomString.prop('checked') != 'undefined' && aboveCustomString.prop('checked') == true)
123
+ {
124
+ $('#above_custom_string_input').removeClass('hidden');
125
+ }
126
+ else
127
+ {
128
+ $('#above_custom_string_input').addClass('hidden');
129
+ }
130
+
131
+ };
132
  var belowCustom = $('#below_custom_button');
133
  var belowCustomShow = function(){
134
  if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
140
  $('.below_option_custom').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
+ };
155
 
156
  aboveCustomShow();
157
+ aboveCustomStringShow();
158
  belowCustomShow();
159
+ belowCustomStringShow();
160
 
161
+ $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow(); } );
162
+ $('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow(); } );
 
163
 
164
  });
js/options-page.js CHANGED
@@ -41,10 +41,8 @@ jQuery(document).ready(function($) {
41
  action: 'at_save_transient',
42
  value : stuff
43
  };
44
-
45
 
46
  jQuery.post(ajaxurl, data, function(response) {
47
-
48
  // Fix for WP 2.9's version of lightbox
49
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
50
  {
@@ -77,12 +75,12 @@ 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
  });
@@ -108,4 +106,59 @@ jQuery(document).ready(function($) {
108
  });
109
 
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  });
41
  action: 'at_save_transient',
42
  value : stuff
43
  };
 
44
 
45
  jQuery.post(ajaxurl, data, function(response) {
 
46
  // Fix for WP 2.9's version of lightbox
47
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
48
  {
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
  });
106
  });
107
 
108
 
109
+ var aboveCustom = $('#above_custom_button');
110
+ var aboveCustomShow = function(){
111
+ if ( aboveCustom.attr('checked') != 'undefined' && aboveCustom.attr('checked') == true)
112
+ {
113
+ $('.above_option_custom').removeClass('hidden');
114
+ }
115
+ else
116
+ {
117
+ $('.above_option_custom').addClass('hidden');
118
+ }
119
+ };
120
+ var aboveCustomString = $('#above_custom_string');
121
+ var aboveCustomStringShow = function(){
122
+ if (aboveCustomString.attr('checked') != 'undefined' && aboveCustomString.attr('checked') == true)
123
+ {
124
+ $('#above_custom_string_input').removeClass('hidden');
125
+ }
126
+ else
127
+ {
128
+ $('#above_custom_string_input').addClass('hidden');
129
+ }
130
+
131
+ };
132
+ var belowCustom = $('#below_custom_button');
133
+ var belowCustomShow = function(){
134
+ if ( belowCustom.attr('checked') != 'undefined' && belowCustom.attr('checked') == true)
135
+ {
136
+ $('.below_option_custom').removeClass('hidden');
137
+ }
138
+ else
139
+ {
140
+ $('.below_option_custom').addClass('hidden');
141
+ }
142
+ };
143
+ var belowCustomString = $('#below_custom_string');
144
+ var belowCustomStringShow = function(){
145
+ if (belowCustomString.attr('checked') != 'undefined' && belowCustomString.attr('checked') == true)
146
+ {
147
+ $('#below_custom_string_input').removeClass('hidden');
148
+ }
149
+ else
150
+ {
151
+ $('#below_custom_string_input').addClass('hidden');
152
+ }
153
+
154
+ };
155
+
156
+ aboveCustomShow();
157
+ aboveCustomStringShow();
158
+ belowCustomShow();
159
+ belowCustomStringShow();
160
+
161
+ $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow(); } );
162
+ $('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow(); } );
163
+
164
  });
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === AddThis featuring Sharing Buttons / Facebook Like / Tweet Button / Google + 1 ===
2
  Contributors: _mjk_, jorbin
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, plus one, google plus one, plus 1, + one, + 1, address bar sharing
4
  Requires at least: 2.9
5
- Tested up to: 3.1.3
6
- Stable tag: 2.1.2
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -12,12 +12,11 @@ Get more traffic back to your site by installing the AddThis WordPress plugin. W
12
 
13
  Optionally, 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
- Another options feature is Address Bar sharing. <a title="Address Bar Sharing Information" href="http://www.addthis.com/help/address-bar-sharing-analytics">Address Bar sharing analytics</a> give you the ability to track URLs that have been sent via emails, IMs and to forums using copy/paste. This captures a whole new segment of sharing that we have found to be up to 10x that of using social buttons. You now get a larger picture of where your direct traffic is coming from and how your users are really sharing your content.
16
-
17
  <a href="http://www.addthis.com/blog">AddThis Blog</a> | <a href="http://www.addthis.com/privacy">Privacy Policy</a>
18
 
19
  == Installation ==
20
 
 
21
  For an automatic installation through WordPress:
22
 
23
  1. Go to the 'Add New' plugins screen in your WordPress admin area
@@ -33,6 +32,8 @@ To upload the plugin through WordPress, instead of FTP:
33
 
34
  1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
35
 
 
 
36
  == Frequently Asked Questions ==
37
 
38
  = Is AddThis free? =
@@ -61,9 +62,6 @@ Over 1,200,000 sites have installed AddThis. With over a billion unique users, A
61
  = What services does AddThis support? =
62
  We currently support over 295 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>.
63
 
64
- = How do I remove AddThis from a page =
65
- In the screen options you can enable the AddThis meta box. Check the box and save if you've already published that page or post to disable AddThis on that page or post.
66
-
67
  == Screenshots ==
68
 
69
  1. The admin dashboard widget
@@ -75,51 +73,6 @@ In the screen options you can enable the AddThis meta box. Check the box and sa
75
  PHP 5+ is preferred; PHP 4 is supported.
76
 
77
  == Changelog ==
78
- = 2.1.2 =
79
- Add Address Bar sharing
80
-
81
- = 2.1.1 =
82
- * Add Google +1
83
-
84
- = 2.1.0 =
85
- * Add Twitter Template Option
86
- * Add Post Meta Box
87
- * Add top shared/clicked URLS to dashboard
88
- * More Filters
89
-
90
- = 2.0.6 =
91
- * define ADDTHIS_NO_NOTICES to prevent admin notices from displaying
92
-
93
- = 2.0.5 =
94
- * force service codes to be lowercase
95
- * If opting out of clickback tracking, set config to force opting out
96
-
97
- = 2.0.4 =
98
- * Fix conflict with other plugins
99
- * Prevent button js from appearing in feeds
100
-
101
- = 2.0.3 =
102
- * plugin should still work if theme doesn't have wp_head and wp_footer
103
-
104
- = 2.0.2 =
105
- * Bug Fixes
106
- * set addthis_exclude custom field to 'true' to not display addthis on that post / page
107
- * Added additional paramater to
108
- * Ability to specify custom toolboxes for both above and below
109
- * Added additional paramater to do_action('addthis_widget'). Paramaters are now:
110
- * * url (use get_permalink() if you are calling it inside the loop)
111
- * * title (use the_title() if calling inside the loop)
112
- * * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
113
-
114
-
115
-
116
- = 2.0.1 =
117
- * Fix theme compatablity issues
118
- * Fix excerpts bug
119
- * Add option to not display on excerpts
120
- * Restore option to customize services
121
- * Add more filters
122
-
123
  = 2.0.0 =
124
  * Redesigned Settings page
125
  * Added Share Counter option
@@ -163,29 +116,6 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
163
 
164
 
165
  == Upgrade Notice ==
166
- = 2.1.2 =
167
- Add Addresss Bar Sharing
168
-
169
- = 2.1.1 =
170
- Add +1 to the button options
171
-
172
- = 2.1.0 =
173
- More Features, More Filters, More Social Goodness
174
-
175
- = 2.0.5 =
176
- Force service codes to be lowercase and If opting out of clickback tracking, set config to force opting out
177
-
178
- = 2.0.4 =
179
- Fix conflict with other plugins and other bug fixes
180
-
181
- = 2.0.3 =
182
- Still work in themes that don't have wp_head and wp_footer
183
-
184
- = 2.0.2 =
185
- Bug Fixes, enhanced customization
186
-
187
- = 2.0.1 =
188
- Bug Fixes, more filters, small tweak to options
189
 
190
  = 2.0.0 =
191
  More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
1
+ === AddThis ===
2
  Contributors: _mjk_, jorbin
3
+ Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
4
  Requires at least: 2.9
5
+ Tested up to: 3.1.0
6
+ Stable tag: 2.0.0
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
12
 
13
  Optionally, 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
  <a href="http://www.addthis.com/blog">AddThis Blog</a> | <a href="http://www.addthis.com/privacy">Privacy Policy</a>
16
 
17
  == Installation ==
18
 
19
+
20
  For an automatic installation through WordPress:
21
 
22
  1. Go to the 'Add New' plugins screen in your WordPress admin area
32
 
33
  1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
34
 
35
+ Note: due to confusion, there are no longer separate versions for PHP4 and PHP5.
36
+
37
  == Frequently Asked Questions ==
38
 
39
  = Is AddThis free? =
62
  = What services does AddThis support? =
63
  We currently support over 295 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>.
64
 
 
 
 
65
  == Screenshots ==
66
 
67
  1. The admin dashboard widget
73
  PHP 5+ is preferred; PHP 4 is supported.
74
 
75
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  = 2.0.0 =
77
  * Redesigned Settings page
78
  * Added Share Counter option
116
 
117
 
118
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  = 2.0.0 =
121
  More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.