WordPress Share Buttons Plugin – AddThis - Version 5.0.6

Version Description

  • Limiting when we filter content from get_the_excerpt because of issues with the manshet and backstreet themes
  • Reducing PHP warnings and error messages
  • Adding back in addthis_config.ignore_server_config JavaScript variable for WordPress model (for on page configurations)
  • Adding data-cfasync="false" to all AddThis JavaScript to stop CloudFlare's RocketScript feature from breaking sharing buttons
Download this release

Release Info

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

Code changes from version 5.0.5 to 5.0.6

AddThisConfigs.php CHANGED
@@ -309,7 +309,9 @@ if (!class_exists('AddThisConfigs')) {
309
  if (!empty($this->configs['addthis_share_json'])) {
310
  $json = $this->configs['addthis_share_json'];
311
  $fromJson = json_decode($json, true);
312
- $addThisShareVariable = array_merge($addThisShareVariable, $fromJson);
 
 
313
  }
314
 
315
  return $addThisShareVariable;
@@ -322,12 +324,6 @@ if (!class_exists('AddThisConfigs')) {
322
 
323
  $addThisConfigVariable = array();
324
 
325
- if( isset($options['addthis_plugin_controls'])
326
- && $this->configs['addthis_plugin_controls'] != "AddThis"
327
- ) {
328
- $addThisConfigVariable['ignore_server_config'] = true;
329
- }
330
-
331
  if (!empty($this->configs['data_ga_property']) ){
332
  $addThisConfigVariable['data_ga_property'] = $this->configs['data_ga_property'];
333
  $addThisConfigVariable['data_ga_social'] = true;
@@ -368,7 +364,15 @@ if (!class_exists('AddThisConfigs')) {
368
  if (!empty($this->configs['addthis_config_json'])) {
369
  $json = $this->configs['addthis_config_json'];
370
  $fromJson = json_decode($json, true);
371
- $addThisConfigVariable = array_merge($addThisConfigVariable, $fromJson);
 
 
 
 
 
 
 
 
372
  }
373
 
374
  return $addThisConfigVariable;
@@ -390,5 +394,21 @@ if (!class_exists('AddThisConfigs')) {
390
 
391
  return $twitter_username;
392
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  }
394
  }
309
  if (!empty($this->configs['addthis_share_json'])) {
310
  $json = $this->configs['addthis_share_json'];
311
  $fromJson = json_decode($json, true);
312
+ if (is_array($fromJson)) {
313
+ $addThisShareVariable = array_merge($addThisShareVariable, $fromJson);
314
+ }
315
  }
316
 
317
  return $addThisShareVariable;
324
 
325
  $addThisConfigVariable = array();
326
 
 
 
 
 
 
 
327
  if (!empty($this->configs['data_ga_property']) ){
328
  $addThisConfigVariable['data_ga_property'] = $this->configs['data_ga_property'];
329
  $addThisConfigVariable['data_ga_social'] = true;
364
  if (!empty($this->configs['addthis_config_json'])) {
365
  $json = $this->configs['addthis_config_json'];
366
  $fromJson = json_decode($json, true);
367
+ if (is_array($fromJson)) {
368
+ $addThisConfigVariable = array_merge($addThisConfigVariable, $fromJson);
369
+ }
370
+ }
371
+
372
+ if( isset($this->configs['addthis_plugin_controls'])
373
+ && $this->configs['addthis_plugin_controls'] != "AddThis"
374
+ ) {
375
+ $addThisConfigVariable['ignore_server_config'] = true;
376
  }
377
 
378
  return $addThisConfigVariable;
394
 
395
  return $twitter_username;
396
  }
397
+
398
+ public function getAddThisPluginInfoJson() {
399
+ if (!is_array($this->configs)) {
400
+ $this->getConfigs();
401
+ }
402
+
403
+ $pluginInfo = array();
404
+ $pluginInfo['cms_name'] = $this->cmsInterface->getCmsName();
405
+ $pluginInfo['cms_version'] = $this->cmsInterface->getCmsVersion();
406
+ $pluginInfo['plugin_name'] = $this->cmsInterface->getPluginName();
407
+ $pluginInfo['plugin_version'] = $this->cmsInterface->getPluginVersion();
408
+ $pluginInfo['plugin_mode'] = $this->configs['addthis_plugin_controls'];
409
+
410
+ $json = json_encode($pluginInfo);
411
+ return $json;
412
+ }
413
  }
414
  }
AddThisWordPressConnector.php CHANGED
@@ -26,10 +26,12 @@ if (!class_exists('AddThisWordpressConnector')) {
26
  // implements AddThisCmsConnectorInterface {
27
 
28
  static $settingsVariableName = 'addthis_settings';
29
- static $pluginVersion = '5.0.5';
30
  static $settingsPageId = 'addthis_social_widget';
31
  static $anonymousProfileIdPrefix = 'wp';
 
32
  static $productPrefix = 'wpp';
 
33
  protected $configs = null;
34
 
35
  protected $defaultConfigs = array(
@@ -71,6 +73,14 @@ if (!class_exists('AddThisWordpressConnector')) {
71
  return self::$pluginVersion;
72
  }
73
 
 
 
 
 
 
 
 
 
74
  static function getSettingsPageId() {
75
  return self::$settingsPageId;
76
  }
26
  // implements AddThisCmsConnectorInterface {
27
 
28
  static $settingsVariableName = 'addthis_settings';
29
+ static $pluginVersion = '5.0.6';
30
  static $settingsPageId = 'addthis_social_widget';
31
  static $anonymousProfileIdPrefix = 'wp';
32
+ static $pluginName = "AddThis Sharing Buttons";
33
  static $productPrefix = 'wpp';
34
+ static $cmsName = "WordPress";
35
  protected $configs = null;
36
 
37
  protected $defaultConfigs = array(
73
  return self::$pluginVersion;
74
  }
75
 
76
+ static function getCmsName() {
77
+ return self::$cmsName;
78
+ }
79
+
80
+ static function getPluginName() {
81
+ return self::$pluginName;
82
+ }
83
+
84
  static function getSettingsPageId() {
85
  return self::$settingsPageId;
86
  }
addthis-toolbox.php CHANGED
@@ -59,8 +59,22 @@ class Addthis_ToolBox
59
  $this->cmsConnector = $cmsConnector;
60
 
61
  add_filter('the_content', array($this, 'addWidget'));
62
- add_filter('get_the_excerpt', array($this, 'addWidget'));
63
- //add_filter('the_excerpt', array($this, 'addWidget'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  /**
59
  $this->cmsConnector = $cmsConnector;
60
 
61
  add_filter('the_content', array($this, 'addWidget'));
62
+ add_filter('get_the_excerpt', array($this, 'addWidgetForExcerpt'));
63
+ }
64
+
65
+ /**
66
+ * Adds toolbox to excerpts wp pages -- can't use addWidget straight out
67
+ * because when the filter on get_the_excerpt is added, it doesn't yet know
68
+ * if it has an excerpt or not
69
+ *
70
+ * @param string $content Page contents
71
+ * @return string Page content with our sharing button HTML added
72
+ */
73
+ public function addWidgetForExcerpt($content){
74
+ if (has_excerpt() || !is_single()) {
75
+ $content = $this->addWidget($content);
76
+ }
77
+ return $content;
78
  }
79
 
80
  /**
addthis_addjs_new.php CHANGED
@@ -48,7 +48,7 @@ Class AddThis_addjs_sharing_button_plugin{
48
  $this->cmsConnector = $cmsConnector;
49
 
50
  if ( did_action('addthis_addjs_created') !== 0){
51
- _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
52
  }
53
 
54
  // We haven't added our JS yet. Or at least better not have.
@@ -83,7 +83,7 @@ Class AddThis_addjs_sharing_button_plugin{
83
  else
84
  add_filter('the_content', array($this, 'output_script_filter') );
85
 
86
- do_action('addthis_addjs_created');
87
  }
88
 
89
  function switch_theme(){
@@ -121,7 +121,7 @@ Class AddThis_addjs_sharing_button_plugin{
121
  }
122
 
123
  function wrapJs(){
124
- $this->jsToAdd = '<script type="text/javascript">' . $this->jsToAdd . '</script>';
125
  }
126
 
127
  /* testing for wp_footer in a theme stuff */
@@ -200,10 +200,11 @@ Class AddThis_addjs_sharing_button_plugin{
200
 
201
  $this->jsToAdd .= '
202
  <!-- AddThis Settings Begin -->
203
- <script type="text/javascript">
204
  var addthis_product = "'. $this->cmsConnector->getProductVersion() . '";
205
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . '";
206
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . '";
 
207
  if (typeof(addthis_config) == "undefined") {
208
  ' . $addthis_config_js . '
209
  }
@@ -212,6 +213,7 @@ Class AddThis_addjs_sharing_button_plugin{
212
  }
213
  </script>
214
  <script
 
215
  type="text/javascript"
216
  src="' . $url . ' "
217
  ' . $async . '
@@ -222,7 +224,7 @@ Class AddThis_addjs_sharing_button_plugin{
222
 
223
  function addAfterToJs(){
224
  if (! empty($this->jsAfterAdd)) {
225
- $this->jsToAdd .= '<script type="text/javascript">' . $this->jsAfterAdd . '</script>';
226
  $this->jsAfterAdd = NULL;
227
  }
228
  }
48
  $this->cmsConnector = $cmsConnector;
49
 
50
  if ( did_action('addthis_addjs_created') !== 0){
51
+ //_doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
52
  }
53
 
54
  // We haven't added our JS yet. Or at least better not have.
83
  else
84
  add_filter('the_content', array($this, 'output_script_filter') );
85
 
86
+ //do_action('addthis_addjs_created');
87
  }
88
 
89
  function switch_theme(){
121
  }
122
 
123
  function wrapJs(){
124
+ $this->jsToAdd = '<script data-cfasync="false" type="text/javascript">' . $this->jsToAdd . '</script>';
125
  }
126
 
127
  /* testing for wp_footer in a theme stuff */
200
 
201
  $this->jsToAdd .= '
202
  <!-- AddThis Settings Begin -->
203
+ <script data-cfasync="false" type="text/javascript">
204
  var addthis_product = "'. $this->cmsConnector->getProductVersion() . '";
205
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . '";
206
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . '";
207
+ var addthis_plugin_info = ' . $this->addThisConfigs->getAddThisPluginInfoJson() . ';
208
  if (typeof(addthis_config) == "undefined") {
209
  ' . $addthis_config_js . '
210
  }
213
  }
214
  </script>
215
  <script
216
+ data-cfasync="false"
217
  type="text/javascript"
218
  src="' . $url . ' "
219
  ' . $async . '
224
 
225
  function addAfterToJs(){
226
  if (! empty($this->jsAfterAdd)) {
227
+ $this->jsToAdd .= '<script data-cfasync="false" type="text/javascript">' . $this->jsAfterAdd . '</script>';
228
  $this->jsAfterAdd = NULL;
229
  }
230
  }
addthis_social_widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
- * Version: 5.0.5
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
@@ -1360,10 +1360,11 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1360
 
1361
  $script = '
1362
  <!-- AddThis Settings Begin -->
1363
- <script type="text/javascript">
1364
  var addthis_product = "'. $cmsConnector->getProductVersion() . ';
1365
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . ';
1366
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . ';
 
1367
  if (typeof(addthis_config) == "undefined") {
1368
  ' . $addthis_config_js . '
1369
  }
@@ -1372,6 +1373,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1372
  }
1373
  </script>
1374
  <script
 
1375
  type="text/javascript"
1376
  src="' . $url . '"
1377
  ' . $async . '
@@ -1461,7 +1463,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1461
  $title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
1462
 
1463
  $content .= "\n<!-- AddThis Button BEGIN -->\n"
1464
- .'<script type="text/javascript">'
1465
  ."\n//<!--\n"
1466
  ."var addthis_product = '". $cmsConnector->getProductVersion() ."';\n";
1467
 
@@ -1478,7 +1480,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1478
  </script>
1479
  <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
1480
  EOF;
1481
- $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/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1482
  }
