WordPress Share Buttons Plugin – AddThis - Version 2.1.0

Version Description

  • Add Twitter Template Option
  • Add Post Meta Box
  • Add top shared/clicked URLS to dashboard
  • More Filters
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.1.0

Files changed (3) hide show
  1. addthis_post_metabox.php +71 -0
  2. addthis_social_widget.php +368 -269
  3. readme.txt +13 -1
addthis_post_metabox.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_social_widget.php CHANGED
@@ -19,7 +19,6 @@
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,7 +26,7 @@ else return;
27
  * Plugin Name: AddThis Social Bookmarking Widget
28
  * Plugin URI: http://www.addthis.com
29
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
30
- * Version: 2.0.6
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com/blog
@@ -53,23 +52,21 @@ $addthis_styles = array(
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.com/bookmark.php?v=250&amp;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden'
65
  ), // Plus sign share | four buttons
66
  'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => ''
67
  ), // 32x32
68
  'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => '', 'below' => 'hidden'
69
  ), // facebook tweet share counter
70
- 'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="http://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'
71
  ), // Plus sign share
72
- 'button' => array( 'src' => '<div><a class="addthis_button" href="http://addthis.com/bookmark.php?v=250" %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></div>', '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
  ),
@@ -94,6 +91,15 @@ function at_title_check($title)
94
  return $title;
95
  }
96
 
 
 
 
 
 
 
 
 
 
97
  function addthis_script_to_content($content)
98
  {
99
  global $addthis_did_script_output;
@@ -107,112 +113,114 @@ function addthis_script_to_content($content)
107
  }
108
 
109
  define( 'addthis_style_default' , 'small_toolbox_with_share');
110
- define( 'ADDTHIS_PLUGIN_VERSION', '2.0.6');
111
  /**
112
  * Converts our old many options in to one beautiful array
113
  *
114
  */
115
- function addthis_options_200()
116
  {
117
-
118
- global $current_user;
119
- $user_id = $current_user->ID;
120
- $addthis_new_options = array();
121
- if ($username = get_option('addthis_username'))
122
- $addthis_new_options['username'] = $username;
 
 
123
 
124
- if ($password = get_option('addthis_password'))
125
- $addthis_new_options['password'] = $password;
126
 
127
- if ($show_stats = get_option('addthis_show_stats'))
128
- $addthis_new_options['addthis_show_stats'] = $show_stats;
129
-
130
- if ($append_data = get_option('addthis_append_data'))
131
- $addthis_new_options['addthis_append_data'] = $append_data;
132
-
133
- if ($showonhome = get_option('addthis_showonhome'))
134
- $addthis_new_options['addthis_showonhome'] = $showonhome;
135
-
136
- if ($showonpages = get_option('addthis_showonpages'))
137
- $addthis_new_options['addthis_showonpages'] = $showonpages;
138
-
139
- if ($showoncats = get_option('addthis_showoncats'))
140
- $addthis_new_options['addthis_showoncats'] = $showoncats;
141
-
142
- if ($showonarchives = get_option('addthis_showonarchives'))
143
- $addthis_new_options['addthis_showonarchives'] = $showonarchives;
144
 
145
- if (get_option('addthis_showonposts') != true)
146
- $addthis_new_options['below'] = 'none';
147
- elseif (get_option('addthis_sidebar_only') == true)
148
- $addthis_new_options['below'] = 'none';
149
- else
150
- {
151
- if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
152
- $addthis_new_options['below'] = 'small_toolbox_with_share';
153
  else
154
- $addthis_new_options['below'] = 'button';
155
- }
156
- if ($header_background = get_option('addthis_header_background'))
157
- $addthis_new_options['addthis_header_background'] = $header_background;
158
- if ($header_color = get_option('addthis_header_color'))
159
- $addthis_new_options['addthis_header_color'] = $header_color;
160
- if ($brand = get_option('addthis_brand'))
161
- $addthis_new_options['addthis_brand'] = $brand;
162
- if ($language = get_option('addthis_language'))
163
- $addthis_new_options['addthis_language'] = $language;
 
 
 
 
164
 
165
 
166
- // Above is new, set it to none
167
- $addthis_new_options['above'] = 'none';
168
 
169
- // Save option
170
- add_option('addthis_settings', $addthis_new_options);
171
 
172
- // if the option saved, delete the old options
173
-
174
- delete_option('addthis_show_stats');
175
- delete_option('addthis_password');
176
- delete_option('addthis_fallback_username');
177
- delete_option('addthis_options');
178
- delete_option('addthis_product');
179
- delete_option('addthis_isdropdown');
180
- delete_option('addthis_menu_type');
181
- delete_option('addthis_append_data');
182
- delete_option('addthis_showonhome');
183
- delete_option('addthis_showonposts');
184
- delete_option('addthis_showonpages');
185
- delete_option('addthis_showoncats');
186
- delete_option('addthis_showonarchives');
187
- delete_option('addthis_style');
188
- delete_option('addthis_header_background');
189
- delete_option('addthis_header_color');
190
- delete_option('addthis_sidebar_only');
191
- delete_option('addthis_brand');
192
- delete_option('addthis_language');;
193
-
194
 
195
- global $current_user;
196
- $user_id = $current_user->ID;
197
 
198
- add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
199
 
200
-
201
 
202
- }
203
 
204
- function addthis_options_210()
205
- {
206
- $options = get_option('addthis_settings');
207
- if ( isset( $options['username'] ) )
208
- $options['profile'] = $options['username'];
209
 
210
- update_option( 'addthis_settings', $options);
211
 
 
212
  }
