WordPress Share Buttons Plugin – AddThis - Version 2.4.1

Version Description

  • Bug fixes
Download this release

Release Info

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

Code changes from version 2.4.0 to 2.4.1

Files changed (3) hide show
  1. addthis_social_widget.php +44 -16
  2. includes/addthis_addjs.php +13 -8
  3. readme.txt +10 -4
addthis_social_widget.php CHANGED
@@ -23,7 +23,7 @@
23
  * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
  * 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.
26
- * Version: 2.4.0
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
@@ -37,7 +37,6 @@ else return;
37
  add_action('init', 'addthis_early', 1);
38
  function addthis_early(){
39
  global $addthis_addjs;
40
-
41
  if (! isset($addthis_addjs)){
42
  require('includes/addthis_addjs.php');
43
  $addthis_options = get_option('addthis_settings');
@@ -46,8 +45,8 @@ function addthis_early(){
46
  }
47
 
48
 
49
- define( 'addthis_style_default' , 'small_toolbox_with_share');
50
- define( 'ADDTHIS_PLUGIN_VERSION', '2.4.0');
51
 
52
  $addthis_settings = array();
53
  $addthis_settings['isdropdown'] = 'true';
@@ -766,7 +765,7 @@ die();
766
  */
767
  function addthis_dashboard_init() {
768
  $options = get_option('addthis_settings');
769
- if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) && (current_user_can('manage_options') || apply_filter('addthis_show_dashboard', __return_false() ) ) )
770
  wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
771
  }
772
 
@@ -836,6 +835,19 @@ if ( isset($data['addthis_profile']) )
836
  if ( isset($data['addthis_password']) )
837
  $options['password'] = sanitize_text_field($data['addthis_password']);
838
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  if (! isset($data['above']) ){
840
  }
841
  elseif ( isset ($data['show_above']) )
@@ -989,7 +1001,7 @@ function addthis_add_content_filters()
989
 
990
  if ( ! empty( $options) ){
991
  if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
992
- add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
993
 
994
  add_filter('the_content', 'addthis_display_social_widget', 15);
995
  }
@@ -1125,16 +1137,28 @@ function addthis_remove_tag($content, $text = '')
1125
  add_filter('the_content', 'addthis_display_social_widget', 15);
1126
 
1127
  $text = str_replace(']]>', ']]>', $text);
1128
- $text = strip_tags($text);
 
 
 
1129
  $excerpt_length = apply_filters('excerpt_length', 55);
1130
  $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
1131
- $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
1132
- if ( count($words) > $excerpt_length ) {
1133
- array_pop($words);
1134
- $text = implode(' ', $words);
1135
- $text = $text . $excerpt_more;
1136
- } else {
1137
- $text = implode(' ', $words);
 
 
 
 
 
 
 
 
 
1138
  }
1139
  if ($options['addthis_showonexcerpts'] == false)
1140
  return $text;
@@ -1371,7 +1395,7 @@ function addthis_output_script($return = false, $justConfig = false )
1371
 
1372
  $script = "\n<!-- AddThis Button Begin -->\n"
1373
  .'<script type="text/javascript">'
1374
- ."var addthis_product = 'wpp-263';\n";
1375
 
1376
 
1377
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
@@ -1455,8 +1479,12 @@ function addthis_output_script($return = false, $justConfig = false )
1455
  if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1456
  $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
1457
  else
1458
- $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
 
 
 
1459
 
 
1460
  $return .= "\n";
1461
 
1462
  if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
23
  * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
  * 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.
26
+ * Version: 2.4.1
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
37
  add_action('init', 'addthis_early', 1);
38
  function addthis_early(){
39
  global $addthis_addjs;
 
40
  if (! isset($addthis_addjs)){
41
  require('includes/addthis_addjs.php');
42
  $addthis_options = get_option('addthis_settings');
45
  }
46
 
47
 
48
+ define( 'addthis_style_default' , 'fb_tw_p1_sc');
49
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.4.1');
50
 
51
  $addthis_settings = array();
52
  $addthis_settings['isdropdown'] = 'true';
765
  */
766
  function addthis_dashboard_init() {
767
  $options = get_option('addthis_settings');
768
+ if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) && (current_user_can('manage_options') || apply_filters('addthis_show_dashboard', __return_false() ) ) )
769
  wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
770
  }