1483
  else if ($addthis_settings['menu_type'] === 'toolbox')
1484
  {
@@ -1486,7 +1488,7 @@ EOF;
1486
  $content .= <<<EOF
1487
  <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
1488
  EOF;
1489
- $content .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1490
  }
1491
  else
1492
  {
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
+ * Version: 5.0.6
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
1360
 
1361
  $script = '
1362
  <!-- AddThis Settings Begin -->
1363
+ <script data-cfasync="false" type="text/javascript">
1364
  var addthis_product = "'. $cmsConnector->getProductVersion() . ';
1365
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . ';
1366
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . ';
1367
+ var addthis_plugin_info = ' . $addThisConfigs->getAddThisPluginInfoJson() . ';
1368
  if (typeof(addthis_config) == "undefined") {
1369
  ' . $addthis_config_js . '
1370
  }
1373
  }
1374
  </script>
1375
  <script
1376
+ data-cfasync="false"
1377
  type="text/javascript"
1378
  src="' . $url . '"
1379
  ' . $async . '
1463
  $title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
1464
 
1465
  $content .= "\n<!-- AddThis Button BEGIN -->\n"
1466
+ .'<script data-cfasync="false" type="text/javascript">'
1467
  ."\n//<!--\n"
1468
  ."var addthis_product = '". $cmsConnector->getProductVersion() ."';\n";
