WordPress Social Tools, Related Posts, Monetization – Shareaholic - Version 8.11.0

Version Description

Massive page speed gains

Download this release

Release Info

Developer shareaholic
Plugin Icon 128x128 WordPress Social Tools, Related Posts, Monetization – Shareaholic
Version 8.11.0
Comparing to
See all releases

Code changes from version 8.10.7 to 8.11.0

admin.php CHANGED
@@ -213,10 +213,10 @@ JQUERY;
213
  }
214
 
215
  /**
216
- * Renders SnapEngage
217
  */
218
- public static function include_snapengage() {
219
- ShareaholicUtilities::load_template('script_snapengage');
220
  }
221
 
222
  /**
213
  }
214
 
215
  /**
216
+ * Renders Chat
217
  */
218
+ public static function include_chat() {
219
+ ShareaholicUtilities::load_template('script_chat');
220
  }
221
 
222
  /**
public.php CHANGED
@@ -356,29 +356,47 @@ class ShareaholicPublic {
356
  * @return string the content
357
  */
358
  public static function draw_canvases($content) {
359
- $settings = ShareaholicUtilities::get_settings();
360
- $page_type = ShareaholicUtilities::page_type();
361
- foreach (array('share_buttons', 'recommendations') as $app) {
 
362
 
363
- // check Excerpt prefs
364
- if ('the_excerpt' == current_filter() && isset($settings["{$app}_display_on_excerpts"]) && $settings["{$app}_display_on_excerpts"] == 'off') {
365
- return $content;
 
 
 
 
 
 
 
 
 
366
  }
367
-
368
- // check individual post prefs
369
- if (!get_post_meta(get_the_ID(), "shareaholic_disable_{$app}", true)) {
370
- // check if ABOVE location is turned on
371
- if (isset($settings[$app]["{$page_type}_above_content"]) && $settings[$app]["{$page_type}_above_content"] == 'on') {
372
- $id = $settings['location_name_ids'][$app]["{$page_type}_above_content"];
373
- $content = self::canvas($id, $app, "{$page_type}_above_content") . $content;
374
  }
375
- // check if BELOW location is turned on
376
- if (isset($settings[$app]["{$page_type}_below_content"]) && $settings[$app]["{$page_type}_below_content"] == 'on') {
377
- $id = $settings['location_name_ids'][$app]["{$page_type}_below_content"];
378
- $content .= self::canvas($id, $app, "{$page_type}_below_content");
 
 
 
 
 
 
 
 
 
379
  }
380
  }
381
  }
 
382
  // something that uses the_content hook must return the $content
383
  return $content;
384
  }
356
  * @return string the content
357
  */
