WordPress Share Buttons Plugin – AddThis - Version 5.2.0

Version Description

  • New feature: AddThis Sharing Buttons metabox supported on custom post types. This meta box is used to disable sharing buttons on posts when editing them.
  • Removing duplicate metabox title 'AddThis'
  • Fixing preview options in plugin settings
  • Using a more unique preview identifier to reduce likelyhood of conflicts with other plugins (specifically Public Post Preview)
  • Fix for undefined variable below_excerpt in addthis_social_widget.php on line 1301
  • Fix for non-object post in addthis_settings_functions.php on line 430
  • Fix for Clickback checkbox in Advanced Options
Download this release

Release Info

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

Code changes from version 5.1.2 to 5.2.0

AddThisConfigs.php CHANGED
@@ -330,7 +330,9 @@ if (!class_exists('AddThisConfigs')) {
330
  $this->getConfigs();
331
  }
332
 
333
- $addThisConfigVariable = array();
 
 
334
 
335
  if (!empty($this->configs['data_ga_property']) ){
336
  $addThisConfigVariable['data_ga_property'] = $this->configs['data_ga_property'];
@@ -504,9 +506,11 @@ if (!class_exists('AddThisConfigs')) {
504
  $pluginInfo['select_prefs']['addthis_sidebar_enabled'] = $this->configs['addthis_sidebar_enabled'];
505
  }
506
 
507
- foreach ($this->configs as $field => $value) {
508
- if (strpos($field, '_showon_') !== false) {
509
- $pluginInfo['select_prefs'][$field] = $value;
 
 
510
  }
511
  }
512
 
330
  $this->getConfigs();
331
  }
332
 
333
+ $addThisConfigVariable = array(
334
+ 'data_track_clickback' => false,
335
+ );
336
 
337
  if (!empty($this->configs['data_ga_property']) ){
338
  $addThisConfigVariable['data_ga_property'] = $this->configs['data_ga_property'];
506
  $pluginInfo['select_prefs']['addthis_sidebar_enabled'] = $this->configs['addthis_sidebar_enabled'];
507
  }
508
 
509
+ if (is_array($this->configs)) {
510
+ foreach ($this->configs as $field => $value) {
511
+ if (strpos($field, '_showon_') !== false) {
512
+ $pluginInfo['select_prefs'][$field] = $value;
513
+ }
514
  }
515
  }
516
 
AddThisWordPressConnector.php CHANGED
@@ -90,7 +90,14 @@ if (!class_exists('AddThisWordPressConnector')) {
90
  'addthis_config_trending_json',
91
  'addthis_config_welcome_json',
92
  'addthis_plugin_controls',
93
-
 
 
 
 
 
 
 
94
  );
95
 
