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 | WordPress Social Tools, Related Posts, Monetization – Shareaholic |
Version | 8.13.4 |
Comparing to | |
See all releases |
Code changes from version 8.13.3 to 8.13.4
- admin.php +1 -1
- lib/social-share-counts/curl_multi_share_count.php +76 -11
- lib/social-share-counts/seq_share_count.php +13 -2
- lib/social-share-counts/share_count.php +2 -2
- lib/social-share-counts/wordpress_http.php +42 -2
- public.php +20 -4
- readme.txt +19 -15
- shareaholic.php +4 -4
- templates/{admin_beta.php → admin.php} +0 -0
- templates/advanced_settings.php +1 -1
- templates/settings.php +3 -1
admin.php
CHANGED
@@ -506,7 +506,7 @@ JQUERY;
|
|
506 |
$jwt = ShareaholicAdmin::get_publisher_token();
|
507 |
|
508 |
if ($jwt) {
|
509 |
-
ShareaholicUtilities::load_template('
|
510 |
'jwt' => $jwt,
|
511 |
'api_key' => $api_key
|
512 |
));
|
506 |
$jwt = ShareaholicAdmin::get_publisher_token();
|
507 |
|
508 |
if ($jwt) {
|
509 |
+
ShareaholicUtilities::load_template('admin', array(
|
510 |
'jwt' => $jwt,
|
511 |
'api_key' => $api_key
|
512 |
));
|
lib/social-share-counts/curl_multi_share_count.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Shareaholic Multi Share Count
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
-
* @version
|
7 |
*/
|
8 |
|
9 |
require_once('share_count.php');
|
@@ -34,8 +34,13 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
34 |
$services_length = count($this->services);
|
35 |
$config = self::get_services_config();
|
36 |
$response = array();
|
|
|
37 |
$response['status'] = 200;
|
38 |
|
|
|
|
|
|
|
|
|
39 |
// array of curl handles
|
40 |
$curl_handles = array();
|
41 |
|
@@ -89,12 +94,38 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
89 |
if(curl_errno($handle)) {
|
90 |
$response['status'] = 500;
|
91 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
$result = array(
|
93 |
-
'body' =>
|
94 |
'response' => array(
|
95 |
'code' => curl_getinfo($handle, CURLINFO_HTTP_CODE)
|
96 |
),
|
97 |
);
|
|
|
98 |
$callback = $config[$service]['callback'];
|
99 |
|
100 |
// Facebook auth?
|
@@ -103,11 +134,41 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
103 |
} else {
|
104 |
$counts = $this->$callback($result);
|
105 |
}
|
106 |
-
|
107 |
if(is_numeric($counts)) {
|
108 |
$response['data'][$service] = $counts;
|
109 |
}
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
curl_multi_remove_handle($multi_handle, $handle);
|
112 |
curl_close($handle);
|
113 |
}
|
@@ -117,9 +178,11 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
117 |
}
|
118 |
|
119 |
private function curl_setopts($curl_handle, $config, $service) {
|
120 |
-
// set the url to make the curl request
|
121 |
$facebook_access_token = isset($this->options['facebook_access_token']) ? $this->options['facebook_access_token'] : false;
|
|
|
|
|
122 |
|
|
|
123 |
if ($service == 'facebook' && $facebook_access_token) {
|
124 |
$url = $config[$service]['url_auth'];
|
125 |
$url = str_replace('%s', $this->url, $url);
|
@@ -128,25 +191,27 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
128 |
} else {
|
129 |
curl_setopt($curl_handle, CURLOPT_URL, str_replace('%s', $this->url, $config[$service]['url']));
|
130 |
}
|
131 |
-
|
132 |
-
$timeout = isset($this->options['timeout']) ? $this->options['timeout'] : 5;
|
133 |
|
134 |
// other necessary settings:
|
135 |
-
// CURLOPT_HEADER means include header in output, which we do not want
|
136 |
// CURLOPT_RETURNTRANSER means return output as string or not
|
137 |
curl_setopt_array($curl_handle, array(
|
138 |
-
CURLOPT_HEADER =>
|
139 |
CURLOPT_RETURNTRANSFER => 1,
|
140 |
CURLOPT_TIMEOUT => $timeout,
|
141 |
CURLOPT_SSL_VERIFYPEER => false,
|
142 |
CURLOPT_SSL_VERIFYHOST => false,
|
143 |
));
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
145 |
// set the http method: default is GET
|
146 |
if($config[$service]['method'] === 'POST') {
|
147 |
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
148 |
}
|
149 |
-
|
150 |
// set the body and headers
|
151 |
$headers = isset($config[$service]['headers']) ? $config[$service]['headers'] : array();
|
152 |
$body = isset($config[$service]['body']) ? $config[$service]['body'] : NULL;
|
3 |
* Shareaholic Multi Share Count
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
+
* @version 2.0.0.0
|
7 |
*/
|
8 |
|
9 |
require_once('share_count.php');
|
34 |
$services_length = count($this->services);
|
35 |
$config = self::get_services_config();
|
36 |
$response = array();
|
37 |
+
$meta = array();
|
38 |
$response['status'] = 200;
|
39 |
|
40 |
+
// Input Params
|
41 |
+
$show_raw = isset($this->options['show_raw']) ? $this->options['show_raw'] : '1';
|
42 |
+
$show_response_header = isset($this->options['show_response_header']) ? $this->options['show_response_header'] : '0';
|
43 |
+
|
44 |
// array of curl handles
|
45 |
$curl_handles = array();
|
46 |
|
94 |
if(curl_errno($handle)) {
|
95 |
$response['status'] = 500;
|
96 |
}
|
97 |
+
|
98 |
+
$headers = array();
|
99 |
+
$body = array();
|
100 |
+
$headers_arr = array();
|
101 |
+
$aHeaders = array();
|
102 |
+
|
103 |
+
// Parse header and body from response
|
104 |
+
$header_size = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
|
105 |
+
$headers = substr(curl_multi_getcontent($handle), 0, $header_size);
|
106 |
+
$body = substr(curl_multi_getcontent($handle), $header_size);
|
107 |
+
|
108 |
+
// Explode header values
|
109 |
+
$headers_arr = explode("\r\n", $headers);
|
110 |
+
// Remove empty values
|
111 |
+
$headers_arr = array_filter($headers_arr);
|
112 |
+
// Convert to key=>value
|
113 |
+
foreach($headers_arr as $i => $line){
|
114 |
+
if ($i === 0) {
|
115 |
+
$aHeaders['http_code'] = trim($line);
|
116 |
+
} else {
|
117 |
+
list($key, $val) = explode(': ', $line, 2);
|
118 |
+
$aHeaders[strtolower($key)] = trim($val);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
$result = array(
|
123 |
+
'body' => $body,
|
124 |
'response' => array(
|
125 |
'code' => curl_getinfo($handle, CURLINFO_HTTP_CODE)
|
126 |
),
|
127 |
);
|
128 |
+
|
129 |
$callback = $config[$service]['callback'];
|
130 |
|
131 |
// Facebook auth?
|
134 |
} else {
|
135 |
$counts = $this->$callback($result);
|
136 |
}
|
137 |
+
|
138 |
if(is_numeric($counts)) {
|
139 |
$response['data'][$service] = $counts;
|
140 |
}
|
141 |
+
|
142 |
+
// Include Response Headers?
|
143 |
+
if ($show_response_header == '1') {
|
144 |
+
$whitelisted_response_header_keys = array(
|
145 |
+
'http_code',
|
146 |
+
'x-app-usage',
|
147 |
+
'expires',
|
148 |
+
'cache-control'
|
149 |
+
);
|
150 |
+
$result_response_headers = array(
|
151 |
+
'response' => array(
|
152 |
+
'header' => array_intersect_key($aHeaders, array_flip($whitelisted_response_header_keys)),
|
153 |
+
'code' => curl_getinfo($handle, CURLINFO_HTTP_CODE),
|
154 |
+
),
|
155 |
+
);
|
156 |
+
$meta = array_merge($meta, $result_response_headers);
|
157 |
+
}
|
158 |
+
|
159 |
+
// Include Raw Body & Headers?
|
160 |
+
if ($show_raw == '1') {
|
161 |
+
$result_raw = array(
|
162 |
+
'raw' => array(
|
163 |
+
'body' => $body,
|
164 |
+
'headers' => $headers,
|
165 |
+
),
|
166 |
+
);
|
167 |
+
$meta = array_merge($meta, $result_raw);
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->raw_response[$service] = $meta;
|
171 |
+
|
172 |
curl_multi_remove_handle($multi_handle, $handle);
|
173 |
curl_close($handle);
|
174 |
}
|
178 |
}
|
179 |
|
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) {
|
187 |
$url = $config[$service]['url_auth'];
|
188 |
$url = str_replace('%s', $this->url, $url);
|
191 |
} else {
|
192 |
curl_setopt($curl_handle, CURLOPT_URL, str_replace('%s', $this->url, $config[$service]['url']));
|
193 |
}
|
|
|
|
|
194 |
|
195 |
// other necessary settings:
|
|
|
196 |
// CURLOPT_RETURNTRANSER means return output as string or not
|
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 |
));
|
204 |
+
|
205 |
+
// HTTP/2 support
|
206 |
+
if($http2 == '1') {
|
207 |
+
curl_setopt($curl_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
208 |
+
}
|
209 |
+
|
210 |
// set the http method: default is GET
|
211 |
if($config[$service]['method'] === 'POST') {
|
212 |
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
213 |
}
|
214 |
+
|
215 |
// set the body and headers
|
216 |
$headers = isset($config[$service]['headers']) ? $config[$service]['headers'] : array();
|
217 |
$body = isset($config[$service]['body']) ? $config[$service]['body'] : NULL;
|
lib/social-share-counts/seq_share_count.php
CHANGED
@@ -34,6 +34,7 @@ class ShareaholicSeqShareCount extends ShareaholicShareCount {
|
|
34 |
$services_length = count($this->services);
|
35 |
$config = self::get_services_config();
|
36 |
$response = array();
|
|
|
37 |
$response['status'] = 200;
|
38 |
|
39 |
for($i = 0; $i < $services_length; $i++) {
|
@@ -49,12 +50,19 @@ class ShareaholicSeqShareCount extends ShareaholicShareCount {
|
|
49 |
|
50 |
$timeout = isset($config[$service]['timeout']) ? $config[$service]['timeout'] : 1;
|
51 |
$timeout = isset($this->options['timeout']) ? $this->options['timeout'] : $timeout;
|
|
|
|
|
|
|
|
|
52 |
|
53 |
$options = array(
|
54 |
'method' => $config[$service]['method'],
|
55 |
'timeout' => $timeout,
|
56 |
'headers' => isset($config[$service]['headers']) ? $config[$service]['headers'] : array(),
|
57 |
'body' => isset($config[$service]['body']) ? $config[$service]['body'] : NULL,
|
|
|
|
|
|
|
58 |
);
|
59 |
|
60 |
// set the url to make the curl request
|
@@ -72,8 +80,9 @@ class ShareaholicSeqShareCount extends ShareaholicShareCount {
|
|
72 |
if(!$result) {
|
73 |
$response['status'] = 500;
|
74 |
}
|
|
|
75 |
$callback = $config[$service]['callback'];
|
76 |
-
|
77 |
if ($service == 'facebook' && isset($this->options['facebook_access_token'])){
|
78 |
$counts = $this->$callback($result, isset($this->options['facebook_access_token']));
|
79 |
} else {
|
@@ -83,8 +92,10 @@ class ShareaholicSeqShareCount extends ShareaholicShareCount {
|
|
83 |
if(is_numeric($counts)) {
|
84 |
$response['data'][$service] = $counts;
|
85 |
}
|
86 |
-
|
|
|
87 |
}
|
|
|
88 |
return $response;
|
89 |
}
|
90 |
}
|
34 |
$services_length = count($this->services);
|
35 |
$config = self::get_services_config();
|
36 |
$response = array();
|
37 |
+
$meta = array();
|
38 |
$response['status'] = 200;
|
39 |
|
40 |
for($i = 0; $i < $services_length; $i++) {
|
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 |
+
|
55 |
+
$show_raw = isset($this->options['show_raw']) ? $this->options['show_raw'] : '1';
|
56 |
+
$show_response_header = isset($this->options['show_response_header']) ? $this->options['show_response_header'] : '0';
|
57 |
|
58 |
$options = array(
|
59 |
'method' => $config[$service]['method'],
|
60 |
'timeout' => $timeout,
|
61 |
'headers' => isset($config[$service]['headers']) ? $config[$service]['headers'] : array(),
|
62 |
'body' => isset($config[$service]['body']) ? $config[$service]['body'] : NULL,
|
63 |
+
'http2' => $http2,
|
64 |
+
'show_raw' => $show_raw,
|
65 |
+
'show_response_header' => $show_response_header,
|
66 |
);
|
67 |
|
68 |
// set the url to make the curl request
|
80 |
if(!$result) {
|
81 |
$response['status'] = 500;
|
82 |
}
|
83 |
+
|
84 |
$callback = $config[$service]['callback'];
|
85 |
+
|
86 |
if ($service == 'facebook' && isset($this->options['facebook_access_token'])){
|
87 |
$counts = $this->$callback($result, isset($this->options['facebook_access_token']));
|
88 |
} else {
|
92 |
if(is_numeric($counts)) {
|
93 |
$response['data'][$service] = $counts;
|
94 |
}
|
95 |
+
|
96 |
+
$this->raw_response[$service] = $result['meta'];
|
97 |
}
|
98 |
+
|
99 |
return $response;
|
100 |
}
|
101 |
}
|
lib/social-share-counts/share_count.php
CHANGED
@@ -37,13 +37,13 @@ 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' =>
|
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' =>
|
47 |
'callback' => 'pinterest_count_callback',
|
48 |
),
|
49 |
'buffer' => array(
|
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(
|
lib/social-share-counts/wordpress_http.php
CHANGED
@@ -49,13 +49,14 @@ class ShareaholicHttp {
|
|
49 |
*
|
50 |
* @return mixed It returns an associative array of name value pairs or false if there was an error.
|
51 |
*/
|
52 |
-
public static function send($url, $options = array(), $ignore_error =
|
53 |
return self::send_with_wp($url, $options, $ignore_error);
|
54 |
}
|
55 |
|
56 |
private static function send_with_wp($url, $options, $ignore_error) {
|
57 |
$request = array();
|
58 |
$result = array();
|
|
|
59 |
$request['method'] = isset($options['method']) ? $options['method'] : 'GET';
|
60 |
$request['headers'] = isset($options['headers']) ? $options['headers'] : array();
|
61 |
$request['redirection'] = isset($options['redirection']) ? $options['redirection'] : 5;
|
@@ -83,7 +84,46 @@ class ShareaholicHttp {
|
|
83 |
}
|
84 |
return false;
|
85 |
}
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
return $response;
|
88 |
}
|
89 |
}
|
49 |
*
|
50 |
* @return mixed It returns an associative array of name value pairs or false if there was an error.
|
51 |
*/
|
52 |
+
public static function send($url, $options = array(), $ignore_error = true) {
|
53 |
return self::send_with_wp($url, $options, $ignore_error);
|
54 |
}
|
55 |
|
56 |
private static function send_with_wp($url, $options, $ignore_error) {
|
57 |
$request = array();
|
58 |
$result = array();
|
59 |
+
$meta = array();
|
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;
|
84 |
}
|
85 |
return false;
|
86 |
}
|
87 |
+
|
88 |
+
// Include Response Headers?
|
89 |
+
$show_response_header = isset($options['show_response_header']) ? $options['show_response_header'] : '0';
|
90 |
+
|
91 |
+
// Whitelisted Headers
|
92 |
+
$aHeaders = array(
|
93 |
+
'x-app-usage' => $response['headers']['x-app-usage'],
|
94 |
+
);
|
95 |
+
|
96 |
+
// Remove entry from array if value is blank
|
97 |
+
foreach($aHeaders as $key=>$value) {
|
98 |
+
if(is_null($value) || $value == '') {
|
99 |
+
unset($aHeaders[$key]);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($show_response_header == '1') {
|
104 |
+
$result_response_headers = array(
|
105 |
+
'response' => array(
|
106 |
+
'header' => $aHeaders,
|
107 |
+
'code' => wp_remote_retrieve_response_code($response),
|
108 |
+
),
|
109 |
+
);
|
110 |
+
$meta = array_merge($meta, $result_response_headers);
|
111 |
+
}
|
112 |
+
|
113 |
+
// Include Raw Body & Headers?
|
114 |
+
$show_raw = isset($options['show_raw']) ? $options['show_raw'] : '1';
|
115 |
+
if ($show_raw == '1') {
|
116 |
+
$result_raw = array(
|
117 |
+
'raw' => array(
|
118 |
+
'body' => wp_remote_retrieve_body($response),
|
119 |
+
'headers' => 'n/a',
|
120 |
+
),
|
121 |
+
);
|
122 |
+
$meta = array_merge($meta, $result_raw);
|
123 |
+
}
|
124 |
+
|
125 |
+
$response['meta'] = $meta;
|
126 |
+
|
127 |
return $response;
|
128 |
}
|
129 |
}
|
public.php
CHANGED
@@ -494,6 +494,11 @@ class ShareaholicPublic {
|
|
494 |
$options['timeout'] = intval($_GET['timeout']);
|
495 |
}
|
496 |
|
|
|
|
|
|
|
|
|
|
|
497 |
if (ShareaholicUtilities::facebook_auth_check() == "SUCCESS") {
|
498 |
$options['facebook_access_token'] = ShareaholicUtilities::fetch_fb_access_token();
|
499 |
}
|
@@ -510,12 +515,13 @@ class ShareaholicPublic {
|
|
510 |
} else {
|
511 |
$shares = new ShareaholicSeqShareCount($url, $services, $options);
|
512 |
}
|
|
|
513 |
$result = $shares->get_counts();
|
514 |
|
515 |
if ($debug_mode) {
|
516 |
$result['has_curl_multi'] = $has_curl_multi;
|
517 |
$result['curl_type'] = get_class($shares);
|
518 |
-
$result['
|
519 |
}
|
520 |
|
521 |
if (isset($result['data']) && !$debug_mode) {
|
@@ -525,9 +531,12 @@ class ShareaholicPublic {
|
|
525 |
}
|
526 |
}
|
527 |
|
|
|
|
|
528 |
header('Access-Control-Allow-Origin: *');
|
529 |
header('Content-Type: application/json');
|
530 |
-
header(
|
|
|
531 |
echo json_encode($result);
|
532 |
exit;
|
533 |
}
|
@@ -899,7 +908,14 @@ class ShareaholicPublic {
|
|
899 |
$post_types_filtered = array_diff($post_types, $post_types_exclude);
|
900 |
|
901 |
// Query
|
902 |
-
$args = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
903 |
$rand_posts = get_posts( $args );
|
904 |
foreach ( $rand_posts as $post ){
|
905 |
if ($post->post_title) {
|
@@ -934,7 +950,7 @@ class ShareaholicPublic {
|
|
934 |
);
|
935 |
|
936 |
header('Content-Type: application/json; charset=utf-8');
|
937 |
-
header('Cache-Control: max-age=
|
938 |
echo json_encode($result);
|
939 |
exit;
|
940 |
}
|
494 |
$options['timeout'] = intval($_GET['timeout']);
|
495 |
}
|
496 |
|
497 |
+
if ($debug_mode) {
|
498 |
+
$options['show_raw'] = isset($_GET['raw']) ? $_GET['raw'] : '1';
|
499 |
+
$options['show_response_header'] = isset($_GET['response_headers']) ? $_GET['response_headers'] : '1';
|
500 |
+
}
|
501 |
+
|
502 |
if (ShareaholicUtilities::facebook_auth_check() == "SUCCESS") {
|
503 |
$options['facebook_access_token'] = ShareaholicUtilities::fetch_fb_access_token();
|
504 |
}
|
515 |
} else {
|
516 |
$shares = new ShareaholicSeqShareCount($url, $services, $options);
|
517 |
}
|
518 |
+
|
519 |
$result = $shares->get_counts();
|
520 |
|
521 |
if ($debug_mode) {
|
522 |
$result['has_curl_multi'] = $has_curl_multi;
|
523 |
$result['curl_type'] = get_class($shares);
|
524 |
+
$result['meta'] = $shares->raw_response;
|
525 |
}
|
526 |
|
527 |
if (isset($result['data']) && !$debug_mode) {
|
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;
|
542 |
}
|
908 |
$post_types_filtered = array_diff($post_types, $post_types_exclude);
|
909 |
|
910 |
// Query
|
911 |
+
$args = array(
|
912 |
+
'post_type' => $post_types_filtered,
|
913 |
+
'post__not_in' => array($post_id),
|
914 |
+
'posts_per_page' => $n,
|
915 |
+
'orderby' => 'rand',
|
916 |
+
'post_status' => 'publish'
|
917 |
+
);
|
918 |
+
|
919 |
$rand_posts = get_posts( $args );
|
920 |
foreach ( $rand_posts as $post ){
|
921 |
if ($post->post_title) {
|
950 |
);
|
951 |
|
952 |
header('Content-Type: application/json; charset=utf-8');
|
953 |
+
header('Cache-Control: max-age=300'); // 5 minutes
|
954 |
echo json_encode($result);
|
955 |
exit;
|
956 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, related posts, google analytics, share buttons, social sharing,
|
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.2
|
7 |
-
Stable tag: 8.13.
|
8 |
|
9 |
|
10 |
Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
|
@@ -54,7 +54,7 @@ The German computer magazine c’t has developed “Shariff” (ʃɛɹɪf) that
|
|
54 |
|
55 |
The "original" share buttons from Facebook, Pinterest and others automatically transmit data of your visitors to the social network sites as soon as they visit your website. They do not need to click on a share button for this to happen and therefore have no choice. Shareaholic enables visitors to see how popular your page is and display share buttons without this needless leakage to the social networks (unless they decide to share, of course). This is done via server-side code that is part of this plugin to fetch share counts. Once fetched, share counts are cached to ensure maximum performance.
|
56 |
|
57 |
-
To take advantage of this privacy feature, enable "
|
58 |
|
59 |
= Share Buttons for Images =
|
60 |
|
@@ -269,6 +269,10 @@ The default Shareaholic thumbnail width is 640px with dynamic height and no crop
|
|
269 |
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.
|
270 |
|
271 |
== Changelog ==
|
|
|
|
|
|
|
|
|
272 |
= 8.13.3 (2019-06-14) =
|
273 |
* Various Admin Panel improvements
|
274 |
|
@@ -279,7 +283,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
279 |
* Bugfix: fixed issue where plugin could not be activated on some webhosts due to an unnecessary code comment
|
280 |
|
281 |
= 8.13.0 (2019-05-24) =
|
282 |
-
* Support for authenticated Facebook Graph API calls from the
|
283 |
|
284 |
= 8.12.6 (2019-05-06) =
|
285 |
* Updated Admin Submenu order
|
@@ -291,7 +295,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
291 |
= 8.12.4 (2019-04-19) =
|
292 |
* Enhancement: Header now consistent and language localized across all menus
|
293 |
* Fix: Facebook changed their [Share Count API](https://www.shareaholic.com/sharecounter/?url=https://www.amazon.com/). So, we adapted.
|
294 |
-
* Fix: Various updates to
|
295 |
|
296 |
= 8.12.3 (2019-04-10) =
|
297 |
* Enhancement: New Admin UI (Beta) is now localized in Dutch (nl), French (fr), German (de), Italian (it), Japanese (jp), Polish (pl), Portugese (pt), Russian (ru) and Spanish (es)
|
@@ -479,7 +483,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
479 |
= 8.1.0 (2017-07-24) =
|
480 |
* New: Introducing the **[Tools Badge](https://support.shareaholic.com/hc/en-us/categories/115001014006-Tools-Badge)**! ([learn more](https://support.shareaholic.com/hc/en-us/categories/115001014006-Tools-Badge)) Introducing a brand new way to launch the Shareaholic Console without ever leaving your website! Contains quick-links to your site analytics, help center, and much more to help you manage your site with greater ease. If you'd rather hide this badge or change its location, you can do so from your settings. It is 100% configurable.
|
481 |
* Bugfix: Resolved the 403 Forbidden error that some admins were getting upon clicking the Dashboard link. Affected only sites on cPanel with mod_security enabled ex. HostGator
|
482 |
-
* Enhancement: Google+ share count is now also available to sites that do not enable
|
483 |
|
484 |
= 8.0.1 (2017-07-10) =
|
485 |
* Version 8 is here bringing with it a brand new revamped and streamlined UI!
|
@@ -516,7 +520,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
516 |
|
517 |
= 7.8.0.4 =
|
518 |
* Bugfix: We fixed the code which displays the Facebook share count to accommodate Facebook's new data structure.
|
519 |
-
* Bugfix: Fixed
|
520 |
|
521 |
= 7.8.0.3 =
|
522 |
* Bugfix: Fix for Cloudflare compatibility
|
@@ -601,7 +605,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
601 |
* Enhancement: Detect permalink changes in order to serve up-to-date content
|
602 |
|
603 |
= 7.6.1.7 =
|
604 |
-
* Bugfix: Fixed issue with
|
605 |
|
606 |
= 7.6.1.6 =
|
607 |
* Enhancement: Removed analytics option from Advanced Settings page
|
@@ -641,12 +645,12 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
641 |
* Enhancement: Improved reliability of Related Content App for cases where the WordPress install is located in a subdirectory or subpath
|
642 |
|
643 |
= 7.6.0.5 =
|
644 |
-
* Enhancement: Modified curl multi to conserve
|
645 |
-
* Enhancement: Added garbage collection cron job to clean up expired
|
646 |
|
647 |
= 7.6.0.4 =
|
648 |
* Bugfix: fixed Share Buttons not generating links for posts in index and category pages
|
649 |
-
* Enhancement: implemented debugging mode for
|
650 |
|
651 |
= 7.6.0.3 =
|
652 |
* Bugfix: fixed Share Buttons not grabbing correct content when placed in the sidebar
|
@@ -681,7 +685,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
681 |
* Updated Simplified Chinese (zh_CN)
|
682 |
|
683 |
= 7.5.0.4 =
|
684 |
-
* Tweak: Cache
|
685 |
* Fix: Fixed miscellaneous v6->v7 conversion bugs
|
686 |
|
687 |
= 7.5.0.3 =
|
@@ -730,11 +734,11 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
730 |
* Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
|
731 |
|
732 |
= 7.4.0.4 =
|
733 |
-
* Bugfix: Removed an unneeded conditional check from the
|
734 |
* Clear W3 Total Cache for clean activation and deactivation
|
735 |
|
736 |
= 7.4.0.3 =
|
737 |
-
* Bugfix: Added url encoding for
|
738 |
|
739 |
= 7.4.0.2 =
|
740 |
* Miscellaneous performance enhancements for Share Counts API
|
@@ -744,7 +748,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
744 |
|
745 |
= 7.4.0.0 =
|
746 |
* Share Buttons App
|
747 |
-
* Share Counts for Google+, Reddit, StumbleUpon, VK, Buffer, etc! This release features an optional and all new
|
748 |
* Major performance upgrade and speed boost! Your pages will load faster for your visitors as share count lookups are now consolidated to one single HTTP request per page load (vs a call for each sharing service). The share counts are also heavily cached on both the client and server for super fast lookups and page performance.
|
749 |
|
750 |
= 7.3.0.1 =
|
@@ -910,7 +914,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
910 |
* Show Related Posts data status
|
911 |
|
912 |
== Upgrade Notice ==
|
913 |
-
= 8.13.
|
914 |
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!
|
915 |
|
916 |
= 8.12.1 =
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.2
|
7 |
+
Stable tag: 8.13.4
|
8 |
|
9 |
|
10 |
Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
|
54 |
|
55 |
The "original" share buttons from Facebook, Pinterest and others automatically transmit data of your visitors to the social network sites as soon as they visit your website. They do not need to click on a share button for this to happen and therefore have no choice. Shareaholic enables visitors to see how popular your page is and display share buttons without this needless leakage to the social networks (unless they decide to share, of course). This is done via server-side code that is part of this plugin to fetch share counts. Once fetched, share counts are cached to ensure maximum performance.
|
56 |
|
57 |
+
To take advantage of this privacy feature, enable "Share Count Proxy" under Advanced Settings.
|
58 |
|
59 |
= Share Buttons for Images =
|
60 |
|
269 |
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.
|
270 |
|
271 |
== Changelog ==
|
272 |
+
= 8.13.4 (2019-06-24) =
|
273 |
+
* New debug options for Share Count Proxy
|
274 |
+
* Caching improvements for Share Count Proxy
|
275 |
+
|
276 |
= 8.13.3 (2019-06-14) =
|
277 |
* Various Admin Panel improvements
|
278 |
|
283 |
* Bugfix: fixed issue where plugin could not be activated on some webhosts due to an unnecessary code comment
|
284 |
|
285 |
= 8.13.0 (2019-05-24) =
|
286 |
+
* Support for authenticated Facebook Graph API calls from the Share Count Proxy. Fixes issue with significantly reduced Share Counts from Facebook in some cases. Please turn on the Share Count API Proxy from the Advanced Settings tab. You will need to save your [Facebook App ID and Secret keys](https://support.shareaholic.com/hc/en-us/articles/360028605231).
|
287 |
|
288 |
= 8.12.6 (2019-05-06) =
|
289 |
* Updated Admin Submenu order
|
295 |
= 8.12.4 (2019-04-19) =
|
296 |
* Enhancement: Header now consistent and language localized across all menus
|
297 |
* Fix: Facebook changed their [Share Count API](https://www.shareaholic.com/sharecounter/?url=https://www.amazon.com/). So, we adapted.
|
298 |
+
* Fix: Various updates to Share Count Proxy service
|
299 |
|
300 |
= 8.12.3 (2019-04-10) =
|
301 |
* Enhancement: New Admin UI (Beta) is now localized in Dutch (nl), French (fr), German (de), Italian (it), Japanese (jp), Polish (pl), Portugese (pt), Russian (ru) and Spanish (es)
|
483 |
= 8.1.0 (2017-07-24) =
|
484 |
* New: Introducing the **[Tools Badge](https://support.shareaholic.com/hc/en-us/categories/115001014006-Tools-Badge)**! ([learn more](https://support.shareaholic.com/hc/en-us/categories/115001014006-Tools-Badge)) Introducing a brand new way to launch the Shareaholic Console without ever leaving your website! Contains quick-links to your site analytics, help center, and much more to help you manage your site with greater ease. If you'd rather hide this badge or change its location, you can do so from your settings. It is 100% configurable.
|
485 |
* Bugfix: Resolved the 403 Forbidden error that some admins were getting upon clicking the Dashboard link. Affected only sites on cPanel with mod_security enabled ex. HostGator
|
486 |
+
* Enhancement: Google+ share count is now also available to sites that do not enable the Share Count Proxy
|
487 |
|
488 |
= 8.0.1 (2017-07-10) =
|
489 |
* Version 8 is here bringing with it a brand new revamped and streamlined UI!
|
520 |
|
521 |
= 7.8.0.4 =
|
522 |
* Bugfix: We fixed the code which displays the Facebook share count to accommodate Facebook's new data structure.
|
523 |
+
* Bugfix: Fixed Share Count Proxy counts for Odnoklassniki
|
524 |
|
525 |
= 7.8.0.3 =
|
526 |
* Bugfix: Fix for Cloudflare compatibility
|
605 |
* Enhancement: Detect permalink changes in order to serve up-to-date content
|
606 |
|
607 |
= 7.6.1.7 =
|
608 |
+
* Bugfix: Fixed issue with Share Count Proxy option
|
609 |
|
610 |
= 7.6.1.6 =
|
611 |
* Enhancement: Removed analytics option from Advanced Settings page
|
645 |
* Enhancement: Improved reliability of Related Content App for cases where the WordPress install is located in a subdirectory or subpath
|
646 |
|
647 |
= 7.6.0.5 =
|
648 |
+
* Enhancement: Modified curl multi to conserve cpu usage for Share Count Proxy
|
649 |
+
* Enhancement: Added garbage collection cron job to clean up expired Share Count Proxy transient cache
|
650 |
|
651 |
= 7.6.0.4 =
|
652 |
* Bugfix: fixed Share Buttons not generating links for posts in index and category pages
|
653 |
+
* Enhancement: implemented debugging mode for Share Count Proxy
|
654 |
|
655 |
= 7.6.0.3 =
|
656 |
* Bugfix: fixed Share Buttons not grabbing correct content when placed in the sidebar
|
685 |
* Updated Simplified Chinese (zh_CN)
|
686 |
|
687 |
= 7.5.0.4 =
|
688 |
+
* Tweak: Cache Share Count Proxy counts for longer duration (5 minutes)
|
689 |
* Fix: Fixed miscellaneous v6->v7 conversion bugs
|
690 |
|
691 |
= 7.5.0.3 =
|
734 |
* Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
|
735 |
|
736 |
= 7.4.0.4 =
|
737 |
+
* Bugfix: Removed an unneeded conditional check from the Share Count Proxy to make it more reliable
|
738 |
* Clear W3 Total Cache for clean activation and deactivation
|
739 |
|
740 |
= 7.4.0.3 =
|
741 |
+
* Bugfix: Added url encoding for Share Count Proxy
|
742 |
|
743 |
= 7.4.0.2 =
|
744 |
* Miscellaneous performance enhancements for Share Counts API
|
748 |
|
749 |
= 7.4.0.0 =
|
750 |
* Share Buttons App
|
751 |
+
* Share Counts for Google+, Reddit, StumbleUpon, VK, Buffer, etc! This release features an optional and all new Share Count Proxy. Toggle this option under the "Advanced Settings" section.
|
752 |
* Major performance upgrade and speed boost! Your pages will load faster for your visitors as share count lookups are now consolidated to one single HTTP request per page load (vs a call for each sharing service). The share counts are also heavily cached on both the client and server for super fast lookups and page performance.
|
753 |
|
754 |
= 7.3.0.1 =
|
914 |
* Show Related Posts data status
|
915 |
|
916 |
== Upgrade Notice ==
|
917 |
+
= 8.13.4 =
|
918 |
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!
|
919 |
|
920 |
= 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.
|
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.
|
18 |
*/
|
19 |
|
20 |
/**
|
@@ -35,7 +35,7 @@ if(!defined('SHAREAHOLIC_DIR')) define('SHAREAHOLIC_DIR', dirname(__FILE__));
|
|
35 |
if(!defined('SHAREAHOLIC_ASSET_DIR')) define('SHAREAHOLIC_ASSET_DIR', plugins_url( '/assets/' , __FILE__ ));
|
36 |
|
37 |
// Caching
|
38 |
-
if(!defined('SHARE_COUNTS_CHECK_CACHE_LENGTH')) define( 'SHARE_COUNTS_CHECK_CACHE_LENGTH',
|
39 |
|
40 |
// because define can use function returns and const can't
|
41 |
if(!defined('SHAREAHOLIC_DEBUG')) define('SHAREAHOLIC_DEBUG', getenv('SHAREAHOLIC_DEBUG'));
|
@@ -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.
|
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.4
|
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.4
|
18 |
*/
|
19 |
|
20 |
/**
|
35 |
if(!defined('SHAREAHOLIC_ASSET_DIR')) define('SHAREAHOLIC_ASSET_DIR', plugins_url( '/assets/' , __FILE__ ));
|
36 |
|
37 |
// Caching
|
38 |
+
if(!defined('SHARE_COUNTS_CHECK_CACHE_LENGTH')) define( 'SHARE_COUNTS_CHECK_CACHE_LENGTH', 900 ); // 900 seconds
|
39 |
|
40 |
// because define can use function returns and const can't
|
41 |
if(!defined('SHAREAHOLIC_DEBUG')) define('SHAREAHOLIC_DEBUG', getenv('SHAREAHOLIC_DEBUG'));
|
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.4';
|
63 |
|
64 |
/**
|
65 |
* Starts off as false so that ::get_instance() returns
|
templates/{admin_beta.php → admin.php}
RENAMED
File without changes
|
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
|
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 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') { ?>
|
templates/settings.php
CHANGED
@@ -167,4 +167,6 @@ window.ShareaholicConfig = {
|
|
167 |
</div>
|
168 |
</div>
|
169 |
<?php ShareaholicAdmin::show_footer(); ?>
|
170 |
-
<?php ShareaholicAdmin::include_chat(); ?>
|
|
|
|
167 |
</div>
|
168 |
</div>
|
169 |
<?php ShareaholicAdmin::show_footer(); ?>
|
170 |
+
<?php ShareaholicAdmin::include_chat(); ?>
|
171 |
+
|
172 |
+
<script src="https://dsms0mj1bbhn4.cloudfront.net/assets/pub/loader-reachable.js" async></script>
|