358
  public static function draw_canvases($content) {
359
+ global $wp_current_filter;
360
+ if (is_main_query()) {
361
+ $settings = ShareaholicUtilities::get_settings();
362
+ $page_type = ShareaholicUtilities::page_type();
363
 
364
+ // Don't allow this function to run more than once for a page load (prevent infinite loops)
365
+ $has_run = false;
366
+ foreach ( $wp_current_filter as $filter ) {
367
+ if ( 'the_content' == $filter ) {
368
+ if ( $has_run ) {
369
+ // has already run once
370
+ return $content;
371
+ } else {
372
+ // first run, set flag!
373
+ $has_run = true;
374
+ }
375
+ }
376
  }
377
+
378
+ foreach (array('share_buttons', 'recommendations') as $app) {
379
+ // check Excerpt prefs
380
+ if ('the_excerpt' == current_filter() && isset($settings["{$app}_display_on_excerpts"]) && $settings["{$app}_display_on_excerpts"] == 'off') {
381
+ return $content;
 
 
382
  }
383
+
384
+ // check individual post prefs
385
+ if (!get_post_meta(get_the_ID(), "shareaholic_disable_{$app}", true)) {
386
+ // check if ABOVE location is turned on
387
+ if (isset($settings[$app]["{$page_type}_above_content"]) && $settings[$app]["{$page_type}_above_content"] == 'on') {
388
+ $id = $settings['location_name_ids'][$app]["{$page_type}_above_content"];
389
+ $content = self::canvas($id, $app, "{$page_type}_above_content") . $content;
390
+ }
391
+ // check if BELOW location is turned on
392
+ if (isset($settings[$app]["{$page_type}_below_content"]) && $settings[$app]["{$page_type}_below_content"] == 'on') {
393
+ $id = $settings['location_name_ids'][$app]["{$page_type}_below_content"];
394
+ $content .= self::canvas($id, $app, "{$page_type}_below_content");
395
+ }
396
  }
397
  }
398
  }
399
+
400
  // something that uses the_content hook must return the $content
401
  return $content;
402
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WordPress Share Buttons, Related Posts, Google Analytics - Shareaholic ===
2
  Contributors: shareaholic
3
  Tags: buttons, related posts, google analytics, share buttons, social sharing, image sharing, related content, woocommerce, typepad, amazon, analytics, arto, baidu, bitly, blogger, buffer, cookie compliance, cookie consent, delicious, digg, diigo, disqus, email button, eu cookie law, evernote, facebook, facebook sharing, fancy, fark, feedly, flipboard, floated share buttons, floating share buttons, follow buttons, GDPR, gmail, google bookmarks, google classroom, google plus, hootsuite, hotmail, houzz, inbound.org, instagram, instagram sharing, instapaper, kik, kindle, line, linkedin, livejournal, meneame, mister wong, mix, mixi, odnoklassniki, box.net, onenote, pinboard.in, pinterest, pinterest sharing, plurk, pocket, printfriendly, recommendations, reddit, sexybookmarks, share buttons, share image, shareaholic, shareholic, sms, social bookmarking, social media, social plugin, social share buttons, spotify, stumbleupon, stumpedia, symphony, tinyurl, tumblr, twitter, viadeo, vk, wanelo, wechat, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
- Requires at least: 3.0
5
- Tested up to: 5.0
6
  Requires PHP: 5.2
7
- Stable tag: 8.10.7
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
@@ -267,6 +267,9 @@ The default Shareaholic thumbnail width is 640px with dynamic height and no crop
267
  Each time you change Shareaholic's thumbnail dimensions like this, you will probably want to have WordPress regenerate appropriate sized thumbnails for all of your images. We highly recommend the [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugin for this purpose.
268
 
269
  == Changelog ==
 
 
 
270
 
271
  = 8.10.7 (2019-01-17) =
272
  * Enhancement: W3C validation
@@ -867,8 +870,11 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
867
  * Show Related Posts data status
868
 
869
  == Upgrade Notice ==
 
 
 
870
  = 8.10.7 =
871
- * W3C validation improvements
872
 
873
  = 8.10.6 =
874
  WeChat Share and Follow Buttons and Twitter Card bug fixes
1
  === WordPress Share Buttons, Related Posts, Google Analytics - Shareaholic ===
2
  Contributors: shareaholic
3
  Tags: buttons, related posts, google analytics, share buttons, social sharing, image sharing, related content, woocommerce, typepad, amazon, analytics, arto, baidu, bitly, blogger, buffer, cookie compliance, cookie consent, delicious, digg, diigo, disqus, email button, eu cookie law, evernote, facebook, facebook sharing, fancy, fark, feedly, flipboard, floated share buttons, floating share buttons, follow buttons, GDPR, gmail, google bookmarks, google classroom, google plus, hootsuite, hotmail, houzz, inbound.org, instagram, instagram sharing, instapaper, kik, kindle, line, linkedin, livejournal, meneame, mister wong, mix, mixi, odnoklassniki, box.net, onenote, pinboard.in, pinterest, pinterest sharing, plurk, pocket, printfriendly, recommendations, reddit, sexybookmarks, share buttons, share image, shareaholic, shareholic, sms, social bookmarking, social media, social plugin, social share buttons, spotify, stumbleupon, stumpedia, symphony, tinyurl, tumblr, twitter, viadeo, vk, wanelo, wechat, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
+ Requires at least: 3.3
5
+ Tested up to: 5.1
6
  Requires PHP: 5.2
7
+ Stable tag: 8.11.0
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
267
  Each time you change Shareaholic's thumbnail dimensions like this, you will probably want to have WordPress regenerate appropriate sized thumbnails for all of your images. We highly recommend the [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugin for this purpose.
268
 
269
  == Changelog ==
270
+ = 8.11.0 (2019-01-31) =
271
+ * Enhancement: Massive page speed gains = 50% faster load times on your site!
272
+ * Bugfix: Fixed issue with some themes rendering Shareaholic Apps multiple times
273
 
274
  = 8.10.7 (2019-01-17) =
275
  * Enhancement: W3C validation
870
  * Show Related Posts data status
871
 
872
  == Upgrade Notice ==
873
+ = 8.11.0 =
874
+ Massive page speed gains = 50% faster load times on your site! This update also fixes issue with some themes rendering Shareaholic Apps multiple times. This one is a must upgrade!
875
+
876
  = 8.10.7 =
877
+ W3C validation improvements
878
 
879
  = 8.10.6 =
880
  WeChat Share and Follow Buttons and Twitter Card bug fixes
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 8.10.7
7
  */
8
 
9
  /*
10
  Plugin Name: Fast Share Buttons, Analytics, Related Posts and More - Shareaholic
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
  Description: The award winning all-in-one Social Media and Related Posts solution for WordPress. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
- Version: 8.10.7
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
@@ -61,7 +61,7 @@ if (!class_exists('Shareaholic')) {
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
- const VERSION = '8.10.7';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
@@ -101,8 +101,8 @@ if (!class_exists('Shareaholic')) {
101
 
102
  add_action('wp_loaded', array('ShareaholicPublic', 'init'));
103
  add_action('after_setup_theme', array('ShareaholicPublic', 'after_setup_theme'));
104
- add_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
105
- add_action('the_excerpt', array('ShareaholicPublic', 'draw_canvases'));
106
 
107
  add_action('wp_head', array('ShareaholicPublic', 'wp_head'), 6);
108
  add_filter('wp_resource_hints', array('ShareaholicPublic', 'shareaholic_resource_hints'), 10, 2);
@@ -162,14 +162,21 @@ if (!class_exists('Shareaholic')) {
162
  add_filter('rocket_minify_excluded_external_js', array('ShareaholicUtilities', 'rocket_exclude_js') );
163
  }
164
 
 
 
 
 
 
 
 
165
  public static function remove_apps() {
166
- remove_filter('the_content', array('ShareaholicPublic', 'draw_canvases'));
167
- remove_filter('the_excerpt', array('ShareaholicPublic', 'draw_canvases'));
168
  }
169
 
170
  public static function return_apps() {
171
- add_filter('the_content', array('ShareaholicPublic', 'draw_canvases'));
172
- add_filter('the_excerpt', array('ShareaholicPublic', 'draw_canvases'));
173
  }
174
 
175
  /**
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 8.11.0
7
  */
8
 
9
  /*
10
  Plugin Name: Fast Share Buttons, Analytics, Related Posts and More - Shareaholic
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
  Description: The award winning all-in-one Social Media and Related Posts solution for WordPress. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
+ Version: 8.11.0
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
+ const VERSION = '8.11.0';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
101
 
102
  add_action('wp_loaded', array('ShareaholicPublic', 'init'));
103
  add_action('after_setup_theme', array('ShareaholicPublic', 'after_setup_theme'));
104
+
105
+ add_action('pre_get_posts', array($this, 'shareaholic_draw_canvas'));
106
 
107
  add_action('wp_head', array('ShareaholicPublic', 'wp_head'), 6);
108
  add_filter('wp_resource_hints', array('ShareaholicPublic', 'shareaholic_resource_hints'), 10, 2);
162
  add_filter('rocket_minify_excluded_external_js', array('ShareaholicUtilities', 'rocket_exclude_js') );
163
  }
164
 
165
+ public static function shareaholic_draw_canvas($query) {
166
+ if ( $query->is_main_query() ) {
167
+ add_filter('the_content', array('ShareaholicPublic', 'draw_canvases'), 98);
168
+ add_filter('the_excerpt', array('ShareaholicPublic', 'draw_canvases'), 98);
169
+ }
170
+ }
171
+
172
  public static function remove_apps() {
173
+ remove_filter('the_content', array('ShareaholicPublic', 'draw_canvases'), 98);
174
+ remove_filter('the_excerpt', array('ShareaholicPublic', 'draw_canvases'), 98);
175
  }
176
 
177
  public static function return_apps() {
178
+ add_filter('the_content', array('ShareaholicPublic', 'draw_canvases'), 98);
179
+ add_filter('the_excerpt', array('ShareaholicPublic', 'draw_canvases'), 98);
180
  }
181
 
182
  /**
templates/admin_beta.php CHANGED
@@ -17,9 +17,9 @@
17
 
18
  <div id="root" class="shr-site-settings"></div>
19
 
20
- <script type="text/javascript" src="<?php echo ShareaholicUtilities::asset_url_admin('ui-site-settings/loader.js') ?>"></script>
21
  </div>
22
 
23
  <?php } ?>
24
 
25
- <?php ShareaholicAdmin::include_snapengage(); ?>
17
 
18
  <div id="root" class="shr-site-settings"></div>
19
 
20
+ <script src="<?php echo ShareaholicUtilities::asset_url_admin('ui-site-settings/loader.js') ?>"></script>
21
  </div>
22
 
23
  <?php } ?>
24
 
25
+ <?php ShareaholicAdmin::include_chat(); ?>
templates/advanced_settings.php CHANGED
@@ -115,4 +115,4 @@
115
  </div>
116
 
117
  <?php ShareaholicAdmin::show_footer(); ?>
118
- <?php ShareaholicAdmin::include_snapengage(); ?>
115
  </div>
116
 
117
  <?php ShareaholicAdmin::show_footer(); ?>
118
+ <?php ShareaholicAdmin::include_chat(); ?>
templates/footer.php CHANGED
@@ -12,7 +12,7 @@
12
  </div>
13
 
14
  <!-- Start of Async HubSpot Analytics -->
15
- <script type="text/javascript">
16
  var _hsq = _hsq || [];
17
  _hsq.push(["setContentType", "standard-page"]);
18
  (function(d,s,i,r) {
12
  </div>
13
 
14
  <!-- Start of Async HubSpot Analytics -->
15
+ <script>
16
  var _hsq = _hsq || [];
17
  _hsq.push(["setContentType", "standard-page"]);
18
  (function(d,s,i,r) {
templates/header.php CHANGED
@@ -1,6 +1,6 @@
1
  <!-- Header - start -->
2
  <div id="shr-header-container"></div>
3
- <script type="text/javascript" src="<?php echo ShareaholicUtilities::asset_url_admin('ui-header/loader.js') ?>"></script>
4
  <!-- Header - end -->
5
 
6
  <script>
1
  <!-- Header - start -->
2
  <div id="shr-header-container"></div>
3
+ <script src="<?php echo ShareaholicUtilities::asset_url_admin('ui-header/loader.js') ?>"></script>
4
  <!-- Header - end -->
5
 
6
  <script>
templates/script_chat.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+
2
+ <script src="https://dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic-chat.js" async></script>
templates/script_snapengage.php DELETED
@@ -1,9 +0,0 @@
1
- <!-- begin SnapEngage code -->
2
- <script type="text/javascript">
3
- (function() {
4
- var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
5
- se.src = '//commondatastorage.googleapis.com/code.snapengage.com/js/62fa2e8b-38a9-4304-ba5c-86503444d30c.js';
6
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
7
- })();
8
- </script>
9
- <!-- end SnapEngage code -->
 
 
 
 
 
 
 
 
 
templates/settings.php CHANGED
@@ -155,4 +155,4 @@
155
  </div>
156
  </div>
157
  <?php ShareaholicAdmin::show_footer(); ?>
158
- <?php ShareaholicAdmin::include_snapengage(); ?>
155
  </div>
156
  </div>
157
  <?php ShareaholicAdmin::show_footer(); ?>
158
+ <?php ShareaholicAdmin::include_chat(); ?>