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

Version Description

We've improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.

Download this release

Release Info

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

Code changes from version 8.6.1 to 8.6.3

Files changed (4) hide show
  1. curl.php +16 -2
  2. readme.txt +11 -1
  3. shareaholic.php +3 -3
  4. utilities.php +6 -4
curl.php CHANGED
@@ -66,18 +66,32 @@ class ShareaholicCurl {
66
  $timeout = 15;
67
  $useragent = 'WordPress/' . get_bloginfo('version') . ' ('. 'PHP/' . phpversion() . '; ' . 'SHR_WP/' . Shareaholic::VERSION . '; +' . get_bloginfo( 'url' ) . ')';
68
  if ($method == 'GET') {
69
- $response = wp_remote_get($url, array('body' => $data, 'sslverify'=>false, 'user-agent'=>$useragent, 'timeout'=>$timeout));
 
 
 
 
 
 
 
 
 
 
 
70
  } elseif ($method == 'POST') {
71
  $request = array();
72
  if ($data_type == 'json') {
73
  $request['headers'] = array(
74
- 'Content-Type' => 'application/json'
75
  );
76
  $request['body'] = json_encode($data);
77
  } else {
78
  $request['body'] = $data;
79
  }
80
  $request['headers']['Accept'] = 'application/json';
 
 
 
81
  $request['headers']['user-agent'] = $useragent;
82
  $request['sslverify'] = false;
83
  $request['timeout'] = $timeout;
66
  $timeout = 15;
67
  $useragent = 'WordPress/' . get_bloginfo('version') . ' ('. 'PHP/' . phpversion() . '; ' . 'SHR_WP/' . Shareaholic::VERSION . '; +' . get_bloginfo( 'url' ) . ')';
68
  if ($method == 'GET') {
69
+ $request = array();
70
+ if (WP_Http_Encoding::is_available()) {
71
+ $request['headers']['Accept-Encoding'] = 'gzip, deflate';
72
+ }
73
+ $response = wp_remote_get($url, array(
74
+ 'body' => $data,
75
+ 'sslverify' => false,
76
+ 'user-agent' => $useragent,
77
+ 'timeout' => $timeout,
78
+ 'headers' => $request['headers']
79
+ )
80
+ );
81
  } elseif ($method == 'POST') {
82
  $request = array();
83
  if ($data_type == 'json') {
84
  $request['headers'] = array(
85
+ 'Content-Type' => 'application/json',
86
  );
87
  $request['body'] = json_encode($data);
88
  } else {
89
  $request['body'] = $data;
90
  }
91
  $request['headers']['Accept'] = 'application/json';
92
+ if (WP_Http_Encoding::is_available()) {
93
+ $request['headers']['Accept-Encoding'] = 'gzip, deflate';
94
+ }
95
  $request['headers']['user-agent'] = $useragent;
96
  $request['sslverify'] = false;
97
  $request['timeout'] = $timeout;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: shareaholic
3
  Tags: Social Tools, 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, izeby, kaboodle, kik, kindle, line, linkedin, livejournal, meneame, mister wong, 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, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
- Stable tag: 8.6.1
7
 
8
  Consolidate plugins with a high-speed suite of social tools: social share buttons, related content, related posts, ad monetization & Google Analytics.
9
 
@@ -213,6 +213,13 @@ Please see here: [Shareaholic Helpdesk](http://support.shareaholic.com/hc/en-us)
213
  Please see here: [Usage & Installation Instructions](http://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
214
 
215
  == Changelog ==
 
 
 
 
 
 
 
216
  = 8.6.1 (2017-11-07) =
217
  * New: Option to show or hide share buttons, related content, etc on excerpts
218
 
@@ -699,6 +706,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
699
  * Show Related Posts data status
700
 
701
  == Upgrade Notice ==
 
 
 
702
  = 8.6.1 =
703
  New option to show or hide share buttons, related content, etc on excerpts
704
 
3
  Tags: Social Tools, 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, izeby, kaboodle, kik, kindle, line, linkedin, livejournal, meneame, mister wong, 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, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
+ Stable tag: 8.6.3
7
 
8
  Consolidate plugins with a high-speed suite of social tools: social share buttons, related content, related posts, ad monetization & Google Analytics.
9
 
213
  Please see here: [Usage & Installation Instructions](http://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
214
 
215
  == Changelog ==
216
+
217
+ = 8.6.3 (2018-02-06) =
218
+ * Bugfix: We've further improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.
219
+
220
+ = 8.6.2 (2018-02-05) =
221
+ * Enhancement: We've improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.
222
+
223
  = 8.6.1 (2017-11-07) =
224
  * New: Option to show or hide share buttons, related content, etc on excerpts
225
 
706
  * Show Related Posts data status
707
 
708
  == Upgrade Notice ==
709
+ = 8.6.3 =
710
+ We've improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.
711
+
712
  = 8.6.1 =
713
  New option to show or hide share buttons, related content, etc on excerpts
714
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 8.6.1
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: The world's leading all-in-one Content Amplification Platform that helps grow your website traffic, engagement, conversions & monetization. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
- Version: 8.6.1
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
@@ -63,7 +63,7 @@ if (!class_exists('Shareaholic')) {
63
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
64
  const REC_API_URL = 'http://recommendations.shareaholic.com';
65
 
66
- const VERSION = '8.6.1';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 8.6.3
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: The world's leading all-in-one Content Amplification Platform that helps grow your website traffic, engagement, conversions & monetization. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
+ Version: 8.6.3
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
63
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
64
  const REC_API_URL = 'http://recommendations.shareaholic.com';
65
 
66
+ const VERSION = '8.6.3';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
utilities.php CHANGED
@@ -658,7 +658,9 @@ class ShareaholicUtilities {
658
  */
659
  public static function get_or_create_api_key() {
660
  $api_key = self::get_option('api_key');
661
- if ($api_key) {
 
 
662
  return $api_key;
663
  }
664
 
@@ -708,7 +710,7 @@ class ShareaholicUtilities {
708
  $data,
709
  'json'
710
  );
711
-
712
  if ($response && preg_match('/20*/', $response['response']['code'])) {
713
  self::update_options(array(
714
  'api_key' => $response['body']['api_key'],
@@ -1384,9 +1386,9 @@ class ShareaholicUtilities {
1384
  public static function connectivity_check() {
1385
  $health_check_url = Shareaholic::API_URL . "/haproxy_health_check";
1386
  $response = ShareaholicCurl::get($health_check_url);
1387
- $body = $response['body'];
1388
  if(is_array($response) && array_key_exists('body', $response)) {
1389
- if ($body == "OK"){
 
1390
  return "SUCCESS";
1391
  } else {
1392
  return "FAIL";
658
  */
659
  public static function get_or_create_api_key() {
660
  $api_key = self::get_option('api_key');
661
+
662
+ // ensure api key set is atleast 30 characters, if not, retry to set new api key
663
+ if ($api_key && (strlen($api_key) > 30)) {
664
  return $api_key;
665
  }
666
 
710
  $data,
711
  'json'
712
  );
713
+
714
  if ($response && preg_match('/20*/', $response['response']['code'])) {
715
  self::update_options(array(
716
  'api_key' => $response['body']['api_key'],
1386
  public static function connectivity_check() {
1387
  $health_check_url = Shareaholic::API_URL . "/haproxy_health_check";
1388
  $response = ShareaholicCurl::get($health_check_url);
 
1389
  if(is_array($response) && array_key_exists('body', $response)) {
1390
+ $response_code = wp_remote_retrieve_response_code($response);
1391
+ if ($response_code == "200"){
1392
  return "SUCCESS";
1393
  } else {
1394
  return "FAIL";