WordPress Share Buttons Plugin – AddThis - Version 2.0.5

Version Description

  • force service codes to be lowercase
  • If opting out of clickback tracking, set config to force opting out
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

Files changed (2) hide show
  1. addthis_social_widget.php +34 -16
  2. readme.txt +9 -2
addthis_social_widget.php CHANGED
@@ -27,7 +27,7 @@ else return;
27
  * Plugin Name: AddThis Social Bookmarking Widget
28
  * Plugin URI: http://www.addthis.com
29
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
30
- * Version: 2.0.4
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com/blog
@@ -107,7 +107,7 @@ function addthis_script_to_content($content)
107
  }
108
 
109
  define( 'addthis_style_default' , 'small_toolbox_with_share');
110
- define( 'ADDTHIS_PLUGIN_VERSION', '2.0.4');
111
  /**
112
  * Converts our old many options in to one beautiful array
113
  *
@@ -302,7 +302,7 @@ function addthis_custom_toolbox($options, $url, $title)
302
  if ($service == 'more')
303
  $button .= '<a class="addthis_button_compact"></a>';
304
  else
305
- $button .= '<a class="addthis_button_'.$service.'"></a>';
306
  }
307
  }
308
 
@@ -359,7 +359,7 @@ function addthis_admin_notices(){
359
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
360
  {
361
  echo '<div class="updated addthis_setup_nag"><p>';
362
- 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');
363
  echo "</p></div>";
364
  }
365
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
@@ -496,20 +496,36 @@ function addthis_render_dashboard_widget() {
496
  '&password='.$password.
497
  $profile;
498
  $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
499
- }
500
-
501
- foreach($stats as $response)
502
  {
503
- if (is_wp_error($response) )
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:" . $response->get_error_code();
507
  exit;
508
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  }
510
 
511
- if ($stats['sharesday']['response']['code'] == 200)
512
- set_transient('addthis_dashboard_stats', $stats, '600');
 
 
513
 
514
  }
515
  if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
@@ -774,7 +790,7 @@ if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
774
 
775
  //[addthis_options] =>
776
  if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
777
- $options['addthis_options'] = str_replace(' ', '', esc_js($data['addthis_options']));
778
 
779
  //[addthis_language] =>
780
  if ( isset ($data['addthis_language']))
@@ -1146,7 +1162,7 @@ function addthis_output_script($return = false )
1146
 
1147
  $script = "\n<!-- AddThis Button Begin -->\n"
1148
  .'<script type="text/javascript">'
1149
- ."var addthis_product = 'wpp-254';\n";
1150
 
1151
 
1152
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
@@ -1160,7 +1176,9 @@ function addthis_output_script($return = false )
1160
 
1161
  if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
1162
  $addthis_config["data_track_clickback"] = true;
1163
-
 
 
1164
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1165
  $addthis_config['ui_language'] = $options['addthis_language'];
1166
 
@@ -1587,7 +1605,7 @@ function addthis_plugin_options_php4() {
1587
  , 'addthis_trans_domain') ?>
1588
  </span></th>
1589
  <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1590
- <span class='description'><?php _e('Enter a comma-separated list of <a href="http://addthis.com/services">service codes</a>', 'addthis_trans_domain' ); ?></span>
1591
  </td>
1592
 
1593
  </tr>
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.5
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com/blog
107
  }
108
 
109
  define( 'addthis_style_default' , 'small_toolbox_with_share');
110
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.0.5');
111
  /**
112
  * Converts our old many options in to one beautiful array
113
  *
302
  if ($service == 'more')
303
  $button .= '<a class="addthis_button_compact"></a>';
304
  else
305
+ $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
306
  }
307
  }
308
 
359
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
360
  {
361
  echo '<div class="updated addthis_setup_nag"><p>';
362
+ 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');
363
  echo "</p></div>";
364
  }
365
  elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
496
  '&password='.$password.
497
  $profile;
498
  $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
499
+
500
+ if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
 
501
  {
 
 
502
  echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n";
503
  echo "Error Code:" . $response->get_error_code();
504
  exit;
505
+ }
506
+
507
+ else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
508
+ {
509
+ echo "The Username / Password / Profile combination you presented is not valid.<br />";
510
+ echo "Please confirm that you have correctly entered your AddThis username, password and profile id.";
511
+ exit;
512
+ }
513
+ else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
514
+ {
515
+ 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";
516
+ exit;
517
+ }
518
+
519
+ else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
520
+ {
521
+ echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set ";
522
+ exit;
523
  }
524
 
525
+ }
526
+
527
+ if ( $stats['sharesday']['response']['code'] == 200)
528
+ set_transient('addthis_dashboard_stats', $stats, '600');
529
 
530
  }
531
  if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
790
 
791
  //[addthis_options] =>
792
  if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
793
+ $options['addthis_options'] = str_replace(' ', '', esc_js( strtolower( $data['addthis_options'] ) ));
794
 
795
  //[addthis_language] =>
796
  if ( isset ($data['addthis_language']))
1162
 
1163
  $script = "\n<!-- AddThis Button Begin -->\n"
1164
  .'<script type="text/javascript">'
1165
+ ."var addthis_product = 'wpp-255';\n";
1166
 
1167
 
1168
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1176
 
1177
  if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
1178
  $addthis_config["data_track_clickback"] = true;
1179
+ else
1180
+ $addthis_config["data_track_clickback"] = false;
1181
+
1182
  if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1183
  $addthis_config['ui_language'] = $options['addthis_language'];
1184
 
1605
  , 'addthis_trans_domain') ?>
1606
  </span></th>
1607
  <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1608
+ <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>
1609
  </td>
1610
 
1611
  </tr>
readme.txt CHANGED
@@ -2,8 +2,8 @@
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
4
  Requires at least: 2.9
5
- Tested up to: 3.1.0
6
- Stable tag: 2.0.4
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -73,6 +73,10 @@ PHP 5+ is preferred; PHP 4 is supported.
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 2.0.4 =
77
  * Fix conflict with other plugins
78
  * Prevent button js from appearing in feeds
@@ -142,6 +146,9 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
142
 
143
 
144
  == Upgrade Notice ==
 
 
 
145
  = 2.0.4 =
146
  Fix conflict with other plugins and other bug fixes
147
 
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
4
  Requires at least: 2.9
5
+ Tested up to: 3.1.1
6
+ Stable tag: 2.0.5
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
73
 
74
  == Changelog ==
75
 
76
+ = 2.0.5 =
77
+ * force service codes to be lowercase
78
+ * If opting out of clickback tracking, set config to force opting out
79
+
80
  = 2.0.4 =
81
  * Fix conflict with other plugins
82
  * Prevent button js from appearing in feeds
146
 
147
 
148
  == Upgrade Notice ==
149
+ = 2.0.5 =
150
+ Force service codes to be lowercase and If opting out of clickback tracking, set config to force opting out
151
+
152
  = 2.0.4 =
153
  Fix conflict with other plugins and other bug fixes
154