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

Version Description

  • Tested on WordPress 3.9.1
  • Bugfix: Fixed annoying bug where Facebook was trying to cache scheduled posts before they were live
  • Share Buttons enhancements
    • Shareaholic now resets the Facebook Open Graph cache (title, description and image) for you automatically when a post is published, so the right stuff gets shared, every time.
    • Share Counts + Floating Share Buttons!
    • New icons for Viadeo, HootSuite, Wanelo
  • Related Content
    • Greatly improved reliability
Download this release

Release Info

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

Code changes from version 7.4.0.5 to 7.4.0.6

Files changed (4) hide show
  1. public.php +1 -1
  2. readme.txt +16 -2
  3. shareaholic.php +8 -13
  4. utilities.php +41 -3
public.php CHANGED
@@ -205,7 +205,7 @@ class ShareaholicPublic {
205
  $article_visibility = $post->post_status;
206
  $article_password = $post->post_password;
207
 
208
- if ($article_visibility == 'draft' || $article_visibility == 'auto-draft'){
209
  $article_visibility = 'draft';
210
  } else if ($article_visibility == 'private' || $post->post_password != '' || is_attachment()) {
211
  $article_visibility = 'private';
205
  $article_visibility = $post->post_status;
206
  $article_password = $post->post_password;
207
 
208
+ if ($article_visibility == 'draft' || $article_visibility == 'auto-draft' || $article_visibility == 'future' || $article_visibility == 'pending'){
209
  $article_visibility = 'draft';
210
  } else if ($article_visibility == 'private' || $post->post_password != '' || is_attachment()) {
211
  $article_visibility = 'private';
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, 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, 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: 3.9
6
- Stable tag: 7.4.0.5
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
@@ -155,6 +155,16 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
 
 
 
 
 
158
  = 7.4.0.5 =
159
  * Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
160
 
@@ -1057,6 +1067,10 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
1057
 
1058
  == Upgrade Notice ==
1059
 
 
 
 
 
1060
  = 7.4.0.5 =
1061
 
1062
  Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
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, 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, 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: 3.9.1
6
+ Stable tag: 7.4.0.6
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
155
 
156
  == Changelog ==
157
 
158
+ = 7.4.0.6 =
159
+ * Tested on WordPress 3.9.1
160
+ * Bugfix: Fixed annoying bug where Facebook was trying to cache scheduled posts before they were live
161
+ * [Share Buttons](http://sharebuttons.com/) enhancements
162
+ * Shareaholic now resets the Facebook Open Graph cache (title, description and image) for you automatically when a post is published, so the right stuff gets shared, every time.
163
+ * [Share Counts + Floating Share Buttons](https://blog.shareaholic.com/floating-share-buttons-and-social-share-counts/)!
164
+ * New icons for Viadeo, HootSuite, Wanelo
165
+ * [Related Content](https://shareaholic.com/publishers/recommendations/)
166
+ * Greatly improved reliability
167
+
168
  = 7.4.0.5 =
169
  * Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
170
 
1067
 
1068
  == Upgrade Notice ==
1069
 
1070
+ = 7.4.0.6 =
1071
+
1072
+ Many improvements to Facebook sharing and Related Content.
1073
+
1074
  = 7.4.0.5 =
1075
 
1076
  Added cache cleanup support for WP Super Cache, Hyper Cache and Quick Cache plugin's
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 7.4.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.4.0.5
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
@@ -61,7 +61,7 @@ class Shareaholic {
61
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const REC_API_URL = 'http://recommendations.shareaholic.com';
63
 
64
- const VERSION = '7.4.0.5';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
@@ -95,25 +95,20 @@ class Shareaholic {
95
  add_action('admin_menu', array('ShareaholicAdmin', 'admin_menu'));
96
 
97
  if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
98
- add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
99
  }
100
-
101
  // add_action('publish_post', array('ShareaholicNotifier', 'post_notify'));
102
  // add_action('publish_page', array('ShareaholicNotifier', 'post_notify'));
103
-
104
- // Check if at least one Related Content location is enabled, if so, notify CM when a new post is published
105
- if (ShareaholicUtilities::should_notify_cm()) {
106
- add_action('publish_post', array('ShareaholicUtilities', 'notify_content_manager_singlepage'));
107
- add_action('publish_page', array('ShareaholicUtilities', 'notify_content_manager_singlepage'));
108
- }
109
- add_action('trashed_post', array('ShareaholicUtilities', 'notify_content_manager_singlepage'));
110
 
111
  register_activation_hook(__FILE__, array($this, 'after_activation'));
112
  register_deactivation_hook( __FILE__, array($this, 'deactivate'));
113
  register_uninstall_hook(__FILE__, array('Shareaholic', 'uninstall'));
114
 
115
  add_action('wp_before_admin_bar_render', array('ShareaholicUtilities', 'admin_bar_extended'));
116
- add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
117
  }
118
 
119
  /**
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.4.0.6
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.4.0.6
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
61
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const REC_API_URL = 'http://recommendations.shareaholic.com';
63
 
64
+ const VERSION = '7.4.0.6';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
95
  add_action('admin_menu', array('ShareaholicAdmin', 'admin_menu'));
96
 
97
  if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
98
+ add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
99
  }
100
+
101
  // add_action('publish_post', array('ShareaholicNotifier', 'post_notify'));
102
  // add_action('publish_page', array('ShareaholicNotifier', 'post_notify'));
103
+
104
+ add_action('transition_post_status', array('ShareaholicUtilities', 'post_transitioned'), 10, 3);
 
 
 
 
 
105
 
106
  register_activation_hook(__FILE__, array($this, 'after_activation'));
107
  register_deactivation_hook( __FILE__, array($this, 'deactivate'));
108
  register_uninstall_hook(__FILE__, array('Shareaholic', 'uninstall'));
109
 
110
  add_action('wp_before_admin_bar_render', array('ShareaholicUtilities', 'admin_bar_extended'));
111
+ add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
112
  }
113
 
114
  /**
utilities.php CHANGED
@@ -858,9 +858,21 @@ class ShareaholicUtilities {
858
  *
859
  * @param string $post_id
860
  */
861
- public static function notify_content_manager_singlepage($post_id = NULL) {
862
- $post_permalink = get_permalink($post_id);
863
-
 
 
 
 
 
 
 
 
 
 
 
 
864
  if ($post_permalink != NULL) {
865
  $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
866
  $payload = array (
@@ -989,6 +1001,32 @@ class ShareaholicUtilities {
989
  auto_clear_cache();
990
  }
991
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
 
993
  /**
994
  * Server Connectivity check
858
  *
859
  * @param string $post_id
860
  */
861
+ public static function notify_content_manager_singlepage($post = NULL) {
862
+ if ($post == NULL) {
863
+ return false;
864
+ }
865
+
866
+ if (in_array($post->post_status, array('draft', 'pending', 'auto-draft'))) {
867
+ // Get the correct permalink for a draft
868
+ $my_post = clone $post;
869
+ $my_post->post_status = 'published';
870
+ $my_post->post_name = sanitize_title($my_post->post_name ? $my_post->post_name : $my_post->post_title, $my_post->ID);
871
+ $post_permalink = get_permalink($my_post);
872
+ } else {
873
+ $post_permalink = get_permalink($post->ID);
874
+ }
875
+
876
  if ($post_permalink != NULL) {
877
  $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
878
  $payload = array (
1001
  auto_clear_cache();
1002
  }
1003
  }
1004
+
1005
+ /**
1006
+ * A post just transitioned state. Do something.
1007
+ *
1008
+ */
1009
+ public static function post_transitioned($new_status, $old_status, $post) {
1010
+ if ($new_status == 'publish') {
1011
+ // Post was just published
1012
+ ShareaholicUtilities::clear_fb_opengraph(get_permalink($post->ID));
1013
+ ShareaholicUtilities::notify_content_manager_singlepage($post);
1014
+ }
1015
+ if ($old_status == 'publish' && $new_status != 'publish') {
1016
+ // Notify CM that the post is no longer public
1017
+ ShareaholicUtilities::notify_content_manager_singlepage($post);
1018
+ }
1019
+ }
1020
+
1021
+ /**
1022
+ * Clears Facebook Open Graph cache for provided URL
1023
+ *
1024
+ * @param string $url
1025
+ */
1026
+ public static function clear_fb_opengraph($url) {
1027
+ $fb_graph_url = "https://graph.facebook.com/?id=". urlencode($url) ."&scrape=true";
1028
+ $result = wp_remote_post ($fb_graph_url);
1029
+ }
1030
 
1031
  /**
1032
  * Server Connectivity check