771
 
835
  if ( isset($data['addthis_password']) )
836
  $options['password'] = sanitize_text_field($data['addthis_password']);
837
 
838
+ if ( isset($data['username']) )
839
+ $options['username'] = sanitize_text_field($data['username']);
840
+
841
+ if ( isset($data['profile']) )
842
+ $options['profile'] = sanitize_text_field($data['profile']);
843
+
844
+ if ( isset($data['password']) )
845
+ $options['password'] = sanitize_text_field($data['password']);
846
+
847
+ if ( isset($data['wpfooter']))
848
+ $options['wpfooter'] = (bool) $data['wpfooter'];
849
+
850
+
851
  if (! isset($data['above']) ){
852
  }
853
  elseif ( isset ($data['show_above']) )
1001
 
1002
  if ( ! empty( $options) ){
1003
  if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
1004
+ add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
1005
 
1006
  add_filter('the_content', 'addthis_display_social_widget', 15);
1007
  }
1137
  add_filter('the_content', 'addthis_display_social_widget', 15);
1138
 
1139
  $text = str_replace(']]>', ']]&gt;', $text);
1140
+
1141
+ // 3.3 and earlier
1142
+ if (! function_exists('wp_trim_words'))
1143
+ $text = strip_tags($text);
1144
  $excerpt_length = apply_filters('excerpt_length', 55);
1145
  $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
1146
+
1147
+ // 3.3 and later
1148
+ if (function_exists('wp_trim_words'))
1149
+ {
1150
+ $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
1151
+ }
1152
+ else
1153
+ {
1154
+ $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
1155
+ if ( count($words) > $excerpt_length ) {
1156
+ array_pop($words);
1157
+ $text = implode(' ', $words);
1158
+ $text = $text . $excerpt_more;
1159
+ } else {
1160
+ $text = implode(' ', $words);
1161
+ }
1162
  }
1163
  if ($options['addthis_showonexcerpts'] == false)
1164
  return $text;
1395
 
1396
  $script = "\n<!-- AddThis Button Begin -->\n"
1397
  .'<script type="text/javascript">'
1398
+ ."var addthis_product = 'wpp-264';\n";
1399
 
1400
 
1401
  $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1479
  if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1480
  $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
1481
  else
1482
+ {
1483
+ $share = apply_filters('addthis_share_js_var', $addthis_share );
1484
+ if (! empty($share) )
1485
+ $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1486
 
1487
+ }
1488
  $return .= "\n";
1489
 
1490
  if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