213
 
214
 
215
-
216
  /**
217
  * Generates unique IDs
218
  */
@@ -343,32 +351,37 @@ function addthis_print_script() {
343
  add_action('admin_notices', 'addthis_admin_notices');
344
 
345
  function addthis_admin_notices(){
346
- if (! current_user_can('manage_options'))
347
  return;
348
 
349
- if ( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true )
350
- return;
351
- global $current_user;
352
  $user_id = $current_user->ID;
353
  $options = get_option('addthis_settings');
354
 
355
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
356
  {
357
  echo '<div class="updated addthis_setup_nag"><p>';
358
- 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');
 
 
359
  echo "</p></div>";
360
  }
361
 
362
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
363
  {
364
  echo '<div class="updated addthis_setup_nag"><p>';
365
- 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?profile=wpp', '?addthis_nag_username_ignore=0');
 
 
 
366
  echo "</p></div>";
367
  }
368
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
369
  {
370
  echo '<div class="updated addthis_setup_nag"><p>';
371
- 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');
 
 
372
  echo "</p></div>";
373
  }
374
  }
@@ -465,7 +478,8 @@ function addthis_render_dashboard_widget() {
465
  return false;
466
  }
467
  $domain = get_home_url();
468
-
 
469
  $domain = str_replace(array('http://', 'https://'), '', $domain);
470
 
471
  if (isset($options['profile']))
@@ -473,6 +487,7 @@ function addthis_render_dashboard_widget() {
473
  else
474
  $profile = '';
475
 
 
476
  $requests = array(
477
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
478
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
@@ -482,157 +497,187 @@ function addthis_render_dashboard_widget() {
482
  array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
483
  array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
484
  array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
485
-
 
486
  );
487
 
488
  if (! $stats = get_transient('addthis_dashboard_stats') )
489
  {
490
  add_filter('http_headers_useragent', 'addthis_plugin_useragent');
491
- foreach ($requests as $request)
492
- {
493
- $dimension = $metric = $domain = $period = '';
494
- extract($request);
495
- $dimension = ($dimension != '') ? '/'.$dimension : '';
496
- $url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
497
- 'domain='.$domain.'&period='.$period.
498
- '&username='.$username.
499
- '&password='.$password.
500
- $profile;
501
- $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
502
-
503
- if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
504
  {
505
- echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n";
506
- echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code();
507
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
510
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
 
 
 
 
 
511
  {
512
- echo "The Username / Password / Profile combination you presented is not valid.<br />";
513
- echo "Please confirm that you have correctly entered your AddThis username, password and profile id.";
514
- exit;
515
  }
516
- else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
 
 
517
  {
518
- 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";
519
- exit;
520
  }
 
521
 
522
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
523
- {
524
- echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set ";
525
- exit;
 
 
 
 
 
 
 
526
  }
 
527
 
528
- }
529
 
530
- if ( $stats['sharesday']['response']['code'] == 200)
531
- set_transient('addthis_dashboard_stats', $stats, '600');
532
-
533
- }
534
- if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
535
- {
536
- $yesterday['shares'] = json_decode($stats['sharesday']['body']);
537
- $yesterday['shares'] = $yesterday['shares'][0]->shares;
538
- $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
539
- $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
540
- $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
541
-
542
- if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
543
- if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
544
-
545
- $decodedLastWeek = json_decode($stats['sharesweek']['body']);
546
- $lastweek['shares'] = 0;
547
- foreach ($decodedLastWeek as $share)
548
- {
549
- $lastweek['shares'] += $share->shares;
550
- }
551
- $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
552
- $lastweek['clickbacks'] = 0;
553
- foreach ($decodedLastWeek as $clickback)
554
- {
555
- $lastweek['clickbacks'] += $clickback->clickbacks;
556
- }
557
- $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
558
 
559
- $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
560
- $lastmonth['shares'] = 0;
561
- foreach ($decodedLastMonth as $share)
562
- {
563
- $lastmonth['shares'] += $share->shares;
564
- }
565
- $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
566
- $lastmonth['clickbacks'] = 0;
567
- foreach ($decodedLastMonth as $clickback)
568
- {
569
- $lastmonth['clickbacks'] += $clickback->clickbacks;
570
- }
571
- $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
572
 
573
 
574
- $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
575
- $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
576
- foreach (array('shares', 'clickbacks') as $type)
 
 
 
 
 
577
  {
578
- $topServiceShare = array_shift($services[$type]);
579
- $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
580
- $firstAmount = $topServiceShare->{$type};
581
- $topServiceShare = array_shift($services[$type]);
582
- $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
583
- $secondAmount = $topServiceShare->{$type};
584
- $thirdLabel = 'Others';
585
- $thirdAmount = 0;
586
- foreach($services[$type] as $service )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587
  {
588
- $thirdAmount += $service->{$type};
 
 
589
  }
590
-
591
-
592
- $servicesCharts[$type] = 'http://chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&'.
593
- 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
594
- 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
595
- }
596
-
597
- echo "<div id='at_tabs'>";
598
- echo "<ul>";
599
- echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
600
- echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
601
- echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
602
- echo "</ul><div class='clear'>&nbsp;</div>";
603
- $tab = 0;
604
- foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
605
- {
606
- $stats = $$timePeriod;
607
- $tab++;
608
- $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
609
- echo '<div id="tab'.$tab.'">';
610
-
611
- echo
612
- '<table class="atw-table">
613
- <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
614
- <tr>';
615
- echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
616
- echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
617
- echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
618
-
619
- echo '</tr>';
620
- echo '</table>';
621
- echo '</div>';
622
- }
623
- echo "</div>";
624
- echo "<hr />";
625
- echo "<div id='tstab1'>";
626
  echo "<h5>Top Services for shares(last month)</h5>";
627
  echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
628
- echo "</div>";
629
- echo '<div id="tstab2">';
 
 
 
 
 
 
 
 
 
 
630
  echo "<h5>Top Services for clicks(last month)</h5>";
631
  echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
632
- echo "</div>";
633
- echo '<div class="clear">&nbsp;</div>';
634
- echo '<p><a class="button rbutton" href="http://www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
635
- }
636
  elseif($stats['sharesday']['response']['code'] == 200){
637
 
638
  echo
@@ -640,9 +685,9 @@ elseif($stats['sharesday']['response']['code'] == 200){
640
  <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>
641
  <p>If you want some ideas for increasing your sharing, check out:</p>
642
  <ul>
643
- <li><span class='b'><a href="http://www.addthis.com//blog/">The AddThis Blog</a></span></li>
644
- <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>
645
- <li><span class='b'><a href="http://www.addthis.com/forum/">The AddThis Forum</a></span></li>
646
  <ul>
647
  ENDHTML;
648
  }
@@ -776,7 +821,7 @@ elseif ($data['below'] = 'custom')
776
 
777
 
778
  // All the checkbox fields
779
- foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts') as $field)
780
  {
781
  if ( isset($data[$field]) && $data[$field] == true)
782
  $options[$field] = true;
@@ -785,6 +830,9 @@ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome'
785
 
786
  }
787
 
 
 
 
788
 
789
  //[addthis_brand] =>
790
 
@@ -860,7 +908,7 @@ function addthis_init()
860
 
861
  add_action( 'wp_head', 'addthis_add_content_filters');
862
 
863
- if (addthis_get_wp_version() >= 2.7) {
864
  if ( is_admin() ) {
865
  add_action( 'admin_init', 'register_addthis_settings' );
866
  }
@@ -868,23 +916,27 @@ function addthis_init()
868
 
869
  $options = get_option('addthis_settings');
870
 
871
- if (function_exists('wp_register_style')) {
872
- wp_register_style( 'addthis', WP_PLUGIN_URL . '/addthis/css/addthis.css');
873
- wp_register_script( 'addthis', WP_PLUGIN_URL . '/addthis/js/addthis.js', array('jquery-ui-tabs') );
874
 
875
- add_action('admin_print_styles-index.php', 'addthis_print_style');
876
- add_action('admin_print_scripts-index.php', 'addthis_print_script');
877
- }
878
 
879
- add_filter('admin_menu', 'addthis_admin_menu');
 
 
 
 
880
 
881
- if ( get_option('addthis_product') !== false && ! is_array( $options ) )
882
- addthis_options_200();
883
 
884
- // Upgrade to 210 from 200
885
- if ( isset($options['username']) && ! isset($options['profile']) )
886
- addthis_options_210();
 
887
 
 
 
 
 
888
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
889
 
890
  $product = get_option('addthis_product');
@@ -1075,8 +1127,9 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1075
  $custom_fields = get_post_custom($post->ID);
1076
  if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1077
  $display = false;
1078
-
1079
-
 
1080
  remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
1081
  remove_filter('get_the_excerpt', 'addthis_late_widget');
1082
  $url = get_permalink();
@@ -1172,7 +1225,7 @@ function addthis_output_script($return = false )
1172
 
1173
  $script = "\n<!-- AddThis Button Begin -->\n"
1174
  .'<script type="text/javascript">'
1175
- ."var addthis_product = 'wpp-256';\n";
1176
 
1177
 
1178
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
@@ -1189,6 +1242,13 @@ function addthis_output_script($return = false )
1189
  else
1190
  $addthis_config["data_track_clickback"] = false;
1191
 
 
 
 
 
 
 
 
1192
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1193
  $addthis_config['ui_language'] = $options['addthis_language'];
1194
 
@@ -1209,12 +1269,18 @@ function addthis_output_script($return = false )
1209
  $script .= 'var addthis_config = '. json_encode($addthis_config) .';';
1210
 
1211
  if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1212
- $script .= 'var addthis_options = "'.$options['addthis_options'].'"';
 
 
 
 
 
 
1213
 
1214
  $script .= '</script>';
1215
-
1216
 
1217
- $script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
 
1218
 
1219
 
1220
  if ( ! is_admin() && ! is_feed() )
@@ -1271,15 +1337,15 @@ function addthis_social_widget($content, $onSidebar = false, $url = null, $title
1271
  $content .= <<<EOF
1272
  //-->
1273
  </script>
1274
- <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">
1275
  EOF;
1276
- $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>';
1277
  }
1278
  else if ($addthis_settings['menu_type'] === 'toolbox')
1279
  {
1280
  $content .= "\n//-->\n</script>\n";
1281
  $content .= <<<EOF
1282
- <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>
1283
  EOF;
1284
  if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
1285
  $addthis_options = split(',', $addthis_options);
@@ -1289,7 +1355,7 @@ EOF;
1289
  $content .= '<a class="addthis_button_'.$option.'"></a>';
1290
  }
1291
  }
1292
- $content .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
1293
  }
1294
  else
1295
  {
@@ -1298,7 +1364,7 @@ EOF;
1298
  $content .= <<<EOF
1299
  //-->
1300
  </script>
1301
- <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">
1302
  EOF;
1303
  $content .= addthis_get_button_img() . '</a></div>';
1304
  }
@@ -1337,7 +1403,7 @@ function addthis_get_button_img( $btnStyle = false )
1337
 
1338
  if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
1339
  $btnRecord = $addthis_styles[$btnStyle];
1340
- $btnUrl = (strpos(trim($btnRecord['img']), 'http://') !== 0 ? "http://s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
1341
 
1342
  if (strpos($btnUrl, '%lang%') !== false)
1343
  {
@@ -1352,12 +1418,14 @@ EOF;
1352
 
1353
  function addthis_options_page_scripts()
1354
  {
1355
- wp_enqueue_script( 'addthis_options_page_script', plugins_url( '/addthis/js/options-page.js', basename(dirname(__FILE__)) ), array('jquery-ui-tabs', 'thickbox' ));
 
1356
  }
1357
 
1358
  function addthis_options_page_style()
1359
  {
1360
- wp_enqueue_style( 'addthis_options_page_style', plugins_url('/addthis/css/options-page.css', basename(dirname(__FILE__)) ) );
 
1361
  wp_enqueue_style( 'thickbox' );
1362
  }
1363
 
@@ -1382,6 +1450,7 @@ function addthis_admin_menu()
1382
  'addthis_showonpages' => true,
1383
  'addthis_showonarchives' => true,
1384
  'addthis_showoncats' => true,
 
1385
  'addthis_brand' => '',
1386
  'toolbox' => '',
1387
  'addthis_language' => '',
@@ -1397,6 +1466,7 @@ function addthis_admin_menu()
1397
  'below_custom_services' => '',
1398
  'below_custom_preferred' => '',
1399
  'below_custom_more' => '',
 
1400
  );
1401
 
1402
  function addthis_plugin_options_php4() {
@@ -1419,10 +1489,10 @@ function addthis_plugin_options_php4() {
1419
  <form id="addthis_settings" method="post" action="options.php">
1420
  <?php
1421
  // use the old-school settings style in older versions of wordpress
1422
- if (addthis_get_wp_version() < 2.7) {
1423
- wp_nonce_field('update-options');
1424
- } else {
1425
  settings_fields('addthis');
 
 
1426
  }
1427
 
1428
  $addthis_options = get_option('addthis_settings');
@@ -1438,7 +1508,7 @@ function addthis_plugin_options_php4() {
1438
  ?>
1439
 
1440
  <div class="page-header" id="tabs">
1441
- <img alt='addthis' src="http://cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
1442
  <ul class="nav-tab-wrapper">
1443
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
1444
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
@@ -1450,7 +1520,8 @@ function addthis_plugin_options_php4() {
1450
  <tr>
1451
  <td id="above" colspan="2">
1452
  <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>
1453
- <?php foreach ($addthis_new_styles as $k => $v)
 
1454
  {
1455
  $class = 'hidden';
1456
  $checked = '';
@@ -1458,7 +1529,7 @@ function addthis_plugin_options_php4() {
1458
  $checked = 'checked="checked"';
1459
  $class = '';
1460
  }
1461
- 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>";
1462
  }
1463
 
1464
  $class = 'hidden';
@@ -1477,7 +1548,7 @@ function addthis_plugin_options_php4() {
1477
  $above_do_custom_preferred = ( isset( $above_do_custom_preferred ) && $above_do_custom_preferred ) ? 'checked="checked"' : '';
1478
 
1479
  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>";
1480
- 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='http://addthis.com/services'>service codes</a> </span></li>";
1481
  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>
1482
  <select name='addthis_settings[above_custom_preferred]' class='at_custom_input'>";
1483
  for($i=0; $i <= 11; $i++)
@@ -1514,7 +1585,7 @@ function addthis_plugin_options_php4() {
1514
  $class = '';
1515
  }
1516
 
1517
- 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>";
1518
  }
1519
  $class = 'hidden';
1520
  $checked = '';
@@ -1531,7 +1602,7 @@ function addthis_plugin_options_php4() {
1531
  $below_do_custom_preferred = ( isset( $below_do_custom_preferred ) && $below_do_custom_preferred) ? 'checked="checked"' : '';
1532
 
1533
  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>";
1534
- 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='http://addthis.com/services'>service codes</a> </span></li>";
1535
  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>
1536
  <select name='addthis_settings[below_custom_preferred]' class='at_custom_input'>";
1537
  for($i=0; $i <= 11; $i++)
@@ -1555,7 +1626,7 @@ function addthis_plugin_options_php4() {
1555
  </td>
1556
  </tr>
1557
  <tr valign="top">
1558
- <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="http://addthis.com/features" target="_blank">Click here for more information on the benefits of register</a>.<a href="http://www.addthis.com/help/faq#accounts" target="_blank">Click here for more information on usernames and profiles</a> ', 'addthis_trans_domain');?> </td>
1559
  </tr>
1560
  <tr valign="top">
1561
  <th scope="row"><?php _e("AddThis profile id:", 'addthis_trans_domain' ); ?></th>
@@ -1580,15 +1651,21 @@ function addthis_plugin_options_php4() {
1580
  <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1581
  </tr>
1582
  <tr>
1583
- <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>
1584
  <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1585
  </tr>
 
 
 
 
 
 
1586
  <tr>
1587
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1588
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1589
  </tr>
1590
  <tr>
1591
- <th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1592
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1593
  </tr>
1594
  <tr>
@@ -1607,7 +1684,7 @@ function addthis_plugin_options_php4() {
1607
  <td colspan="2"></td>
1608
  </tr>
1609
  <tr valign="top">
1610
- <td colspan="2">For more details on the following options, see <a href="http://addthis.com/customization">our customization docs</a>.</td>
1611
  </tr>
1612
  <tr valign="top">
1613
  <th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
@@ -1615,14 +1692,17 @@ function addthis_plugin_options_php4() {
1615
  , 'addthis_trans_domain') ?>
1616
  </span></th>
1617
  <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1618
- <span class='description'><?php _e('Enter a comma-separated list of <a href="http://addthis.com/services/list">service codes</a>', 'addthis_trans_domain' ); ?></span>
1619
  </td>
1620
-
1621
  </tr>
1622
  <tr valign="top">
1623
  <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
1624
  <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
1625
  </tr>
 
 
 
 
1626
  <tr valign="top">
1627
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1628
  <td>
@@ -1710,6 +1790,22 @@ if (! function_exists('get_home_url'))
1710
  }
1711
  }
1712
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1713
  /**
1714
  * Make sure the option gets added on registration
1715
  * @since 2.0.6
@@ -1723,4 +1819,7 @@ function addthis_activation_hook(){
1723
 
1724
  register_activation_hook( __FILE__, 'addthis_activation_hook' );
1725
 
 
 
 
1726
  ?>
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
  * 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.0
30
  *
31
  * Author: The AddThis Team
32
  * Author URI: http://www.addthis.com/blog
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
 
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
  ),
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;
113
  }
114
 
115
  define( 'addthis_style_default' , 'small_toolbox_with_share');
116
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.1.0');
117
  /**
118
  * Converts our old many options in to one beautiful array
119
  *
120
  */
121
+ if ( apply_filters( 'at_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
  /**
225
  * Generates unique IDs
226
  */
351
  add_action('admin_notices', 'addthis_admin_notices');
352
 
353
  function addthis_admin_notices(){
354
+ if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
355
  return;
356
 
357
+ global $current_user ;
 
 
358
  $user_id = $current_user->ID;
359
  $options = get_option('addthis_settings');
360
 
361
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
362
  {
363
  echo '<div class="updated addthis_setup_nag"><p>';
364
+ 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>'),
365
+ admin_url('options-general.php?page=' . __FILE__ ),
366
+ '?addthis_nag_ignore=0');
367
  echo "</p></div>";
368
  }
369
 
370
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
371
  {
372
  echo '<div class="updated addthis_setup_nag"><p>';
373
+ 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>'),
374
+ admin_url('options-general.php?page=' . __FILE__ ),
375
+ 'https://www.addthis.com/register?profile=wpp',
376
+ '?addthis_nag_username_ignore=0');
377
  echo "</p></div>";
378
  }
379
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
380
  {
381
  echo '<div class="updated addthis_setup_nag"><p>';
382
+ 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>'),
383
+ admin_url('options-general.php?page=' . __FILE__ ),
384
+ '?addthis_nag_updated_ignore=0');
385
  echo "</p></div>";
386
  }
387
  }
478
  return false;
479
  }
480
  $domain = get_home_url();
481
+
482
+
483
  $domain = str_replace(array('http://', 'https://'), '', $domain);
484
 
485
  if (isset($options['profile']))
487
  else
488
  $profile = '';
489
 
490
+
491
  $requests = array(
492
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
493
  array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
497
  array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
498
  array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
499
  array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
500
+ array('metric' => 'shares', 'dimension' => 'url' , 'domain' => $domain, 'period' => 'month'),
501
+ array('metric' => 'clickbacks', 'dimension' => 'url', 'domain' => $domain, 'period' => 'month'),
502
  );
503
 
504
  if (! $stats = get_transient('addthis_dashboard_stats') )
505
  {
506
  add_filter('http_headers_useragent', 'addthis_plugin_useragent');
507
+ foreach ($requests as $request)
 
 
 
 
 
 
 
 
 
 
 
 
508
  {
509
+ $dimension = $metric = $domain = $period = '';
510
+ extract($request);
511
+ $dimension = ($dimension != '') ? '/'.$dimension : '';
512
+ $url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
513
+ 'domain='.$domain.'&period='.$period.
514
+ '&username='.$username.
515
+ '&password='.$password.
516
+ $profile;
517
+ $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
518
+
519
+ if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
520
+ {
521
+ echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n";
522
+ if (defined(WP_DEBUG) && WP_DEBUG == TRUE)
523
+ echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code();
524
+
525
+ exit;
526
+ }
527
+
528
+ else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
529
+ {
530
+ echo "The Username / Password / Profile combination you presented is not valid.<br />";
531
+ echo "Please confirm that you have correctly entered your AddThis username, password and profile id.";
532
+ exit;
533
+ }
534
+ else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
535
+ {
536
+ 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";
537
+ exit;
538
+ }
539
+
540
+ else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
541
+ {
542
+ echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set ";
543
+ exit;
544
+ }
545
+ else if ($stats[$metric.$dimension.$period]['response']['code'] != 201 )
546
+ {
547
+ }
548
  }
549
+
550
+ if ( $stats['sharesday']['response']['code'] == 200)
551
+ set_transient('addthis_dashboard_stats', $stats, '600');
552
+
553
+ }
554
+ if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
555
+ {
556
+ $shareurls = json_decode($stats['shares/urlmonth']['body']);
557
+ $clickbackurls = json_decode($stats['clickbacks/urlmonth']['body']);
558
+ $yesterday['shares'] = json_decode($stats['sharesday']['body']);
559
+ $yesterday['shares'] = $yesterday['shares'][0]->shares;
560
+ $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
561
+ $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
562
+ $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
563
 
564
+ if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
565
+ if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
566
+
567
+ $decodedLastWeek = json_decode($stats['sharesweek']['body']);
568
+ $lastweek['shares'] = 0;
569
+ foreach ($decodedLastWeek as $share)
570
  {
571
+ $lastweek['shares'] += $share->shares;
 
 
572
  }
573
+ $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
574
+ $lastweek['clickbacks'] = 0;
575
+ foreach ($decodedLastWeek as $clickback)
576
  {
577
+ $lastweek['clickbacks'] += $clickback->clickbacks;
 
578
  }
579
+ $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
580
 
581
+ $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
582
+ $lastmonth['shares'] = 0;
583
+ foreach ($decodedLastMonth as $share)
584
+ {
585
+ $lastmonth['shares'] += $share->shares;
586
+ }
587
+ $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
588
+ $lastmonth['clickbacks'] = 0;
589
+ foreach ($decodedLastMonth as $clickback)
590
+ {
591
+ $lastmonth['clickbacks'] += $clickback->clickbacks;
592
  }
593
+ $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
594
 
 
595
 
596
+ $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
597
+ $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
598
+ foreach (array('shares', 'clickbacks') as $type)
599
+ {
600
+ $topServiceShare = array_shift($services[$type]);
601
+ $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
602
+ $firstAmount = $topServiceShare->{$type};
603
+ $topServiceShare = array_shift($services[$type]);
604
+ $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
605
+ $secondAmount = $topServiceShare->{$type};
606
+ $thirdLabel = 'Others';
607
+ $thirdAmount = 0;
608
+ foreach($services[$type] as $service )
609
+ {
610
+ $thirdAmount += $service->{$type};
611
+ }
 
 
 
 
 
 
 
 
 
 
 
 
612
 
613
+
614
+ $servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&'.
615
+ 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
616
+ 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
617
+ }
 
 
 
 
 
 
 
 
618
 
619
 
620
+ echo "<div id='at_tabs'>";
621
+ echo "<ul>";
622
+ echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
623
+ echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
624
+ echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
625
+ echo "</ul><div class='clear'>&nbsp;</div>";
626
+ $tab = 0;
627
+ foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
628
  {
629
+ $stats = $$timePeriod;
630
+ $tab++;
631
+ $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
632
+ echo '<div id="tab'.$tab.'">';
633
+
634
+ echo
635
+ '<table class="atw-table">
636
+ <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
637
+ <tr>';
638
+ echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
639
+ echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
640
+ echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
641
+
642
+ echo '</tr>';
643
+ echo '</table>';
644
+ echo '</div>';
645
+ }
646
+ echo "</div>";
647
+
648
+ echo "<div>";
649
+ echo "</div>";
650
+ echo "<div id='tstab1'>";
651
+ echo "<h5> Most Shared URLs (last month) </h5>";
652
+ echo "<ul>";
653
+ $count = count($shareurls);
654
+ for($i = 0; ( $i < 5 && $i < $count ); $i++)
655
  {
656
+ $url = array_shift($shareurls);
657
+ $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
658
+ echo "<li><span class='urlCount'>" . $url->shares . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
659
  }
660
+ echo "</ul>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  echo "<h5>Top Services for shares(last month)</h5>";
662
  echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
663
+ echo "</div>";
664
+ echo '<div id="tstab2">';
665
+ echo '<h5> Most Clicked URLs (last month) </h5>';
666
+ echo "<ul>";
667
+ $count = count($clickbackurls);
668
+ for($i = 0; ( $i < 5 && $i < $count ); $i++)
669
+ {
670
+ $url = array_shift($clickbackurls);
671
+ $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
672
+ echo "<li><span class='urlCount'>" . $url->clickbacks . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
673
+ }
674
+ echo "</ul>";
675
  echo "<h5>Top Services for clicks(last month)</h5>";
676
  echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
677
+ echo "</div>";
678
+ echo '<div class="clear">&nbsp;</div>';
679
+ echo '<p><a class="button rbutton" href="//www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
680
+ }
681
  elseif($stats['sharesday']['response']['code'] == 200){
682
 
683
  echo
685
  <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>
686
  <p>If you want some ideas for increasing your sharing, check out:</p>
687
  <ul>
688
+ <li><span class='b'><a href="//www.addthis.com//blog/">The AddThis Blog</a></span></li>
689
+ <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>
690
+ <li><span class='b'><a href="//www.addthis.com/forum/">The AddThis Forum</a></span></li>
691
  <ul>
692
  ENDHTML;
693
  }
821
 
822
 
823
  // All the checkbox fields
824
+ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar') as $field)
825
  {
826
  if ( isset($data[$field]) && $data[$field] == true)
827
  $options[$field] = true;
830
 
831
  }
832
 
833
+ //[addthis_twitter_template]
834
+ if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 )
835
+ $options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
836
 
837
  //[addthis_brand] =>
838
 
908
 
909
  add_action( 'wp_head', 'addthis_add_content_filters');
910
 
911
+ if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', '__return_false') ) {
912
  if ( is_admin() ) {
913
  add_action( 'admin_init', 'register_addthis_settings' );
914
  }
916
 
917
  $options = get_option('addthis_settings');
918
 
 
 
 
919
 
920
+ $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
921
+ $style_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
 
922
 
923
+ wp_register_style( 'addthis', $style_location );
924
+ wp_register_script( 'addthis', $script_location , array('jquery-ui-tabs') );
925
+
926
+ add_action('admin_print_styles-index.php', 'addthis_print_style');
927
+ add_action('admin_print_scripts-index.php', 'addthis_print_script');
928
 
929
+ add_filter('admin_menu', 'addthis_admin_menu');
 
930
 
931
+ if ( apply_filters( 'at_do_options_upgrades', '__return_true') )
932
+ {
933
+ if ( get_option('addthis_product') !== false && ! is_array( $options ) )
934
+ addthis_options_200();
935
 
936
+ // Upgrade to 210 from 200
937
+ if ( isset($options['username']) && ! isset($options['profile']) )
938
+ addthis_options_210();
939
+ }
940
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
941
 
942
  $product = get_option('addthis_product');
1127
  $custom_fields = get_post_custom($post->ID);
1128
  if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1129
  $display = false;
1130
+
1131
+ $display = apply_filters('addthis_post_exclude', $display);
1132
+
1133
  remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
1134
  remove_filter('get_the_excerpt', 'addthis_late_widget');
1135
  $url = get_permalink();
1225
 
1226
  $script = "\n<!-- AddThis Button Begin -->\n"
1227
  .'<script type="text/javascript">'
1228
+ ."var addthis_product = 'wpp-257';\n";
1229
 
1230
 
1231
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1242
  else
1243
  $addthis_config["data_track_clickback"] = false;
1244
 
1245
+ /*/
1246
+ if ( isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true)
1247
+ $addthis_config["data_track_addressbar"] = true;
1248
+ else
1249
+ $addthis_config["data_track_addressbar"] = false;
1250
+ //*/
1251
+
1252
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1253
  $addthis_config['ui_language'] = $options['addthis_language'];
1254
 
1269
  $script .= 'var addthis_config = '. json_encode($addthis_config) .';';
1270
 
1271
  if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1272
+ $script .= 'var addthis_options = "'.$options['addthis_options'].'";';
1273
+
1274
+ if (isset($options['addthis_twitter_template'])){
1275
+ $script .= 'if (typeof(addthis_share) == "undefined"){
1276
+ var addthis_share = { templates: { twitter: "' . esc_js($options['addthis_twitter_template']) . '" } };
1277
+ }';
1278
+ }
1279
 
1280
  $script .= '</script>';
 
1281
 
1282
+
1283
+ $script .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1284
 
1285
 
1286
  if ( ! is_admin() && ! is_feed() )
1337
  $content .= <<<EOF
1338
  //-->
1339
  </script>
1340
+ <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">
1341
  EOF;
1342
+ $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>';
1343
  }
1344
  else if ($addthis_settings['menu_type'] === 'toolbox')
1345
  {
1346
  $content .= "\n//-->\n</script>\n";
1347
  $content .= <<<EOF
1348
+ <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>
1349
  EOF;
1350
  if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
1351
  $addthis_options = split(',', $addthis_options);
1355
  $content .= '<a class="addthis_button_'.$option.'"></a>';
1356
  }
1357
  }
1358
+ $content .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
1359
  }
1360
  else
1361
  {
1364
  $content .= <<<EOF
1365
  //-->
1366
  </script>
1367
+ <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">
1368
  EOF;
1369
  $content .= addthis_get_button_img() . '</a></div>';
1370
  }
1403
 
1404
  if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
1405
  $btnRecord = $addthis_styles[$btnStyle];
1406
+ $btnUrl = (strpos(trim($btnRecord['img']), '//') !== 0 ? "//s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
1407
 
1408
  if (strpos($btnUrl, '%lang%') !== false)
1409
  {
1418
 
1419
  function addthis_options_page_scripts()
1420
  {
1421
+ $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/options-page.js' ;
1422
+ wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
1423
  }
1424
 
1425
  function addthis_options_page_style()
1426
  {
1427
+ $style_location = apply_filters( 'at_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
1428
+ wp_enqueue_style( 'addthis_options_page_style', $style_location);
1429
  wp_enqueue_style( 'thickbox' );
1430
  }
1431
 
1450
  'addthis_showonpages' => true,
1451
  'addthis_showonarchives' => true,
1452
  'addthis_showoncats' => true,
1453
+ 'addthis_addressbar' => false,
1454
  'addthis_brand' => '',
1455
  'toolbox' => '',
1456
  'addthis_language' => '',
1466
  'below_custom_services' => '',
1467
  'below_custom_preferred' => '',
1468
  'below_custom_more' => '',
1469
+ 'addthis_twitter_template' => '',
1470
  );
1471
 
1472
  function addthis_plugin_options_php4() {
1489
  <form id="addthis_settings" method="post" action="options.php">
1490
  <?php
1491
  // use the old-school settings style in older versions of wordpress
1492
+ if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', '__return_false') ) {
 
 
1493
  settings_fields('addthis');
1494
+ } else {
1495
+ wp_nonce_field('update-options');
1496
  }
1497
 
1498
  $addthis_options = get_option('addthis_settings');
1508
  ?>
1509
 
1510
  <div class="page-header" id="tabs">
1511
+ <img alt='addthis' src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
1512
  <ul class="nav-tab-wrapper">
1513
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
1514
  <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
1520
  <tr>
1521
  <td id="above" colspan="2">
1522
  <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>
1523
+ <?php $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1524
+ foreach ($addthis_new_styles as $k => $v)
1525
  {
1526
  $class = 'hidden';
1527
  $checked = '';
1529
  $checked = 'checked="checked"';
1530
  $class = '';
1531
  }
1532
+ 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>";
1533
  }
1534
 
1535
  $class = 'hidden';
1548
  $above_do_custom_preferred = ( isset( $above_do_custom_preferred ) && $above_do_custom_preferred ) ? 'checked="checked"' : '';
1549
 
1550
  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>";
1551
+ 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>";
1552
  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>
1553
  <select name='addthis_settings[above_custom_preferred]' class='at_custom_input'>";
1554
  for($i=0; $i <= 11; $i++)
1585
  $class = '';
1586
  }
1587
 
1588
+ 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>";
1589
  }
1590
  $class = 'hidden';
1591
  $checked = '';
1602
  $below_do_custom_preferred = ( isset( $below_do_custom_preferred ) && $below_do_custom_preferred) ? 'checked="checked"' : '';
1603
 
1604
  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>";
1605
+ 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>";
1606
  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>
1607
  <select name='addthis_settings[below_custom_preferred]' class='at_custom_input'>";
1608
  for($i=0; $i <= 11; $i++)
1626
  </td>
1627
  </tr>
1628
  <tr valign="top">
1629
+ <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>
1630
  </tr>
1631
  <tr valign="top">
1632
  <th scope="row"><?php _e("AddThis profile id:", 'addthis_trans_domain' ); ?></th>
1651
  <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
1652
  </tr>
1653
  <tr>
1654
+ <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>
1655
  <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1656
  </tr>
1657
+ <?php /* ?>
1658
+ <tr>
1659
+ <th scope="row"><?php _e("Track Address Bar Shares", 'addthis_trans_domain' ); ?></th>
1660
+ <td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
1661
+ </tr>
1662
+ <?php //*/ ?>
1663
  <tr>
1664
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1665
  <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1666
  </tr>
1667
  <tr>
1668
+ <th scope="row"><?php _e("Show on <a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1669
  <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1670
  </tr>
1671
  <tr>
1684
  <td colspan="2"></td>
1685
  </tr>
1686
  <tr valign="top">
1687
+ <td colspan="2">For more details on the following options, see <a href="//addthis.com/customization">our customization docs</a>.</td>
1688
  </tr>
1689
  <tr valign="top">
1690
  <th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
1692
  , 'addthis_trans_domain') ?>
1693
  </span></th>
1694
  <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1695
+ <span class='description'><?php _e('Enter a comma-separated list of <a href="//addthis.com/services/list">service codes</a>', 'addthis_trans_domain' ); ?></span>
1696
  </td>
 
1697
  </tr>
1698
  <tr valign="top">
1699
  <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
1700
  <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
1701
  </tr>
1702
+ <tr valign="top">
1703
+ <th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template</a>:", 'addthis_trans_domain' ); ?></th>
1704
+ <td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
1705
+ </tr>
1706
  <tr valign="top">
1707
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1708
  <td>
1790
  }
1791
  }
1792
 
1793
+ if (! function_exists('__return_false'))
1794
+ {
1795
+ function __return_false()
1796
+ {
1797
+ return false;
1798
+ }
1799
+ }
1800
+
1801
+ if (! function_exists('__return_true'))
1802
+ {
1803
+ function __return_true()
1804
+ {
1805
+ return true;
1806
+ }
1807
+ }
1808
+
1809
  /**
1810
  * Make sure the option gets added on registration
1811
  * @since 2.0.6
1819
 
1820
  register_activation_hook( __FILE__, 'addthis_activation_hook' );
1821
 
1822
+
1823
+ require_once('addthis_post_metabox.php');
1824
+
1825
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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
4
  Requires at least: 2.9
5
  Tested up to: 3.1.1
6
- Stable tag: 2.0.6
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -61,6 +61,9 @@ 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
  == Screenshots ==
65
 
66
  1. The admin dashboard widget
@@ -72,6 +75,12 @@ We currently support over 295 services, from email and blogging platforms to soc
72
  PHP 5+ is preferred; PHP 4 is supported.
73
 
74
  == Changelog ==
 
 
 
 
 
 
75
  = 2.0.6 =
76
  * define ADDTHIS_NO_NOTICES to prevent admin notices from displaying
77
 
@@ -148,6 +157,9 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
148
 
149
 
150
  == Upgrade Notice ==
 
 
 
151
  = 2.0.5 =
152
  Force service codes to be lowercase and If opting out of clickback tracking, set config to force opting out
153
 
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz
4
  Requires at least: 2.9
5
  Tested up to: 3.1.1
6
+ Stable tag: 2.1.0
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
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
  PHP 5+ is preferred; PHP 4 is supported.
76
 
77
  == Changelog ==
78
+ = 2.1.0 =
79
+ * Add Twitter Template Option
80
+ * Add Post Meta Box
81
+ * Add top shared/clicked URLS to dashboard
82
+ * More Filters
83
+
84
  = 2.0.6 =
85
  * define ADDTHIS_NO_NOTICES to prevent admin notices from displaying
86
 
157
 
158
 
159
  == Upgrade Notice ==
160
+ = 2.1.0 =
161
+ More Features, More Filters, More Social Goodness
162
+
163
  = 2.0.5 =
164
  Force service codes to be lowercase and If opting out of clickback tracking, set config to force opting out
165