1469
 
1480
  </script>
1481
  <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
1482
  EOF;
1483
+ $content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script data-cfasync="false" type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1484
  }
1485
  else if ($addthis_settings['menu_type'] === 'toolbox')
1486
  {
1488
  $content .= <<<EOF
1489
  <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
1490
  EOF;
1491
+ $content .= '<script data-cfasync="false" type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1492
  }
1493
  else
1494
  {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, m
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
- Stable tag: 5.0.5
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
@@ -75,11 +75,17 @@ PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
78
  = 5.0.5 =
79
  * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
80
  * Removing conflicts with WordPress Login Box plugin
81
  * Removing conflicts with AddThis Follow Widget plugin
82
- * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (Thanks Customizr)
83
  * Exposing more objects for use with adding sharing buttons to troublesome themes
84
 
85
  = 5.0.4 =
@@ -332,11 +338,17 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
332
 
333
  == Upgrade Notice ==
334
 
 
 
 
 
 
 
335
  = 5.0.5 =
336
  * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
337
  * Removing conflicts with WordPress Login Box plugin
338
  * Removing conflicts with AddThis Follow Widget plugin
339
- * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (Thanks Customizr)
340
  * Exposing more objects for use with adding sharing buttons to troublesome themes
341
 
342
  = 5.0.3 =
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
+ Stable tag: 5.0.6
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
75
 
76
  == Changelog ==
77
 
78
+ = 5.0.6 =
79
+ * Limiting when we filter content from get_the_excerpt because of issues with the manshet and backstreet themes
80
+ * Reducing PHP warnings and error messages
81
+ * Adding back in addthis_config.ignore_server_config JavaScript variable for WordPress model (for on page configurations)
82
+ * Adding data-cfasync="false" to all AddThis JavaScript to stop CloudFlare's RocketScript feature from breaking sharing buttons
83
+
84
  = 5.0.5 =
85
  * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
86
  * Removing conflicts with WordPress Login Box plugin
87
  * Removing conflicts with AddThis Follow Widget plugin
88
+ * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (such as Customizr)
89
  * Exposing more objects for use with adding sharing buttons to troublesome themes
90
 
91
  = 5.0.4 =
338
 
339
  == Upgrade Notice ==
340
 
341
+ = 5.0.6 =
342
+ * Limiting when we filter content from get_the_excerpt because of issues with the manshet and backstreet themes
343
+ * Reducing PHP warnings and error messages
344
+ * Adding back in addthis_config.ignore_server_config JavaScript variable for WordPress model (for on page configurations)
345
+ * Adding data-cfasync="false" to all AddThis JavaScript to stop CloudFlare's RocketScript feature from breaking sharing buttons
346
+
347
  = 5.0.5 =
348
  * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
349
  * Removing conflicts with WordPress Login Box plugin
350
  * Removing conflicts with AddThis Follow Widget plugin
351
+ * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (such as Customizr)
352
  * Exposing more objects for use with adding sharing buttons to troublesome themes
353
 
354
  = 5.0.3 =