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

Version Description

New themes, improved content syncing for more accurate Related Content and Analytics, refreshed Post-Share Prompt Slider design, Related Posts headline customizer and more!

Download this release

Release Info

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

Code changes from version 8.10.3 to 8.10.4

Files changed (4) hide show
  1. admin.php +6 -8
  2. readme.txt +14 -1
  3. shareaholic.php +8 -5
  4. utilities.php +59 -43
admin.php CHANGED
@@ -35,7 +35,7 @@ class ShareaholicAdmin {
35
  }
36
 
37
  /**
38
- * Check if the user has dismissed the review message
39
  *
40
  */
41
  public static function check_review_dismissal() {
@@ -135,20 +135,18 @@ JQUERY;
135
 
136
  public static function display_review_notice() {
137
  $dismiss_url = wp_nonce_url('?'. self::REVIEW_DISMISS_OPTION .'=true', 'review-nonce');
138
-
139
  echo '
140
- <div class="updated">
141
- <p>' . __('You have been using the ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic plugin</a>' . __(' for some time now, do you like it? If so, please consider leaving us a review on WordPress.org! It would help us out a lot and we would really appreciate it.', 'shareaholic') . '
142
  <br />
143
  <br />
144
- <a onclick="location.href=\'' . esc_url($dismiss_url) . '\';" class="button button-primary" href="' . esc_url('https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post') . '" target="_blank">' . __('Leave a Review', 'shareaholic') . '</a>
145
- <a href="' . esc_url($dismiss_url) . '">' . __('No thanks', 'shareaholic') . '</a>
146
  </p>
147
  </div>';
148
-
149
  }
150
 
151
-
152
  /**
153
  * The function called during the admin_head action.
154
  *
35
  }
36
 
37
  /**
38
+ * Check if the current user has dismissed the review message
39
  *
40
  */
41
  public static function check_review_dismissal() {
135
 
136
  public static function display_review_notice() {
137
  $dismiss_url = wp_nonce_url('?'. self::REVIEW_DISMISS_OPTION .'=true', 'review-nonce');
138
+
139
  echo '
140
+ <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__) . ');">
141
+ <p style="background: rgba(255, 255, 255, 0.85); text-shadow: white 0px 0px 10px;">' . __('Hey there! we noticed that you have been using ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic</a>' . __(' for some time now. That is so great. Could you please do us a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation. ~ Your friends @ Shareaholic', 'shareaholic') . '
142
  <br />
143
  <br />
144
+ <a onclick="location.href=\'' . esc_url($dismiss_url) . '\';" class="button button-primary" href="' . esc_url('https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post') . '" target="_blank">' . __('Ok, you deserve it', 'shareaholic') . '</a>
145
+ <a href="' . esc_url($dismiss_url) . '">' . __('No, maybe later', 'shareaholic') . '</a>
146
  </p>
147
  </div>';
 
148
  }
149
 
 
150
  /**
151
  * The function called during the admin_head action.
152
  *
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, related posts, google analytics, share buttons, social sharing,
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
- Stable tag: 8.10.3
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
@@ -244,6 +244,10 @@ Yes! Shareaholic's core features are and always will be free.
244
 
245
  Shareaholic's paid services include Share Count Recovery, advanced analytics, premium customization settings, priority support, and more. To learn more, visit our [plan comparison page](https://www.shareaholic.com/plans).
246
 
 
 
 
 
247
  = Shareaholic is not displaying for me. Why, and what should I try? =
248
 
249
  Something on your own personal device/browser/connection is likely filtering web functionality like major social buttons. The usual cause for this uncommon issue is 3rd party browser add-on software that blocks ads and optionally filters out major social buttons. For example, some security apps and Internet connections have an option to filter social buttons. Usually a social filter option is disabled by default, but if you find that some software is inappropriately filtering Shareaholic, please [let us know](https://www.shareaholic.com/contact).
@@ -263,6 +267,13 @@ The default Shareaholic thumbnail width is 640px with dynamic height and no crop
263
  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.
264
 
265
  == Changelog ==
 
 
 
 
 
 
 
266
  = 8.10.3 (2018-12-11) =
267
  * Enhancement: Advanced option to include <code>%author%</code> tag for [Share Count Recovery](https://www.shareaholic.com/sharecounter/)
268
 
@@ -846,6 +857,8 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
846
  * Show Related Posts data status
847
 
848
  == Upgrade Notice ==
 
 
849
 
850
  = 8.10.3 =
851
  New option to include <code>%author%</code> tag for Share Count Recovery
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
+ Stable tag: 8.10.4
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
244
 
245
  Shareaholic's paid services include Share Count Recovery, advanced analytics, premium customization settings, priority support, and more. To learn more, visit our [plan comparison page](https://www.shareaholic.com/plans).
246
 
247
+ = Do I need to have coding skills to use Shareaholic? =
248
+
249
+ Not at all. You can manage Shareaholic without any coding using our user-friendly drag and drop interface.
250
+
251
  = Shareaholic is not displaying for me. Why, and what should I try? =
252
 
253
  Something on your own personal device/browser/connection is likely filtering web functionality like major social buttons. The usual cause for this uncommon issue is 3rd party browser add-on software that blocks ads and optionally filters out major social buttons. For example, some security apps and Internet connections have an option to filter social buttons. Usually a social filter option is disabled by default, but if you find that some software is inappropriately filtering Shareaholic, please [let us know](https://www.shareaholic.com/contact).
267
  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.
268
 
269
  == Changelog ==
270
+
271
+ = 8.10.4 (2018-12-21) =
272
+ * Enhancement: [New Related Posts Themes](https://www.shareaholic.com/blog/new-related-content-widget-themes/) - two of which are inspired by Medium.com and Wired.com
273
+ * Enhancement: [Related Posts Headline Customizer](https://www.shareaholic.com/website-tools/related-content/) - headline design can now be customized via the UI, including font typeface, size, color, etc
274
+ * Enhancement: Improved content syncing between WordPress and Shareaholic Cloud for more accurate Related Content and Analytics
275
+ * Enhancement: [Share Buttons](https://www.shareaholic.com/website-tools/social-share-buttons/) Post-Share Prompt Slider gets a [design refresh](https://www.shareaholic.com/blog/post-share-prompt-slider-gets-a-design-refresh/)
276
+
277
  = 8.10.3 (2018-12-11) =
278
  * Enhancement: Advanced option to include <code>%author%</code> tag for [Share Count Recovery](https://www.shareaholic.com/sharecounter/)
279
 
857
  * Show Related Posts data status
858
 
859
  == Upgrade Notice ==
860
+ = 8.10.4 =
861
+ New themes, improved content syncing for more accurate Related Content and Analytics, refreshed Post-Share Prompt Slider design, Related Posts headline customizer and more!
862
 
863
  = 8.10.3 =
864
  New option to include <code>%author%</code> tag for Share Count Recovery
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 8.10.3
7
  */
8
 
9
  /*
10
- Plugin Name: Shareaholic - Share Buttons, Analytics, Related Posts
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
- Description: The best WordPress all-in-one Social Media and Related Posts solution. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
- Version: 8.10.3
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
@@ -61,7 +61,7 @@ if (!class_exists('Shareaholic')) {
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
- const VERSION = '8.10.3';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
@@ -135,6 +135,9 @@ if (!class_exists('Shareaholic')) {
135
 
136
  // do something before a post is updated
137
  add_action('pre_post_update', array('ShareaholicUtilities', 'before_post_is_updated'));
 
 
 
138
 
139
  // do something before a site's permalink structure changes
140
  add_action('update_option_permalink_structure', array('ShareaholicUtilities', 'notify_content_manager_singledomain'));
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 8.10.4
7
  */
8
 
9
  /*
10
+ Plugin Name: Fast Share Buttons, Analytics, Related Posts and More
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
+ Description: The award winning all-in-one Social Media and Related Posts solution for WordPress. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
+ Version: 8.10.4
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
+ const VERSION = '8.10.4';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
135
 
136
  // do something before a post is updated
137
  add_action('pre_post_update', array('ShareaholicUtilities', 'before_post_is_updated'));
138
+
139
+ // do something before a post is trashed
140
+ add_action('pre_trash_post', array('ShareaholicUtilities', 'before_post_is_trashed'));
141
 
142
  // do something before a site's permalink structure changes
143
  add_action('update_option_permalink_structure', array('ShareaholicUtilities', 'notify_content_manager_singledomain'));
utilities.php CHANGED
@@ -998,42 +998,28 @@ class ShareaholicUtilities {
998
  }
999
  }
1000
 
1001
- /**
1002
- * Answers whether we should ping CM
1003
- *
1004
- * @return bool
1005
- */
1006
- public static function should_notify_cm() {
1007
- $settings = ShareaholicUtilities::get_settings();
1008
- $recommendations_settings = isset($settings['recommendations']) ?
1009
- $settings["recommendations"] :
1010
- null;
1011
-
1012
- if (is_array($recommendations_settings)) {
1013
- if (in_array("on", $recommendations_settings)) {
1014
- return true;
1015
- } else {
1016
- return false;
1017
- }
1018
- } else {
1019
- return false;
1020
- }
1021
- }
1022
-
1023
  /**
1024
  * Wrapper for the Shareaholic Content Manager Single Page worker API
1025
  *
1026
  * @param string $post_id
1027
  */
1028
- public static function notify_content_manager_singlepage($post = NULL) {
1029
 
1030
  if ($post == NULL) {
1031
- return false;
1032
  }
1033
 
1034
  $api_key = ShareaholicUtilities::get_option('api_key');
 
1035
  if (ShareaholicUtilities::has_accepted_terms_of_service() && !empty($api_key)) {
1036
- if (in_array($post->post_status, array('draft', 'pending', 'auto-draft'))) {
 
 
 
 
 
 
 
1037
  // Get the correct permalink for a draft
1038
  $my_post = clone $post;
1039
  $my_post->post_status = 'published';
@@ -1043,39 +1029,49 @@ class ShareaholicUtilities {
1043
  $post_permalink = get_permalink($post->ID);
1044
  }
1045
 
1046
- if ($post_permalink != NULL) {
 
 
1047
  $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
1048
  $payload = array (
1049
  'args' => array (
1050
  $post_permalink,
1051
- array ('force' => true)
1052
- )
1053
- );
1054
-
 
 
 
 
 
 
1055
  $response = ShareaholicCurl::post($cm_single_page_job_url, $payload, 'json');
1056
- }
1057
- }
1058
- }
 
1059
 
1060
  /**
1061
  * Wrapper for the Shareaholic Content Manager Single Domain worker API
1062
  *
1063
- * @param string $domain
1064
  */
1065
- public static function notify_content_manager_singledomain($domain = NULL) {
1066
- if ($domain == NULL) {
1067
- $domain = get_bloginfo('url');
1068
- }
1069
-
1070
  if ($domain != NULL) {
1071
  $cm_single_domain_job_url = Shareaholic::CM_API_URL . '/jobs/single_domain';
1072
  $payload = array (
1073
  'args' => array (
1074
  $domain,
1075
- array ('force' => true)
1076
- )
1077
- );
1078
-
 
 
 
 
 
1079
  $response = ShareaholicCurl::post($cm_single_domain_job_url, $payload, 'json');
1080
  }
1081
  }
@@ -1543,6 +1539,26 @@ class ShareaholicUtilities {
1543
  }
1544
 
1545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1546
  /**
1547
  * Call the content manager for a post before it is updated
1548
  *
998
  }
999
  }
1000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  /**
1002
  * Wrapper for the Shareaholic Content Manager Single Page worker API
1003
  *
1004
  * @param string $post_id
1005
  */
1006
+ public static function notify_content_manager_singlepage($post = NULL, $status = NULL) {
1007
 
1008
  if ($post == NULL) {
1009
+ return;
1010
  }
1011
 
1012
  $api_key = ShareaholicUtilities::get_option('api_key');
1013
+
1014
  if (ShareaholicUtilities::has_accepted_terms_of_service() && !empty($api_key)) {
1015
+
1016
+ if ($status != NULL) {
1017
+ $visiblity = $status;
1018
+ } else {
1019
+ $visiblity = $post->post_status;
1020
+ }
1021
+
1022
+ if (in_array($post->post_status, array('draft', 'pending'))) {
1023
  // Get the correct permalink for a draft
1024
  $my_post = clone $post;
1025
  $my_post->post_status = 'published';
1029
  $post_permalink = get_permalink($post->ID);
1030
  }
1031
 
1032
+ if ($post_permalink != NULL
1033
+ && (strpos($post_permalink, '__trashed') == false)
1034
+ && !in_array($post->post_status, array('auto-draft', 'inherit')) ) {
1035
  $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
1036
  $payload = array (
1037
  'args' => array (
1038
  $post_permalink,
1039
+ array (
1040
+ 'force' => true
1041
+ ),
1042
+ ),
1043
+ 'api_key' => ShareaholicUtilities::get_option('api_key'),
1044
+ 'verification_key' => ShareaholicUtilities::get_option('verification_key'),
1045
+ 'admin_ajax_path' => admin_url('admin-ajax.php'),
1046
+ 'wp_version' => Shareaholic::VERSION,
1047
+ 'post_visibility' => $visiblity
1048
+ );
1049
  $response = ShareaholicCurl::post($cm_single_page_job_url, $payload, 'json');
1050
+ }
1051
+
1052
+ }
1053
+ }
1054
 
1055
  /**
1056
  * Wrapper for the Shareaholic Content Manager Single Domain worker API
1057
  *
 
1058
  */
1059
+ public static function notify_content_manager_singledomain() {
1060
+ $domain = get_bloginfo('url');
 
 
 
1061
  if ($domain != NULL) {
1062
  $cm_single_domain_job_url = Shareaholic::CM_API_URL . '/jobs/single_domain';
1063
  $payload = array (
1064
  'args' => array (
1065
  $domain,
1066
+ array (
1067
+ 'force' => true
1068
+ ),
1069
+ ),
1070
+ 'api_key' => ShareaholicUtilities::get_option('api_key'),
1071
+ 'verification_key' => ShareaholicUtilities::get_option('verification_key'),
1072
+ 'admin_ajax_path' => admin_url('admin-ajax.php'),
1073
+ 'wp_version' => Shareaholic::VERSION
1074
+ );
1075
  $response = ShareaholicCurl::post($cm_single_domain_job_url, $payload, 'json');
1076
  }
1077
  }
1539
  }
1540
 
1541
 
1542
+ /**
1543
+ * Call the content manager for a post before it is trashed
1544
+ *
1545
+ * We do this because permalink changes on being trashed
1546
+ * and so we tell CM that the old permalink is no longer valid
1547
+ *
1548
+ */
1549
+ public static function before_post_is_trashed($post_id) {
1550
+
1551
+ $post_type = get_post_type($post_id);
1552
+
1553
+ // exit if blacklisted post type
1554
+ if ($post_type && in_array($post_type, ShareaholicUtilities::$blacklisted_post_types)) {
1555
+ return;
1556
+ }
1557
+
1558
+ ShareaholicUtilities::notify_content_manager_singlepage(get_post($post_id), 'trash');
1559
+ }
1560
+
1561
+
1562
  /**
1563
  * Call the content manager for a post before it is updated
1564
  *