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.5 |
Comparing to | |
See all releases |
Code changes from version 8.13.4 to 8.13.5
- admin.php +36 -8
- assets/css/main.css +13 -0
- curl.php +6 -6
- public.php +0 -1
- public_js.php +5 -0
- readme.txt +25 -3
- shareaholic.php +5 -3
- templates/terms_of_service_notice.php +2 -2
- utilities.php +37 -44
admin.php
CHANGED
@@ -26,11 +26,13 @@ class ShareaholicAdmin {
|
|
26 |
// workaround: http://codex.wordpress.org/Function_Reference/register_activation_hook
|
27 |
if (is_admin() && get_option( 'Activated_Plugin_Shareaholic') == 'shareaholic') {
|
28 |
delete_option('Activated_Plugin_Shareaholic');
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
}
|
|
|
34 |
self::check_redirect_url();
|
35 |
self::check_review_dismissal();
|
36 |
self::check_plugin_review();
|
@@ -85,7 +87,7 @@ class ShareaholicAdmin {
|
|
85 |
$activation_timestamp = time();
|
86 |
add_site_option(self::ACTIVATE_TIMESTAMP_OPTION, $activation_timestamp);
|
87 |
}
|
88 |
-
|
89 |
// display review message after a certain period of time after activation
|
90 |
if ((time() - $activation_timestamp > self::REVIEW_FIRST_PERIOD) && $show_review_notice == true) {
|
91 |
add_action('admin_notices', array('ShareaholicAdmin', 'display_review_notice'));
|
@@ -108,7 +110,7 @@ class ShareaholicAdmin {
|
|
108 |
$dismiss_forlater_url = wp_nonce_url($dismiss_forlater, 'review-nonce');
|
109 |
|
110 |
echo '
|
111 |
-
<div class="notice notice-info" style="background-size: contain; background-position: right bottom; background-repeat: no-repeat; background-image: url(' . plugins_url('assets/img/happy-people-cover.png', __FILE__) . ');">
|
112 |
<p style="background: rgba(255, 255, 255, 0.85); text-shadow: white 0px 0px 10px;">' . __('Hey there! We noticed that you have had some success using ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic</a>' . __(' — awesome! Could you please do us a BIG favor and give us a quick 5-star rating on WordPress? Just to help us spread the word and boost our motivation. We would really appreciate it 🙂 ~ Your friends @ Shareaholic', 'shareaholic') . '
|
113 |
<br />
|
114 |
<br />
|
@@ -119,6 +121,28 @@ class ShareaholicAdmin {
|
|
119 |
</div>';
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
* Redirect to Plans
|
124 |
*
|
@@ -156,8 +180,12 @@ JQUERY;
|
|
156 |
}
|
157 |
|
158 |
// Get User Email
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
161 |
|
162 |
// Pass verification_key only if current wp user has permission to the key
|
163 |
if (current_user_can('activate_plugins')) {
|
26 |
// workaround: http://codex.wordpress.org/Function_Reference/register_activation_hook
|
27 |
if (is_admin() && get_option( 'Activated_Plugin_Shareaholic') == 'shareaholic') {
|
28 |
delete_option('Activated_Plugin_Shareaholic');
|
29 |
+
/* do stuff once right after activation */
|
30 |
+
if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
|
31 |
+
ShareaholicUtilities::share_counts_api_connectivity_check();
|
32 |
+
}
|
33 |
+
self::activation_redirect();
|
34 |
}
|
35 |
+
|
36 |
self::check_redirect_url();
|
37 |
self::check_review_dismissal();
|
38 |
self::check_plugin_review();
|
87 |
$activation_timestamp = time();
|
88 |
add_site_option(self::ACTIVATE_TIMESTAMP_OPTION, $activation_timestamp);
|
89 |
}
|
90 |
+
|
91 |
// display review message after a certain period of time after activation
|
92 |
if ((time() - $activation_timestamp > self::REVIEW_FIRST_PERIOD) && $show_review_notice == true) {
|
93 |
add_action('admin_notices', array('ShareaholicAdmin', 'display_review_notice'));
|
110 |
$dismiss_forlater_url = wp_nonce_url($dismiss_forlater, 'review-nonce');
|
111 |
|
112 |
echo '
|
113 |
+
<div class="notice notice-info shareaholic-notice" style="background-size: contain; background-position: right bottom; background-repeat: no-repeat; background-image: url(' . plugins_url('assets/img/happy-people-cover.png', __FILE__) . ');">
|
114 |
<p style="background: rgba(255, 255, 255, 0.85); text-shadow: white 0px 0px 10px;">' . __('Hey there! We noticed that you have had some success using ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic</a>' . __(' — awesome! Could you please do us a BIG favor and give us a quick 5-star rating on WordPress? Just to help us spread the word and boost our motivation. We would really appreciate it 🙂 ~ Your friends @ Shareaholic', 'shareaholic') . '
|
115 |
<br />
|
116 |
<br />
|
121 |
</div>';
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* Sends user to the Settings page on activation of Shareaholic plugin
|
126 |
+
*
|
127 |
+
*/
|
128 |
+
|
129 |
+
public static function activation_redirect() {
|
130 |
+
// Bail if no activation redirect transientad
|
131 |
+
if (!get_transient('_shr_activation_redirect')){
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
|
135 |
+
delete_transient('_shr_activation_redirect');
|
136 |
+
|
137 |
+
// Bail if activating from multisite, network, or bulk
|
138 |
+
if( is_multisite() || is_network_admin() || isset($_GET['activate-multi']) ){
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
wp_safe_redirect( add_query_arg( array( 'page' => 'shareaholic-settings' ), admin_url( 'admin.php' ) ) );
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
/**
|
147 |
* Redirect to Plans
|
148 |
*
|
180 |
}
|
181 |
|
182 |
// Get User Email
|
183 |
+
if (function_exists('wp_get_current_user')) {
|
184 |
+
$current_user = wp_get_current_user();
|
185 |
+
$user_email = urlencode($current_user->user_email);
|
186 |
+
} else {
|
187 |
+
$user_email = '';
|
188 |
+
}
|
189 |
|
190 |
// Pass verification_key only if current wp user has permission to the key
|
191 |
if (current_user_can('activate_plugins')) {
|
assets/css/main.css
CHANGED
@@ -17,6 +17,19 @@ body {
|
|
17 |
display: none !important;
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
.btn-warning {
|
21 |
color: #fff !important;
|
22 |
}
|
17 |
display: none !important;
|
18 |
}
|
19 |
|
20 |
+
/*** Hides notice pollution from other plugins ***/
|
21 |
+
.notice {
|
22 |
+
display: none !important;
|
23 |
+
}
|
24 |
+
.error {
|
25 |
+
display: none !important;
|
26 |
+
}
|
27 |
+
/* ensure Shareaholic notices show */
|
28 |
+
.notice.notice-info.shareaholic-notice {
|
29 |
+
display: block !important;
|
30 |
+
}
|
31 |
+
/*** Hides notice pollution ***/
|
32 |
+
|
33 |
.btn-warning {
|
34 |
color: #fff !important;
|
35 |
}
|
curl.php
CHANGED
@@ -25,8 +25,8 @@ class ShareaholicCurl {
|
|
25 |
*
|
26 |
* @return array the returned data json decoded
|
27 |
*/
|
28 |
-
public static function post($url, $data = array(), $data_type = '', $ignore_error = false) {
|
29 |
-
return self::send_request_with_wp($url, $data, $data_type, $ignore_error, 'POST');
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -40,8 +40,8 @@ class ShareaholicCurl {
|
|
40 |
*
|
41 |
* @return array the returned data json decoded
|
42 |
*/
|
43 |
-
public static function get($url, $data = array(), $data_type = '', $ignore_error = false) {
|
44 |
-
return self::send_request_with_wp($url, $data, $data_type, $ignore_error, 'GET');
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -54,16 +54,16 @@ class ShareaholicCurl {
|
|
54 |
* @param string $data_type either an empty string or 'json'
|
55 |
* @param bool $ignore_error whether to log a networking error
|
56 |
* @param string $method the HTTP verb to be used
|
|
|
57 |
*
|
58 |
* @return mixed the returned data json decoded or false
|
59 |
*/
|
60 |
-
private static function send_request_with_wp($url, $data, $data_type, $ignore_error, $method) {
|
61 |
ShareaholicUtilities::log($url);
|
62 |
ShareaholicUtilities::log($data);
|
63 |
ShareaholicUtilities::log($data_type);
|
64 |
ShareaholicUtilities::log($method);
|
65 |
ShareaholicUtilities::log('-----------------');
|
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();
|
25 |
*
|
26 |
* @return array the returned data json decoded
|
27 |
*/
|
28 |
+
public static function post($url, $data = array(), $data_type = '', $ignore_error = false, $timeout = 10) {
|
29 |
+
return self::send_request_with_wp($url, $data, $data_type, $ignore_error, 'POST', $timeout);
|
30 |
}
|
31 |
|
32 |
/**
|
40 |
*
|
41 |
* @return array the returned data json decoded
|
42 |
*/
|
43 |
+
public static function get($url, $data = array(), $data_type = '', $ignore_error = false, $timeout = 10) {
|
44 |
+
return self::send_request_with_wp($url, $data, $data_type, $ignore_error, 'GET', $timeout);
|
45 |
}
|
46 |
|
47 |
/**
|
54 |
* @param string $data_type either an empty string or 'json'
|
55 |
* @param bool $ignore_error whether to log a networking error
|
56 |
* @param string $method the HTTP verb to be used
|
57 |
+
* @param int $timeout timeout in seconds
|
58 |
*
|
59 |
* @return mixed the returned data json decoded or false
|
60 |
*/
|
61 |
+
private static function send_request_with_wp($url, $data, $data_type, $ignore_error, $method, $timeout = 10) {
|
62 |
ShareaholicUtilities::log($url);
|
63 |
ShareaholicUtilities::log($data);
|
64 |
ShareaholicUtilities::log($data_type);
|
65 |
ShareaholicUtilities::log($method);
|
66 |
ShareaholicUtilities::log('-----------------');
|
|
|
67 |
$useragent = 'WordPress/' . get_bloginfo('version') . ' ('. 'PHP/' . phpversion() . '; ' . 'SHR_WP/' . Shareaholic::VERSION . '; +' . get_bloginfo( 'url' ) . ')';
|
68 |
if ($method == 'GET') {
|
69 |
$request = array();
|
public.php
CHANGED
@@ -622,7 +622,6 @@ class ShareaholicPublic {
|
|
622 |
'stats' => array (
|
623 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
624 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
625 |
-
'comments_total' => wp_count_comments()->approved,
|
626 |
'users_total' => $wpdb->get_var("SELECT count(ID) FROM $wpdb->users"),
|
627 |
),
|
628 |
'diagnostics' => array (
|
622 |
'stats' => array (
|
623 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
624 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
|
|
625 |
'users_total' => $wpdb->get_var("SELECT count(ID) FROM $wpdb->users"),
|
626 |
),
|
627 |
'diagnostics' => array (
|
public_js.php
CHANGED
@@ -33,6 +33,11 @@ class ShareaholicPublicJS {
|
|
33 |
}
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
// Used by Share Count Recovery
|
37 |
if (is_singular()) {
|
38 |
global $post;
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
// Can publish?
|
37 |
+
if ( is_user_logged_in() && current_user_can( 'publish_posts' ) ){
|
38 |
+
$base_settings['user']['capabilities']['publish_posts'] = true;
|
39 |
+
}
|
40 |
+
|
41 |
// Used by Share Count Recovery
|
42 |
if (is_singular()) {
|
43 |
global $post;
|
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.
|
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.
|
@@ -262,6 +262,22 @@ Please see here: [Shareaholic Helpdesk](https://support.shareaholic.com/hc/en-us
|
|
262 |
|
263 |
Please see here: [Usage & Installation Instructions](https://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
= How can I change the thumbnail image size for Shareaholic Related Posts? =
|
266 |
|
267 |
The default Shareaholic thumbnail width is 640px with dynamic height and no cropping. The thumbnail size can be specified programmatically by adding `add_image_size('shareaholic-thumbnail', $width, $height, true);` to your theme's `functions.php` file with [appropriate width and height variables](https://developer.wordpress.org/reference/functions/add_image_size/).
|
@@ -269,6 +285,12 @@ 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.4 (2019-06-24) =
|
273 |
* New debug options for Share Count Proxy
|
274 |
* Caching improvements for Share Count Proxy
|
@@ -914,7 +936,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
914 |
* Show Related Posts data status
|
915 |
|
916 |
== Upgrade Notice ==
|
917 |
-
= 8.13.
|
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 =
|
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.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.
|
262 |
|
263 |
Please see here: [Usage & Installation Instructions](https://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
|
264 |
|
265 |
+
= Can I disable the redirect screen after activation? =
|
266 |
+
|
267 |
+
When Shareaholic is activated it redirects to its welcome screen. If you want to prevent this you can use the function below:
|
268 |
+
|
269 |
+
`
|
270 |
+
/**
|
271 |
+
* Disable Shareaholic activation redirect
|
272 |
+
*
|
273 |
+
* Use this if you use the TGM Plugin Activation to install plugins
|
274 |
+
*/
|
275 |
+
|
276 |
+
function prefix_shareaholic_disable_welcome_redirect() {
|
277 |
+
delete_transient( '_shr_activation_redirect' );
|
278 |
+
}
|
279 |
+
`
|
280 |
+
|
281 |
= How can I change the thumbnail image size for Shareaholic Related Posts? =
|
282 |
|
283 |
The default Shareaholic thumbnail width is 640px with dynamic height and no cropping. The thumbnail size can be specified programmatically by adding `add_image_size('shareaholic-thumbnail', $width, $height, true);` to your theme's `functions.php` file with [appropriate width and height variables](https://developer.wordpress.org/reference/functions/add_image_size/).
|
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
|
291 |
+
* Bugfix: Undefined function wp_get_current_user()
|
292 |
+
* Bugfix: App Manager language localization was not working
|
293 |
+
|
294 |
= 8.13.4 (2019-06-24) =
|
295 |
* New debug options for Share Count Proxy
|
296 |
* Caching improvements for Share Count Proxy
|
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 =
|
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 |
/**
|
@@ -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
|
@@ -237,6 +237,8 @@ if (!class_exists('Shareaholic')) {
|
|
237 |
* This function fires after the plugin has been activated.
|
238 |
*/
|
239 |
public function after_activation() {
|
|
|
|
|
240 |
// Cleanup leftover mutex
|
241 |
ShareaholicUtilities::delete_mutex();
|
242 |
|
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 |
* The main file!
|
15 |
*
|
16 |
* @package shareaholic
|
17 |
+
* @version 8.13.5
|
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.5';
|
63 |
|
64 |
/**
|
65 |
* Starts off as false so that ::get_instance() returns
|
237 |
* This function fires after the plugin has been activated.
|
238 |
*/
|
239 |
public function after_activation() {
|
240 |
+
set_transient('_shr_activation_redirect', true, 120); // for post-activation redirect
|
241 |
+
|
242 |
// Cleanup leftover mutex
|
243 |
ShareaholicUtilities::delete_mutex();
|
244 |
|
templates/terms_of_service_notice.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php if ( current_user_can( 'manage_options' ) ){ ?>
|
2 |
|
3 |
-
<div class="shareaholic-wrap-container" style="background-color: #
|
4 |
<div style="margin: 0px 15px 0 20px; float: left;">
|
5 |
<img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>img/check.png" width="56" height="50" />
|
6 |
</div>
|
7 |
<div class="shareaholic-text-container" style="color: #fff; text-shadow: 0px 1px 1px rgba(0,0,0,0.2); font-size: 14px; line-height: 1.5em; height: 50px; vertical-align: middle; display: table-cell; line-height: 1.5;">
|
8 |
-
<?php echo sprintf(__('You\'ve added Shareaholic
|
9 |
</div>
|
10 |
</div>
|
11 |
<div style="clear:both;"></div>
|
1 |
<?php if ( current_user_can( 'manage_options' ) ){ ?>
|
2 |
|
3 |
+
<div class="shareaholic-wrap-container" style="background-color: #009688; margin: 5px 0px 5px -20px;">
|
4 |
<div style="margin: 0px 15px 0 20px; float: left;">
|
5 |
<img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>img/check.png" width="56" height="50" />
|
6 |
</div>
|
7 |
<div class="shareaholic-text-container" style="color: #fff; text-shadow: 0px 1px 1px rgba(0,0,0,0.2); font-size: 14px; line-height: 1.5em; height: 50px; vertical-align: middle; display: table-cell; line-height: 1.5;">
|
8 |
+
<?php echo sprintf(__('You\'ve added Shareaholic - Welcome! Action required: %sComplete Installation »%s', 'shareaholic'), '<a href="admin.php?page=shareaholic-settings" class="button-secondary" style="vertical-align: initial;">', '</a>'); ?>
|
9 |
</div>
|
10 |
</div>
|
11 |
<div style="clear:both;"></div>
|
utilities.php
CHANGED
@@ -101,13 +101,15 @@ class ShareaholicUtilities {
|
|
101 |
* @return array
|
102 |
*/
|
103 |
public static function admin_plugin_action_links($links) {
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
111 |
|
112 |
return $links;
|
113 |
}
|
@@ -352,19 +354,6 @@ class ShareaholicUtilities {
|
|
352 |
if (self::get_version() && intval(self::get_version()) <= 6) {
|
353 |
ShareaholicSixToSeven::update();
|
354 |
}
|
355 |
-
|
356 |
-
// Re-acquire site content. Important: Run ONLY if API KEY is set
|
357 |
-
/*
|
358 |
-
$api_key = ShareaholicUtilities::get_option('api_key');
|
359 |
-
if (ShareaholicUtilities::has_accepted_terms_of_service() && !empty($api_key)) {
|
360 |
-
ShareaholicUtilities::notify_content_manager_singledomain();
|
361 |
-
}
|
362 |
-
*/
|
363 |
-
|
364 |
-
// Check for SS Share Counts API connectivity
|
365 |
-
if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
|
366 |
-
ShareaholicUtilities::share_counts_api_connectivity_check();
|
367 |
-
}
|
368 |
|
369 |
// Activate Shareaholic Cron job
|
370 |
ShareaholicCron::activate();
|
@@ -1096,7 +1085,6 @@ class ShareaholicUtilities {
|
|
1096 |
'stats' => array (
|
1097 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
1098 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
1099 |
-
'comments_total' => wp_count_comments()->approved,
|
1100 |
'users_total' => $wpdb->get_var("SELECT count(ID) FROM $wpdb->users"),
|
1101 |
),
|
1102 |
'diagnostics' => array (
|
@@ -1119,9 +1107,9 @@ class ShareaholicUtilities {
|
|
1119 |
$event_api_url = Shareaholic::API_URL . '/api/events';
|
1120 |
$event_params = array('name' => "WordPress:".$event_name, 'data' => json_encode($event_metadata) );
|
1121 |
|
1122 |
-
$response = ShareaholicCurl::post($event_api_url, $event_params, '', true);
|
1123 |
}
|
1124 |
-
|
1125 |
/**
|
1126 |
* Deletes the api key
|
1127 |
*
|
@@ -1611,33 +1599,38 @@ class ShareaholicUtilities {
|
|
1611 |
}
|
1612 |
|
1613 |
public static function user_info() {
|
1614 |
-
$
|
|
|
|
|
|
|
|
|
1615 |
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
|
1620 |
-
|
1621 |
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
|
1637 |
-
|
1638 |
-
|
|
|
1639 |
}
|
1640 |
-
|
1641 |
return $user_info;
|
1642 |
}
|
1643 |
|
101 |
* @return array
|
102 |
*/
|
103 |
public static function admin_plugin_action_links($links) {
|
104 |
+
if (is_array($links)) {
|
105 |
+
$settings_link = '<a href="'.esc_url(admin_url('admin.php?page=shareaholic-settings')).'">'.__('Settings', 'shareaholic').'</a>';
|
106 |
+
$premium_link = '<a href="https://www.shareaholic.com/plans" target="_blank" rel="noopener noreferrer">'.__('Upgrade', 'shareaholic').'</a>';
|
107 |
+
$helpdesk_link = '<a href="https://support.shareaholic.com/" target="_blank" rel="noopener noreferrer">'.__('Support & Documentation', 'shareaholic').'</a>';
|
108 |
+
|
109 |
+
array_unshift($links, $settings_link);
|
110 |
+
$links[] = $helpdesk_link;
|
111 |
+
$links[] = $premium_link;
|
112 |
+
}
|
113 |
|
114 |
return $links;
|
115 |
}
|
354 |
if (self::get_version() && intval(self::get_version()) <= 6) {
|
355 |
ShareaholicSixToSeven::update();
|
356 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
// Activate Shareaholic Cron job
|
359 |
ShareaholicCron::activate();
|
1085 |
'stats' => array (
|
1086 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
1087 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
|
|
1088 |
'users_total' => $wpdb->get_var("SELECT count(ID) FROM $wpdb->users"),
|
1089 |
),
|
1090 |
'diagnostics' => array (
|
1107 |
$event_api_url = Shareaholic::API_URL . '/api/events';
|
1108 |
$event_params = array('name' => "WordPress:".$event_name, 'data' => json_encode($event_metadata) );
|
1109 |
|
1110 |
+
$response = ShareaholicCurl::post($event_api_url, $event_params, '', true, 2);
|
1111 |
}
|
1112 |
+
|
1113 |
/**
|
1114 |
* Deletes the api key
|
1115 |
*
|
1599 |
}
|
1600 |
|
1601 |
public static function user_info() {
|
1602 |
+
$user_info = array();
|
1603 |
+
|
1604 |
+
if (function_exists('wp_get_current_user')) {
|
1605 |
+
|
1606 |
+
$current_user = wp_get_current_user();
|
1607 |
|
1608 |
+
if ( !($current_user instanceof WP_User) || !is_user_logged_in()) {
|
1609 |
+
return array();
|
1610 |
+
}
|
1611 |
|
1612 |
+
$user_caps = $current_user->get_role_caps();
|
1613 |
|
1614 |
+
$caps = array('switch_themes', 'edit_themes', 'activate_plugins',
|
1615 |
+
'edit_plugins', 'manage_options', 'unfiltered_html', 'edit_dashboard',
|
1616 |
+
'update_plugins', 'delete_plugins', 'install_plugins', 'update_themes',
|
1617 |
+
'install_themes', 'update_core', 'edit_theme_options', 'delete_themes',
|
1618 |
+
'administrator'
|
1619 |
+
);
|
1620 |
|
1621 |
+
$user_info = array(
|
1622 |
+
'username' => $current_user->user_login,
|
1623 |
+
'email' => $current_user->user_email,
|
1624 |
+
'roles' => $current_user->roles,
|
1625 |
+
'capabilities' => array(),
|
1626 |
+
'is_super_admin' => is_super_admin()
|
1627 |
+
);
|
1628 |
|
1629 |
+
foreach($caps as $cap) {
|
1630 |
+
$user_info['capabilities'][$cap] = isset($user_caps[$cap]) ? $user_caps[$cap] : '';
|
1631 |
+
}
|
1632 |
}
|
1633 |
+
|
1634 |
return $user_info;
|
1635 |
}
|
1636 |
|