96
  static $deprecatedSharedVariables = array(
@@ -240,38 +247,46 @@ if (!class_exists('AddThisWordPressConnector')) {
240
  public function getPluginConfigVariables() {
241
  if ($this->isPreviewMode()) {
242
  $plugin = get_transient($this->plugin->getConfigVariableName());
243
- } else {
244
- $plugin = get_option($this->plugin->getConfigVariableName());
 
 
245
  }
246
 
 
 
247
  return $plugin;
248
  }
249
 
250
  public function getSharedConfigVariables() {
251
  if ($this->isPreviewMode()) {
252
  $shared = get_transient($this->sharedConfigVariableName);
253
- } else {
254
- $shared = get_option($this->sharedConfigVariableName);
 
 
255
  }
256
 
 
 
257
  return $shared;
258
  }
259
 
260
- public function saveConfigs($configs = null) {
261
  if (!is_array($configs)) {
262
  $configs = $this->configs;
263
  }
264
 
265
  if (is_array($configs)) {
266
- $this->saveSharedConfigs($configs);
267
- $this->savePluginConfigs($configs);
268
  $this->configs = $this->getConfigs();
269
  }
270
 
271
  return $this->configs;
272
  }
273
 
274
- protected function saveSharedConfigs($configs) {
275
  $newSharedConfigs = array();
276
  foreach (self::$sharedVariables as $variable) {
277
  if(isset($configs[$variable])) {
@@ -279,17 +294,33 @@ if (!class_exists('AddThisWordPressConnector')) {
279
  }
280
  }
281
 
282
- update_option($this->sharedConfigVariableName, $newSharedConfigs);
 
 
 
 
 
 
 
 
283
  }
284
 
285
- protected function savePluginConfigs($configs) {
286
  foreach (self::$sharedVariables as $variable) {
287
  if(isset($configs[$variable])) {
288
  unset($configs[$variable]);
289
  }
290
  }
291
 
292
- update_option($this->plugin->getConfigVariableName(), $configs);
 
 
 
 
 
 
 
 
293
  }
294
 
295
  /**
@@ -297,7 +328,7 @@ if (!class_exists('AddThisWordPressConnector')) {
297
  * @return boolean true if in preview, false otherwise
298
  */
299
  public function isPreviewMode() {
300
- if (isset($_GET['preview']) && $_GET['preview'] == 1) {
301
  return true;
302
  }
303
 
90
  'addthis_config_trending_json',
91
  'addthis_config_welcome_json',
92
  'addthis_plugin_controls',
93
+ // new code base only fields
94
+ 'filter_get_the_excerpt',
95
+ 'filter_the_excerpt',
96
+ 'filter_wp_trim_excerpt',
97
+ 'startUpgradeAt',
98
+ 'debug_enable',
99
+ 'darkseid_environment',
100
+ 'settings_ui_base_url',
101
  );
102
 
103
  static $deprecatedSharedVariables = array(
247
  public function getPluginConfigVariables() {
248
  if ($this->isPreviewMode()) {
249
  $plugin = get_transient($this->plugin->getConfigVariableName());
250
+
251
+ if (is_array($plugin) && !empty($plugin)) {
252
+ return $plugin;
253
+ }
254
  }
255
 
256
+ $plugin = get_option($this->plugin->getConfigVariableName());
257
+
258
  return $plugin;
259
  }
260
 
261
  public function getSharedConfigVariables() {
262
  if ($this->isPreviewMode()) {
263
  $shared = get_transient($this->sharedConfigVariableName);
264
+
265
+ if (is_array($shared) && !empty($shared)) {
266
+ return $shared;
267
+ }
268
  }
269
 
270
+ $shared = get_option($this->sharedConfigVariableName);
271
+
272
  return $shared;
273
  }
274
 
275
+ public function saveConfigs($configs = null, $transient = false) {
276
  if (!is_array($configs)) {
277
  $configs = $this->configs;
278
  }
279
 
280
  if (is_array($configs)) {
281
+ $this->saveSharedConfigs($configs, $transient);
282
+ $this->savePluginConfigs($configs, $transient);
283
  $this->configs = $this->getConfigs();
284
  }
285
 
286
  return $this->configs;
287
  }
288
 
289
+ protected function saveSharedConfigs($configs, $transient = false) {
290
  $newSharedConfigs = array();
291
  foreach (self::$sharedVariables as $variable) {
292
  if(isset($configs[$variable])) {
294
  }
295
  }
296
 
297
+ if ($transient) {
298
+ if (get_transient($this->sharedConfigVariableName) !== false) {
299
+ delete_transient($this->sharedConfigVariableName);
300
+ }
301
+
302
+ set_transient($this->sharedConfigVariableName, $newSharedConfigs, 120);
303
+ } else {
304
+ update_option($this->sharedConfigVariableName, $newSharedConfigs);
305
+ }
306
  }
307
 
308
+ protected function savePluginConfigs($configs, $transient = false) {
309
  foreach (self::$sharedVariables as $variable) {
310
  if(isset($configs[$variable])) {
311
  unset($configs[$variable]);
312
  }
313
  }
314
 
315
+ if ($transient) {
316
+ if (get_transient($this->plugin->getConfigVariableName()) !== false) {
317
+ delete_transient($this->plugin->getConfigVariableName());
318
+ }
319
+
320
+ set_transient($this->plugin->getConfigVariableName(), $configs, 120);
321
+ } else {
322
+ update_option($this->plugin->getConfigVariableName(), $configs);
323
+ }
324
  }
325
 
326
  /**
328
  * @return boolean true if in preview, false otherwise
329
  */
330
  public function isPreviewMode() {
331
+ if (!empty($_GET['addthis_preview'])) {
332
  return true;
333
  }
334
 
AddThisWordPressSharingButtonsPlugin.php CHANGED
@@ -25,7 +25,7 @@ if (!class_exists('AddThisWordPressSharingButtonsPlugin')) {
25
  Class AddThisWordPressSharingButtonsPlugin {
26
  // implements AddThisWordPressPluginInterface {
27
 
28
- static $version = '5.1.2';
29
  static $settingsPageId = 'addthis_social_widget';
30
  static $name = "AddThis Sharing Buttons";
31
  static $productPrefix = 'wpp';
25
  Class AddThisWordPressSharingButtonsPlugin {
26
  // implements AddThisWordPressPluginInterface {
27
 
28
+ static $version = '5.2.0';
29
  static $settingsPageId = 'addthis_social_widget';
30
  static $name = "AddThis Sharing Buttons";
31
  static $productPrefix = 'wpp';
addthis_addjs_new.php CHANGED
@@ -268,9 +268,25 @@ Class AddThis_addjs_sharing_button_plugin{
268
  return;
269
  }
270
 
271
- add_meta_box('at_widget', __('AddThis Sharing Buttons'), array($this, 'add_at_flag_meta_box'), 'post', 'advanced', 'high');
272
- add_meta_box('at_widget', __('AddThis Sharing Buttons'), array($this, 'add_at_flag_meta_box'), 'page', 'advanced', 'high');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  }
 
274
  /*
275
  * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
276
  */
268
  return;
269
  }
270
 
271
+ $args = array(
272
+ '_builtin' => false,
273
+ );
274
+ $postTypes = get_post_types($args, 'names');
275
+ $postTypes[] = 'post';
276
+ $postTypes[] = 'page';
277
+
278
+ foreach ($postTypes as $postType) {
279
+ add_meta_box(
280
+ 'at_widget',
281
+ __('AddThis Sharing Buttons'),
282
+ array($this, 'add_at_flag_meta_box'),
283
+ $postType,
284
+ 'advanced',
285
+ 'high'
286
+ );
287
+ }
288
  }
289
+
290
  /*
291
  * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
292
  */
addthis_settings_functions.php CHANGED
@@ -427,7 +427,7 @@ function _addthis_determine_template_type() {
427
  if (is_category()) {
428
  $type = 'categories';
429
  }
430
- } elseif (is_page($post->ID)) {
431
  $type = 'pages';
432
  } elseif (is_single()) {
433
  $type = 'posts';
427
  if (is_category()) {
428
  $type = 'categories';
429
  }
430
+ } elseif (is_object($post) && is_page($post->ID)) {
431
  $type = 'pages';
432
  } elseif (is_single()) {
433
  $type = 'posts';
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.1.2
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
@@ -36,7 +36,6 @@ define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
36
  require_once('AddThisWordPressSharingButtonsPlugin.php');
37
  require_once('AddThisWordPressConnector.php');
38
  require_once('AddThisConfigs.php');
39
- require_once('addthis_post_metabox.php');
40
 
41
  $addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
42
  $cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
@@ -675,18 +674,12 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
675
  }
676
 
677
  // Parse Post data
678
- $option_array = addthis_parse_options($values);
679
 
680
- // Set Transient
681
- if (get_transient('addthis_settings') !== false) {
682
- delete_transient('addthis_settings');
683
- }
684
-
685
- $eh = set_transient('addthis_settings', $option_array, 120);
686
-
687
- print_r($option_array);
688
 
689
- die();
690
  }
691
 
692
  function addthis_save_settings($input)
@@ -1297,7 +1290,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1297
  && (!$excerpt || _addthis_excerpt_buttons_enabled_below())
1298
  ) {
1299
  $below = addthis_display_widget_below($styles, $options);
1300
- } elseif ( $below_excerpt
1301
  && $displayBelow
1302
  && $options['below'] != 'none'
1303
  ) {
@@ -2636,7 +2629,7 @@ function _addthis_settings_buttons($includePreview = true) {
2636
  $previewLink = str_replace('http://', 'https://', $previewLink);
2637
  }
2638
  $queryArgs = array(
2639
- 'preview' => 1,
2640
  'template' => $template,
2641
  'stylesheet' => $stylesheet,
2642
  'preview_iframe' => true,
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.2.0
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
36
  require_once('AddThisWordPressSharingButtonsPlugin.php');
37
  require_once('AddThisWordPressConnector.php');
38
  require_once('AddThisConfigs.php');
 
39
 
40
  $addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
41
  $cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
674
  }
675
 
676
  // Parse Post data
677
+ $configs = addthis_parse_options($values);
678
 
679
+ global $cmsConnector;
680
+ $cmsConnector->saveConfigs($configs, true);
 
 
 
 
 
 
681
 
682
+ wp_send_json($configs);
683
  }
684
 
685
  function addthis_save_settings($input)
1290
  && (!$excerpt || _addthis_excerpt_buttons_enabled_below())
1291
  ) {
1292
  $below = addthis_display_widget_below($styles, $options);
1293
+ } elseif ( $excerpt
1294
  && $displayBelow
1295
  && $options['below'] != 'none'
1296
  ) {
2629
  $previewLink = str_replace('http://', 'https://', $previewLink);
2630
  }
2631
  $queryArgs = array(
2632
+ 'addthis_preview' => 1,
2633
  'template' => $template,
2634
  'stylesheet' => $stylesheet,
2635
  'preview_iframe' => true,
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === AddThis Sharing Buttons ===
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis, AddThis_Mike
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.3
6
- Stable tag: 5.1.2
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
@@ -76,6 +76,15 @@ In the screen options you can enable the AddThis meta box. Check the box and sav
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
 
 
79
  = 5.1.2 =
80
  * Resolves a bug where above excerpt sharing buttons would be added whenever below excerpt sharing buttons were enabled
81
  * Adding back in the addthis_post_exclude filter
@@ -385,7 +394,16 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
385
 
386
  == Upgrade Notice ==
387
 
388
- = 5.1.2=
 
 
 
 
 
 
 
 
 
389
  * Resolves a bug where above excerpt sharing buttons would be added whenever below excerpt sharing buttons were enabled
390
  * Adding back in the addthis_post_exclude filter
391
 
1
  === AddThis Sharing Buttons ===
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis, AddThis_Mike
3
+ Tags: bookmarking, email sharing, facebook, linkedin, pinterest, share, sharing buttons, social marketing, social tools, twitter, whatsapp
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
+ Stable tag: 5.2.0
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
76
 
77
  == Changelog ==
78
 
79
+ = 5.2.0 =
80
+ * New feature: AddThis Sharing Buttons metabox supported on custom post types. This meta box is used to disable sharing buttons on posts when editing them.
81
+ * Removing duplicate metabox title 'AddThis'
82
+ * Fixing preview options in plugin settings
83
+ * Using a more unique preview identifier to reduce likelyhood of conflicts with other plugins (specifically <a href="https://wordpress.org/support/plugin/public-post-preview">Public Post Preview</a>)
84
+ * Fix for undefined variable below_excerpt in addthis_social_widget.php on line 1301
85
+ * Fix for non-object post in addthis_settings_functions.php on line 430
86
+ * Fix for Clickback checkbox in Advanced Options
87
+
88
  = 5.1.2 =
89
  * Resolves a bug where above excerpt sharing buttons would be added whenever below excerpt sharing buttons were enabled
90
  * Adding back in the addthis_post_exclude filter
394
 
395
  == Upgrade Notice ==
396
 
397
+ = 5.2.0 =
398
+ * New feature: AddThis Sharing Buttons metabox supported on custom post types. This meta box is used to disable sharing buttons on posts when editing them.
399
+ * Removing duplicate metabox title 'AddThis'
400
+ * Fixing preview options in plugin settings
401
+ * Using a more unique preview identifier to reduce likelyhood of conflicts with other plugins (specifically <a href="https://wordpress.org/support/plugin/public-post-preview">Public Post Preview</a>)
402
+ * Fix for undefined variable below_excerpt in addthis_social_widget.php on line 1301
403
+ * Fix for non-object post in addthis_settings_functions.php on line 430
404
+ * Fix for Clickback checkbox in Advanced Options
405
+
406
+ = 5.1.2 =
407
  * Resolves a bug where above excerpt sharing buttons would be added whenever below excerpt sharing buttons were enabled
408
  * Adding back in the addthis_post_exclude filter
409