WordPress Share Buttons Plugin – AddThis - Version 2.0.4

Version Description

  • Fix conflict with other plugins
  • Prevent button js from appearing in feeds
Download this release

Release Info

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

Code changes from version 2.0.3 to 2.0.4

Files changed (2) hide show
  1. addthis_social_widget.php +40 -13
  2. readme.txt +7 -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.3
31
  *
32
  * Author: The AddThis Team
33
  * Author URI: http://www.addthis.com/blog
@@ -87,18 +87,27 @@ function at_title_check($title)
87
  addthis_add_content_filters();
88
  add_filter('the_content', 'addthis_script_to_content');
89
  }
90
-
 
 
91
 
92
  return $title;
93
  }
 
94
  function addthis_script_to_content($content)
95
  {
96
- addthis_output_script();
97
- return $content;
 
 
 
 
 
 
98
  }
99
 
100
  define( 'addthis_style_default' , 'small_toolbox_with_share');
101
- define( 'ADDTHIS_PLUGIN_VERSION', '2.0.2');
102
  /**
103
  * Converts our old many options in to one beautiful array
104
  *
@@ -197,7 +206,6 @@ function addthis_options_210()
197
  $options = get_option('addthis_settings');
198
  if ( isset( $options['username'] ) )
199
  $options['profile'] = $options['username'];
200
- $$options['dbversion'] == '210';
201
 
202
  update_option( 'addthis_settings', $options);
203
 
@@ -489,6 +497,17 @@ function addthis_render_dashboard_widget() {
489
  $profile;
490
  $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
491
  }
 
 
 
 
 
 
 
 
 
 
 
492
  if ($stats['sharesday']['response']['code'] == 200)
493
  set_transient('addthis_dashboard_stats', $stats, '600');
494
 
@@ -608,8 +627,13 @@ elseif($stats['sharesday']['response']['code'] == 200){
608
  <ul>
609
  ENDHTML;
610
  }
 
 
 
 
 
611
  else{
612
- echo "I'm sorry, but we seemed to encounter an error. This could be because your password is not accurate. Please check and update it.";
613
  }
614
  die();
615
  }
@@ -1003,7 +1027,7 @@ function addthis_display_social_widget_excerpt($content)
1003
  function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
1004
  {
1005
 
1006
- global $addthis_styles, $addthis_new_styles;
1007
  $styles = array_merge($addthis_styles, $addthis_new_styles);
1008
 
1009
 
@@ -1027,7 +1051,6 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1027
  $display = true;
1028
  else
1029
  $display = false;
1030
-
1031
  $custom_fields = get_post_custom($post->ID);
1032
  if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1033
  $display = false;
@@ -1112,7 +1135,7 @@ add_action('wp_footer', 'addthis_output_script');
1112
  *
1113
  * @return mixed
1114
  */
1115
- function addthis_output_script()
1116
  {
1117
  global $addthis_settings;
1118
 
@@ -1123,7 +1146,7 @@ function addthis_output_script()
1123
 
1124
  $script = "\n<!-- AddThis Button Begin -->\n"
1125
  .'<script type="text/javascript">'
1126
- ."var addthis_product = 'wpp-252';\n";
1127
 
1128
 
1129
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
@@ -1164,8 +1187,12 @@ function addthis_output_script()
1164
 
1165
 
1166
  $script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1167
-
1168
- echo $script;
 
 
 
 
1169
  }
1170
 
1171
 
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
87
  addthis_add_content_filters();
88
  add_filter('the_content', 'addthis_script_to_content');
89
  }
90
+ else
91
+ {
92
+ }
93
 
94
  return $title;
95
  }
96
+
97
  function addthis_script_to_content($content)
98
  {
99
+ global $addthis_did_script_output;
100
+
101
+ if (!isset($addthis_did_script_output) )
102
+ {
103
+ $addthis_did_script_output = true;
104
+ $content .= addthis_output_script(true);
105
+ }
106
+ return $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
  *
206
  $options = get_option('addthis_settings');
207
  if ( isset( $options['username'] ) )
208
  $options['profile'] = $options['username'];
 
209
 
210
  update_option( 'addthis_settings', $options);
211
 
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
 
627
  <ul>
628
  ENDHTML;
629
  }
630
+ elseif ($stats['sharesday']['response']['code'] == 401){
631
+ echo "I'm sorry, but we seemed to encounter an error. Please ensure that your password, username and pubid are correct.";
632
+
633
+ }
634
+
635
  else{
636
+ echo "I'm sorry, but we seemed to have encountered an error when requesting your analytics. Please wait a few moments and try again.";
637
  }
638
  die();
639
  }
1027
  function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
1028
  {
1029
 
1030
+ global $addthis_styles, $addthis_new_styles, $post;
1031
  $styles = array_merge($addthis_styles, $addthis_new_styles);
1032
 
1033
 
1051
  $display = true;
1052
  else
1053
  $display = false;
 
1054
  $custom_fields = get_post_custom($post->ID);
1055
  if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1056
  $display = false;
1135
  *
1136
  * @return mixed
1137
  */
1138
+ function addthis_output_script($return = false )
1139
  {
1140
  global $addthis_settings;
1141
 
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 ;
1187
 
1188
 
1189
  $script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
1190
+
1191
+
1192
+ if ( ! is_admin() && ! is_feed() )
1193
+ echo $script;
1194
+ elseif ($return == true && ! is_admin() && ! is_feed() )
1195
+ return $script;
1196
  }
1197
 
1198
 
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.0
6
- Stable tag: 2.0.3
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -16,7 +16,6 @@ Optionally, sign up for a free AddThis.com account to see how your visitors are
16
 
17
  == Installation ==
18
 
19
-
20
  For an automatic installation through WordPress:
21
 
22
  1. Go to the 'Add New' plugins screen in your WordPress admin area
@@ -74,6 +73,10 @@ PHP 5+ is preferred; PHP 4 is supported.
74
 
75
  == Changelog ==
76
 
 
 
 
 
77
  = 2.0.3 =
78
  * plugin should still work if theme doesn't have wp_head and wp_footer
79
 
@@ -139,6 +142,8 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
139
 
140
 
141
  == Upgrade Notice ==
 
 
142
 
143
  = 2.0.3 =
144
  Still work in themes that don't have wp_head and wp_footer
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
 
16
 
17
  == Installation ==
18
 
 
19
  For an automatic installation through WordPress:
20
 
21
  1. Go to the 'Add New' plugins screen in your WordPress admin area
73
 
74
  == Changelog ==
75
 
76
+ = 2.0.4 =
77
+ * Fix conflict with other plugins
78
+ * Prevent button js from appearing in feeds
79
+
80
  = 2.0.3 =
81
  * plugin should still work if theme doesn't have wp_head and wp_footer
82
 
142
 
143
 
144
  == Upgrade Notice ==
145
+ = 2.0.4 =
146
+ Fix conflict with other plugins and other bug fixes
147
 
148
  = 2.0.3 =
149
  Still work in themes that don't have wp_head and wp_footer