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

Version Description

  • Miscellaneous performance and on-boarding enhancements for the Related Content app
Download this release

Release Info

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

Code changes from version 7.5.0.1 to 7.5.0.2

Files changed (6) hide show
  1. Rakefile +0 -53
  2. admin.php +2 -1
  3. public.php +141 -27
  4. readme.txt +8 -1
  5. shareaholic.php +8 -4
  6. utilities.php +66 -0
Rakefile DELETED
@@ -1,53 +0,0 @@
1
- # Copyright Shareaholic, Inc. (www.shareaholic.com). All Rights Reserved.
2
-
3
- desc 'Get plugin ready for WordPress directory'
4
- task :makerelease do
5
- Rake::Task['min'].invoke
6
- end
7
-
8
- desc 'Minify scripts using closure compiler'
9
- task :min => "compiler/compiler.jar" do
10
- files = %w(main)
11
- js_root = File.expand_path(File.join(File.dirname(__FILE__),'assets/js'))
12
- files.each do |name|
13
- src = File.join(js_root,"#{name}.js")
14
- dest = File.join(js_root,"#{name}.min.js")
15
- cmd = "java -jar compiler/compiler.jar "
16
- cmd << "--js #{src} "
17
- cmd << "--js_output_file #{dest}"
18
- sh cmd
19
- end
20
- end
21
-
22
- file "compiler/compiler.jar" do
23
- mkdir "compiler"
24
- cd "compiler"
25
- url = "http://closure-compiler.googlecode.com/files/compiler-latest.zip"
26
- sh "curl -O #{url}"
27
- sh "unzip compiler-latest.zip"
28
- sh "rm compiler-latest.zip"
29
- cd "../"
30
- end
31
-
32
- desc 'Copy latest plugin code to local WP install'
33
- task :maketest do
34
- Rake::Task['makerelease'].invoke
35
- sh "rm -rf ../wordpress_local/wp-content/plugins/shareaholic"
36
- sh "cp -r ../shareaholic_for_wordpress ../wordpress_local/wp-content/plugins/shareaholic"
37
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".DS_Store\"`"
38
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \"Thumbs.db\"`"
39
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".git\"`"
40
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".gitignore\"`"
41
- sh "rm -rf ../wordpress_local/wp-content/plugins/shareaholic/compiler"
42
- end
43
-
44
- desc 'Copy latest plugin code to local WP install - DOES NOT MINIFY'
45
- task :makequickcopy do
46
- sh "rm -rf ../wordpress_local/wp-content/plugins/shareaholic"
47
- sh "cp -r ../shareaholic_for_wordpress ../wordpress_local/wp-content/plugins/shareaholic"
48
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".DS_Store\"`"
49
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \"Thumbs.db\"`"
50
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".git\"`"
51
- sh "rm -rf `find ../wordpress_local/wp-content/plugins/shareaholic/ -name \".gitignore\"`"
52
- sh "rm -rf ../wordpress_local/wp-content/plugins/shareaholic/compiler"
53
- end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin.php CHANGED
@@ -407,13 +407,14 @@ class ShareaholicAdmin {
407
  * This function is in charge of sending the "get started" email
408
  */
409
  public static function send_welcome_email() {
 
410
  $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');
411
 
412
  $to = get_bloginfo('admin_email');
413
  $subject = 'Thank you for upgrading to Shareaholic for WordPress!';
414
  $message = "
415
  <p>Hi there,</p>
416
- <p>Thank you for upgrading to Shareaholic for WordPress, my name is Mary Anne, and I'm going to help you get set-up!</p>
417
  <p>To start, make sure you sign-up for a Shareaholic.com account, because it will give you access to analytics and more features like Follow Buttons and opportunities to earn revenue from your site. <a href=\"$sign_up_link\">Sign-up now</a> - it's free!</p>
418
  <p>Next, reply to this email with any questions or problems you're having as you customize your Shareaholic settings. Consider me your personal assistant!</p>
419
  <p>Last step? Sit back, and watch your visitors engage with your content.</p>
407
  * This function is in charge of sending the "get started" email
408
  */
409
  public static function send_welcome_email() {
410
+ $site_url = get_bloginfo('url');
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 upgrading to Shareaholic for WordPress!';
415
  $message = "
416
  <p>Hi there,</p>
417
+ <p>Thank you for upgrading to Shareaholic for WordPress on $site_url, my name is Mary Anne, and I'm going to help you get set-up!</p>
418
  <p>To start, make sure you sign-up for a Shareaholic.com account, because it will give you access to analytics and more features like Follow Buttons and opportunities to earn revenue from your site. <a href=\"$sign_up_link\">Sign-up now</a> - it's free!</p>
419
  <p>Next, reply to this email with any questions or problems you're having as you customize your Shareaholic settings. Consider me your personal assistant!</p>
420
  <p>Last step? Sit back, and watch your visitors engage with your content.</p>
public.php CHANGED
@@ -131,7 +131,7 @@ class ShareaholicPublic {
131
  }
132
 
133
  // Get post tags
134
- $keywords = implode(', ', wp_get_post_tags( $id, array('fields' => 'names') ) );
135
 
136
  // Get post categories
137
  $categories_array = get_the_category($id);
@@ -154,33 +154,10 @@ class ShareaholicPublic {
154
  } else {
155
  $keywords .= $categories;
156
  }
157
-
158
- // Support for "All in One SEO Pack" plugin keywords
159
- if (get_post_meta($post->ID, '_aioseop_keywords') != NULL){
160
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
161
- }
162
-
163
- // Support for "WordPress SEO by Yoast" plugin keywords
164
- if (get_post_meta($post->ID, '_yoast_wpseo_focuskw') != NULL){
165
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_yoast_wpseo_focuskw', true));
166
- }
167
-
168
- if (get_post_meta($post->ID, '_yoast_wpseo_metakeywords') != NULL){
169
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_yoast_wpseo_metakeywords', true));
170
- }
171
-
172
- // Support for "Add Meta Tags" plugin keywords
173
- if (get_post_meta($post->ID, '_amt_keywords') != NULL){
174
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_amt_keywords', true));
175
- }
176
-
177
- if (get_post_meta($post->ID, '_amt_news_keywords') != NULL){
178
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_amt_news_keywords', true));
179
- }
180
-
181
  // Encode, lowercase & trim appropriately
182
- $keywords = trim(trim(strtolower(trim(htmlspecialchars(htmlspecialchars_decode($keywords), ENT_QUOTES))), ","));
183
-
184
  // Unique keywords
185
  $keywords_array = array();
186
  $keywords_array = explode(', ', $keywords);
@@ -535,6 +512,8 @@ class ShareaholicPublic {
535
  * @return list of permalinks in JSON or plain text
536
  */
537
  public static function permalink_list(){
 
 
538
  $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : "any";
539
  $n = isset($_GET['n']) ? $_GET['n'] : -1;
540
  $format = isset($_GET['format']) ? $_GET['format'] : "json";
@@ -577,6 +556,141 @@ class ShareaholicPublic {
577
  exit;
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  /**
581
  * Checks to see if curl is installed
582
  *
131
  }
132
 
133
  // Get post tags
134
+ $keywords = implode(', ' , ShareaholicUtilities::permalink_keywords($id));
135
 
136
  // Get post categories
137
  $categories_array = get_the_category($id);
154
  } else {
155
  $keywords .= $categories;
156
  }
157
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  // Encode, lowercase & trim appropriately
159
+ $keywords = ShareaholicUtilities::normalize_keywords($keywords);
160
+
161
  // Unique keywords
162
  $keywords_array = array();
163
  $keywords_array = explode(', ', $keywords);
512
  * @return list of permalinks in JSON or plain text
513
  */
514
  public static function permalink_list(){
515
+
516
+ // Input Params
517
  $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : "any";
518
  $n = isset($_GET['n']) ? $_GET['n'] : -1;
519
  $format = isset($_GET['format']) ? $_GET['format'] : "json";
556
  exit;
557
  }
558
 
559
+ /**
560
+ * Function to return relevant info for a given permalink for the Related Content index
561
+ *
562
+ * @return page info in JSON
563
+ */
564
+ public static function permalink_info() {
565
+ global $wpdb, $post;
566
+
567
+ // Input Params
568
+ $permalink = isset($_GET['permalink']) ? $_GET['permalink'] : NULL;
569
+ $body_text = isset($_GET['body_text']) ? $_GET['body_text'] : "raw";
570
+
571
+ if ($permalink == NULL){
572
+ return;
573
+ }
574
+
575
+ // Get post ID
576
+ $post_id = url_to_postid($permalink);
577
+
578
+ // for non-default paths - handle both https and http versions of the permalink
579
+ if ($post_id == 0){
580
+ $parse = parse_url($permalink);
581
+ if ($parse['scheme'] == "https"){
582
+ $permalink = str_replace("https", "http", $permalink);
583
+ $post_id = url_to_postid($permalink);
584
+ } else if ($parse['scheme'] == "http"){
585
+ $permalink = str_replace("http", "https", $permalink);
586
+ $post_id = url_to_postid($permalink);
587
+ }
588
+ }
589
+
590
+ if ($post_id == 0){
591
+ return;
592
+ }
593
+
594
+ // Get post for given ID
595
+ $post = get_post($post_id);
596
+
597
+ if ($post->post_status != 'publish' || $post->post_password != ''){
598
+ return;
599
+ }
600
+
601
+ // Post tags
602
+ $tags = ShareaholicUtilities::permalink_keywords($post_id);
603
+
604
+ // Post categories
605
+ $categories = array();
606
+ $categories_array = get_the_category($post_id);
607
+
608
+ if($categories_array) {
609
+ foreach($categories_array as $category) {
610
+ if ($category->cat_name != "Uncategorized") {
611
+ $category_name = ShareaholicUtilities::normalize_keywords($category->cat_name);
612
+ array_push($categories, $category_name);
613
+ }
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("&nbsp;", "\r\n", "\n", "\r", " ");
630
+ $post_body = str_replace($order, ' ', $post->post_content);
631
+
632
+ if ($body_text == "clean"){
633
+ $post_body = strip_tags($post_body);
634
+ } elseif ($body_text == "raw" || $body_text == NULL) {
635
+ $post_body = $post_body;
636
+ }
637
+
638
+ // Get post author name
639
+ if ($post->post_author) {
640
+ $author_data = get_userdata($post->post_author);
641
+ $author_name = $author_data->display_name;
642
+ }
643
+
644
+ // Term frequencies
645
+ // $term_frequency_title = array_count_values(str_word_count(strtolower(strip_tags($post->post_title)), 1));
646
+ $term_frequency_body = array_count_values(str_word_count(strtolower(strip_tags($post_body)), 1));
647
+
648
+ $term_frequency = $term_frequency_body;
649
+ arsort($term_frequency);
650
+
651
+ // Construct array
652
+ $info = array(
653
+ 'permalink' => $permalink,
654
+ 'domain' => get_bloginfo('url'),
655
+ 'site_id' => ShareaholicUtilities::get_option('api_key'),
656
+ 'content' => array(
657
+ 'title' => $post->post_title,
658
+ 'excerpt' => $post->post_excerpt,
659
+ 'body' => $post_body,
660
+ 'thumbnail' => $thumbnail_src,
661
+ ),
662
+ 'post_metadata' => array(
663
+ 'author_id' => $post->post_author,
664
+ 'author_name' => $author_name,
665
+ 'post_type' => $post->post_type,
666
+ 'post_id' => $post_id,
667
+ 'post_tags' => $tags,
668
+ 'post_categories' => $categories,
669
+ 'post_language' => get_bloginfo('language'),
670
+ 'post_published' => date('c', strtotime($post->post_date_gmt)),
671
+ 'post_updated' => date('c', strtotime(get_lastpostmodified('GMT'))),
672
+ 'post_visibility' => $post->post_status,
673
+ ),
674
+ 'post_stats' => array(
675
+ 'post_comments_count' => get_comments_number($post_id),
676
+ 'post_content_title_character_count' => strlen(trim(html_entity_decode($post->post_title))),
677
+ 'post_content_title_word_count' => str_word_count(strip_tags($post->post_title)),
678
+ 'post_content_body_character_count' => strlen(trim(html_entity_decode($post_body))),
679
+ 'post_content_body_word_count' => str_word_count(strip_tags($post_body)),
680
+ 'term_frequency' => $term_frequency,
681
+ ),
682
+ 'diagnostics' => array(
683
+ 'platform' => 'wp',
684
+ 'platform_version' => get_bloginfo('version'),
685
+ 'plugin_version' => Shareaholic::VERSION,
686
+ ),
687
+ );
688
+
689
+ header('Content-Type: application/json; charset=utf-8');
690
+ echo json_encode($info);
691
+ exit;
692
+ }
693
+
694
  /**
695
  * Checks to see if curl is installed
696
  *
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.1
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
@@ -158,6 +158,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
158
 
159
  == Changelog ==
160
 
 
 
 
161
  = 7.5.0.1 =
162
  * Ensure featured image theme support
163
  * Faster and more reliable Related Content on-boarding!
@@ -1089,6 +1092,10 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
1089
 
1090
  == Upgrade Notice ==
1091
 
 
 
 
 
1092
  = 7.5.0.1 =
1093
 
1094
  Many improvements to the Related Content app.
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.2
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
158
 
159
  == Changelog ==
160
 
161
+ = 7.5.0.2 =
162
+ * Miscellaneous performance and on-boarding enhancements for the Related Content app
163
+
164
  = 7.5.0.1 =
165
  * Ensure featured image theme support
166
  * Faster and more reliable Related Content on-boarding!
1092
 
1093
  == Upgrade Notice ==
1094
 
1095
+ = 7.5.0.2 =
1096
+
1097
+ Many improvements to the Related Content app.
1098
+
1099
  = 7.5.0.1 =
1100
 
1101
  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.1
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.1
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.1';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
@@ -83,9 +83,13 @@ class Shareaholic {
83
  add_action('wp_ajax_nopriv_shareaholic_debug_info', array('ShareaholicPublic', 'debug_info'));
84
  add_action('wp_ajax_shareaholic_debug_info', array('ShareaholicPublic', 'debug_info'));
85
 
86
- // Permalink list for Related Content content index
87
  add_action('wp_ajax_nopriv_shareaholic_permalink_list', array('ShareaholicPublic', 'permalink_list'));
88
  add_action('wp_ajax_shareaholic_permalink_list', array('ShareaholicPublic', 'permalink_list'));
 
 
 
 
89
 
90
  add_action('init', array('ShareaholicPublic', 'init'));
91
  add_action('after_setup_theme', array('ShareaholicPublic', 'after_setup_theme'));
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.5.0.2
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.2
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.2';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
83
  add_action('wp_ajax_nopriv_shareaholic_debug_info', array('ShareaholicPublic', 'debug_info'));
84
  add_action('wp_ajax_shareaholic_debug_info', array('ShareaholicPublic', 'debug_info'));
85
 
86
+ // Permalink list for Related Content index
87
  add_action('wp_ajax_nopriv_shareaholic_permalink_list', array('ShareaholicPublic', 'permalink_list'));
88
  add_action('wp_ajax_shareaholic_permalink_list', array('ShareaholicPublic', 'permalink_list'));
89
+
90
+ // Permalink info for Related Content index
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'));
utilities.php CHANGED
@@ -1020,6 +1020,72 @@ class ShareaholicUtilities {
1020
  echo '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">';
1021
  }
1022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1023
  /*
1024
  * Clears cache created by caching plugins like W3 Total Cache
1025
  *
1020
  echo '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">';
1021
  }
1022
 
1023
+ /**
1024
+ * Function to return a list of permalink keywords
1025
+ *
1026
+ * @return list of keywords for the given permalink in an array
1027
+ */
1028
+ public static function permalink_keywords($post_id = NULL){
1029
+ global $post;
1030
+ $keywords = '';
1031
+
1032
+ if ($post_id != NULL) {
1033
+ $id = $post_id;
1034
+ } else {
1035
+ $id = $post->ID;
1036
+ }
1037
+
1038
+ // Get post tags
1039
+ $keywords = implode(', ', wp_get_post_tags( $id, array('fields' => 'names') ) );
1040
+
1041
+ // Support for "All in One SEO Pack" plugin keywords
1042
+ if (get_post_meta($id, '_aioseop_keywords') != NULL){
1043
+ $keywords .= ', '.stripslashes(get_post_meta($id, '_aioseop_keywords', true));
1044
+ }
1045
+
1046
+ // Support for "WordPress SEO by Yoast" plugin keywords
1047
+ if (get_post_meta($id, '_yoast_wpseo_focuskw') != NULL){
1048
+ $keywords .= ', '.stripslashes(get_post_meta($id, '_yoast_wpseo_focuskw', true));
1049
+ }
1050
+
1051
+ if (get_post_meta($id, '_yoast_wpseo_metakeywords') != NULL){
1052
+ $keywords .= ', '.stripslashes(get_post_meta($id, '_yoast_wpseo_metakeywords', true));
1053
+ }
1054
+
1055
+ // Support for "Add Meta Tags" plugin keywords
1056
+ if (get_post_meta($id, '_amt_keywords') != NULL){
1057
+ $keywords .= ', '.stripslashes(get_post_meta($id, '_amt_keywords', true));
1058
+ }
1059
+
1060
+ if (get_post_meta($id, '_amt_news_keywords') != NULL){
1061
+ $keywords .= ', '.stripslashes(get_post_meta($id, '_amt_news_keywords', true));
1062
+ }
1063
+
1064
+ // Encode, lowercase & trim appropriately
1065
+ $keywords = ShareaholicUtilities::normalize_keywords($keywords);
1066
+
1067
+ // Unique keywords
1068
+ $keywords_array = array();
1069
+ $keywords_array = explode(', ', $keywords);
1070
+ $keywords_array = array_unique($keywords_array);
1071
+
1072
+ if (empty($keywords_array[0])){
1073
+ return array();
1074
+ } else {
1075
+ return $keywords_array;
1076
+ }
1077
+ }
1078
+
1079
+ /**
1080
+ * Normalizes and cleans up a list of comma separated keywords ie. encode, lowercase & trim appropriately
1081
+ *
1082
+ * @param string $keywords
1083
+ * @return string
1084
+ */
1085
+ public static function normalize_keywords($keywords) {
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
  *