All in One SEO Pack - Version 1.2.6.8

Version Description

Download this release

Release Info

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

Code changes from version 1.2.6.4 to 1.2.6.8

Files changed (1) hide show
  1. all_in_one_seo_pack.php +39 -30
all_in_one_seo_pack.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/
6
  Description: Out-of-the-box SEO for your Wordpress blog.
7
- Version: 1.2.6.6
8
  Author: uberdose
9
  Author URI: http://wp.uberdose.com/
10
  */
@@ -28,18 +28,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
 
29
  class All_in_One_SEO_Pack {
30
 
31
- var $version = "1.2.6.6";
32
 
33
  /**
34
- * Number of words to be used (max) for generating an excerpt.
35
  */
36
- var $maximum_excerpt_length = 25;
37
-
38
  /**
39
  * Minimum number of chars an excerpt should be so that it can be used
40
  * as description. Touch only if you know what you're doing.
41
  */
42
- var $minimum_excerpt_length = 1;
43
 
44
  var $table_prefix = "aiosp_";
45
 
@@ -47,14 +47,17 @@ class All_in_One_SEO_Pack {
47
 
48
  var $db_version = '0.1';
49
 
 
 
50
  function template_redirect() {
51
  if (is_feed()) {
52
  return;
53
  }
54
 
55
- if (get_option('aiosp_max_words_excerpt') && is_numeric(get_option('aiosp_max_words_excerpt'))) {
56
- $this->maximum_excerpt_length = get_option('aiosp_max_words_excerpt');
57
  }
 
58
  if (get_option('aiosp_rewrite_titles')) {
59
  ob_start(array($this, 'output_callback_for_title'));
60
  }
@@ -125,7 +128,7 @@ class All_in_One_SEO_Pack {
125
  $description = category_description();
126
  }
127
 
128
- if (isset($description) && strlen($description) > $this->minimum_excerpt_length) {
129
  $description = str_replace('"', '', $description);
130
 
131
  // replace newlines on mac / windows?
@@ -185,6 +188,10 @@ class All_in_One_SEO_Pack {
185
  $start = strpos($content, "<title>");
186
  $end = strpos($content, "</title>");
187
 
 
 
 
 
188
  if ($start && $end) {
189
  $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
190
  } else {
@@ -313,21 +320,19 @@ class All_in_One_SEO_Pack {
313
  function trim_excerpt_without_filters($text) {
314
  $text = str_replace(']]>', ']]&gt;', $text);
315
  $text = strip_tags($text);
316
- $excerpt_length = $this->maximum_excerpt_length;
317
- $words = explode(' ', $text, $excerpt_length + 1);
318
- if (count($words) > $excerpt_length) {
319
- array_pop($words);
320
- array_push($words, '...');
321
- $text = implode(' ', $words);
322
  }
 
323
  return trim(stripslashes($text));
324
  }
325
 
326
  function trim_excerpt_without_filters_full_length($text) {
327
  $text = str_replace(']]>', ']]&gt;', $text);
328
  $text = strip_tags($text);
329
- $excerpt_length = $this->maximum_excerpt_length;
330
- $words = explode(' ', $text, $excerpt_length + 1);
331
  return trim(stripslashes($text));
332
  }
333
 
@@ -509,7 +514,9 @@ class All_in_One_SEO_Pack {
509
  </tr>
510
  <tr>
511
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
512
- <td><textarea name="aiosp_description" rows="1" cols="78"><?php echo $description ?></textarea></td>
 
 
513
  </tr>
514
  <tr>
515
  <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
@@ -538,7 +545,8 @@ class All_in_One_SEO_Pack {
538
  </tr>
539
  <tr>
540
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
541
- <td><textarea name="aiosp_description" rows="1" cols="78" tabindex="1001"><?php echo $description ?></textarea></td>
 
542
  </tr>
543
  <tr>
544
  <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
@@ -575,6 +583,7 @@ class All_in_One_SEO_Pack {
575
  update_option('aiosp_archive_noindex', $_POST['aiosp_archive_noindex']);
576
  update_option('aiosp_tags_noindex', $_POST['aiosp_tags_noindex']);
577
  update_option('aiosp_generate_descriptions', $_POST['aiosp_generate_descriptions']);
 
578
  wp_cache_flush();
579
  }
580
 
@@ -628,6 +637,16 @@ class All_in_One_SEO_Pack {
628
  </tr>
629
  <tr>
630
  <th scope="row" style="text-align:right; vertical-align:top;">
 
 
 
 
 
 
 
 
 
 
631
  <a target="_blank" title="<?php _e('Help for Option Rewrite Titles', 'all_in_one_seo_pack')?>" href="http://wp.uberdose.com/2007/05/11/all-in-one-seo-pack-help/#rewritetitles">
632
  <?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
633
  </a>
@@ -749,16 +768,6 @@ class All_in_One_SEO_Pack {
749
  <input type="checkbox" name="aiosp_generate_descriptions" <?php if (get_option('aiosp_generate_descriptions')) echo "checked=\"1\""; ?>/>
750
  </td>
751
  </tr>
752
- <tr>
753
- <th scope="row" style="text-align:right; vertical-align:top;">
754
- <a target="_blank" title="<?php _e('Help for Option Max Number of Words in Auto-Generated Descriptions', 'all_in_one_seo_pack')?>" href="http://wp.uberdose.com/2007/05/11/all-in-one-seo-pack-help/#maxwordsdescription">
755
- <?php _e('Max Number of Words in Auto-Generated Descriptions:', 'all_in_one_seo_pack')?>
756
- </a>
757
- </td>
758
- <td>
759
- <input size="5" name="aiosp_max_words_excerpt" value="<?php echo stripcslashes(get_option('aiosp_max_words_excerpt')); ?>"/>
760
- </td>
761
- </tr>
762
  </table>
763
  <p class="submit">
764
  <input type="hidden" name="action" value="aiosp_update" />
@@ -777,7 +786,6 @@ add_option("aiosp_home_description", null, __('All in One SEO Plugin Home Descri
777
  add_option("aiosp_home_title", null, __('All in One SEO Plugin Home Title', 'all_in_one_seo_pack'), 'yes');
778
  add_option("aiosp_rewrite_titles", 1, __('All in One SEO Plugin Rewrite Titles', 'all_in_one_seo_pack'), 'yes');
779
  add_option("aiosp_use_categories", 1, __('All in One SEO Plugin Use Categories', 'all_in_one_seo_pack'), 'yes');
780
- add_option("aiosp_max_words_excerpt", 25, __('All in One SEO Plugin Maximum Number of Words in Auto-Generated Descriptions', 'all_in_one_seo_pack'), 'yes');
781
  add_option("aiosp_category_noindex", 1, __('All in One SEO Plugin Noindex for Categories', 'all_in_one_seo_pack'), 'yes');
782
  add_option("aiosp_archive_noindex", 1, __('All in One SEO Plugin Noindex for Archives', 'all_in_one_seo_pack'), 'yes');
783
  add_option("aiosp_tags_noindex", 1, __('All in One SEO Plugin Noindex for Tag Archives', 'all_in_one_seo_pack'), 'yes');
@@ -788,6 +796,7 @@ add_option("aiosp_category_title_format", '%category_title% | %blog_title%', __(
788
  add_option("aiosp_archive_title_format", '%date% | %blog_title%', __('All in One SEO Plugin Archive Title Format', 'all_in_one_seo_pack'), 'yes');
789
  add_option("aiosp_tag_title_format", '%tag% | %blog_title%', __('All in One SEO Plugin Tag Title Format', 'all_in_one_seo_pack'), 'yes');
790
  add_option("aiosp_search_title_format", '%search% | %blog_title%', __('All in One SEO Plugin Search Title Format', 'all_in_one_seo_pack'), 'yes');
 
791
 
792
  $aiosp = new All_in_One_SEO_Pack();
793
  add_action('wp_head', array($aiosp, 'wp_head'));
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/
6
  Description: Out-of-the-box SEO for your Wordpress blog.
7
+ Version: 1.2.6.8
8
  Author: uberdose
9
  Author URI: http://wp.uberdose.com/
10
  */
28
 
29
  class All_in_One_SEO_Pack {
30
 
31
+ var $version = "1.2.6.8";
32
 
33
  /**
34
+ * Max numbers of chars in auto-generated description.
35
  */
36
+ var $maximum_description_length = 160;
37
+
38
  /**
39
  * Minimum number of chars an excerpt should be so that it can be used
40
  * as description. Touch only if you know what you're doing.
41
  */
42
+ var $minimum_description_length = 1;
43
 
44
  var $table_prefix = "aiosp_";
45
 
47
 
48
  var $db_version = '0.1';
49
 
50
+ var $debug = false;
51
+
52
  function template_redirect() {
53
  if (is_feed()) {
54
  return;
55
  }
56
 
57
+ if (get_option('aiosp_debug_info')) {
58
+ $this->debug = true;
59
  }
60
+
61
  if (get_option('aiosp_rewrite_titles')) {
62
  ob_start(array($this, 'output_callback_for_title'));
63
  }
128
  $description = category_description();
129
  }
130
 
131
+ if (isset($description) && strlen($description) > $this->minimum_description_length) {
132
  $description = str_replace('"', '', $description);
133
 
134
  // replace newlines on mac / windows?
188
  $start = strpos($content, "<title>");
189
  $end = strpos($content, "</title>");
190
 
191
+ if ($this->debug) {
192
+ $content .= "<!-- aiosp title: $start,$end -->";
193
+ }
194
+
195
  if ($start && $end) {
196
  $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
197
  } else {
320
  function trim_excerpt_without_filters($text) {
321
  $text = str_replace(']]>', ']]&gt;', $text);
322
  $text = strip_tags($text);
323
+ $max = $this->maximum_description_length;
324
+ if ($max < strlen($text)) {
325
+ while($text[$max] != ' ' && $max > $this->minimum_description_length) {
326
+ $max--;
327
+ }
 
328
  }
329
+ $text = substr($text, 0, $max);
330
  return trim(stripslashes($text));
331
  }
332
 
333
  function trim_excerpt_without_filters_full_length($text) {
334
  $text = str_replace(']]>', ']]&gt;', $text);
335
  $text = strip_tags($text);
 
 
336
  return trim(stripslashes($text));
337
  }
338
 
514
  </tr>
515
  <tr>
516
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
517
+ <td><textarea name="aiosp_description" rows="1" cols="78"><?php echo $description ?></textarea><br/>
518
+ Most search engines use a maximum of 160 chars for the description.
519
+ </td>
520
  </tr>
521
  <tr>
522
  <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
545
  </tr>
546
  <tr>
547
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
548
+ <td><textarea name="aiosp_description" rows="1" cols="78" tabindex="1001"><?php echo $description ?></textarea><br/>
549
+ Most search engines use a maximum of 160 chars for the description.</td>
550
  </tr>
551
  <tr>
552
  <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
583
  update_option('aiosp_archive_noindex', $_POST['aiosp_archive_noindex']);
584
  update_option('aiosp_tags_noindex', $_POST['aiosp_tags_noindex']);
585
  update_option('aiosp_generate_descriptions', $_POST['aiosp_generate_descriptions']);
586
+ update_option('aiosp_debug_info', $_POST['aiosp_debug_info']);
587
  wp_cache_flush();
588
  }
589
 
637
  </tr>
638
  <tr>
639
  <th scope="row" style="text-align:right; vertical-align:top;">
640
+ <a target="_blank" title="<?php _e('Help for Option Debug Info', 'all_in_one_seo_pack')?>" href="http://wp.uberdose.com/2007/05/11/all-in-one-seo-pack-help/#debuginfo">
641
+ <?php _e('Debug Info:', 'all_in_one_seo_pack')?>
642
+ </a>
643
+ </td>
644
+ <td>
645
+ <input type="checkbox" name="aiosp_debug_info" <?php if (get_option('aiosp_debug_info')) echo "checked=\"1\""; ?>/>
646
+ </td>
647
+ </tr>
648
+ <tr>
649
+ <th scope="row" style="text-align:right; vertical-align:top;">
650
  <a target="_blank" title="<?php _e('Help for Option Rewrite Titles', 'all_in_one_seo_pack')?>" href="http://wp.uberdose.com/2007/05/11/all-in-one-seo-pack-help/#rewritetitles">
651
  <?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
652
  </a>
768
  <input type="checkbox" name="aiosp_generate_descriptions" <?php if (get_option('aiosp_generate_descriptions')) echo "checked=\"1\""; ?>/>
769
  </td>
770
  </tr>
 
 
 
 
 
 
 
 
 
 
771
  </table>
772
  <p class="submit">
773
  <input type="hidden" name="action" value="aiosp_update" />
786
  add_option("aiosp_home_title", null, __('All in One SEO Plugin Home Title', 'all_in_one_seo_pack'), 'yes');
787
  add_option("aiosp_rewrite_titles", 1, __('All in One SEO Plugin Rewrite Titles', 'all_in_one_seo_pack'), 'yes');
788
  add_option("aiosp_use_categories", 1, __('All in One SEO Plugin Use Categories', 'all_in_one_seo_pack'), 'yes');
 
789
  add_option("aiosp_category_noindex", 1, __('All in One SEO Plugin Noindex for Categories', 'all_in_one_seo_pack'), 'yes');
790
  add_option("aiosp_archive_noindex", 1, __('All in One SEO Plugin Noindex for Archives', 'all_in_one_seo_pack'), 'yes');
791
  add_option("aiosp_tags_noindex", 1, __('All in One SEO Plugin Noindex for Tag Archives', 'all_in_one_seo_pack'), 'yes');
796
  add_option("aiosp_archive_title_format", '%date% | %blog_title%', __('All in One SEO Plugin Archive Title Format', 'all_in_one_seo_pack'), 'yes');
797
  add_option("aiosp_tag_title_format", '%tag% | %blog_title%', __('All in One SEO Plugin Tag Title Format', 'all_in_one_seo_pack'), 'yes');
798
  add_option("aiosp_search_title_format", '%search% | %blog_title%', __('All in One SEO Plugin Search Title Format', 'all_in_one_seo_pack'), 'yes');
799
+ add_option("aiosp_debug_info", 0, __('All in One SEO Plugin Debug Info', 'all_in_one_seo_pack'), 'yes');
800
 
801
  $aiosp = new All_in_One_SEO_Pack();
802
  add_action('wp_head', array($aiosp, 'wp_head'));