Version Description
- Related Content
- Faster on-boarding! (in seconds vs hours)
- Post-Share Follow Buttons
- Added support for Instagram, YouTube, Bloglovin, Vimeo, Flickr, Dribbble, FourSquare, Yelp, RSS
- Share Buttons
- Added support for Meneame, Wykop
Download this release
Release Info
Developer | shareaholic |
Plugin | WordPress Social Tools, Related Posts, Monetization – Shareaholic |
Version | 7.5.0.3 |
Comparing to | |
See all releases |
Code changes from version 7.5.0.2 to 7.5.0.3
- admin.php +12 -4
- notifier.php +1 -1
- public.php +71 -35
- readme.txt +16 -3
- shareaholic.php +7 -3
- templates/settings.php +1 -1
- utilities.php +44 -0
admin.php
CHANGED
@@ -411,12 +411,20 @@ class ShareaholicAdmin {
|
|
411 |
$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');
|
412 |
|
413 |
$to = get_bloginfo('admin_email');
|
414 |
-
$subject = 'Thank you for
|
415 |
$message = "
|
416 |
<p>Hi there,</p>
|
417 |
-
|
418 |
-
<p>
|
419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
<p>Last step? Sit back, and watch your visitors engage with your content.</p>
|
421 |
Enjoy the show :)<br />
|
422 |
<br />
|
411 |
$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');
|
412 |
|
413 |
$to = get_bloginfo('admin_email');
|
414 |
+
$subject = 'Thank you for using Shareaholic for WordPress!';
|
415 |
$message = "
|
416 |
<p>Hi there,</p>
|
417 |
+
|
418 |
+
<p>Thank you so much for using Shareaholic on $site_url! My name is Mary Anne, and I'm going to help you get set-up! Just follow the steps below, and you'll have everything you need to make the most out of Shareaholic. (Need help with the new plugin interface? Click <a href='https://blog.shareaholic.com/shareaholic-wordpress-v75/' target='_blank'>here</a> for a tour.)</p>
|
419 |
+
|
420 |
+
<p><strong>1. Unlock more features</strong><br /><br />
|
421 |
+
|
422 |
+
Analytics, follow buttons and opportunities to earn revenue from your site (just to name a few) are waiting for you when you sign-up for a free Shareaholic account. <a href='$sign_up_link'>Click here to sign-up</a> (or <a href='$sign_up_link'>login to an existing Shareaholic account</a>) and we'll automatically sync the plugin settings with your account. It's easy and free!</p>
|
423 |
+
|
424 |
+
<p><strong>2. Get personal (assistance)</strong><br /><br />
|
425 |
+
Reply to this email with any questions or problems you encounter as you customize your Shareaholic settings. Consider me your personal assistant!
|
426 |
+
</p>
|
427 |
+
|
428 |
<p>Last step? Sit back, and watch your visitors engage with your content.</p>
|
429 |
Enjoy the show :)<br />
|
430 |
<br />
|
notifier.php
CHANGED
@@ -34,7 +34,7 @@ class ShareaholicNotifier {
|
|
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 =
|
38 |
if (!$featured_image) {
|
39 |
$featured_image = '';
|
40 |
}
|
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 |
}
|
public.php
CHANGED
@@ -283,7 +283,7 @@ class ShareaholicPublic {
|
|
283 |
$thumbnail_src = esc_attr($thumbnail[0]);
|
284 |
}
|
285 |
if ($thumbnail_src == NULL) {
|
286 |
-
$thumbnail_src =
|
287 |
}
|
288 |
if ($thumbnail_src != NULL) {
|
289 |
echo "<meta name='shareaholic:image' content='" . $thumbnail_src . "' />";
|
@@ -305,7 +305,7 @@ class ShareaholicPublic {
|
|
305 |
$thumbnail_src = esc_attr($thumbnail[0]);
|
306 |
}
|
307 |
if ($thumbnail_src == NULL) {
|
308 |
-
$thumbnail_src =
|
309 |
}
|
310 |
if ($thumbnail_src != NULL) {
|
311 |
echo "\n<!-- Shareaholic Open Graph Tags -->\n";
|
@@ -315,27 +315,6 @@ class ShareaholicPublic {
|
|
315 |
}
|
316 |
}
|
317 |
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* This will grab the URL of the first image in a given post
|
321 |
-
*
|
322 |
-
* @return returns `false` or a string of the image src
|
323 |
-
*/
|
324 |
-
public static function post_first_image() {
|
325 |
-
global $post;
|
326 |
-
$first_img = '';
|
327 |
-
if ($post == NULL)
|
328 |
-
return false;
|
329 |
-
else {
|
330 |
-
$output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
|
331 |
-
if(isset($matches[1][0]) ){
|
332 |
-
$first_img = $matches[1][0];
|
333 |
-
} else {
|
334 |
-
return false;
|
335 |
-
}
|
336 |
-
return $first_img;
|
337 |
-
}
|
338 |
-
}
|
339 |
|
340 |
/**
|
341 |
* This static function inserts the shareaholic canvas at the end of the post
|
@@ -614,17 +593,6 @@ class ShareaholicPublic {
|
|
614 |
}
|
615 |
}
|
616 |
|
617 |
-
// Post thumbnail
|
618 |
-
$thumbnail_src = '';
|
619 |
-
if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
|
620 |
-
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'large');
|
621 |
-
$thumbnail_src = esc_attr($thumbnail[0]);
|
622 |
-
}
|
623 |
-
|
624 |
-
if ($thumbnail_src == NULL) {
|
625 |
-
$thumbnail_src = ShareaholicPublic::post_first_image();
|
626 |
-
}
|
627 |
-
|
628 |
// Post body
|
629 |
$order = array(" ", "\r\n", "\n", "\r", " ");
|
630 |
$post_body = str_replace($order, ' ', $post->post_content);
|
@@ -657,7 +625,7 @@ class ShareaholicPublic {
|
|
657 |
'title' => $post->post_title,
|
658 |
'excerpt' => $post->post_excerpt,
|
659 |
'body' => $post_body,
|
660 |
-
'thumbnail' => $
|
661 |
),
|
662 |
'post_metadata' => array(
|
663 |
'author_id' => $post->post_author,
|
@@ -691,6 +659,74 @@ class ShareaholicPublic {
|
|
691 |
exit;
|
692 |
}
|
693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
/**
|
695 |
* Checks to see if curl is installed
|
696 |
*
|
283 |
$thumbnail_src = esc_attr($thumbnail[0]);
|
284 |
}
|
285 |
if ($thumbnail_src == NULL) {
|
286 |
+
$thumbnail_src = ShareaholicUtilities::post_first_image();
|
287 |
}
|
288 |
if ($thumbnail_src != NULL) {
|
289 |
echo "<meta name='shareaholic:image' content='" . $thumbnail_src . "' />";
|
305 |
$thumbnail_src = esc_attr($thumbnail[0]);
|
306 |
}
|
307 |
if ($thumbnail_src == NULL) {
|
308 |
+
$thumbnail_src = ShareaholicUtilities::post_first_image();
|
309 |
}
|
310 |
if ($thumbnail_src != NULL) {
|
311 |
echo "\n<!-- Shareaholic Open Graph Tags -->\n";
|
315 |
}
|
316 |
}
|
317 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
/**
|
320 |
* This static function inserts the shareaholic canvas at the end of the post
|
593 |
}
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
// Post body
|
597 |
$order = array(" ", "\r\n", "\n", "\r", " ");
|
598 |
$post_body = str_replace($order, ' ', $post->post_content);
|
625 |
'title' => $post->post_title,
|
626 |
'excerpt' => $post->post_excerpt,
|
627 |
'body' => $post_body,
|
628 |
+
'thumbnail' => ShareaholicUtilities::permalink_thumbnail($post->ID, "large"),
|
629 |
),
|
630 |
'post_metadata' => array(
|
631 |
'author_id' => $post->post_author,
|
659 |
exit;
|
660 |
}
|
661 |
|
662 |
+
/**
|
663 |
+
* Function to return related permalinks for a given permalink to bootstrap the Related Content app until the off-line processing routines complete
|
664 |
+
*
|
665 |
+
* @return list of related permalinks in JSON
|
666 |
+
*/
|
667 |
+
public static function permalink_related() {
|
668 |
+
global $post;
|
669 |
+
|
670 |
+
// Input Params
|
671 |
+
$permalink = isset($_GET['permalink']) ? $_GET['permalink'] : NULL;
|
672 |
+
$match = isset($_GET['match']) ? $_GET['match'] : "random"; // match method
|
673 |
+
$n = isset($_GET['n']) ? $_GET['n'] : 10; // number of related permalinks to return
|
674 |
+
|
675 |
+
$related_permalink_list = array();
|
676 |
+
|
677 |
+
// Get post ID
|
678 |
+
if ($permalink == NULL){
|
679 |
+
// default to random match if no permalink is available
|
680 |
+
$match = "random";
|
681 |
+
} else {
|
682 |
+
$post_id = url_to_postid($permalink);
|
683 |
+
|
684 |
+
// for non-default paths - handle both https and http versions of the permalink
|
685 |
+
if ($post_id == 0){
|
686 |
+
$parse = parse_url($permalink);
|
687 |
+
if ($parse['scheme'] == "https"){
|
688 |
+
$permalink = str_replace("https", "http", $permalink);
|
689 |
+
$post_id = url_to_postid($permalink);
|
690 |
+
} else if ($parse['scheme'] == "http"){
|
691 |
+
$permalink = str_replace("http", "https", $permalink);
|
692 |
+
$post_id = url_to_postid($permalink);
|
693 |
+
}
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
if ($match == "random"){
|
698 |
+
$args = array( 'posts_per_page' => $n, 'orderby' => 'rand' );
|
699 |
+
$rand_posts = get_posts( $args );
|
700 |
+
foreach ( $rand_posts as $post ){
|
701 |
+
$related_link = array(
|
702 |
+
'page_id' => $post->ID,
|
703 |
+
'url' => get_permalink($post->ID),
|
704 |
+
'title' => $post->post_title,
|
705 |
+
'description' => $post->post_excerpt,
|
706 |
+
'image_url' => ShareaholicUtilities::permalink_thumbnail($post->ID, "medium"),
|
707 |
+
'score' => 1
|
708 |
+
);
|
709 |
+
array_push($related_permalink_list, $related_link);
|
710 |
+
}
|
711 |
+
wp_reset_postdata();
|
712 |
+
} else {
|
713 |
+
// other methods coming soon
|
714 |
+
}
|
715 |
+
|
716 |
+
// Construct results array
|
717 |
+
$result = array(
|
718 |
+
'request' => array(
|
719 |
+
'api_key' => ShareaholicUtilities::get_option('api_key'),
|
720 |
+
'url' => $permalink,
|
721 |
+
),
|
722 |
+
'internal' => $related_permalink_list
|
723 |
+
);
|
724 |
+
|
725 |
+
header('Content-Type: application/json; charset=utf-8');
|
726 |
+
echo json_encode($result);
|
727 |
+
exit;
|
728 |
+
}
|
729 |
+
|
730 |
/**
|
731 |
* Checks to see if curl is installed
|
732 |
*
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Shareaholic | share buttons & related posts ===
|
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.5.0.
|
7 |
|
8 |
Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
|
9 |
|
@@ -12,7 +12,8 @@ Adds an attractive social bookmarking menu and related content widget to your po
|
|
12 |
Three powerful apps to amplify your content and create conversations, across the web. Shareaholic has proven time and time again to be an extremely useful and successful tool in getting your readers to actually **discover** and **submit your articles** to numerous social bookmarking sites.
|
13 |
|
14 |
= Recent Updates =
|
15 |
-
* [
|
|
|
16 |
* [Shareable Images](https://blog.shareaholic.com/image-share-buttons/) (share buttons for images)
|
17 |
* Recommendations & Related Content - Increases engagement and time on site by highlighting relevant content that may not otherwise be discovered from across your site.
|
18 |
* Social Analytics - Provides you with important actionable metrics including insights into how your content is performing, who's sharing it, and through which channels.
|
@@ -158,6 +159,14 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
|
|
158 |
|
159 |
== Changelog ==
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
= 7.5.0.2 =
|
162 |
* Miscellaneous performance and on-boarding enhancements for the Related Content app
|
163 |
|
@@ -1092,6 +1101,10 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
|
|
1092 |
|
1093 |
== Upgrade Notice ==
|
1094 |
|
|
|
|
|
|
|
|
|
1095 |
= 7.5.0.2 =
|
1096 |
|
1097 |
Many improvements to the Related Content app.
|
1 |
=== Shareaholic | share buttons & related posts ===
|
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, sumome, 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.5.0.3
|
7 |
|
8 |
Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
|
9 |
|
12 |
Three powerful apps to amplify your content and create conversations, across the web. Shareaholic has proven time and time again to be an extremely useful and successful tool in getting your readers to actually **discover** and **submit your articles** to numerous social bookmarking sites.
|
13 |
|
14 |
= Recent Updates =
|
15 |
+
* [Post-Share Follow Buttons](https://blog.shareaholic.com/post-share-follow-buttons/)
|
16 |
+
* [Floating Share Buttons](https://blog.shareaholic.com/floating-share-buttons/)
|
17 |
* [Shareable Images](https://blog.shareaholic.com/image-share-buttons/) (share buttons for images)
|
18 |
* Recommendations & Related Content - Increases engagement and time on site by highlighting relevant content that may not otherwise be discovered from across your site.
|
19 |
* Social Analytics - Provides you with important actionable metrics including insights into how your content is performing, who's sharing it, and through which channels.
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 7.5.0.3 =
|
163 |
+
* Related Content
|
164 |
+
* Faster on-boarding! (in seconds vs hours)
|
165 |
+
* Post-Share Follow Buttons
|
166 |
+
* Added support for Instagram, YouTube, Bloglovin, Vimeo, Flickr, Dribbble, FourSquare, Yelp, RSS
|
167 |
+
* Share Buttons
|
168 |
+
* Added support for Meneame, Wykop
|
169 |
+
|
170 |
= 7.5.0.2 =
|
171 |
* Miscellaneous performance and on-boarding enhancements for the Related Content app
|
172 |
|
1101 |
|
1102 |
== Upgrade Notice ==
|
1103 |
|
1104 |
+
= 7.5.0.3 =
|
1105 |
+
|
1106 |
+
New post-share follow button services (including Instagram, YouTube and RSS) and additional improvements to the Related Content app.
|
1107 |
+
|
1108 |
= 7.5.0.2 =
|
1109 |
|
1110 |
Many improvements to the Related Content app.
|
shareaholic.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* The main file!
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
-
* @version 7.5.0.
|
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.5.0.
|
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.5.0.
|
65 |
|
66 |
/**
|
67 |
* Starts off as false so that ::get_instance() returns
|
@@ -91,6 +91,10 @@ class Shareaholic {
|
|
91 |
add_action('wp_ajax_nopriv_shareaholic_permalink_info', array('ShareaholicPublic', 'permalink_info'));
|
92 |
add_action('wp_ajax_shareaholic_permalink_info', array('ShareaholicPublic', 'permalink_info'));
|
93 |
|
|
|
|
|
|
|
|
|
94 |
add_action('init', array('ShareaholicPublic', 'init'));
|
95 |
add_action('after_setup_theme', array('ShareaholicPublic', 'after_setup_theme'));
|
96 |
add_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
|
3 |
* The main file!
|
4 |
*
|
5 |
* @package shareaholic
|
6 |
+
* @version 7.5.0.3
|
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.5.0.3
|
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.5.0.3';
|
65 |
|
66 |
/**
|
67 |
* Starts off as false so that ::get_instance() returns
|
91 |
add_action('wp_ajax_nopriv_shareaholic_permalink_info', array('ShareaholicPublic', 'permalink_info'));
|
92 |
add_action('wp_ajax_shareaholic_permalink_info', array('ShareaholicPublic', 'permalink_info'));
|
93 |
|
94 |
+
// Related Permalinks for Related Content app bootup
|
95 |
+
add_action('wp_ajax_nopriv_shareaholic_permalink_related', array('ShareaholicPublic', 'permalink_related'));
|
96 |
+
add_action('wp_ajax_shareaholic_permalink_related', array('ShareaholicPublic', 'permalink_related'));
|
97 |
+
|
98 |
add_action('init', array('ShareaholicPublic', 'init'));
|
99 |
add_action('after_setup_theme', array('ShareaholicPublic', 'after_setup_theme'));
|
100 |
add_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
|
templates/settings.php
CHANGED
@@ -19,7 +19,7 @@ window.verification_key = '<?php echo $settings['verification_key'] ?>'
|
|
19 |
|
20 |
<div id='app_settings'>
|
21 |
|
22 |
-
<fieldset class="app" style="line-height:18px;"><?php echo sprintf(__('First time here? Read %sUnderstanding the new Shareaholic for WordPress interface and configuration settings.%s', 'shareaholic'), '<a href="https://blog.shareaholic.com/
|
23 |
</fieldset>
|
24 |
|
25 |
<fieldset class="app"><legend><h2><i class="icon icon-recommendations"></i><?php echo sprintf(__('Related Content', 'shareaholic')); ?></h2></legend>
|
19 |
|
20 |
<div id='app_settings'>
|
21 |
|
22 |
+
<fieldset class="app" style="line-height:18px;"><?php echo sprintf(__('First time here? Read %sUnderstanding the new Shareaholic for WordPress interface and configuration settings.%s', 'shareaholic'), '<a href="https://blog.shareaholic.com/shareaholic-wordpress-v75/" target="_blank">','</a>'); ?> <?php echo sprintf(__('If you are upgrading from an earlier version of Shareaholic for WordPress and need help, have a question or have a bug to report, please %slet us know%s.', 'shareaholic'), '<a href="#" onclick="SnapEngage.startLink();">','</a>'); ?>
|
23 |
</fieldset>
|
24 |
|
25 |
<fieldset class="app"><legend><h2><i class="icon icon-recommendations"></i><?php echo sprintf(__('Related Content', 'shareaholic')); ?></h2></legend>
|
utilities.php
CHANGED
@@ -1086,6 +1086,50 @@ class ShareaholicUtilities {
|
|
1086 |
return trim(trim(strtolower(trim(htmlspecialchars(htmlspecialchars_decode($keywords), ENT_QUOTES))), ","));
|
1087 |
}
|
1088 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
/*
|
1090 |
* Clears cache created by caching plugins like W3 Total Cache
|
1091 |
*
|
1086 |
return trim(trim(strtolower(trim(htmlspecialchars(htmlspecialchars_decode($keywords), ENT_QUOTES))), ","));
|
1087 |
}
|
1088 |
|
1089 |
+
/**
|
1090 |
+
* Function to return a thumbnail for a given permalink
|
1091 |
+
*
|
1092 |
+
* @return thumbnail URL
|
1093 |
+
*/
|
1094 |
+
public static function permalink_thumbnail($post_id = NULL, $size = "large"){
|
1095 |
+
$thumbnail_src = '';
|
1096 |
+
// Get Featured Image
|
1097 |
+
if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
|
1098 |
+
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
|
1099 |
+
$thumbnail_src = esc_attr($thumbnail[0]);
|
1100 |
+
}
|
1101 |
+
// Get first image included in the post
|
1102 |
+
if ($thumbnail_src == NULL) {
|
1103 |
+
$thumbnail_src = ShareaholicUtilities::post_first_image();
|
1104 |
+
}
|
1105 |
+
if ($thumbnail_src == NULL){
|
1106 |
+
return NULL;
|
1107 |
+
} else {
|
1108 |
+
return $thumbnail_src;
|
1109 |
+
}
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* This will grab the URL of the first image in a given post
|
1114 |
+
*
|
1115 |
+
* @return returns `false` or a string of the image src
|
1116 |
+
*/
|
1117 |
+
public static function post_first_image() {
|
1118 |
+
global $post;
|
1119 |
+
$first_img = '';
|
1120 |
+
if ($post == NULL)
|
1121 |
+
return false;
|
1122 |
+
else {
|
1123 |
+
$output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
|
1124 |
+
if(isset($matches[1][0]) ){
|
1125 |
+
$first_img = $matches[1][0];
|
1126 |
+
} else {
|
1127 |
+
return false;
|
1128 |
+
}
|
1129 |
+
return $first_img;
|
1130 |
+
}
|
1131 |
+
}
|
1132 |
+
|
1133 |
/*
|
1134 |
* Clears cache created by caching plugins like W3 Total Cache
|
1135 |
*
|