All in One SEO Pack - Version 1.4.8

Version Description

Download this release

Release Info

Developer hallsofmontezuma
Plugin Icon 128x128 All in One SEO Pack
Version 1.4.8
Comparing to
See all releases

Code changes from version 1.4.7.4 to 1.4.8

Files changed (1) hide show
  1. all_in_one_seo_pack.php +115 -3
all_in_one_seo_pack.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://semperfiwebdesign.com
6
  Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/all_in_one_seo_pack.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/" >Support</a>
7
- Version: 1.4.7.4
8
  Author: Michael Torbert
9
  Author URI: http://semperfiwebdesign.com
10
  */
@@ -476,7 +476,7 @@ $UTF8_TABLES['strtoupper'] = array(
476
 
477
  class All_in_One_SEO_Pack {
478
 
479
- var $version = "1.4.7.4";
480
 
481
  /** Max numbers of chars in auto-generated description */
482
  var $maximum_description_length = 160;
@@ -600,7 +600,8 @@ class All_in_One_SEO_Pack {
600
  $stylesheet = $home.'/wp-content/plugins' . $this->get_base() . '/css/all_in_one_seo_pack.css';
601
  echo('<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />');
602
  }
603
-
 
604
  function wp_head() {
605
  if (is_feed()) {
606
  return;
@@ -743,9 +744,102 @@ class All_in_One_SEO_Pack {
743
  echo "$meta_string\n";
744
  }
745
 
 
 
 
 
 
 
 
746
  echo "<!-- /all in one seo pack -->\n";
747
  }
748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  function get_post_description($post) {
750
  $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "description", true))));
751
  if (!$description) {
@@ -1530,6 +1624,7 @@ class All_in_One_SEO_Pack {
1530
  // update options
1531
  if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
1532
  $message = $message_updated;
 
1533
  update_option('aiosp_donate', $_POST['aiosp_donate']);
1534
  update_option('aiosp_home_title', $_POST['aiosp_home_title']);
1535
  update_option('aiosp_home_description', $_POST['aiosp_home_description']);
@@ -1693,6 +1788,22 @@ _e("A comma separated list of your most important keywords for your site that wi
1693
  </td>
1694
  </tr>
1695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1696
  <tr>
1697
  <th scope="row" style="text-align:right; vertical-align:top;">
1698
  <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
@@ -2093,6 +2204,7 @@ _e('All donations support continued development of this free software.', 'all_in
2093
  add_option("aiosp_home_description", null, 'All in One SEO Plugin Home Description', 'yes');
2094
  add_option("aiosp_home_title", null, 'All in One SEO Plugin Home Title', 'yes');
2095
  add_option("aiosp_donate", 0, 'All in One SEO Pack Donate', 'no');
 
2096
  add_option("aiosp_rewrite_titles", 1, 'All in One SEO Plugin Rewrite Titles', 'yes');
2097
  add_option("aiosp_use_categories", 0, 'All in One SEO Plugin Use Categories', 'yes');
2098
  add_option("aiosp_category_noindex", 1, 'All in One SEO Plugin Noindex for Categories', 'yes');
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://semperfiwebdesign.com
6
  Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/all_in_one_seo_pack.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/" >Support</a>
7
+ Version: 1.4.8
8
  Author: Michael Torbert
9
  Author URI: http://semperfiwebdesign.com
10
  */
476
 
477
  class All_in_One_SEO_Pack {
478
 
479
+ var $version = "1.4.8";
480
 
481
  /** Max numbers of chars in auto-generated description */
482
  var $maximum_description_length = 160;
600
  $stylesheet = $home.'/wp-content/plugins' . $this->get_base() . '/css/all_in_one_seo_pack.css';
601
  echo('<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />');
602
  }
603
+
604
+
605
  function wp_head() {
606
  if (is_feed()) {
607
  return;
744
  echo "$meta_string\n";
745
  }
746
 
747
+ if(get_option('aiosp_can')){
748
+ $url = $this->aiosp_mrt_get_url($wp_query);
749
+ if ($url) {
750
+ echo "".'<link rel="canonical" href="'.$url.'"/>'."\n";
751
+ }
752
+ }
753
+
754
  echo "<!-- /all in one seo pack -->\n";
755
  }
756
 
757
+
758
+ function aiosp_mrt_get_url($query) {
759
+ if ($query->is_404 || $query->is_search) {
760
+ return false;
761
+ }
762
+ $haspost = count($query->posts) > 0;
763
+ $has_ut = function_exists('user_trailingslashit');
764
+
765
+ if (get_query_var('m')) {
766
+ $m = preg_replace('/[^0-9]/', '', get_query_var('m'));
767
+ switch (strlen($m)) {
768
+ case 4:
769
+ $link = get_year_link($m);
770
+ break;
771
+ case 6:
772
+ $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
773
+ break;
774
+ case 8:
775
+ $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2),
776
+ substr($m, 6, 2));
777
+ break;
778
+ default:
779
+ return false;
780
+ }
781
+ } elseif (($query->is_single || $query->is_page) && $haspost) {
782
+ $post = $query->posts[0];
783
+ $link = get_permalink($post->ID);
784
+ $page = get_query_var('paged');
785
+ if ($page && $page > 1) {
786
+ $link = trailingslashit($link) . "page/". "$page";
787
+ if ($has_ut) {
788
+ $link = user_trailingslashit($link, 'paged');
789
+ } else {
790
+ $link .= '/';
791
+ }
792
+ }
793
+ if ($query->is_page && ('page' == get_option('show_on_front')) &&
794
+ $post->ID == get_option('page_on_front'))
795
+ {
796
+ $link = trailingslashit($link);
797
+ }
798
+ } elseif ($query->is_author && $haspost) {
799
+ global $wp_version;
800
+ if ($wp_version >= '2') {
801
+ $author = get_userdata(get_query_var('author'));
802
+ if ($author === false)
803
+ return false;
804
+ $link = get_author_link(false, $author->ID,
805
+ $author->user_nicename);
806
+ } else {
807
+ global $cache_userdata;
808
+ $userid = get_query_var('author');
809
+ $link = get_author_link(false, $userid,
810
+ $cache_userdata[$userid]->user_nicename);
811
+ }
812
+ } elseif ($query->is_category && $haspost) {
813
+ $link = get_category_link(get_query_var('cat'));
814
+ } elseif ($query->is_day && $haspost) {
815
+ $link = get_day_link(get_query_var('year'),
816
+ get_query_var('monthnum'),
817
+ get_query_var('day'));
818
+ } elseif ($query->is_month && $haspost) {
819
+ $link = get_month_link(get_query_var('year'),
820
+ get_query_var('monthnum'));
821
+ } elseif ($query->is_year && $haspost) {
822
+ $link = get_year_link(get_query_var('year'));
823
+ } elseif ($query->is_home) {
824
+ if ((get_option('show_on_front') == 'page') &&
825
+ ($pageid = get_option('page_for_posts')))
826
+ {
827
+ $link = trailingslashit(get_permalink($pageid));
828
+ } else {
829
+ $link = trailingslashit(get_option('home'));
830
+ }
831
+ } else {
832
+ return false;
833
+ }
834
+
835
+ return $link;
836
+
837
+ }
838
+
839
+
840
+
841
+
842
+
843
  function get_post_description($post) {
844
  $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "description", true))));
