Version Description
- Enhancement: Modified curl multi to conserve on cpu usage for server side share counts
- Enhancement: Added garbage collection cron job to clean up expired server side share count transient cache
Download this release
Release Info
Developer | shareaholic |
Plugin | WordPress Social Tools, Related Posts, Monetization – Shareaholic |
Version | 7.6.0.5 |
Comparing to | |
See all releases |
Code changes from version 7.6.0.4 to 7.6.0.5
- cron.php +74 -0
- lib/social-share-counts/curl_multi_share_count.php +16 -3
- lib/social-share-counts/share_count.php +5 -5
- public.php +63 -6
- readme.txt +10 -2
- shareaholic.php +14 -3
- utilities.php +2 -2
cron.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Holds the ShareaholicCron class.
|
4 |
+
*
|
5 |
+
* @package shareaholic
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* This class will contain all the cron jobs executed by this plugin
|
10 |
+
*
|
11 |
+
* @package shareaholic
|
12 |
+
*/
|
13 |
+
class ShareaholicCron {
|
14 |
+
|
15 |
+
const TRANSIENT_SCHEDULE = 'hourly';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Schedules the cron jobs if it does not exist
|
19 |
+
*/
|
20 |
+
public static function activate() {
|
21 |
+
if (!wp_next_scheduled('shareaholic_remove_transients_hourly')) {
|
22 |
+
// schedule the first occurrence 1 min from now
|
23 |
+
wp_schedule_event(
|
24 |
+
time() + 60, self::TRANSIENT_SCHEDULE, 'shareaholic_remove_transients_hourly'
|
25 |
+
);
|
26 |
+
ShareaholicUtilities::log('Shareaholic is now scheduled');
|
27 |
+
} else {
|
28 |
+
ShareaholicUtilities::log('Shareaholic is already scheduled');
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Remove scheduled cron jobs created by Shareaholic
|
34 |
+
*/
|
35 |
+
public static function deactivate() {
|
36 |
+
if (wp_next_scheduled('shareaholic_remove_transients_hourly')) {
|
37 |
+
wp_clear_scheduled_hook('shareaholic_remove_transients_hourly');
|
38 |
+
ShareaholicUtilities::log('Shareaholic schedule cleared');
|
39 |
+
} else {
|
40 |
+
ShareaholicUtilities::log('no need to clear nonexistent Shareaholic schedule');
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* A job that clears up the shareaholic share counts transients
|
46 |
+
*/
|
47 |
+
public static function remove_transients() {
|
48 |
+
global $wpdb;
|
49 |
+
$older_than = time() - (60 * 60); // older than an hour ago
|
50 |
+
|
51 |
+
ShareaholicUtilities::log('Start of Shareaholic transient cleanup');
|
52 |
+
|
53 |
+
$query = "SELECT REPLACE(option_name, '_transient_timeout_', '') AS transient_name FROM {$wpdb->options} WHERE option_name LIKE '\_transient\_timeout\_shr\_api\_res-%%' AND option_value < %s LIMIT 5000";
|
54 |
+
$transients = $wpdb->get_col($wpdb->prepare($query, $older_than));
|
55 |
+
|
56 |
+
$options_names = array();
|
57 |
+
foreach($transients as $transient) {
|
58 |
+
$options_names[] = esc_sql('_transient_' . $transient);
|
59 |
+
$options_names[] = esc_sql('_transient_timeout_' . $transient);
|
60 |
+
}
|
61 |
+
if ($options_names) {
|
62 |
+
$options_names = "'" . implode("','", $options_names) . "'";
|
63 |
+
$result = $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name IN ({$options_names})");
|
64 |
+
|
65 |
+
if (!$result) {
|
66 |
+
ShareaholicUtilities::log('Transient Query Error!!!');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
ShareaholicUtilities::log('End of Shareaholic transient cleanup');
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
}
|
lib/social-share-counts/curl_multi_share_count.php
CHANGED
@@ -65,11 +65,24 @@ class ShareaholicCurlMultiShareCount extends ShareaholicShareCount {
|
|
65 |
|
66 |
// Run curl_multi only if there are some actual curl handles
|
67 |
if(count($curl_handles) > 0) {
|
68 |
-
// execute
|
69 |
$running = NULL;
|
70 |
do {
|
71 |
-
curl_multi_exec($multi_handle, $running);
|
72 |
-
} while($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
// handle the responses
|
75 |
foreach($curl_handles as $service => $handle) {
|
65 |
|
66 |
// Run curl_multi only if there are some actual curl handles
|
67 |
if(count($curl_handles) > 0) {
|
68 |
+
// While we're still active, execute curl
|
69 |
$running = NULL;
|
70 |
do {
|
71 |
+
$mrc = curl_multi_exec($multi_handle, $running);
|
72 |
+
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
|
73 |
+
|
74 |
+
while ($running && $mrc == CURLM_OK) {
|
75 |
+
// Wait for activity on any curl-connection
|
76 |
+
if (curl_multi_select($multi_handle) == -1) {
|
77 |
+
usleep(1);
|
78 |
+
}
|
79 |
+
|
80 |
+
// Continue to exec until curl is ready to
|
81 |
+
// give us more data
|
82 |
+
do {
|
83 |
+
$mrc = curl_multi_exec($multi_handle, $running);
|
84 |
+
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
|
85 |
+
}
|
86 |
|
87 |
// handle the responses
|
88 |
foreach($curl_handles as $service => $handle) {
|
lib/social-share-counts/share_count.php
CHANGED
@@ -40,13 +40,13 @@ abstract class ShareaholicShareCount {
|
|
40 |
'callback' => 'facebook_count_callback',
|
41 |
),
|
42 |
'twitter' => array(
|
43 |
-
'url' => '
|
44 |
'method' => 'GET',
|
45 |
'timeout' => 3,
|
46 |
'callback' => 'twitter_count_callback',
|
47 |
),
|
48 |
'linkedin' => array(
|
49 |
-
'url' => '
|
50 |
'method' => 'GET',
|
51 |
'timeout' => 3,
|
52 |
'callback' => 'linkedin_count_callback',
|
@@ -67,7 +67,7 @@ abstract class ShareaholicShareCount {
|
|
67 |
'callback' => 'delicious_count_callback',
|
68 |
),
|
69 |
'pinterest' => array(
|
70 |
-
'url' => '
|
71 |
'method' => 'GET',
|
72 |
'timeout' => 3,
|
73 |
'callback' => 'pinterest_count_callback',
|
@@ -79,13 +79,13 @@ abstract class ShareaholicShareCount {
|
|
79 |
'callback' => 'buffer_count_callback',
|
80 |
),
|
81 |
'stumbleupon' => array(
|
82 |
-
'url' => '
|
83 |
'method' => 'GET',
|
84 |
'timeout' => 1,
|
85 |
'callback' => 'stumbleupon_count_callback',
|
86 |
),
|
87 |
'reddit' => array(
|
88 |
-
'url' => '
|
89 |
'method' => 'GET',
|
90 |
'timeout' => 1,
|
91 |
'callback' => 'reddit_count_callback',
|
40 |
'callback' => 'facebook_count_callback',
|
41 |
),
|
42 |
'twitter' => array(
|
43 |
+
'url' => 'https://cdn.api.twitter.com/1/urls/count.json?url=%s',
|
44 |
'method' => 'GET',
|
45 |
'timeout' => 3,
|
46 |
'callback' => 'twitter_count_callback',
|
47 |
),
|
48 |
'linkedin' => array(
|
49 |
+
'url' => 'https://www.linkedin.com/countserv/count/share?format=json&url=%s',
|
50 |
'method' => 'GET',
|
51 |
'timeout' => 3,
|
52 |
'callback' => 'linkedin_count_callback',
|
67 |
'callback' => 'delicious_count_callback',
|
68 |
),
|
69 |
'pinterest' => array(
|
70 |
+
'url' => 'https://api.pinterest.com/v1/urls/count.json?url=%s&callback=f',
|
71 |
'method' => 'GET',
|
72 |
'timeout' => 3,
|
73 |
'callback' => 'pinterest_count_callback',
|
79 |
'callback' => 'buffer_count_callback',
|
80 |
),
|
81 |
'stumbleupon' => array(
|
82 |
+
'url' => 'https://www.stumbleupon.com/services/1.01/badge.getinfo?url=%s',
|
83 |
'method' => 'GET',
|
84 |
'timeout' => 1,
|
85 |
'callback' => 'stumbleupon_count_callback',
|
86 |
),
|
87 |
'reddit' => array(
|
88 |
+
'url' => 'https://buttons.reddit.com/button_info.json?url=%s',
|
89 |
'method' => 'GET',
|
90 |
'timeout' => 1,
|
91 |
'callback' => 'reddit_count_callback',
|
public.php
CHANGED
@@ -367,7 +367,9 @@ class ShareaholicPublic {
|
|
367 |
global $post, $wp_query;
|
368 |
$page_type = ShareaholicUtilities::page_type();
|
369 |
$is_list_page = $page_type == 'index' || $page_type == 'category';
|
370 |
-
$
|
|
|
|
|
371 |
|
372 |
$link = trim($link);
|
373 |
|
@@ -402,13 +404,24 @@ class ShareaholicPublic {
|
|
402 |
*/
|
403 |
public static function share_counts_api() {
|
404 |
$debug_mode = isset($_GET['debug']) && $_GET['debug'] === '1';
|
405 |
-
$
|
406 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
$has_curl_multi = self::has_curl();
|
408 |
|
409 |
-
if (!$result || $debug_mode) {
|
410 |
-
|
411 |
-
|
|
|
|
|
412 |
$result = array();
|
413 |
$options = array();
|
414 |
|
@@ -437,6 +450,7 @@ class ShareaholicPublic {
|
|
437 |
}
|
438 |
|
439 |
if (isset($result['data']) && !$debug_mode) {
|
|
|
440 |
set_transient( $cache_key, $result, SHARE_COUNTS_CHECK_CACHE_LENGTH );
|
441 |
}
|
442 |
}
|
@@ -448,6 +462,49 @@ class ShareaholicPublic {
|
|
448 |
exit;
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
/**
|
452 |
* Function to return relevant plugin debug info
|
453 |
*
|
367 |
global $post, $wp_query;
|
368 |
$page_type = ShareaholicUtilities::page_type();
|
369 |
$is_list_page = $page_type == 'index' || $page_type == 'category';
|
370 |
+
$loop_start = did_action('loop_start');
|
371 |
+
$loop_end = did_action('loop_end');
|
372 |
+
$in_loop = $loop_start > $loop_end ? TRUE : FALSE;
|
373 |
|
374 |
$link = trim($link);
|
375 |
|
404 |
*/
|
405 |
public static function share_counts_api() {
|
406 |
$debug_mode = isset($_GET['debug']) && $_GET['debug'] === '1';
|
407 |
+
$url = isset($_GET['url']) ? $_GET['url'] : '';
|
408 |
+
$services = isset($_GET['services']) ? $_GET['services'] : array();
|
409 |
+
$services = self::parse_services($services);
|
410 |
+
$cache_key = 'shr_api_res-' . md5( $url );
|
411 |
+
|
412 |
+
if (empty($url) || empty($services)) {
|
413 |
+
$result = array();
|
414 |
+
} else {
|
415 |
+
$result = get_transient($cache_key);
|
416 |
+
}
|
417 |
+
|
418 |
$has_curl_multi = self::has_curl();
|
419 |
|
420 |
+
if (!$result || $debug_mode || !self::has_services_in_result($result, $services)) {
|
421 |
+
if (isset($result['services']) && !$debug_mode) {
|
422 |
+
$services = array_keys(array_flip(array_merge($result['services'], $services)));
|
423 |
+
}
|
424 |
+
|
425 |
$result = array();
|
426 |
$options = array();
|
427 |
|
450 |
}
|
451 |
|
452 |
if (isset($result['data']) && !$debug_mode) {
|
453 |
+
$result['services'] = $services;
|
454 |
set_transient( $cache_key, $result, SHARE_COUNTS_CHECK_CACHE_LENGTH );
|
455 |
}
|
456 |
}
|
462 |
exit;
|
463 |
}
|
464 |
|
465 |
+
/**
|
466 |
+
* Helper method to parse the list of social services to get share counts
|
467 |
+
*/
|
468 |
+
public static function parse_services($services) {
|
469 |
+
$result = array();
|
470 |
+
|
471 |
+
if (empty($services) || !is_array($services)) {
|
472 |
+
return $result;
|
473 |
+
}
|
474 |
+
|
475 |
+
// make the set of services unique
|
476 |
+
$services = array_unique($services);
|
477 |
+
|
478 |
+
// only get the services we can get share counts for
|
479 |
+
$social_services = array_keys(ShareaholicSeqShareCount::get_services_config());
|
480 |
+
|
481 |
+
foreach($services as $service) {
|
482 |
+
if (in_array($service, $social_services)) {
|
483 |
+
array_push($result, $service);
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
return $result;
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Helper method to check if the result has the requested services
|
492 |
+
*/
|
493 |
+
public static function has_services_in_result($result, $services) {
|
494 |
+
if (!isset($result['services'])) {
|
495 |
+
return false;
|
496 |
+
}
|
497 |
+
|
498 |
+
$requested_services = $result['services'];
|
499 |
+
foreach($services as $service) {
|
500 |
+
if (!in_array($service, $requested_services)) {
|
501 |
+
return false;
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
return true;
|
506 |
+
}
|
507 |
+
|
508 |
/**
|
509 |
* Function to return relevant plugin debug info
|
510 |
*
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: shareaholic
|
3 |
Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, houzz, yummly, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, wanelo, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, sumome, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 4.0
|
6 |
-
Stable tag: 7.6.0.
|
7 |
|
8 |
The easiest, most effective way to grow your website traffic, effectively engage your audience, monetize, and gain insights for free.
|
9 |
|
@@ -175,6 +175,10 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
|
|
175 |
|
176 |
== Changelog ==
|
177 |
|
|
|
|
|
|
|
|
|
178 |
= 7.6.0.4 =
|
179 |
* Bugfix: fixed Share Buttons not generating links for posts in index and category pages
|
180 |
* Enhancement: implemented debugging mode for server side share counts
|
@@ -1174,6 +1178,10 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
|
|
1174 |
|
1175 |
== Upgrade Notice ==
|
1176 |
|
|
|
|
|
|
|
|
|
1177 |
= 7.6.0.4 =
|
1178 |
|
1179 |
Bug fixes
|
2 |
Contributors: shareaholic
|
3 |
Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, houzz, yummly, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, wanelo, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, sumome, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 4.0.1
|
6 |
+
Stable tag: 7.6.0.5
|
7 |
|
8 |
The easiest, most effective way to grow your website traffic, effectively engage your audience, monetize, and gain insights for free.
|
9 |
|
175 |
|
176 |
== Changelog ==
|
177 |
|
178 |
+
= 7.6.0.5 =
|
179 |
+
* Enhancement: Modified curl multi to conserve on cpu usage for server side share counts
|
180 |
+
* Enhancement: Added garbage collection cron job to clean up expired server side share count transient cache
|
181 |
+
|
182 |
= 7.6.0.4 =
|
183 |
* Bugfix: fixed Share Buttons not generating links for posts in index and category pages
|
184 |
* Enhancement: implemented debugging mode for server side share counts
|
1178 |
|
1179 |
== Upgrade Notice ==
|
1180 |
|
1181 |
+
= 7.6.0.5 =
|
1182 |
+
|
1183 |
+
Modified curl multi to conserve on cpu usage for server side share counts and added garbage collection cron job to clean up expired server side share count transient cache. This is an important update for larger WordPress installations.
|
1184 |
+
|
1185 |
= 7.6.0.4 =
|
1186 |
|
1187 |
Bug fixes
|
shareaholic.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* The main file!
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
-
* @version 7.6.0.
|
7 |
*/
|
8 |
|
9 |
/*
|
10 |
Plugin Name: Shareaholic | share buttons, analytics, related content
|
11 |
Plugin URI: https://shareaholic.com/publishers/
|
12 |
Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
|
13 |
-
Version: 7.6.0.
|
14 |
Author: Shareaholic
|
15 |
Author URI: https://shareaholic.com
|
16 |
Text Domain: shareaholic
|
@@ -50,6 +50,7 @@ require_once(SHAREAHOLIC_DIR . '/admin.php');
|
|
50 |
require_once(SHAREAHOLIC_DIR . '/public.php');
|
51 |
require_once(SHAREAHOLIC_DIR . '/notifier.php');
|
52 |
require_once(SHAREAHOLIC_DIR . '/deprecation.php');
|
|
|
53 |
|
54 |
if (!class_exists('Shareaholic')) {
|
55 |
/**
|
@@ -63,7 +64,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 = '7.6.0.
|
67 |
|
68 |
/**
|
69 |
* Starts off as false so that ::get_instance() returns
|
@@ -128,6 +129,9 @@ if (!class_exists('Shareaholic')) {
|
|
128 |
|
129 |
add_action('wp_before_admin_bar_render', array('ShareaholicUtilities', 'admin_bar_extended'));
|
130 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
/**
|
@@ -189,6 +193,9 @@ if (!class_exists('Shareaholic')) {
|
|
189 |
if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
|
190 |
ShareaholicUtilities::share_counts_api_connectivity_check();
|
191 |
}
|
|
|
|
|
|
|
192 |
}
|
193 |
}
|
194 |
}
|
@@ -223,6 +230,9 @@ if (!class_exists('Shareaholic')) {
|
|
223 |
if (!ShareaholicUtilities::get_version()) {
|
224 |
ShareaholicUtilities::log_event("Install_Fresh");
|
225 |
}
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
/**
|
@@ -231,6 +241,7 @@ if (!class_exists('Shareaholic')) {
|
|
231 |
public function deactivate() {
|
232 |
ShareaholicUtilities::log_event("Deactivate");
|
233 |
ShareaholicUtilities::clear_cache();
|
|
|
234 |
}
|
235 |
|
236 |
/**
|
3 |
* The main file!
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
+
* @version 7.6.0.5
|
7 |
*/
|
8 |
|
9 |
/*
|
10 |
Plugin Name: Shareaholic | share buttons, analytics, related content
|
11 |
Plugin URI: https://shareaholic.com/publishers/
|
12 |
Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
|
13 |
+
Version: 7.6.0.5
|
14 |
Author: Shareaholic
|
15 |
Author URI: https://shareaholic.com
|
16 |
Text Domain: shareaholic
|
50 |
require_once(SHAREAHOLIC_DIR . '/public.php');
|
51 |
require_once(SHAREAHOLIC_DIR . '/notifier.php');
|
52 |
require_once(SHAREAHOLIC_DIR . '/deprecation.php');
|
53 |
+
require_once(SHAREAHOLIC_DIR . '/cron.php');
|
54 |
|
55 |
if (!class_exists('Shareaholic')) {
|
56 |
/**
|
64 |
const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
|
65 |
const REC_API_URL = 'http://recommendations.shareaholic.com';
|
66 |
|
67 |
+
const VERSION = '7.6.0.5';
|
68 |
|
69 |
/**
|
70 |
* Starts off as false so that ::get_instance() returns
|
129 |
|
130 |
add_action('wp_before_admin_bar_render', array('ShareaholicUtilities', 'admin_bar_extended'));
|
131 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
|
132 |
+
|
133 |
+
// Add custom action to run Shareaholic cron job
|
134 |
+
add_action('shareaholic_remove_transients_hourly', array('ShareaholicCron', 'remove_transients'));
|
135 |
}
|
136 |
|
137 |
/**
|
193 |
if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
|
194 |
ShareaholicUtilities::share_counts_api_connectivity_check();
|
195 |
}
|
196 |
+
|
197 |
+
// Activate the Shareaholic Cron job for existing plugin users
|
198 |
+
ShareaholicCron::activate();
|
199 |
}
|
200 |
}
|
201 |
}
|
230 |
if (!ShareaholicUtilities::get_version()) {
|
231 |
ShareaholicUtilities::log_event("Install_Fresh");
|
232 |
}
|
233 |
+
|
234 |
+
// Activate the Shareaholic Cron Job for new users
|
235 |
+
ShareaholicCron::activate();
|
236 |
}
|
237 |
|
238 |
/**
|
241 |
public function deactivate() {
|
242 |
ShareaholicUtilities::log_event("Deactivate");
|
243 |
ShareaholicUtilities::clear_cache();
|
244 |
+
ShareaholicCron::deactivate();
|
245 |
}
|
246 |
|
247 |
/**
|
utilities.php
CHANGED
@@ -1248,8 +1248,8 @@ class ShareaholicUtilities {
|
|
1248 |
// Did it return at least 8 services?
|
1249 |
$has_majority_services = count(array_keys($response['body']['data'])) >= 8 ? true : false;
|
1250 |
$has_important_services = true;
|
1251 |
-
// Does it have counts for twtr,
|
1252 |
-
foreach (array('twitter', '
|
1253 |
if (!isset($response['body']['data'][$service]) || !is_numeric($response['body']['data'][$service])) {
|
1254 |
$has_important_services = false;
|
1255 |
}
|
1248 |
// Did it return at least 8 services?
|
1249 |
$has_majority_services = count(array_keys($response['body']['data'])) >= 8 ? true : false;
|
1250 |
$has_important_services = true;
|
1251 |
+
// Does it have counts for twtr, linkedin, pinterest, and delicious?
|
1252 |
+
foreach (array('twitter', 'linkedin', 'pinterest', 'delicious') as $service) {
|
1253 |
if (!isset($response['body']['data'][$service]) || !is_numeric($response['body']['data'][$service])) {
|
1254 |
$has_important_services = false;
|
1255 |
}
|