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

Version Description

  • Bugfix: Fixed admin bar link
  • Bugfix: Properly escape meta tags values
  • Enhancement: Better compatibility with caching plugins
  • Enhancement: Better compatibility with Base64 image strings
  • Various performance upgrades
Download this release

Release Info

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

Code changes from version 7.8.0.5 to 7.8.0.6

Files changed (5) hide show
  1. admin.php +7 -8
  2. public.php +16 -3
  3. readme.txt +12 -2
  4. shareaholic.php +9 -6
  5. utilities.php +40 -30
admin.php CHANGED
@@ -499,28 +499,27 @@ class ShareaholicAdmin {
499
  public static function send_welcome_email() {
500
  $site_url = get_bloginfo('url');
501
  $api_key = ShareaholicUtilities::get_option('api_key');
502
- $payment_url = 'https://shareaholic.com/account';
503
  $shr_wp_dashboard_url = admin_url('admin.php?page=shareaholic-settings');
504
- $sign_up_link = 'https://shareaholic.com/publisher_tools/'.ShareaholicUtilities::get_option('api_key').'/verify?verification_key='.ShareaholicUtilities::get_option('verification_key').'&redirect_to='.'https://shareaholic.com/publisher_tools/'.ShareaholicUtilities::get_option('api_key').'/websites/edit?verification_key='.ShareaholicUtilities::get_option('verification_key');
505
-
506
  $to = get_bloginfo('admin_email');
507
  $subject = 'Thank you for installing Shareaholic for WordPress!';
508
  $message = "
509
  <p>Hi there,</p>
510
 
511
- <p>Thank you for installing Shareaholic on $site_url! You are one step closer to growing your website traffic and revenue with our award winning all-in-one content amplification platform. Completing your set-up is easy, just follow these three easy steps and you'll be ready to go:</p>
512
 
513
  <p><strong>Step 1. Customize to your needs</strong><br /><br />
514
 
515
- Personalize the design of the Share Buttons and Related Content Recommendations App to match your website using the \"Customize\" buttons in your <a href='$shr_wp_dashboard_url'>Shareaholic App Manager in WordPress</a>, then choose where you want them to appear on your website using the checkboxes!
516
 
517
- <p><strong>Step 2: Sign-up for a free Shareaholic account</strong><br /><br />
518
 
519
- This will allow you to add more (free!) features like Analytics, Floating Share Buttons, Follow Buttons and more. <strong><a href='$sign_up_link'>Click here to sign-up</a></strong>, or <a href='$sign_up_link'>login to an existing Shareaholic account</a> and we'll automatically sync the plugin settings with your account.</p>
520
 
521
  <p><strong>Step 3: Control your earnings and setup how you would like to get paid</strong><br /><br />
522
 
523
- Decide how much you would like to earn from Promoted Content (native ads that appear in the Related Content app) and other monetization apps by editing your settings in the \"Monetization\" section of the plugin. Next, visit the \"Username and email address\" <a href='$payment_url'>section of your Shareaholic.com account</a> to add your PayPal information, so you can collect the revenue you generate from Shareaholic.</p>
524
 
525
  <p>Have questions? Simply reply to this email and we will help you out!</p>
526
 
499
  public static function send_welcome_email() {
500
  $site_url = get_bloginfo('url');
501
  $api_key = ShareaholicUtilities::get_option('api_key');
502
+ $payment_url = 'https://shareaholic.com/user-settings/payments';
503
  $shr_wp_dashboard_url = admin_url('admin.php?page=shareaholic-settings');
504
+ $sign_up_link = 'https://shareaholic.com/publisher_tools/'.ShareaholicUtilities::get_option('api_key').'/websites/edit/?verification_key='.ShareaholicUtilities::get_option('verification_key');
 
505
  $to = get_bloginfo('admin_email');
506
  $subject = 'Thank you for installing Shareaholic for WordPress!';
507
  $message = "
508
  <p>Hi there,</p>
509
 
510
+ <p>Thank you for installing Shareaholic on $site_url! You are one step closer to growing your website. Completing your set-up is easy, just follow these three easy steps and you'll be ready to go:</p>
511
 
512
  <p><strong>Step 1. Customize to your needs</strong><br /><br />
513
 
514
+ Personalize the various apps (ex. Share Buttons and Related Content) to match your website using the \"Customize\" buttons in your <a href='$shr_wp_dashboard_url'>Shareaholic App Manager in WordPress</a>, then choose where you want them to appear on your website using the checkboxes!
515
 
516
+ <p><strong>Step 2: Get your free Shareaholic account</strong><br /><br />
517
 
518
+ This will enable you to add more features like Analytics, Floating Share Buttons, Share Buttons for Images, Follow Buttons and more. <strong><a href='$sign_up_link'>Click here to sign-up</a></strong>, or <a href='$sign_up_link'>login to an existing Shareaholic account</a> and we'll automatically sync the plugin settings with your account.</p>
519
 
520
  <p><strong>Step 3: Control your earnings and setup how you would like to get paid</strong><br /><br />
521
 
522
+ Decide how much you would like to earn from Promoted Content (native ads that appear in the Related Content app) and other monetization apps by editing your settings in the \"Monetization\" section of the plugin. Next, visit the \"Payments\" <a href='$payment_url'>section of your Shareaholic.com account</a> to add your PayPal information, so you can collect the revenue your site earns.</p>
523
 
524
  <p>Have questions? Simply reply to this email and we will help you out!</p>
525
 
public.php CHANGED
@@ -169,9 +169,15 @@ class ShareaholicPublic {
169
  * Draws Shareaholic article meta tags
170
  */
171
  private static function draw_article_meta_tag() {
 
 
 
 
 
 
172
  if (in_array(ShareaholicUtilities::page_type(), array('page', 'post'))) {
173
  global $post;
174
-
175
  // Article Publish and Modified Time
176
  $article_published_time = strtotime($post->post_date_gmt);
177
  $article_modified_time = strtotime(get_lastpostmodified('GMT'));
@@ -219,7 +225,7 @@ class ShareaholicPublic {
219
  }
220
  }
221
  if (!empty($article_author_name)) {
222
- echo "<meta name='shareaholic:article_author_name' content='" . $article_author_name . "' />\n";
223
  }
224
  }
225
  }
@@ -279,6 +285,9 @@ class ShareaholicPublic {
279
  global $post;
280
  $thumbnail_src = '';
281
 
 
 
 
282
  if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
283
  $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
284
  $thumbnail_src = esc_attr($thumbnail[0]);
@@ -300,7 +309,11 @@ class ShareaholicPublic {
300
  global $post;
301
  $thumbnail_src = '';
302
  $settings = ShareaholicUtilities::get_settings();
303
- if (!get_post_meta($post->ID, 'shareaholic_disable_open_graph_tags', true) && (isset($settings['disable_og_tags']) && $settings['disable_og_tags'] == "off")) {
 
 
 
 
304
  if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
305
  $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
306
  $thumbnail_src = esc_attr($thumbnail[0]);
169
  * Draws Shareaholic article meta tags
170
  */
171
  private static function draw_article_meta_tag() {
172
+
173
+ if (in_array(ShareaholicUtilities::page_type(), array('index', 'category'))) {
174
+ echo "<meta name='shareaholic:article_visibility' content='private' />\n";
175
+ return;
176
+ }
177
+
178
  if (in_array(ShareaholicUtilities::page_type(), array('page', 'post'))) {
179
  global $post;
180
+
181
  // Article Publish and Modified Time
182
  $article_published_time = strtotime($post->post_date_gmt);
183
  $article_modified_time = strtotime(get_lastpostmodified('GMT'));
225
  }
226
  }
227
  if (!empty($article_author_name)) {
228
+ echo "<meta name='shareaholic:article_author_name' content='" . htmlspecialchars($article_author_name, ENT_QUOTES) . "' />\n";
229
  }
230
  }
231
  }
285
  global $post;
286
  $thumbnail_src = '';
287
 
288
+ if (is_attachment()) {
289
+ $thumbnail_src = wp_get_attachment_thumb_url();
290
+ }
291
  if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
292
  $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
293
  $thumbnail_src = esc_attr($thumbnail[0]);
309
  global $post;
310
  $thumbnail_src = '';
311
  $settings = ShareaholicUtilities::get_settings();
312
+
313
+ if (!get_post_meta($post->ID, 'shareaholic_disable_open_graph_tags', true) && (isset($settings['disable_og_tags']) && $settings['disable_og_tags'] == "off")) {
314
+ if (is_attachment()) {
315
+ $thumbnail_src = wp_get_attachment_thumb_url();
316
+ }
317
  if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
318
  $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
319
  $thumbnail_src = esc_attr($thumbnail[0]);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: shareaholic
3
  Tags: share buttons, related content, cookie compliance, eu cookie law, shareaholic, shareholic, sexybookmarks, recommendations, cookie consent, email button, social sharing, social bookmarking, share image, image sharing, follow buttons, floated share buttons, floating share buttons, analytics, social media, social plugin, facebook, twitter, google plus, google bookmarks, gmail, linkedin, pinterest, reddit, tumblr, evernote, digg, delicious, stumbleupon, printfriendly, fancy, amazon, xing, vk, yahoo, mister wong, viadeo, odnoklassniki box.net, diigo, yammer, ycombinator, hotmail, instapaper, mixi, arto, whatsapp, hootsuite, inbound.org, plurk, aim, buffer, meneame, pinboard.in, stumpedia, bitly, blogger, yummly, izeby, kaboodle, weibo, instagram, tinyurl, typepad, weheartit, flipboard, pocket, wanelo, fark, wykop, symphony, kindle, houzz, youtube, sms, onenote, google classroom, disqus, spotify, zillow, feedly, kik, line, livejournal, baidu
4
  Requires at least: 3.0
5
- Tested up to: 4.7.3
6
- Stable tag: 7.8.0.5
7
 
8
  World's leading all-in-one Content Amplification Platform that helps grow your site traffic, engagement, conversions & monetization for FREE.
9
 
@@ -194,6 +194,13 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
 
 
197
  = 7.8.0.5 =
198
  * Minor enhancements
199
 
@@ -1033,6 +1040,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
1033
 
1034
  == Upgrade Notice ==
1035
 
 
 
 
1036
  = 7.8.0.5 =
1037
  Minor enhancements
1038
 
2
  Contributors: shareaholic
3
  Tags: share buttons, related content, cookie compliance, eu cookie law, shareaholic, shareholic, sexybookmarks, recommendations, cookie consent, email button, social sharing, social bookmarking, share image, image sharing, follow buttons, floated share buttons, floating share buttons, analytics, social media, social plugin, facebook, twitter, google plus, google bookmarks, gmail, linkedin, pinterest, reddit, tumblr, evernote, digg, delicious, stumbleupon, printfriendly, fancy, amazon, xing, vk, yahoo, mister wong, viadeo, odnoklassniki box.net, diigo, yammer, ycombinator, hotmail, instapaper, mixi, arto, whatsapp, hootsuite, inbound.org, plurk, aim, buffer, meneame, pinboard.in, stumpedia, bitly, blogger, yummly, izeby, kaboodle, weibo, instagram, tinyurl, typepad, weheartit, flipboard, pocket, wanelo, fark, wykop, symphony, kindle, houzz, youtube, sms, onenote, google classroom, disqus, spotify, zillow, feedly, kik, line, livejournal, baidu
4
  Requires at least: 3.0
5
+ Tested up to: 4.7
6
+ Stable tag: 7.8.0.6
7
 
8
  World's leading all-in-one Content Amplification Platform that helps grow your site traffic, engagement, conversions & monetization for FREE.
9
 
194
 
195
  == Changelog ==
196
 
197
+ = 7.8.0.6 =
198
+ * Bugfix: Fixed admin bar link
199
+ * Bugfix: Properly escape meta tags values
200
+ * Enhancement: Better compatibility with caching plugins
201
+ * Enhancement: Better compatibility with Base64 image strings
202
+ * Various performance upgrades
203
+
204
  = 7.8.0.5 =
205
  * Minor enhancements
206
 
1040
 
1041
  == Upgrade Notice ==
1042
 
1043
+ = 7.8.0.6 =
1044
+ Various enhancements
1045
+
1046
  = 7.8.0.5 =
1047
  Minor enhancements
1048
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 7.8.0.5
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: The world's leading all-in-one Content Amplification Platform that helps grow your website traffic, engagement, conversions & monetization. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
- Version: 7.8.0.5
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
@@ -63,7 +63,7 @@ if (!class_exists('Shareaholic')) {
63
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
64
  const REC_API_URL = 'http://recommendations.shareaholic.com';
65
 
66
- const VERSION = '7.8.0.5';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
@@ -207,8 +207,11 @@ if (!class_exists('Shareaholic')) {
207
  ShareaholicUtilities::log_event("Upgrade", array ('previous_plugin_version' => ShareaholicUtilities::get_version()));
208
  ShareaholicUtilities::perform_update();
209
  ShareaholicUtilities::set_version(self::VERSION);
210
- ShareaholicUtilities::notify_content_manager_sitemap();
211
- ShareaholicUtilities::notify_content_manager_singledomain();
 
 
 
212
 
213
  // Call the share counts api to check for connectivity on update
214
  if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
@@ -242,7 +245,7 @@ if (!class_exists('Shareaholic')) {
242
 
243
  // workaround: http://codex.wordpress.org/Function_Reference/register_activation_hook
244
  add_option( 'Activated_Plugin_Shareaholic', 'shareaholic' );
245
-
246
  if (ShareaholicUtilities::has_accepted_terms_of_service() && ShareaholicUtilities::get_option('api_key') != NULL){
247
  ShareaholicUtilities::notify_content_manager_sitemap();
248
  ShareaholicUtilities::notify_content_manager_singledomain();
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.8.0.6
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: The world's leading all-in-one Content Amplification Platform that helps grow your website traffic, engagement, conversions & monetization. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
+ Version: 7.8.0.6
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
63
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
64
  const REC_API_URL = 'http://recommendations.shareaholic.com';
65
 
66
+ const VERSION = '7.8.0.6';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
207
  ShareaholicUtilities::log_event("Upgrade", array ('previous_plugin_version' => ShareaholicUtilities::get_version()));
208
  ShareaholicUtilities::perform_update();
209
  ShareaholicUtilities::set_version(self::VERSION);
210
+
211
+ if (ShareaholicUtilities::has_accepted_terms_of_service() && ShareaholicUtilities::get_option('api_key') != NULL) {
212
+ ShareaholicUtilities::notify_content_manager_sitemap();
213
+ ShareaholicUtilities::notify_content_manager_singledomain();
214
+ }
215
 
216
  // Call the share counts api to check for connectivity on update
217
  if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
245
 
246
  // workaround: http://codex.wordpress.org/Function_Reference/register_activation_hook
247
  add_option( 'Activated_Plugin_Shareaholic', 'shareaholic' );
248
+
249
  if (ShareaholicUtilities::has_accepted_terms_of_service() && ShareaholicUtilities::get_option('api_key') != NULL){
250
  ShareaholicUtilities::notify_content_manager_sitemap();
251
  ShareaholicUtilities::notify_content_manager_singledomain();
utilities.php CHANGED
@@ -139,7 +139,7 @@ class ShareaholicUtilities {
139
  'parent' => 'wp_shareaholic_adminbar_menu',
140
  'id' => 'wp_shareaholic_adminbar_submenu-general',
141
  'title' => __('Website Settings', 'shareaholic'),
142
- 'href' => 'https://shareaholic.com/publisher_tools/'.self::get_option('api_key').'/verify?verification_key='.self::get_option('verification_key').'&redirect_to='.'https://shareaholic.com/publisher_tools/'.self::get_option('api_key').'/websites/edit?verification_key='.self::get_option('verification_key'),
143
  'meta' => Array( 'target' => '_blank' )
144
  ));
145
  $wp_admin_bar->add_menu(array(
@@ -354,7 +354,7 @@ class ShareaholicUtilities {
354
  return 'page';
355
  } elseif (is_single()) {
356
  return 'post';
357
- } elseif (is_category() || is_author() || is_tag() || is_date()) {
358
  return 'category';
359
  }
360
  }
@@ -948,31 +948,34 @@ class ShareaholicUtilities {
948
  * @param string $post_id
949
  */
950
  public static function notify_content_manager_singlepage($post = NULL) {
 
951
  if ($post == NULL) {
952
  return false;
953
  }
954
-
955
- if (in_array($post->post_status, array('draft', 'pending', 'auto-draft'))) {
956
- // Get the correct permalink for a draft
957
- $my_post = clone $post;
958
- $my_post->post_status = 'published';
959
- $my_post->post_name = sanitize_title($my_post->post_name ? $my_post->post_name : $my_post->post_title, $my_post->ID);
960
- $post_permalink = get_permalink($my_post);
961
- } else {
962
- $post_permalink = get_permalink($post->ID);
963
- }
964
 
965
- if ($post_permalink != NULL) {
966
- $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
967
- $payload = array (
968
- 'args' => array (
969
- $post_permalink,
970
- array ('force' => true)
971
- )
972
- );
973
- $response = ShareaholicCurl::post($cm_single_page_job_url, $payload, 'json');
974
- }
975
- }
 
 
 
 
 
 
 
 
 
 
 
 
976
 
977
  /**
978
  * Wrapper for the Shareaholic Content Manager Single Domain worker API
@@ -1185,10 +1188,13 @@ class ShareaholicUtilities {
1185
  $first_img = '';
1186
  if ($post == NULL)
1187
  return false;
1188
- else {
1189
- $output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
1190
- if(isset($matches[1][0]) ){
1191
- $first_img = $matches[1][0];
 
 
 
1192
  } else {
1193
  return false;
1194
  }
@@ -1203,20 +1209,24 @@ class ShareaholicUtilities {
1203
  public static function clear_cache() {
1204
  // W3 Total Cache plugin
1205
  if (function_exists('w3tc_pgcache_flush')) {
1206
- w3tc_pgcache_flush();
1207
  }
1208
  // WP Super Cache
1209
  if (function_exists('wp_cache_clear_cache')) {
1210
  wp_cache_clear_cache();
1211
  }
1212
  // Hyper Cache
1213
- if (function_exists('hyper_cache_invalidate')) {
1214
- hyper_cache_invalidate();
1215
  }
1216
  // Quick Cache
1217
  if (function_exists('auto_clear_cache')) {
1218
  auto_clear_cache();
1219
  }
 
 
 
 
1220
  }
1221
 
1222
  /**
139
  'parent' => 'wp_shareaholic_adminbar_menu',
140
  'id' => 'wp_shareaholic_adminbar_submenu-general',
141
  'title' => __('Website Settings', 'shareaholic'),
142
+ 'href' => 'https://shareaholic.com/publisher_tools/'.self::get_option('api_key').'/websites/edit/?verification_key='.self::get_option('verification_key'),
143
  'meta' => Array( 'target' => '_blank' )
144
  ));
145
  $wp_admin_bar->add_menu(array(
354
  return 'page';
355
  } elseif (is_single()) {
356
  return 'post';
357
+ } elseif (is_category() || is_author() || is_tag() || is_date() || is_search()) {
358
  return 'category';
359
  }
360
  }
948
  * @param string $post_id
949
  */
950
  public static function notify_content_manager_singlepage($post = NULL) {
951
+
952
  if ($post == NULL) {
953
  return false;
954
  }
 
 
 
 
 
 
 
 
 
 
955
 
956
+ if (ShareaholicUtilities::has_accepted_terms_of_service() && ShareaholicUtilities::get_option('api_key') != NULL) {
957
+ if (in_array($post->post_status, array('draft', 'pending', 'auto-draft'))) {
958
+ // Get the correct permalink for a draft
959
+ $my_post = clone $post;
960
+ $my_post->post_status = 'published';
961
+ $my_post->post_name = sanitize_title($my_post->post_name ? $my_post->post_name : $my_post->post_title, $my_post->ID);
962
+ $post_permalink = get_permalink($my_post);
963
+ } else {
964
+ $post_permalink = get_permalink($post->ID);
965
+ }
966
+
967
+ if ($post_permalink != NULL) {
968
+ $cm_single_page_job_url = Shareaholic::CM_API_URL . '/jobs/uber_single_page';
969
+ $payload = array (
970
+ 'args' => array (
971
+ $post_permalink,
972
+ array ('force' => true)
973
+ )
974
+ );
975
+ $response = ShareaholicCurl::post($cm_single_page_job_url, $payload, 'json');
976
+ }
977
+ }
978
+ }
979
 
980
  /**
981
  * Wrapper for the Shareaholic Content Manager Single Domain worker API
1188
  $first_img = '';
1189
  if ($post == NULL)
1190
  return false;
1191
+ else {
1192
+ $output = preg_match_all('/<img.*?src=[\'"](.*?)[\'"].*?>/i', $post->post_content, $matches);
1193
+ if (isset($matches[1][0])) {
1194
+ // Exclude base64 images; meta tags require full URLs
1195
+ if (strpos($matches[1][0], 'data:') === false) {
1196
+ $first_img = $matches[1][0];
1197
+ }
1198
  } else {
1199
  return false;
1200
  }
1209
  public static function clear_cache() {
1210
  // W3 Total Cache plugin
1211
  if (function_exists('w3tc_pgcache_flush')) {
1212
+ w3tc_pgcache_flush();
1213
  }
1214
  // WP Super Cache
1215
  if (function_exists('wp_cache_clear_cache')) {
1216
  wp_cache_clear_cache();
1217
  }
1218
  // Hyper Cache
1219
+ if (function_exists('hyper_cache_flush_all')) {
1220
+ hyper_cache_flush_all();
1221
  }
1222
  // Quick Cache
1223
  if (function_exists('auto_clear_cache')) {
1224
  auto_clear_cache();
1225
  }
1226
+ // CometCache
1227
+ if (class_exists("comet_cache")) {
1228
+ comet_cache::clear();
1229
+ }
1230
  }
1231
 
1232
  /**