845
  if (!$description) {
1624
  // update options
1625
  if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
1626
  $message = $message_updated;
1627
+ update_option('aiosp_can', $_POST['aiosp_can']);
1628
  update_option('aiosp_donate', $_POST['aiosp_donate']);
1629
  update_option('aiosp_home_title', $_POST['aiosp_home_title']);
1630
  update_option('aiosp_home_description', $_POST['aiosp_home_description']);
1788
  </td>
1789
  </tr>
1790
 
1791
+ <tr>
1792
+ <th scope="row" style="text-align:right; vertical-align:top;">
1793
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_can_tip');">
1794
+ <?php _e('Canonical URLs:', 'all_in_one_seo_pack')?>
1795
+ </a>
1796
+ </td>
1797
+ <td>
1798
+ <input type="checkbox" name="aiosp_can" <?php if (get_option('aiosp_can')) echo "checked=\"1\""; ?>/>
1799
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_can_tip">
1800
+ <?php
1801
+ _e("This option will automatically generate Canonical URLS for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href='http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html' target='_blank'>Google</a>.", 'all_in_one_seo_pack');
1802
+ ?>
1803
+ </div>
1804
+ </td>
1805
+ </tr>
1806
+
1807
  <tr>
1808
  <th scope="row" style="text-align:right; vertical-align:top;">
1809
  <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
2204
  add_option("aiosp_home_description", null, 'All in One SEO Plugin Home Description', 'yes');
2205
  add_option("aiosp_home_title", null, 'All in One SEO Plugin Home Title', 'yes');
2206
  add_option("aiosp_donate", 0, 'All in One SEO Pack Donate', 'no');
2207
+ add_option("aiosp_can", 1, 'All in One SEO Pack Canonical URLs', 'yes');
2208
  add_option("aiosp_rewrite_titles", 1, 'All in One SEO Plugin Rewrite Titles', 'yes');
2209
  add_option("aiosp_use_categories", 0, 'All in One SEO Plugin Use Categories', 'yes');
2210
  add_option("aiosp_category_noindex", 1, 'All in One SEO Plugin Noindex for Categories', 'yes');