includes/addthis_addjs.php CHANGED
@@ -44,7 +44,7 @@ Class AddThis_addjs{
44
  $this->_cuid = $cuid;
45
 
46
  // If the footer option isn't set, check for it
47
- if (! isset($this->options['wpfooter']) && current_user_can('manage_options'))
48
  {
49
  add_action('admin_init',array($this, 'update_wpfooter'));
50
  }
@@ -52,7 +52,7 @@ Class AddThis_addjs{
52
  $this->pubid = $this->getProfileId();
53
 
54
  // on theme swich, check for footer again
55
- add_action('switch_theme', array($this, 'switch_theme'));
56
 
57
  // In order for our wp_footer magic to work, we need to sometimes add our stuff
58
  add_action('init', array($this, 'maybe_add_footer_comment'));
@@ -67,6 +67,12 @@ Class AddThis_addjs{
67
  do_action('addthis_addjs_created');
68
  }
69
 
 
 
 
 
 
 
70
  function output_script(){
71
  if ($this->_js_added != true)
72
  {
@@ -136,30 +142,29 @@ Class AddThis_addjs{
136
 
137
  /* User name and other shared resources */
138
  function getUsername(){
139
- return (isset($this->_options['addthis_username']))? $this->_options['addthis_username'] : false;
140
 
141
  }
142
  function setUsername($username){
143
- $this->_options['addthis_username'] = sanitize_text_field($username);
144
  update_option( 'addthis_settings', $options);
145
  }
146
 
147
  function getProfileId(){
148
- return (isset($this->_options['profile']))? $this->_options['profile'] : $this->_cuid;
149
  }
150
 
151
-
152
  function setProfileId($profile){
153
  $this->_options['profile'] = sanitize_text_field($profile);
154
  update_option( 'addthis_settings', $options);
155
  }
156
 
157
  function getPassword(){
158
- return (isset($this->_options['addthis_password']))? $this->_options['addthis_password'] : $this->_cuid;
159
  }
160
 
161
  function setPassword($password){
162
- $this->_options['addthis_password'] = sanitize_text_field($password);
163
  update_option( 'addthis_settings', $options);
164
  }
165
 
44
  $this->_cuid = $cuid;
45
 
46
  // If the footer option isn't set, check for it
47
+ if (! isset($this->_options['wpfooter']) && current_user_can('manage_options'))
48
  {
49
  add_action('admin_init',array($this, 'update_wpfooter'));
50
  }
52
  $this->pubid = $this->getProfileId();
53
 
54
  // on theme swich, check for footer again
55
+ add_action('switch_theme', array($this, 'switch_theme'),15);
56
 
57
  // In order for our wp_footer magic to work, we need to sometimes add our stuff
58
  add_action('init', array($this, 'maybe_add_footer_comment'));
67
  do_action('addthis_addjs_created');
68
  }
69
 
70
+ function switch_theme(){
71
+ $footer = $this->check_for_footer();
72
+ $this->_options['wpfooter'] = $footer;
73
+ update_option( 'addthis_settings', $this->_options);
74
+ }
75
+
76
  function output_script(){
77
  if ($this->_js_added != true)
78
  {
142
 
143
  /* User name and other shared resources */
144
  function getUsername(){
145
+ return (isset($this->_options['username']))? $this->_options['username'] : false;
146
 
147
  }
148
  function setUsername($username){
149
+ $this->_options['username'] = sanitize_text_field($username);
150
  update_option( 'addthis_settings', $options);
151
  }
152
 
153
  function getProfileId(){
154
+ return( isset( $this->_options['profile'] ) && ! empty($this->_options['profile']) )? $this->_options['profile'] : $this->_cuid;
155
  }
156
 
 
157
  function setProfileId($profile){
158
  $this->_options['profile'] = sanitize_text_field($profile);
159
  update_option( 'addthis_settings', $options);
160
  }
161
 
162
  function getPassword(){
163
+ return (isset($this->_options['password']))? $this->_options['password'] : $this->_cuid;
164
  }
165
 
166
  function setPassword($password){
167
+ $this->_options['password'] = sanitize_text_field($password);
168
  update_option( 'addthis_settings', $options);
169
  }
170
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === AddThis ===
2
- Contributors: _mjk_, jorbin, addthis_paul
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, pintrest
4
  Requires at least: 2.9
5
  Tested up to: 3.3.2
6
- Stable tag: 2.4.0
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with over 330 popular services.
9
 
@@ -36,7 +36,7 @@ To upload the plugin through WordPress, instead of FTP:
36
 
37
  = Is AddThis free? =
38
 
39
- Yep! The features you see today on AddThis will always be free.
40
 
41
  = Do I need to create an account? =
42
 
@@ -74,6 +74,9 @@ In the screen options you can enable the AddThis meta box. Check the box and sa
74
  PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  == Changelog ==
 
 
 
77
  = 2.4.0 =
78
  * Refactor how we add code to pages which should eliminate how many times it is added
79
  * Numerous Bug Fixes and a few new filters
@@ -184,6 +187,9 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
184
 
185
 
186
  == Upgrade Notice ==
 
 
 
187
  = 2.4.0 =
188
  Better Performance and improved UI
189
 
1
  === AddThis ===
2
+ Contributors: _mjk_, jorbin, addthis_paul, joesullivan
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, pintrest, widget
4
  Requires at least: 2.9
5
  Tested up to: 3.3.2
6
+ Stable tag: 2.4.1
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with over 330 popular services.
9
 
36
 
37
  = Is AddThis free? =
38
 
39
+ Yep! The features you see today on AddThis will always be free of charge.
40
 
41
  = Do I need to create an account? =
42
 
74
  PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  == Changelog ==
77
+ = 2.4.1 =
78
+ * Bug fixes
79
+
80
  = 2.4.0 =
81
  * Refactor how we add code to pages which should eliminate how many times it is added
82
  * Numerous Bug Fixes and a few new filters
187
 
188
 
189
  == Upgrade Notice ==
190
+ = 2.4.1 =
191
+ Bug Fixes
192
+
193
  = 2.4.0 =
194
  Better Performance and improved UI
195