WordPress Share Buttons Plugin – AddThis - Version 2.0.6

Version Description

  • define ADDTHIS_NO_NOTICES to prevent admin notices from displaying
Download this release

Release Info

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

Code changes from version 2.0.5 to 2.0.6

Files changed (2) hide show
  1. addthis_social_widget.php +36 -14
  2. readme.txt +3 -1
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.5
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.5');
111
  /**
112
  * Converts our old many options in to one beautiful array
113
  *
@@ -345,6 +345,9 @@ add_action('admin_notices', 'addthis_admin_notices');
345
  function addthis_admin_notices(){
346
  if (! current_user_can('manage_options'))
347
  return;
 
 
 
348
  global $current_user;
349
  $user_id = $current_user->ID;
350
  $options = get_option('addthis_settings');
@@ -500,7 +503,7 @@ function addthis_render_dashboard_widget() {
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
 
@@ -838,11 +841,13 @@ function addthis_add_content_filters()
838
  $preview = true;
839
  else
840
  $options = get_option('addthis_settings');
841
-
842
- if ($options['addthis_showonexcerpts'] == true )
843
- add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
844
-
845
- add_filter('the_content', 'addthis_display_social_widget', 15);
 
 
846
  }
847
 
848
 
@@ -1080,6 +1085,8 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1080
  $url_above .= "addthis:title='$title'";
1081
  $url_below = "addthis:url='$url' ";
1082
  $url_below .= "addthis:title='$title'";
 
 
1083
 
1084
  // Still here? Well let's add some social goodness
1085
  if ( $options['above'] != 'none' && $display )
@@ -1134,7 +1141,10 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1134
 
1135
  if ($display)
1136
  {
1137
- $content = sprintf($above, $url_above) . $content . sprintf($below, $url_below);
 
 
 
1138
  if ($filtered == true)
1139
  add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
1140
  }
@@ -1162,7 +1172,7 @@ function addthis_output_script($return = false )
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 ;
@@ -1463,8 +1473,8 @@ function addthis_plugin_options_php4() {
1463
  echo "<ul class='above_option_custom hidden'>";
1464
  $above_custom_16 = ($above_custom_size == 16) ? 'selected="selected"' : '' ;
1465
  $above_custom_32 = ($above_custom_size == 32) ? 'selected="selected"' : '' ;
1466
- $above_do_custom_services = ($above_do_custom_services) ? 'checked="checked"' : '';
1467
- $above_do_custom_preferred = ($above_do_custom_preferred) ? 'checked="checked"' : '';
1468
 
1469
  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>";
1470
  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>";
@@ -1517,8 +1527,8 @@ function addthis_plugin_options_php4() {
1517
  echo "<ul class='below_option_custom hidden'>";
1518
  $below_custom_16 = ($below_custom_size == 16) ? 'selected="selected"' : '' ;
1519
  $below_custom_32 = ($below_custom_size == 32) ? 'selected="selected"' : '' ;
1520
- $below_do_custom_services = ($below_do_custom_services) ? 'checked="checked"' : '';
1521
- $below_do_custom_preferred = ($below_do_custom_preferred) ? 'checked="checked"' : '';
1522
 
1523
  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>";
1524
  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>";
@@ -1700,5 +1710,17 @@ if (! function_exists('get_home_url'))
1700
  }
1701
  }
1702
 
 
 
 
 
 
 
 
 
 
 
 
 
1703
 
1704
  ?>
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
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
  *
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');
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
 
841
  $preview = true;
842
  else
843
  $options = get_option('addthis_settings');
844
+
845
+ if ( ! empty( $options) ){
846
+ if ($options['addthis_showonexcerpts'] == true )
847
+ add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
848
+
849
+ add_filter('the_content', 'addthis_display_social_widget', 15);
850
+ }
851
  }
852
 
853
 
1085
  $url_above .= "addthis:title='$title'";
1086
  $url_below = "addthis:url='$url' ";
1087
  $url_below .= "addthis:title='$title'";
1088
+ $above = '';
1089
+ $below = '';
1090
 
1091
  // Still here? Well let's add some social goodness
1092
  if ( $options['above'] != 'none' && $display )
1141
 
1142
  if ($display)
1143
  {
1144
+ if ( isset($above) )
1145
+ $content = sprintf($above, $url_above) . $content;
1146
+ if ( isset($below) )
1147
+ $content = $content . sprintf($below, $url_below);
1148
  if ($filtered == true)
1149
  add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
1150
  }
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 ;
1473
  echo "<ul class='above_option_custom hidden'>";
1474
  $above_custom_16 = ($above_custom_size == 16) ? 'selected="selected"' : '' ;
1475
  $above_custom_32 = ($above_custom_size == 32) ? 'selected="selected"' : '' ;
1476
+ $above_do_custom_services = ( isset( $above_do_custom_services ) && $above_do_custom_services ) ? 'checked="checked"' : '';
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>";
1527
  echo "<ul class='below_option_custom hidden'>";
1528
  $below_custom_16 = ($below_custom_size == 16) ? 'selected="selected"' : '' ;
1529
  $below_custom_32 = ($below_custom_size == 32) ? 'selected="selected"' : '' ;
1530
+ $below_do_custom_services = ( isset( $below_do_custom_services ) && $below_do_custom_services) ? 'checked="checked"' : '';
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>";
1710
  }
1711
  }
1712
 
1713
+ /**
1714
+ * Make sure the option gets added on registration
1715
+ * @since 2.0.6
1716
+ */
1717
+
1718
+ function addthis_activation_hook(){
1719
+ if ( get_option('addthis_settings') == false)
1720
+ add_option('addthis_settings', array() );
1721
+
1722
+ }
1723
+
1724
+ register_activation_hook( __FILE__, 'addthis_activation_hook' );
1725
 
1726
  ?>
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.5
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -72,6 +72,8 @@ 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
 
76
  = 2.0.5 =
77
  * force service codes to be lowercase
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
 
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
 
78
  = 2.0.5 =
79
  * force service codes to be lowercase