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

Version Description

We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thanks for using Shareaholic!

Download this release

Release Info

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

Code changes from version 8.13.5 to 8.13.6

admin.php CHANGED
@@ -389,7 +389,9 @@ JQUERY;
389
 
390
  /**
391
  * Include remote styles and scripts for the admin panel.
392
- * This addresses a conflict with 3rd party plugins that force modify the paths of scripts that are passed through to wp_enqueue_script
 
 
393
  *
394
  * @since 8.12.1
395
  */
389
 
390
  /**
391
  * Include remote styles and scripts for the admin panel.
392
+ *
393
+ * This addresses a conflict with 3rd party plugins that force modify the paths of
394
+ * scripts that are passed through to wp_enqueue_script
395
  *
396
  * @since 8.12.1
397
  */
lib/social-share-counts/curl_multi_share_count.php CHANGED
@@ -180,7 +180,9 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
180
  private function curl_setopts($curl_handle, $config, $service) {
181
  $facebook_access_token = isset($this->options['facebook_access_token']) ? $this->options['facebook_access_token'] : false;
182
  $http2 = isset($this->options['http2']) ? $this->options['http2'] : '0';
183
- $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : 5;
 
 
184
 
185
  // set the url to make the curl request to
186
  if ($service == 'facebook' && $facebook_access_token) {
@@ -197,7 +199,7 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
197
  curl_setopt_array($curl_handle, array(
198
  CURLOPT_HEADER => 1,
199
  CURLOPT_RETURNTRANSFER => 1,
200
- CURLOPT_TIMEOUT => $timeout,
201
  CURLOPT_SSL_VERIFYPEER => false,
202
  CURLOPT_SSL_VERIFYHOST => false,
203
  ));
180
  private function curl_setopts($curl_handle, $config, $service) {
181
  $facebook_access_token = isset($this->options['facebook_access_token']) ? $this->options['facebook_access_token'] : false;
182
  $http2 = isset($this->options['http2']) ? $this->options['http2'] : '0';
183
+
184
+ $timeout = isset($config[$service]['timeout']) ? $config[$service]['timeout'] : 1000;
185
+ $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : $timeout;
186
 
187
  // set the url to make the curl request to
188
  if ($service == 'facebook' && $facebook_access_token) {
199
  curl_setopt_array($curl_handle, array(
200
  CURLOPT_HEADER => 1,
201
  CURLOPT_RETURNTRANSFER => 1,
202
+ CURLOPT_TIMEOUT_MS => $timeout,
203
  CURLOPT_SSL_VERIFYPEER => false,
204
  CURLOPT_SSL_VERIFYHOST => false,
205
  ));
lib/social-share-counts/seq_share_count.php CHANGED
@@ -48,7 +48,7 @@ class ShareaholicSeqShareCount extends ShareaholicShareCount {
48
  $this->{$config[$service]['prepare']}($this->url, $config);
49
  }
50
 
51
- $timeout = isset($config[$service]['timeout']) ? $config[$service]['timeout'] : 1;
52
  $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : $timeout;
53
  $http2 = isset($this->options['http2']) ? $this->options['http2'] : '0';
54
 
48
  $this->{$config[$service]['prepare']}($this->url, $config);
49
  }
50
 
51
+ $timeout = isset($config[$service]['timeout']) ? $config[$service]['timeout'] : 1000;
52
  $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : $timeout;
53
  $http2 = isset($this->options['http2']) ? $this->options['http2'] : '0';
54
 
lib/social-share-counts/share_count.php CHANGED
@@ -37,55 +37,55 @@ abstract class ShareaholicShareCount {
37
  'url' => 'https://graph.facebook.com/?fields=og_object{engagement{count}}&id=%s',
38
  'url_auth' => 'https://graph.facebook.com/?access_token=%auth%&fields=engagement&id=%s',
39
  'method' => 'GET',
40
- 'timeout' => 1, // in number of seconds
41
  'callback' => 'facebook_count_callback',
42
  ),
43
  'pinterest' => array(
44
  'url' => 'https://api.pinterest.com/v1/urls/count.json?url=%s&callback=f',
45
  'method' => 'GET',
46
- 'timeout' => 1,
47
  'callback' => 'pinterest_count_callback',
48
  ),
49
  'buffer' => array(
50
  'url' => 'https://api.bufferapp.com/1/links/shares.json?url=%s',
51
  'method' => 'GET',
52
- 'timeout' => 1,
53
  'callback' => 'buffer_count_callback',
54
  ),
55
  'reddit' => array(
56
  'url' => 'https://www.reddit.com/button_info.json?url=%s',
57
  'method' => 'GET',
58
- 'timeout' => 1,
59
  'callback' => 'reddit_count_callback',
60
  ),
61
  'vk' => array(
62
  'url' => 'https://vk.com/share.php?act=count&url=%s',
63
  'method' => 'GET',
64
- 'timeout' => 1,
65
  'callback' => 'vk_count_callback',
66
  ),
67
  'tumblr' => array(
68
  'url' => 'https://api.tumblr.com/v2/share/stats?url=%s',
69
  'method' => 'GET',
70
- 'timeout' => 1,
71
  'callback' => 'tumblr_count_callback',
72
  ),
73
  'odnoklassniki' => array(
74
  'url' => 'https://connect.ok.ru/dk?st.cmd=extLike&uid=odklcnt0&ref=%s',
75
  'method' => 'GET',
76
- 'timeout' => 1,
77
  'callback' => 'odnoklassniki_count_callback',
78
  ),
79
  'fancy' => array(
80
  'url' => 'https://fancy.com/fancyit/count?ItemURL=%s',
81
  'method' => 'GET',
82
- 'timeout' => 1,
83
  'callback' => 'fancy_count_callback',
84
  ),
85
  'yummly' => array(
86
  'url' => 'https://www.yummly.com/services/yum-count?url=%s',
87
  'method' => 'GET',
88
- 'timeout' => 1,
89
  'callback' => 'yummly_count_callback',
90
  ),
91
  );
37
  'url' => 'https://graph.facebook.com/?fields=og_object{engagement{count}}&id=%s',
38
  'url_auth' => 'https://graph.facebook.com/?access_token=%auth%&fields=engagement&id=%s',
39
  'method' => 'GET',
40
+ 'timeout' => 1000, // in number of milliseconds
41
  'callback' => 'facebook_count_callback',
42
  ),
43
  'pinterest' => array(
44
  'url' => 'https://api.pinterest.com/v1/urls/count.json?url=%s&callback=f',
45
  'method' => 'GET',
46
+ 'timeout' => 1000,
47
  'callback' => 'pinterest_count_callback',
48
  ),
49
  'buffer' => array(
50
  'url' => 'https://api.bufferapp.com/1/links/shares.json?url=%s',
51
  'method' => 'GET',
52
+ 'timeout' => 1000,
53
  'callback' => 'buffer_count_callback',
54
  ),
55
  'reddit' => array(
56
  'url' => 'https://www.reddit.com/button_info.json?url=%s',
57
  'method' => 'GET',
58
+ 'timeout' => 1000,
59
  'callback' => 'reddit_count_callback',
60
  ),
61
  'vk' => array(
62
  'url' => 'https://vk.com/share.php?act=count&url=%s',
63
  'method' => 'GET',
64
+ 'timeout' => 1000,
65
  'callback' => 'vk_count_callback',
66
  ),
67
  'tumblr' => array(
68
  'url' => 'https://api.tumblr.com/v2/share/stats?url=%s',
69
  'method' => 'GET',
70
+ 'timeout' => 1000,
71
  'callback' => 'tumblr_count_callback',
72
  ),
73
  'odnoklassniki' => array(
74
  'url' => 'https://connect.ok.ru/dk?st.cmd=extLike&uid=odklcnt0&ref=%s',
75
  'method' => 'GET',
76
+ 'timeout' => 1000,
77
  'callback' => 'odnoklassniki_count_callback',
78
  ),
79
  'fancy' => array(
80
  'url' => 'https://fancy.com/fancyit/count?ItemURL=%s',
81
  'method' => 'GET',
82
+ 'timeout' => 1000,
83
  'callback' => 'fancy_count_callback',
84
  ),
85
  'yummly' => array(
86
  'url' => 'https://www.yummly.com/services/yum-count?url=%s',
87
  'method' => 'GET',
88
+ 'timeout' => 1000,
89
  'callback' => 'yummly_count_callback',
90
  ),
91
  );
