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

Version Description

  • New: You can now set custom Related Posts thumbnail dimensions. See FAQ in the readme if you would like to change the thumbnail size.
Download this release

Release Info

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

Code changes from version 8.6.5 to 8.6.6

Files changed (6) hide show
  1. admin.php +13 -1
  2. notifier.php +1 -10
  3. public.php +8 -7
  4. readme.txt +15 -2
  5. shareaholic.php +8 -5
  6. utilities.php +39 -7
admin.php CHANGED
@@ -630,7 +630,19 @@ JQUERY;
630
  wp_mail($to, $subject, $message, $headers);
631
  }
632
  }
633
-
 
 
 
 
 
 
 
 
 
 
 
 
634
  public static function admin_notices() {
635
  $current_screen = get_current_screen();
636
 
630
  wp_mail($to, $subject, $message, $headers);
631
  }
632
  }
633
+
634
+ /**
635
+ * This function adds our custom image type to the Media Library
636
+ */
637
+ public static function show_custom_sizes($sizes) {
638
+ return array_merge($sizes, array(
639
+ 'shareaholic-thumbnail' => __('Shareaholic'),
640
+ ));
641
+ }
642
+
643
+ /**
644
+ * This function adds a notice to Settings->Permalinks
645
+ */
646
  public static function admin_notices() {
647
  $current_screen = get_current_screen();
648
 
notifier.php CHANGED
@@ -31,15 +31,6 @@ class ShareaholicNotifier {
31
 
32
  $categories = array_map(array('ShareaholicNotifier', 'post_notify_iterator'), get_the_category($post_id));
33
 
34
- if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
35
- $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'large');
36
- } else {
37
- $featured_image = ShareaholicUtilities::post_first_image();
38
- if (!$featured_image) {
39
- $featured_image = '';
40
- }
41
- }
42
-
43
  if ($post->post_author) {
44
  $author_data = get_userdata($post->post_author);
45
  $author_name = $author_data->display_name;
@@ -52,7 +43,7 @@ class ShareaholicNotifier {
52
  'title' => $post->post_title,
53
  'excerpt' => $post->post_excerpt,
54
  'body' => $post->post_content,
55
- 'featured-image-url' => $featured_image,
56
  ),
57
  'metadata' => array(
58
  'author-id' => $post->post_author,
31
 
32
  $categories = array_map(array('ShareaholicNotifier', 'post_notify_iterator'), get_the_category($post_id));
33
 
 
 
 
 
 
 
 
 
 
34
  if ($post->post_author) {
35
  $author_data = get_userdata($post->post_author);
36
  $author_name = $author_data->display_name;
43
  'title' => $post->post_title,
44
  'excerpt' => $post->post_excerpt,
45
  'body' => $post->post_content,
46
+ 'featured-image-url' => ShareaholicUtilities::permalink_thumbnail($post_id),
47
  ),
48
  'metadata' => array(
49
  'author-id' => $post->post_author,
public.php CHANGED
@@ -40,7 +40,8 @@ class ShareaholicPublic {
40
  add_filter('widget_text', 'do_shortcode', 11);
41
  }
42
 
43
- add_image_size('shareaholic-thumbnail', 300); // 300 pixels wide (and unlimited height)
 
44
  }
45
 
46
  /**
@@ -291,13 +292,13 @@ class ShareaholicPublic {
291
  if (is_attachment()) {
292
  $thumbnail_src = wp_get_attachment_thumb_url();
293
  }
294
- if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
295
- $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
296
- $thumbnail_src = esc_attr($thumbnail[0]);
297
- }
298
  if ($thumbnail_src == NULL) {
299
  $thumbnail_src = ShareaholicUtilities::post_first_image();
300
  }
 
301
  if ($thumbnail_src != NULL) {
302
  echo "<meta name='shareaholic:image' content='" . $thumbnail_src . "' />";
303
  }
@@ -777,7 +778,7 @@ class ShareaholicPublic {
777
  'title' => $post->post_title,
778
  'excerpt' => $post->post_excerpt,
779
  'body' => $post_body,
780
- 'thumbnail' => ShareaholicUtilities::permalink_thumbnail($post->ID, "large"),
781
  ),
782
  'post_metadata' => array(
783
  'author_id' => $post->post_author,
@@ -855,7 +856,7 @@ class ShareaholicPublic {
855
  'url' => get_permalink($post->ID),
856
  'title' => $post->post_title,
857
  'description' => $post->post_excerpt,
858
- 'image_url' => ShareaholicUtilities::permalink_thumbnail($post->ID, "medium"),
859
  'score' => 1
860
  );
861
  array_push($related_permalink_list, $related_link);
40
  add_filter('widget_text', 'do_shortcode', 11);
41
  }
42
 
43
+ // Our custom image type
44
+ add_image_size('shareaholic-thumbnail', 640); // 640 pixels wide (and unlimited height)
45
  }
46
 
47
  /**
292
  if (is_attachment()) {
293
  $thumbnail_src = wp_get_attachment_thumb_url();
294
  }
295
+
296
+ $thumbnail_src = ShareaholicUtilities::post_featured_image();
297
+
 
298
  if ($thumbnail_src == NULL) {
299
  $thumbnail_src = ShareaholicUtilities::post_first_image();
300
  }
301
+
302
  if ($thumbnail_src != NULL) {
303
  echo "<meta name='shareaholic:image' content='" . $thumbnail_src . "' />";
304
  }
778
  'title' => $post->post_title,
779
  'excerpt' => $post->post_excerpt,
780
  'body' => $post_body,
781
+ 'thumbnail' => ShareaholicUtilities::permalink_thumbnail($post->ID),
782
  ),
783
  'post_metadata' => array(
784
  'author_id' => $post->post_author,
856
  'url' => get_permalink($post->ID),
857
  'title' => $post->post_title,
858
  'description' => $post->post_excerpt,
859
+ 'image_url' => ShareaholicUtilities::permalink_thumbnail($post->ID),
860
  'score' => 1
861
  );
862
  array_push($related_permalink_list, $related_link);
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === WordPress Social Tools, Related Content, Monetization - Shareaholic ===
2
  Contributors: shareaholic
3
  Tags: Social Tools, 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, izeby, kaboodle, kik, kindle, line, linkedin, livejournal, meneame, mister wong, 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, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
- Stable tag: 8.6.5
7
 
8
  Consolidate plugins with a high-speed suite of social tools: social share buttons, related content, related posts, ad monetization & Google Analytics.
9
 
@@ -211,12 +211,22 @@ If use double quotes ("'s) in your title or summary, make sure to encode them pr
211
  == Frequently Asked Questions ==
212
 
213
  = Where can I find a detailed FAQ? =
 
214
  Please see here: [Shareaholic Helpdesk](http://support.shareaholic.com/hc/en-us)
215
 
216
  = Where can I get detailed Usage & Installation instructions? =
 
217
  Please see here: [Usage & Installation Instructions](http://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
218
 
 
 
 
 
 
 
219
  == Changelog ==
 
 
220
 
221
  = 8.6.5 (2018-02-07) =
222
  * Bugfix: Fixes 'Trying to get property of non-object' exception
@@ -718,6 +728,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
718
  * Show Related Posts data status
719
 
720
  == Upgrade Notice ==
 
 
 
721
  = 8.6.5 =
722
  We've improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.
723
 
1
+ === WordPress Social Tools, Related Posts, Monetization - Shareaholic ===
2
  Contributors: shareaholic
3
  Tags: Social Tools, 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, izeby, kaboodle, kik, kindle, line, linkedin, livejournal, meneame, mister wong, 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, weheartit, weibo, whatsapp, wykop, xing, yahoo, yammer, ycombinator, hacker news, youtube, yummly, zillow
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
+ Stable tag: 8.6.6
7
 
8
  Consolidate plugins with a high-speed suite of social tools: social share buttons, related content, related posts, ad monetization & Google Analytics.
9
 
211
  == Frequently Asked Questions ==
212
 
213
  = Where can I find a detailed FAQ? =
214
+
215
  Please see here: [Shareaholic Helpdesk](http://support.shareaholic.com/hc/en-us)
216
 
217
  = Where can I get detailed Usage & Installation instructions? =
218
+
219
  Please see here: [Usage & Installation Instructions](http://support.shareaholic.com/hc/en-us/categories/200101476-WordPress-Plugin)
220
 
221
+ = How can I change the thumbnail image size for Shareaholic Related Posts? =
222
+
223
+ 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/).
224
+
225
+ 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.
226
+
227
  == Changelog ==
228
+ = 8.6.6 (2018-05-12) =
229
+ * New: You can now set custom Related Posts thumbnail dimensions. See [FAQ in the readme](https://wordpress.org/plugins/shareaholic/) if you would like to change the thumbnail size.
230
 
231
  = 8.6.5 (2018-02-07) =
232
  * Bugfix: Fixes 'Trying to get property of non-object' exception
728
  * Show Related Posts data status
729
 
730
  == Upgrade Notice ==
731
+ = 8.6.6 =
732
+ * New: You can now set custom Related Posts thumbnail dimensions. See [FAQ in the readme](https://wordpress.org/plugins/shareaholic/) if you would like to change the thumbnail size.
733
+
734
  = 8.6.5 =
735
  We've improved the server connectivity check. If you've been getting the 'retry' error message after installing Shareaholic, this one is for you.
736
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 8.6.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: 8.6.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 = '8.6.5';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
@@ -147,6 +147,9 @@ if (!class_exists('Shareaholic')) {
147
 
148
  // use the admin notice API
149
  add_action('admin_notices', array('ShareaholicAdmin', 'admin_notices'));
 
 
 
150
 
151
  // ShortCode UI plugin specific hooks to prevent duplicate app rendering
152
  // https://wordpress.org/support/topic/custom-post-type-exclude-issue?replies=10#post-3370550
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 8.6.6
7
  */
8
 
9
  /*
10
+ Plugin Name: Shareaholic | share buttons, analytics, related posts
11
  Plugin URI: https://shareaholic.com/publishers/
12
+ Description: The world's leading all-in-one Audience 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: 8.6.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 = '8.6.6';
67
 
68
  /**
69
  * Starts off as false so that ::get_instance() returns
147
 
148
  // use the admin notice API
149
  add_action('admin_notices', array('ShareaholicAdmin', 'admin_notices'));
150
+
151
+ // Add our custom image type to the Media Library
152
+ add_filter('image_size_names_choose', array('ShareaholicAdmin', 'show_custom_sizes'));
153
 
154
  // ShortCode UI plugin specific hooks to prevent duplicate app rendering
155
  // https://wordpress.org/support/topic/custom-post-type-exclude-issue?replies=10#post-3370550
utilities.php CHANGED
@@ -1246,26 +1246,58 @@ class ShareaholicUtilities {
1246
  *
1247
  * @return thumbnail URL
1248
  */
1249
- public static function permalink_thumbnail($post_id = NULL, $size = "large"){
1250
  $thumbnail_src = '';
 
1251
  // Get Featured Image
1252
- if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
1253
- $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
1254
- $thumbnail_src = esc_attr($thumbnail[0]);
1255
- }
1256
  // Get first image included in the post
1257
  if ($thumbnail_src == NULL) {
1258
- $thumbnail_src = ShareaholicUtilities::post_first_image();
1259
  }
 
1260
  if ($thumbnail_src == NULL){
1261
  return NULL;
1262
  } else {
1263
  return $thumbnail_src;
1264
  }
1265
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1266
 
1267
  /**
1268
- * This will grab the URL of the first image in a given post
1269
  *
1270
  * @return returns `false` or a string of the image src
1271
  */
1246
  *
1247
  * @return thumbnail URL
1248
  */
1249
+ public static function permalink_thumbnail($post_id = NULL, $size = "shareaholic-thumbnail"){
1250
  $thumbnail_src = '';
1251
+
1252
  // Get Featured Image
1253
+ $thumbnail_src = ShareaholicUtilities::post_featured_image($size);
1254
+
 
 
1255
  // Get first image included in the post
1256
  if ($thumbnail_src == NULL) {
1257
+ $thumbnail_src = ShareaholicUtilities::post_first_image($post_id);
1258
  }
1259
+
1260
  if ($thumbnail_src == NULL){
1261
  return NULL;
1262
  } else {
1263
  return $thumbnail_src;
1264
  }
1265
  }
1266
+
1267
+ /**
1268
+ * This function returns the URL of the featured image for a given post
1269
+ *
1270
+ * @return returns `false` or a string of the image src
1271
+ */
1272
+ public static function post_featured_image($size = "shareaholic-thumbnail") {
1273
+ global $post;
1274
+ $featured_img = '';
1275
+ if ($post == NULL)
1276
+ return false;
1277
+ else {
1278
+ if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
1279
+ $thumbnail_shareaholic = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'shareaholic-thumbnail');
1280
+ $thumbnail_full = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
1281
+
1282
+ if (($size == "shareaholic-thumbnail") && ($thumbnail_shareaholic[0] !== $thumbnail_full[0])) {
1283
+ $featured_img = esc_attr($thumbnail_shareaholic[0]);
1284
+ } else {
1285
+ if ($size == "shareaholic-thumbnail") {
1286
+ $thumbnail_large = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
1287
+ } else {
1288
+ $thumbnail_large = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $size);
1289
+ }
1290
+ $featured_img = esc_attr($thumbnail_large[0]);
1291
+ }
1292
+ } else {
1293
+ return false;
1294
+ }
1295
+ }
1296
+ return $featured_img;
1297
+ }
1298
 
1299
  /**
1300
+ * This function grabs the URL of the first image in a given post
1301
  *
1302
  * @return returns `false` or a string of the image src
1303
  */