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 | 9.0.1 |
Comparing to | |
See all releases |
Code changes from version 8.13.16 to 9.0.1
- admin.php +14 -1
- assets/css/main.css +4 -0
- content_manager.php +0 -2
- readme.txt +7 -2
- shareaholic.php +3 -3
- six_to_seven.php +0 -2
- templates/advanced_settings.php +22 -3
- templates/failed_to_create_api_key_modal.php +2 -2
- templates/footer.php +1 -1
- templates/settings.php +18 -37
- utilities.php +181 -6
admin.php
CHANGED
@@ -509,6 +509,9 @@ JQUERY;
|
|
509 |
* Updates the information if passed in and sets save message.
|
510 |
*/
|
511 |
public static function admin_legacy() {
|
|
|
|
|
|
|
512 |
$settings = ShareaholicUtilities::get_settings();
|
513 |
$action = str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] );
|
514 |
if ( isset( $_POST['already_submitted'] ) && $_POST['already_submitted'] == 'Y' &&
|
@@ -560,8 +563,11 @@ JQUERY;
|
|
560 |
ShareaholicUtilities::update_options( array( 'recommendations_display_on_excerpts' => $_POST['shareaholic']['recommendations_display_on_excerpts'] ) );
|
561 |
}
|
562 |
|
|
|
|
|
|
|
563 |
ShareaholicUtilities::log_event( 'UpdatedSettings' );
|
564 |
-
//
|
565 |
ShareaholicUtilities::clear_cache();
|
566 |
}
|
567 |
|
@@ -582,6 +588,9 @@ JQUERY;
|
|
582 |
*/
|
583 |
public static function admin() {
|
584 |
|
|
|
|
|
|
|
585 |
if ( ! ShareaholicUtilities::has_accepted_terms_of_service() ) {
|
586 |
ShareaholicUtilities::load_template(
|
587 |
'terms_of_service_modal',
|
@@ -631,6 +640,10 @@ JQUERY;
|
|
631 |
* The function for the advanced admin section
|
632 |
*/
|
633 |
public static function advanced_admin() {
|
|
|
|
|
|
|
|
|
634 |
$settings = ShareaholicUtilities::get_settings();
|
635 |
|
636 |
if ( ShareaholicUtilities::has_accepted_terms_of_service() ) {
|
509 |
* Updates the information if passed in and sets save message.
|
510 |
*/
|
511 |
public static function admin_legacy() {
|
512 |
+
// Fetch and save location status from cloud
|
513 |
+
ShareaholicUtilities::location_sync_update_plugin();
|
514 |
+
|
515 |
$settings = ShareaholicUtilities::get_settings();
|
516 |
$action = str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] );
|
517 |
if ( isset( $_POST['already_submitted'] ) && $_POST['already_submitted'] == 'Y' &&
|
563 |
ShareaholicUtilities::update_options( array( 'recommendations_display_on_excerpts' => $_POST['shareaholic']['recommendations_display_on_excerpts'] ) );
|
564 |
}
|
565 |
|
566 |
+
// Send location status to Shareaholic.com
|
567 |
+
ShareaholicUtilities::location_sync_to_cloud();
|
568 |
+
// Log event
|
569 |
ShareaholicUtilities::log_event( 'UpdatedSettings' );
|
570 |
+
// Clear WP cache
|
571 |
ShareaholicUtilities::clear_cache();
|
572 |
}
|
573 |
|
588 |
*/
|
589 |
public static function admin() {
|
590 |
|
591 |
+
// Fetch and save location status from cloud
|
592 |
+
ShareaholicUtilities::location_sync_update_plugin();
|
593 |
+
|
594 |
if ( ! ShareaholicUtilities::has_accepted_terms_of_service() ) {
|
595 |
ShareaholicUtilities::load_template(
|
596 |
'terms_of_service_modal',
|
640 |
* The function for the advanced admin section
|
641 |
*/
|
642 |
public static function advanced_admin() {
|
643 |
+
|
644 |
+
// Fetch and save location status from cloud
|
645 |
+
ShareaholicUtilities::location_sync_update_plugin();
|
646 |
+
|
647 |
$settings = ShareaholicUtilities::get_settings();
|
648 |
|
649 |
if ( ShareaholicUtilities::has_accepted_terms_of_service() ) {
|
assets/css/main.css
CHANGED
@@ -397,6 +397,10 @@ input[type='text'] {
|
|
397 |
color: #45a147;
|
398 |
}
|
399 |
|
|
|
|
|
|
|
|
|
400 |
.blink {
|
401 |
text-decoration: blink;
|
402 |
-webkit-animation-name: blinker;
|
397 |
color: #45a147;
|
398 |
}
|
399 |
|
400 |
+
.key-status.unknown {
|
401 |
+
color: #9e9e9e;
|
402 |
+
}
|
403 |
+
|
404 |
.blink {
|
405 |
text-decoration: blink;
|
406 |
-webkit-animation-name: blinker;
|
content_manager.php
CHANGED
@@ -13,5 +13,3 @@
|
|
13 |
class ShareaholicContentManager {
|
14 |
|
15 |
}
|
16 |
-
|
17 |
-
|
13 |
class ShareaholicContentManager {
|
14 |
|
15 |
}
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: social, social sharing, google analytics, pinterest, twitter, share butto
|
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag:
|
8 |
|
9 |
|
10 |
Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
|
@@ -310,6 +310,11 @@ The default Shareaholic thumbnail width is 640px with dynamic height and no crop
|
|
310 |
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.
|
311 |
|
312 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
= 8.13.16 (2020-02-14) =
|
315 |
* Bugfix: Set In-Page block app ID for shortcode when required
|
@@ -1028,7 +1033,7 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
|
|
1028 |
* Show Related Posts data status
|
1029 |
|
1030 |
== Upgrade Notice ==
|
1031 |
-
=
|
1032 |
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!
|
1033 |
|
1034 |
= 8.12.1 =
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 9.0.1
|
8 |
|
9 |
|
10 |
Boost Audience Engagement with Award Winning Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
|
310 |
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.
|
311 |
|
312 |
== Changelog ==
|
313 |
+
= 9.0.1 (2020-02-20) =
|
314 |
+
* Enhancement: Sync In-Page block app status between Plugin ↔ Shareaholic Cloud
|
315 |
+
* Enhancement: Removed additional duplicate options from legacy dashboard
|
316 |
+
* Bugfix: Fixed plugin reset function
|
317 |
+
* Bugfix: Fixed handling of `null` setting arrays
|
318 |
|
319 |
= 8.13.16 (2020-02-14) =
|
320 |
* Bugfix: Set In-Page block app ID for shortcode when required
|
1033 |
* Show Related Posts data status
|
1034 |
|
1035 |
== Upgrade Notice ==
|
1036 |
+
= 9.0.1 =
|
1037 |
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!
|
1038 |
|
1039 |
= 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:
|
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
|
18 |
*/
|
19 |
|
20 |
/**
|
@@ -71,7 +71,7 @@ if ( ! class_exists( 'Shareaholic' ) ) {
|
|
71 |
const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
|
72 |
const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
|
73 |
|
74 |
-
const VERSION = '
|
75 |
|
76 |
/**
|
77 |
* 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: 9.0.1
|
7 |
Author: Shareaholic
|
8 |
Author URI: https://www.shareaholic.com
|
9 |
Text Domain: shareaholic
|
14 |
* The main file!
|
15 |
*
|
16 |
* @package shareaholic
|
17 |
+
* @version 9.0.1
|
18 |
*/
|
19 |
|
20 |
/**
|
71 |
const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
|
72 |
const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
|
73 |
|
74 |
+
const VERSION = '9.0.1';
|
75 |
|
76 |
/**
|
77 |
* Starts off as false so that ::get_instance() returns
|
six_to_seven.php
CHANGED
@@ -594,5 +594,3 @@ class ShareaholicSixToSeven {
|
|
594 |
return $headline_text;
|
595 |
}
|
596 |
}
|
597 |
-
|
598 |
-
|
594 |
return $headline_text;
|
595 |
}
|
596 |
}
|
|
|
|
templates/advanced_settings.php
CHANGED
@@ -49,8 +49,8 @@ window.ShareaholicConfig = {
|
|
49 |
<h2><?php _e( 'Server Connectivity', 'shareaholic' ); ?></h2>
|
50 |
<div class="app-content">
|
51 |
<?php if ( ShareaholicUtilities::connectivity_check() == 'SUCCESS' ) { ?>
|
52 |
-
<span class="key-status passed"><i class="fa fa-circle green" aria-hidden="true"></i> <?php _e( 'Shareaholic.com servers are reachable', 'shareaholic' ); ?></span>
|
53 |
-
<p class="key-description"><?php _e( 'Shareaholic should be working correctly.', 'shareaholic' ); ?> <?php _e( 'All Shareaholic servers are accessible.', 'shareaholic' ); ?></p>
|
54 |
<?php } else { // can't connect to any server ?>
|
55 |
<span class="key-status failed"><i class="fa fa-circle red blink" aria-hidden="true"></i> <?php _e( 'Unable to reach any Shareaholic server', 'shareaholic' ); ?></span> <a href="#" onClick="window.location.reload(); this.innerHTML='<?php _e( 'Checking...', 'shareaholic' ); ?>';"><?php _e( 'Re-check', 'shareaholic' ); ?></a>
|
56 |
<p class="key-description"><?php echo sprintf( __( 'A network problem or firewall is blocking connections from your web server to Shareaholic.com. <strong>Shareaholic cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%1$s" target="_blank">this information about Shareaholic and firewalls</a>. <a href="#" class="%2$s">Let us know too</a>, so we can follow up!' ), 'https://www.shareaholic.com/blog/shareaholic-hosting-faq/', 'drift-open-chat', '</a>' ); ?></p>
|
@@ -79,6 +79,25 @@ window.ShareaholicConfig = {
|
|
79 |
</div>
|
80 |
</div>
|
81 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
<div class='clear'></div>
|
84 |
|
@@ -103,7 +122,7 @@ window.ShareaholicConfig = {
|
|
103 |
<?php if ( isset( $settings['disable_internal_share_counts_api'] ) ) { ?>
|
104 |
<?php echo ( $settings['disable_internal_share_counts_api'] == 'on' ? 'checked' : '' ); ?>
|
105 |
<?php } ?>>
|
106 |
-
<label for="share_counts"> <?php echo sprintf( __( 'Disable Local Share Count Proxy.', 'shareaholic' ) ); ?> <?php echo sprintf( __( 'When enabled, Share Counts will be fetched and cached locally by your server. This local proxy enhances user privacy and share counts but uses your server resources. Retrieving, caching and serving Share Counts can be a server and database intensive activity which can test even the best of web hosts. You can save on your hosting bill by offloading this heavy lifting to Shareaholic servers instead, <a href="%s" target="_blank">learn more</a>.', 'shareaholic' ), 'https://support.shareaholic.com/hc/en-us/articles/360029500132' ); ?></label>
|
107 |
</div>
|
108 |
|
109 |
<?php if ( isset( $settings['disable_internal_share_counts_api'] ) && $settings['disable_internal_share_counts_api'] != 'on' ) { ?>
|
49 |
<h2><?php _e( 'Server Connectivity', 'shareaholic' ); ?></h2>
|
50 |
<div class="app-content">
|
51 |
<?php if ( ShareaholicUtilities::connectivity_check() == 'SUCCESS' ) { ?>
|
52 |
+
<span class="key-status passed"><i class="fa fa-circle green" aria-hidden="true"></i> <?php _e( 'Shareaholic.com Cloud servers are reachable', 'shareaholic' ); ?></span>
|
53 |
+
<p class="key-description"><?php _e( 'Shareaholic plugin should be working correctly.', 'shareaholic' ); ?> <?php _e( 'All Shareaholic Cloud servers are accessible.', 'shareaholic' ); ?></p>
|
54 |
<?php } else { // can't connect to any server ?>
|
55 |
<span class="key-status failed"><i class="fa fa-circle red blink" aria-hidden="true"></i> <?php _e( 'Unable to reach any Shareaholic server', 'shareaholic' ); ?></span> <a href="#" onClick="window.location.reload(); this.innerHTML='<?php _e( 'Checking...', 'shareaholic' ); ?>';"><?php _e( 'Re-check', 'shareaholic' ); ?></a>
|
56 |
<p class="key-description"><?php echo sprintf( __( 'A network problem or firewall is blocking connections from your web server to Shareaholic.com. <strong>Shareaholic cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%1$s" target="_blank">this information about Shareaholic and firewalls</a>. <a href="#" class="%2$s">Let us know too</a>, so we can follow up!' ), 'https://www.shareaholic.com/blog/shareaholic-hosting-faq/', 'drift-open-chat', '</a>' ); ?></p>
|
79 |
</div>
|
80 |
</div>
|
81 |
</div>
|
82 |
+
|
83 |
+
<div class='clear'></div>
|
84 |
+
|
85 |
+
<div class="app">
|
86 |
+
<h2><?php _e( 'Plugin ↔ Shareaholic Cloud Sync', 'shareaholic' ); ?></h2>
|
87 |
+
<div class="app-content">
|
88 |
+
<?php
|
89 |
+
$sync_status = ShareaholicUtilities::location_sync_status();
|
90 |
+
if ( $sync_status == 200 ) {
|
91 |
+
?>
|
92 |
+
<span class="key-status passed"><?php _e( 'Plugin In-Page Block settings are in-sync with Shareaholic Cloud', 'shareaholic' ); ?></span>
|
93 |
+
<?php } elseif ( $sync_status == 409 ) { ?>
|
94 |
+
<span class="key-status failed"><?php _e( 'Plugin In-Page Block settings are NOT in-sync with Shareaholic Cloud', 'shareaholic' ); ?></span>
|
95 |
+
<?php } else { ?>
|
96 |
+
<span class="key-status unknown"><?php _e( 'Sync Status Unknown', 'shareaholic' ); ?></span>
|
97 |
+
<?php } ?>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
|
101 |
|
102 |
<div class='clear'></div>
|
103 |
|
122 |
<?php if ( isset( $settings['disable_internal_share_counts_api'] ) ) { ?>
|
123 |
<?php echo ( $settings['disable_internal_share_counts_api'] == 'on' ? 'checked' : '' ); ?>
|
124 |
<?php } ?>>
|
125 |
+
<label for="share_counts"> <?php echo sprintf( __( 'Disable Local Share Count Proxy.', 'shareaholic' ) ); ?> <?php echo sprintf( __( 'When enabled, Share Counts will be fetched and cached locally by your server. This local proxy enhances user privacy and share counts but uses your server resources. Retrieving, caching and serving Share Counts can be a server and database intensive activity which can test even the best of web hosts. You can save on your hosting bill by offloading this heavy lifting to Shareaholic Cloud servers instead, <a href="%s" target="_blank">learn more</a>.', 'shareaholic' ), 'https://support.shareaholic.com/hc/en-us/articles/360029500132' ); ?></label>
|
126 |
</div>
|
127 |
|
128 |
<?php if ( isset( $settings['disable_internal_share_counts_api'] ) && $settings['disable_internal_share_counts_api'] != 'on' ) { ?>
|
templates/failed_to_create_api_key_modal.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<h4><?php echo sprintf( __( 'Setup Shareaholic', 'shareaholic' ) ); ?></h4>
|
3 |
<div class="content pal" style="padding:20px;">
|
4 |
<p style="font-size:14px;">
|
5 |
-
<?php _e( 'It appears that we are having some trouble
|
6 |
</p>
|
7 |
<a id='get_started' class="btn_main" style="margin-top: 15px;" href=''><?php echo _e( 'Retry', 'shareaholic' ); ?></a>
|
8 |
<br />
|
@@ -11,7 +11,7 @@
|
|
11 |
</span>
|
12 |
<br /><br />
|
13 |
<p style="font-size:12px; font-weight:normal;">
|
14 |
-
<?php echo sprintf( __( 'If you continue to get this prompt for more than a few minutes, ensure that you have the latest version of the plugin installed. If you still continue to get this prompt, then check "Shareaholic Server Connectivity Status" or reset the plugin. Both are available under %1$sAdvanced Settings%2$s.', 'shareaholic' ), '<a href="admin.php?page=shareaholic-advanced">', '</a>' ); ?> <?php echo sprintf( __( '
|
15 |
</p>
|
16 |
</div>
|
17 |
</div>
|
2 |
<h4><?php echo sprintf( __( 'Setup Shareaholic', 'shareaholic' ) ); ?></h4>
|
3 |
<div class="content pal" style="padding:20px;">
|
4 |
<p style="font-size:14px;">
|
5 |
+
<?php _e( 'It appears that we are having some trouble communicating with Shareaholic Cloud servers right now. This is usually temporary. Please revisit this section after a few minutes or click "retry" now.', 'shareaholic' ); ?>
|
6 |
</p>
|
7 |
<a id='get_started' class="btn_main" style="margin-top: 15px;" href=''><?php echo _e( 'Retry', 'shareaholic' ); ?></a>
|
8 |
<br />
|
11 |
</span>
|
12 |
<br /><br />
|
13 |
<p style="font-size:12px; font-weight:normal;">
|
14 |
+
<?php echo sprintf( __( 'If you continue to get this prompt for more than a few minutes, ensure that you have the latest version of the plugin installed. If you still continue to get this prompt, then check "Shareaholic Server Connectivity Status" or reset the plugin. Both are available under %1$sAdvanced Settings%2$s.', 'shareaholic' ), '<a href="admin.php?page=shareaholic-advanced">', '</a>' ); ?> <?php echo sprintf( __( 'If you are stuck, have a question or have a bug to report, please %1$slet us know%2$s.', 'shareaholic' ), '<a href="https://www.shareaholic.com/help/message" target="_blank">', '</a>' ); ?>
|
15 |
</p>
|
16 |
</div>
|
17 |
</div>
|
templates/footer.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<div style="margin-top:45px;"></div>
|
2 |
<div class='clear'>
|
3 |
<p class="text-muted">
|
4 |
-
<?php echo sprintf( __( '%sShareaholic for WordPress v' . ShareaholicUtilities::get_version() . '%s | %
|
5 |
</p>
|
6 |
<p class="text-muted">
|
7 |
<?php echo sprintf( __( 'If you like our work, please show some love and %1$sleave a ⭐️⭐️⭐️⭐️⭐️ review%2$s. It would help us out a lot and we would really appreciate it.', 'shareaholic' ), '<a href="https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post" target="_new">', '</a>' ); ?>
|
1 |
<div style="margin-top:45px;"></div>
|
2 |
<div class='clear'>
|
3 |
<p class="text-muted">
|
4 |
+
<?php echo sprintf( __( '%sShareaholic for WordPress v' . ShareaholicUtilities::get_version() . '%s | %sTerms of Service%s | %sSupport Center%s | %sAPI%s', 'shareaholic' ), '<a href="https://www.shareaholic.com/?src=wp_admin" target="_new">', '</a>', '<a href="https://www.shareaholic.com/terms/?src=wp_admin" target="_new">', '</a>', '<a href="https://support.shareaholic.com/" target="_new">', '</a>', '<a href="https://www.shareaholic.com/api/?src=wp_admin" target="_new">', '</a>' ); ?>
|
5 |
</p>
|
6 |
<p class="text-muted">
|
7 |
<?php echo sprintf( __( 'If you like our work, please show some love and %1$sleave a ⭐️⭐️⭐️⭐️⭐️ review%2$s. It would help us out a lot and we would really appreciate it.', 'shareaholic' ), '<a href="https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post" target="_new">', '</a>' ); ?>
|
templates/settings.php
CHANGED
@@ -27,34 +27,25 @@ window.ShareaholicConfig = {
|
|
27 |
<input type="hidden" name="already_submitted" value="Y">
|
28 |
|
29 |
<div id='app_settings'>
|
30 |
-
|
31 |
<div class="app">
|
32 |
-
<h2
|
33 |
<p>
|
34 |
-
|
|
|
35 |
</p>
|
36 |
-
|
37 |
<?php foreach ( array( 'post', 'page', 'index', 'category' ) as $page_type ) { ?>
|
38 |
<fieldset id='sharebuttons'>
|
39 |
<legend><?php echo ucfirst( $page_type ); ?></legend>
|
40 |
<?php foreach ( array( 'above', 'below' ) as $position ) { ?>
|
41 |
-
<?php if ( isset( $settings['location_name_ids']['share_buttons'][ "{$page_type}_{$position}_content" ] ) ) { ?>
|
42 |
-
<?php $location_id = $settings['location_name_ids']['share_buttons'][ "{$page_type}_{$position}_content" ]; ?>
|
43 |
-
<?php
|
44 |
-
} else {
|
45 |
-
$location_id = ''; }
|
46 |
-
?>
|
47 |
<div class="location">
|
48 |
-
|
49 |
-
|
50 |
-
<?php
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
data-location_id='<?php echo intval( $location_id ); ?>'
|
55 |
-
data-href='share_buttons/locations/{{id}}/edit'
|
56 |
-
class="location_item_cta btn btn-sm btn-success float-right">
|
57 |
-
<?php _e( 'Customize', 'shareaholic' ); ?></button>
|
58 |
</div>
|
59 |
<?php } ?>
|
60 |
</fieldset>
|
@@ -69,34 +60,24 @@ window.ShareaholicConfig = {
|
|
69 |
<label for="share_buttons_excerpts">Display on excerpts</label>
|
70 |
</p>
|
71 |
</div>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
<h2><i class="icon icon-recommendations"></i> <?php echo sprintf( __( 'Related Content', 'shareaholic' ) ); ?></h2>
|
76 |
<p>
|
77 |
-
|
|
|
78 |
</p>
|
79 |
<?php foreach ( array( 'post', 'page', 'index', 'category' ) as $page_type ) { ?>
|
80 |
<?php foreach ( array( 'below' ) as $position ) { ?>
|
81 |
-
<?php if ( isset( $settings['location_name_ids']['recommendations'][ "{$page_type}_{$position}_content" ] ) ) { ?>
|
82 |
-
<?php $location_id = $settings['location_name_ids']['recommendations'][ "{$page_type}_{$position}_content" ]; ?>
|
83 |
-
<?php
|
84 |
-
} else {
|
85 |
-
$location_id = ''; }
|
86 |
-
?>
|
87 |
<fieldset id='recommendations'>
|
88 |
<legend><?php echo ucfirst( $page_type ); ?></legend>
|
89 |
<div class="location">
|
|
|
90 |
<input type="checkbox" id="recommendations_<?php echo "{$page_type}_below_content"; ?>" name="recommendations[<?php echo "{$page_type}_below_content"; ?>]" class="check"
|
91 |
<?php if ( isset( $recommendations[ "{$page_type}_below_content" ] ) ) { ?>
|
92 |
<?php echo ( $recommendations[ "{$page_type}_below_content" ] == 'on' ? 'checked' : '' ); ?>
|
93 |
-
<?php }
|
94 |
<label for="recommendations_<?php echo "{$page_type}_below_content"; ?>"><?php echo ucfirst( $position ); ?> Content</label>
|
95 |
-
<button data-app='recommendations'
|
96 |
-
data-location_id='<?php echo intval( $location_id ); ?>'
|
97 |
-
data-href="recommendations/locations/{{id}}/edit"
|
98 |
-
class="location_item_cta btn btn-sm btn-success">
|
99 |
-
<?php _e( 'Customize', 'shareaholic' ); ?></button>
|
100 |
</div>
|
101 |
<?php } ?>
|
102 |
</fieldset>
|
27 |
<input type="hidden" name="already_submitted" value="Y">
|
28 |
|
29 |
<div id='app_settings'>
|
30 |
+
|
31 |
<div class="app">
|
32 |
+
<h2>In-Page App Code Blocks</h2>
|
33 |
<p>
|
34 |
+
<i class="icon icon-share_buttons"></i> <?php echo sprintf( __( 'In-Page Share Buttons', 'shareaholic' ) ); ?>
|
35 |
+
<?php echo sprintf( __( '- Pick where you want your In-Page code blocks to be inserted', 'shareaholic' ) ); ?>
|
36 |
</p>
|
37 |
+
|
38 |
<?php foreach ( array( 'post', 'page', 'index', 'category' ) as $page_type ) { ?>
|
39 |
<fieldset id='sharebuttons'>
|
40 |
<legend><?php echo ucfirst( $page_type ); ?></legend>
|
41 |
<?php foreach ( array( 'above', 'below' ) as $position ) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<div class="location">
|
43 |
+
<input type="hidden" name="share_buttons[<?php echo "{$page_type}_{$position}_content"; ?>]" value="off" />
|
44 |
+
<input type="checkbox" id="share_buttons_<?php echo "{$page_type}_{$position}_content"; ?>" name="share_buttons[<?php echo "{$page_type}_{$position}_content"; ?>]" class="check"
|
45 |
+
<?php if ( isset( $share_buttons[ "{$page_type}_{$position}_content" ] ) ) { ?>
|
46 |
+
<?php echo ( $share_buttons[ "{$page_type}_{$position}_content" ] == 'on' ? 'checked' : '' ); ?>
|
47 |
+
<?php } ?> />
|
48 |
+
<label for="share_buttons_<?php echo "{$page_type}_{$position}_content"; ?>"><?php echo ucfirst( $position ); ?> Content</label>
|
|
|
|
|
|
|
|
|
49 |
</div>
|
50 |
<?php } ?>
|
51 |
</fieldset>
|
60 |
<label for="share_buttons_excerpts">Display on excerpts</label>
|
61 |
</p>
|
62 |
</div>
|
63 |
+
|
64 |
+
<div class='clear'></div>
|
65 |
+
|
|
|
66 |
<p>
|
67 |
+
<i class="icon icon-recommendations"></i> <?php echo sprintf( __( 'Related Content', 'shareaholic' ) ); ?>
|
68 |
+
<?php echo sprintf( __( '- Pick where you want your In-Page code blocks to be inserted', 'shareaholic' ) ); ?>
|
69 |
</p>
|
70 |
<?php foreach ( array( 'post', 'page', 'index', 'category' ) as $page_type ) { ?>
|
71 |
<?php foreach ( array( 'below' ) as $position ) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
<fieldset id='recommendations'>
|
73 |
<legend><?php echo ucfirst( $page_type ); ?></legend>
|
74 |
<div class="location">
|
75 |
+
<input type="hidden" name="recommendations[<?php echo "{$page_type}_below_content"; ?>]" value="off" />
|
76 |
<input type="checkbox" id="recommendations_<?php echo "{$page_type}_below_content"; ?>" name="recommendations[<?php echo "{$page_type}_below_content"; ?>]" class="check"
|
77 |
<?php if ( isset( $recommendations[ "{$page_type}_below_content" ] ) ) { ?>
|
78 |
<?php echo ( $recommendations[ "{$page_type}_below_content" ] == 'on' ? 'checked' : '' ); ?>
|
79 |
+
<?php } ?> />
|
80 |
<label for="recommendations_<?php echo "{$page_type}_below_content"; ?>"><?php echo ucfirst( $position ); ?> Content</label>
|
|
|
|
|
|
|
|
|
|
|
81 |
</div>
|
82 |
<?php } ?>
|
83 |
</fieldset>
|
utilities.php
CHANGED
@@ -72,6 +72,9 @@ class ShareaholicUtilities {
|
|
72 |
if ( isset( $settings['location_name_ids'] ) && is_array( $settings['location_name_ids'] ) ) {
|
73 |
self::set_default_location_settings( $settings['location_name_ids'] );
|
74 |
}
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -375,7 +378,7 @@ class ShareaholicUtilities {
|
|
375 |
if ( ! self::is_locked( 'perform_update' ) ) {
|
376 |
self::set_lock( 'perform_update' );
|
377 |
|
378 |
-
// Upgrade v6
|
379 |
if ( self::get_version() && intval( self::get_version() ) <= 6 ) {
|
380 |
ShareaholicSixToSeven::update();
|
381 |
}
|
@@ -383,11 +386,15 @@ class ShareaholicUtilities {
|
|
383 |
// Activate Shareaholic Cron job
|
384 |
ShareaholicCron::activate();
|
385 |
|
|
|
|
|
|
|
|
|
|
|
386 |
// Clear site cache
|
387 |
self::clear_cache();
|
388 |
|
389 |
// add other things that need to run on version change here
|
390 |
-
|
391 |
self::unlock( 'perform_update' );
|
392 |
}
|
393 |
}
|
@@ -500,8 +507,7 @@ class ShareaholicUtilities {
|
|
500 |
}
|
501 |
|
502 |
/**
|
503 |
-
* A wrapper function to
|
504 |
-
* because this is such a common function
|
505 |
*
|
506 |
* @todo Determine whether needed anymore
|
507 |
*
|
@@ -521,7 +527,7 @@ class ShareaholicUtilities {
|
|
521 |
/**
|
522 |
*
|
523 |
* Loads the locations names and their respective ids for an api key
|
524 |
-
* and sets them in the shareaholic settings.
|
525 |
*
|
526 |
* @param string $api_key
|
527 |
*/
|
@@ -1565,7 +1571,6 @@ class ShareaholicUtilities {
|
|
1565 |
}
|
1566 |
}
|
1567 |
|
1568 |
-
|
1569 |
/**
|
1570 |
* Server Connectivity check
|
1571 |
*/
|
@@ -1584,6 +1589,176 @@ class ShareaholicUtilities {
|
|
1584 |
}
|
1585 |
}
|
1586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1587 |
/**
|
1588 |
* Facebook Auth Token check
|
1589 |
*/
|
72 |
if ( isset( $settings['location_name_ids'] ) && is_array( $settings['location_name_ids'] ) ) {
|
73 |
self::set_default_location_settings( $settings['location_name_ids'] );
|
74 |
}
|
75 |
+
|
76 |
+
// Sync local locations with Cloud
|
77 |
+
self::location_sync_to_cloud();
|
78 |
}
|
79 |
|
80 |
/**
|
378 |
if ( ! self::is_locked( 'perform_update' ) ) {
|
379 |
self::set_lock( 'perform_update' );
|
380 |
|
381 |
+
// Upgrade v6
|
382 |
if ( self::get_version() && intval( self::get_version() ) <= 6 ) {
|
383 |
ShareaholicSixToSeven::update();
|
384 |
}
|
386 |
// Activate Shareaholic Cron job
|
387 |
ShareaholicCron::activate();
|
388 |
|
389 |
+
// Upgrade v8
|
390 |
+
if ( self::get_version() && intval( self::get_version() ) <= 8 && intval( self::get_version() ) > 7 ) {
|
391 |
+
self::EightToNineUpdate();
|
392 |
+
}
|
393 |
+
|
394 |
// Clear site cache
|
395 |
self::clear_cache();
|
396 |
|
397 |
// add other things that need to run on version change here
|
|
|
398 |
self::unlock( 'perform_update' );
|
399 |
}
|
400 |
}
|
507 |
}
|
508 |
|
509 |
/**
|
510 |
+
* A wrapper function to specifically update the location name ids
|
|
|
511 |
*
|
512 |
* @todo Determine whether needed anymore
|
513 |
*
|
527 |
/**
|
528 |
*
|
529 |
* Loads the locations names and their respective ids for an api key
|
530 |
+
* and sets them in the shareaholic settings.
|
531 |
*
|
532 |
* @param string $api_key
|
533 |
*/
|
1571 |
}
|
1572 |
}
|
1573 |
|
|
|
1574 |
/**
|
1575 |
* Server Connectivity check
|
1576 |
*/
|
1589 |
}
|
1590 |
}
|
1591 |
|
1592 |
+
/**
|
1593 |
+
* Manages V8 => V9 upgrade
|
1594 |
+
*/
|
1595 |
+
public static function EightToNineUpdate() {
|
1596 |
+
$api_key = self::get_option( 'api_key' );
|
1597 |
+
if ( $api_key ) {
|
1598 |
+
$response = ShareaholicCurl::get( Shareaholic::API_URL . "/publisher_tools/{$api_key}.json" );
|
1599 |
+
|
1600 |
+
if ( is_array( $response ) && array_key_exists( 'body', $response ) ) {
|
1601 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
1602 |
+
if ( $response_code == '404' ) {
|
1603 |
+
// Site ID is not active in Shareaholic Cloud
|
1604 |
+
exit;
|
1605 |
+
}
|
1606 |
+
}
|
1607 |
+
|
1608 |
+
// If Cloud location = off then set Plugin location = off
|
1609 |
+
$publisher_configuration = $response['body'];
|
1610 |
+
if ( $publisher_configuration && is_array( $publisher_configuration ) ) {
|
1611 |
+
foreach ( array( 'share_buttons', 'recommendations' ) as $app ) {
|
1612 |
+
$cloud_result = array();
|
1613 |
+
foreach ( $publisher_configuration['apps'][ $app ]['locations'] as $key => $val ) {
|
1614 |
+
if ( array_key_exists( $val['name'], self::get_option( $app ) ) ) {
|
1615 |
+
// Update only if location already exists in Plugin settings
|
1616 |
+
if ( $val['enabled'] == false ) {
|
1617 |
+
self::update_options( array( $app => array( $val['name'] => 'off' ) ) );
|
1618 |
+
}
|
1619 |
+
}
|
1620 |
+
}
|
1621 |
+
}
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
// Send Plugin settings to Cloud
|
1625 |
+
self::location_sync_to_cloud();
|
1626 |
+
}
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
/**
|
1630 |
+
* Prepare associative array of locations, and their parameters.
|
1631 |
+
*/
|
1632 |
+
public static function prepareLocationsArray( $locations ) {
|
1633 |
+
$formatted_app_locations = array();
|
1634 |
+
foreach ( $locations as $key => $val ) {
|
1635 |
+
if ( $val == 'on' ) {
|
1636 |
+
$formatted_app_locations[ $key ] = array( 'enabled' => true );
|
1637 |
+
} else {
|
1638 |
+
$formatted_app_locations[ $key ] = array( 'enabled' => false );
|
1639 |
+
}
|
1640 |
+
}
|
1641 |
+
if ( empty( $formatted_app_locations ) ) {
|
1642 |
+
// By casting the array into an object, json_encode will always use braces instead of brackets for the value (even when empty)
|
1643 |
+
return (object) array();
|
1644 |
+
} else {
|
1645 |
+
return $formatted_app_locations;
|
1646 |
+
}
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
/**
|
1650 |
+
* Sync In-Page Location Blocks - Shareaholic Cloud => WP Plugin
|
1651 |
+
*/
|
1652 |
+
public static function location_sync_update_plugin() {
|
1653 |
+
$api_key = self::get_option( 'api_key' );
|
1654 |
+
if ( $api_key ) {
|
1655 |
+
$response = ShareaholicCurl::get( Shareaholic::API_URL . "/publisher_tools/{$api_key}.json" );
|
1656 |
+
|
1657 |
+
if ( is_array( $response ) && array_key_exists( 'body', $response ) ) {
|
1658 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
1659 |
+
if ( $response_code == '404' ) {
|
1660 |
+
// Site ID is not active in Shareaholic Cloud
|
1661 |
+
exit;
|
1662 |
+
}
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
$publisher_configuration = $response['body'];
|
1666 |
+
if ( $publisher_configuration && is_array( $publisher_configuration ) ) {
|
1667 |
+
foreach ( array( 'share_buttons', 'recommendations' ) as $app ) {
|
1668 |
+
$cloud_result = array();
|
1669 |
+
foreach ( $publisher_configuration['apps'][ $app ]['locations'] as $key => $val ) {
|
1670 |
+
if ( array_key_exists( $val['name'], self::get_option( $app ) ) ) {
|
1671 |
+
// Update only if location already exists in Plugin settings
|
1672 |
+
if ( $val['enabled'] == true ) {
|
1673 |
+
self::update_options( array( $app => array( $val['name'] => 'on' ) ) );
|
1674 |
+
} else {
|
1675 |
+
self::update_options( array( $app => array( $val['name'] => 'off' ) ) );
|
1676 |
+
}
|
1677 |
+
}
|
1678 |
+
}
|
1679 |
+
}
|
1680 |
+
}
|
1681 |
+
}
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
/**
|
1685 |
+
* Sync status of In-Page Location Blocks - WP Plugin <=> Shareaholic Cloud
|
1686 |
+
*/
|
1687 |
+
public static function location_sync_status() {
|
1688 |
+
$api_key = self::get_option( 'api_key' );
|
1689 |
+
if ( $api_key ) {
|
1690 |
+
$app_locations = array(
|
1691 |
+
'share_buttons' => self::prepareLocationsArray( self::get_option( 'share_buttons' ) ),
|
1692 |
+
'recommendations' => self::prepareLocationsArray( self::get_option( 'recommendations' ) ),
|
1693 |
+
);
|
1694 |
+
|
1695 |
+
$payload = array(
|
1696 |
+
'verification_key' => self::get_option( 'verification_key' ),
|
1697 |
+
'app_locations' => $app_locations,
|
1698 |
+
);
|
1699 |
+
|
1700 |
+
$sync_status_url = Shareaholic::API_URL . '/publisher_tools/' . $api_key . '/sync/status';
|
1701 |
+
|
1702 |
+
$response = ShareaholicCurl::post(
|
1703 |
+
$sync_status_url,
|
1704 |
+
$payload,
|
1705 |
+
'json',
|
1706 |
+
true
|
1707 |
+
);
|
1708 |
+
|
1709 |
+
if ( is_array( $response ) && array_key_exists( 'body', $response ) ) {
|
1710 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
1711 |
+
if ( $response_code == '200' ) {
|
1712 |
+
return 200;
|
1713 |
+
}
|
1714 |
+
if ( $response_code == '409' ) {
|
1715 |
+
return 409;
|
1716 |
+
}
|
1717 |
+
if ( $response_code == '404' ) {
|
1718 |
+
return 404;
|
1719 |
+
}
|
1720 |
+
} else {
|
1721 |
+
return null;
|
1722 |
+
}
|
1723 |
+
}
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
/**
|
1727 |
+
* Sync In-Page Location Blocks - WP Plugin => Shareaholic Cloud
|
1728 |
+
*/
|
1729 |
+
public static function location_sync_to_cloud() {
|
1730 |
+
$api_key = self::get_option( 'api_key' );
|
1731 |
+
if ( $api_key ) {
|
1732 |
+
$app_locations = array(
|
1733 |
+
'share_buttons' => self::prepareLocationsArray( self::get_option( 'share_buttons' ) ),
|
1734 |
+
'recommendations' => self::prepareLocationsArray( self::get_option( 'recommendations' ) ),
|
1735 |
+
);
|
1736 |
+
|
1737 |
+
$payload = array(
|
1738 |
+
'verification_key' => self::get_option( 'verification_key' ),
|
1739 |
+
'app_locations' => $app_locations,
|
1740 |
+
);
|
1741 |
+
|
1742 |
+
$sync_url = Shareaholic::API_URL . '/publisher_tools/' . $api_key . '/sync';
|
1743 |
+
|
1744 |
+
$response = ShareaholicCurl::post(
|
1745 |
+
$sync_url,
|
1746 |
+
$payload,
|
1747 |
+
'json',
|
1748 |
+
true
|
1749 |
+
);
|
1750 |
+
|
1751 |
+
if ( is_array( $response ) && array_key_exists( 'body', $response ) ) {
|
1752 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
1753 |
+
if ( $response_code == '200' ) {
|
1754 |
+
return true;
|
1755 |
+
}
|
1756 |
+
} else {
|
1757 |
+
return null;
|
1758 |
+
}
|
1759 |
+
}
|
1760 |
+
}
|
1761 |
+
|
1762 |
/**
|
1763 |
* Facebook Auth Token check
|
1764 |
*/
|