lib/social-share-counts/wordpress_http.php CHANGED
@@ -29,7 +29,7 @@ class ShareaholicHttp {
29
  *
30
  * - redirection: The number of redirects to follow for this request as an integer, Default is 5.
31
  *
32
- * - timeout: The number of seconds the request should take as an integer. Default is 15 (seconds).
33
  *
34
  * - user-agent: The useragent for the request. Default is mozilla browser useragent.
35
  *
@@ -60,9 +60,12 @@ class ShareaholicHttp {
60
  $request['method'] = isset($options['method']) ? $options['method'] : 'GET';
61
  $request['headers'] = isset($options['headers']) ? $options['headers'] : array();
62
  $request['redirection'] = isset($options['redirection']) ? $options['redirection'] : 5;
63
- $request['timeout'] = isset($options['timeout']) ? $options['timeout'] : 15;
64
  $request['user-agent'] = isset($options['user-agent']) ? $options['user-agent'] : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0';
65
-
 
 
 
 
66
  if(isset($options['body'])) {
67
  if(isset($request['headers']['Content-Type']) && $request['headers']['Content-Type'] === 'application/json') {
68
  $request['body'] = json_encode($options['body']);
29
  *
30
  * - redirection: The number of redirects to follow for this request as an integer, Default is 5.
31
  *
32
+ * - timeout: The number of milliseconds the request should take. Default is 15000 milliseconds. Note that this is rounded up to nearest second.
33
  *
34
  * - user-agent: The useragent for the request. Default is mozilla browser useragent.
35
  *
60
  $request['method'] = isset($options['method']) ? $options['method'] : 'GET';
61
  $request['headers'] = isset($options['headers']) ? $options['headers'] : array();
62
  $request['redirection'] = isset($options['redirection']) ? $options['redirection'] : 5;
 
63
  $request['user-agent'] = isset($options['user-agent']) ? $options['user-agent'] : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0';
64
+
65
+ // Convert ms to seconds (WP native function accepts timeouts in seconds only)
66
+ $timeout_ms = isset($options['timeout']) ? $options['timeout'] : 15000;
67
+ $request['timeout'] = ceil($timeout_ms / 1000);
68
+
69
  if(isset($options['body'])) {
70
  if(isset($request['headers']['Content-Type']) && $request['headers']['Content-Type'] === 'application/json') {
71
  $request['body'] = json_encode($options['body']);
public.php CHANGED
@@ -531,11 +531,11 @@ class ShareaholicPublic {
531
  }
532
  }
533
 
534
- $seconds_to_cache = 600; // 10 minutes
535
- $ts = gmdate("D, d M Y H:i:s", time() + 600) . " GMT";
536
  header('Access-Control-Allow-Origin: *');
537
  header('Content-Type: application/json');
538
- header("Expires: $ts"); // 10 minutes
539
  header("Cache-Control: max-age=$seconds_to_cache"); // 10 minutes
540
  echo json_encode($result);
541
  exit;
531
  }
532
  }
533
 
534
+ $seconds_to_cache = 900; // 15 minutes
535
+ $ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
536
  header('Access-Control-Allow-Origin: *');
537
  header('Content-Type: application/json');
538
+ header("Expires: $ts");
539
  header("Cache-Control: max-age=$seconds_to_cache"); // 10 minutes
540
  echo json_encode($result);
541
  exit;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, related posts, google analytics, share buttons, social sharing,
4
  Requires at least: 3.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.2
7
- Stable tag: 8.13.5
8
 
9
 
10
  Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
@@ -285,6 +285,10 @@ The default Shareaholic thumbnail width is 640px with dynamic height and no crop
285
  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.
286
 
287
  == Changelog ==
 
 
 
 
288
  = 8.13.5 (2019-06-27) =
289
  * Hide notice spam from other plugins in Shareaholic Admin
290
  * Redirect to plugin settings after activation
@@ -936,7 +940,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
936
  * Show Related Posts data status
937
 
938
  == Upgrade Notice ==
939
- = 8.13.5 =
940
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thanks for using Shareaholic!
941
 
942
  = 8.12.1 =
4
  Requires at least: 3.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.2
7
+ Stable tag: 8.13.6
8
 
9
 
10
  Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
285
  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.
286
 
287
  == Changelog ==
288
+ = 8.13.6 (2019-07-11) =
289
+ * New: Hosted/cloud option for Share Count Proxy now available [More info](https://www.shareaholic.com/blog/social-share-count-api/)
290
+ * Enhancement: Performance improvements to Share Count Proxy (stricter timeouts for API calls)
291
+
292
  = 8.13.5 (2019-06-27) =
293
  * Hide notice spam from other plugins in Shareaholic Admin
294
  * Redirect to plugin settings after activation
940
  * Show Related Posts data status
941
 
942
  == Upgrade Notice ==
943
+ = 8.13.6 =
944
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thanks for using Shareaholic!
945
 
946
  = 8.12.1 =
shareaholic.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Shareaholic - Grow and Engage Your Audience
4
  Plugin URI: https://www.shareaholic.com/website-tools/
5
  Description: Shareaholic’s official WordPress plugin allows you to add Award-Winning Social Share Buttons, Related Posts, Content Analytics, Ad Monetization, and more to your website.
6
- Version: 8.13.5
7
  Author: Shareaholic
8
  Author URI: https://www.shareaholic.com
9
  Text Domain: shareaholic
@@ -14,7 +14,7 @@ Domain Path: /languages
14
  * The main file!
15
  *
16
  * @package shareaholic
17
- * @version 8.13.5
18
  */
19
 
20
  /**
@@ -59,7 +59,7 @@ if (!class_exists('Shareaholic')) {
59
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
60
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
61
 
62
- const VERSION = '8.13.5';
63
 
64
  /**
65
  * Starts off as false so that ::get_instance() returns
3
  Plugin Name: Shareaholic - Grow and Engage Your Audience
4
  Plugin URI: https://www.shareaholic.com/website-tools/
5
  Description: Shareaholic’s official WordPress plugin allows you to add Award-Winning Social Share Buttons, Related Posts, Content Analytics, Ad Monetization, and more to your website.
6
+ Version: 8.13.6
7
  Author: Shareaholic
8
  Author URI: https://www.shareaholic.com
9
  Text Domain: shareaholic
14
  * The main file!
15
  *
16
  * @package shareaholic
17
+ * @version 8.13.6
18
  */
19
 
20
  /**
59
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
60
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
61
 
62
+ const VERSION = '8.13.6';
63
 
64
  /**
65
  * Starts off as false so that ::get_instance() returns
templates/advanced_settings.php CHANGED
@@ -81,7 +81,7 @@ window.ShareaholicConfig = {
81
  <?php if (isset($settings['disable_internal_share_counts_api'])) { ?>
82
  <?php echo ($settings['disable_internal_share_counts_api'] == 'on' ? 'checked' : '') ?>
83
  <?php } ?>>
84
- <label for="share_counts"> <?php echo sprintf(__('Disable Share Count Proxy.', 'shareaholic')); ?> <?php echo sprintf(__('When enabled, Share Counts will be fetched and cached locally by your server. This local proxy enhances user privacy and share counts but uses your server resources. Retrieving, caching and serving Share Counts can be a server and database intensive activity which can test even the best of web hosts. You can save on your hosting bill by offloading this heavy lifting to Shareaholic servers instead, <a href="%s" target="_blank">learn more</a>.', 'shareaholic'), 'https://support.shareaholic.com/hc/en-us/articles/360029500132'); ?></label>
85
  </div>
86
 
87
  <?php if (isset($settings['disable_internal_share_counts_api']) && $settings['disable_internal_share_counts_api'] != 'on') { ?>
81
  <?php if (isset($settings['disable_internal_share_counts_api'])) { ?>
82
  <?php echo ($settings['disable_internal_share_counts_api'] == 'on' ? 'checked' : '') ?>
83
  <?php } ?>>
84
+ <label for="share_counts"> <?php echo sprintf(__('Disable Local Share Count Proxy.', 'shareaholic')); ?> <?php echo sprintf(__('When enabled, Share Counts will be fetched and cached locally by your server. This local proxy enhances user privacy and share counts but uses your server resources. Retrieving, caching and serving Share Counts can be a server and database intensive activity which can test even the best of web hosts. You can save on your hosting bill by offloading this heavy lifting to Shareaholic servers instead, <a href="%s" target="_blank">learn more</a>.', 'shareaholic'), 'https://support.shareaholic.com/hc/en-us/articles/360029500132'); ?></label>
85
  </div>
86
 
87
  <?php if (isset($settings['disable_internal_share_counts_api']) && $settings['disable_internal_share_counts_api'] != 'on') { ?>