Version Description
Download this release
Release Info
| Developer | uberdose |
| Plugin | |
| Version | 1.3.7.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.7.2 to 1.3.7.3
- all_in_one_seo_pack.php +89 -16
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.3.7.
|
| 8 |
Author: uberdose
|
| 9 |
Author URI: http://wp.uberdose.com/
|
| 10 |
*/
|
|
@@ -28,7 +28,7 @@ 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.3.7.
|
| 32 |
|
| 33 |
/** Max numbers of chars in auto-generated description */
|
| 34 |
var $maximum_description_length = 160;
|
|
@@ -47,9 +47,6 @@ class All_in_One_SEO_Pack {
|
|
| 47 |
/** The title before rewriting */
|
| 48 |
var $orig_title = '';
|
| 49 |
|
| 50 |
-
/** The "original" Wordpress title (e.g., post or page title) */
|
| 51 |
-
var $pure_title = '';
|
| 52 |
-
|
| 53 |
function template_redirect() {
|
| 54 |
if (is_feed()) {
|
| 55 |
return;
|
|
@@ -159,7 +156,7 @@ class All_in_One_SEO_Pack {
|
|
| 159 |
$description = str_replace('%description%', $description, $description_format);
|
| 160 |
$description = str_replace('%blog_title%', get_bloginfo('name'), $description);
|
| 161 |
$description = str_replace('%blog_description%', get_bloginfo('description'), $description);
|
| 162 |
-
$description = str_replace('%title%', $this->
|
| 163 |
|
| 164 |
$meta_string .= sprintf("<meta name=\"description\" content=\"%s\"/>", $description);
|
| 165 |
}
|
|
@@ -245,6 +242,88 @@ class All_in_One_SEO_Pack {
|
|
| 245 |
return $in;
|
| 246 |
}
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
function rewrite_title($header) {
|
| 249 |
global $wp_query;
|
| 250 |
if (!$wp_query) {
|
|
@@ -263,7 +342,6 @@ class All_in_One_SEO_Pack {
|
|
| 263 |
if (!$title) {
|
| 264 |
$title = $this->internationalize(wp_title('', false));
|
| 265 |
}
|
| 266 |
-
$this->pure_title = $title;
|
| 267 |
$title_format = get_option('aiosp_page_title_format');
|
| 268 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 269 |
$new_title = str_replace('%page_title%', $title, $new_title);
|
|
@@ -274,7 +352,6 @@ class All_in_One_SEO_Pack {
|
|
| 274 |
if ($this->internationalize(get_option('aiosp_home_title'))) {
|
| 275 |
$header = $this->replace_title($header, $this->internationalize(get_option('aiosp_home_title')));
|
| 276 |
}
|
| 277 |
-
$this->pure_title = get_option('aiosp_home_title');
|
| 278 |
}
|
| 279 |
} else if (is_single()) {
|
| 280 |
$categories = get_the_category();
|
|
@@ -289,7 +366,6 @@ class All_in_One_SEO_Pack {
|
|
| 289 |
$title = $this->internationalize(wp_title('', false));
|
| 290 |
}
|
| 291 |
}
|
| 292 |
-
$this->pure_title = $title;
|
| 293 |
$title_format = get_option('aiosp_post_title_format');
|
| 294 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 295 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
|
@@ -306,7 +382,6 @@ class All_in_One_SEO_Pack {
|
|
| 306 |
$search = wp_specialchars(stripcslashes($s), true);
|
| 307 |
}
|
| 308 |
$search = $this->capitalize($search);
|
| 309 |
-
$this->pure_title = $search;
|
| 310 |
$title_format = get_option('aiosp_search_title_format');
|
| 311 |
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 312 |
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
|
@@ -315,7 +390,6 @@ class All_in_One_SEO_Pack {
|
|
| 315 |
} else if (is_category() && !is_feed()) {
|
| 316 |
$category_description = $this->internationalize(category_description());
|
| 317 |
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
| 318 |
-
$this->pure_title = $category_name;
|
| 319 |
$title_format = get_option('aiosp_category_title_format');
|
| 320 |
$title = str_replace('%category_title%', $category_name, $title_format);
|
| 321 |
$title = str_replace('%category_description%', $category_description, $title);
|
|
@@ -325,7 +399,6 @@ class All_in_One_SEO_Pack {
|
|
| 325 |
} else if (is_page()) {
|
| 326 |
if ($this->is_static_front_page()) {
|
| 327 |
if ($this->internationalize(get_option('aiosp_home_title'))) {
|
| 328 |
-
$this->pure_title = $this->internationalize(get_option('aiosp_home_title'));
|
| 329 |
$header = $this->replace_title($header, get_option('aiosp_home_title'));
|
| 330 |
}
|
| 331 |
} else {
|
|
@@ -333,7 +406,6 @@ class All_in_One_SEO_Pack {
|
|
| 333 |
if (!$title) {
|
| 334 |
$title = $this->internationalize(wp_title('', false));
|
| 335 |
}
|
| 336 |
-
$this->pure_title = $title;
|
| 337 |
$title_format = get_option('aiosp_page_title_format');
|
| 338 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 339 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
|
@@ -352,7 +424,6 @@ class All_in_One_SEO_Pack {
|
|
| 352 |
$tag = $this->internationalize(wp_title('', false));
|
| 353 |
}
|
| 354 |
if ($tag) {
|
| 355 |
-
$this->pure_title = $tag;
|
| 356 |
$tag = $this->capitalize($tag);
|
| 357 |
$title_format = get_option('aiosp_tag_title_format');
|
| 358 |
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
|
@@ -362,7 +433,6 @@ class All_in_One_SEO_Pack {
|
|
| 362 |
}
|
| 363 |
} else if (is_archive()) {
|
| 364 |
$date = $this->internationalize(wp_title('', false));
|
| 365 |
-
$this->pure_title = $date;
|
| 366 |
$title_format = get_option('aiosp_archive_title_format');
|
| 367 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 368 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
|
@@ -375,7 +445,6 @@ class All_in_One_SEO_Pack {
|
|
| 375 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 376 |
$new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
|
| 377 |
$new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
|
| 378 |
-
$this->pure_title = $new_title;
|
| 379 |
$header = $this->replace_title($header, $new_title);
|
| 380 |
}
|
| 381 |
|
|
@@ -436,6 +505,10 @@ class All_in_One_SEO_Pack {
|
|
| 436 |
function get_all_keywords() {
|
| 437 |
global $posts;
|
| 438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
$keywords = array();
|
| 440 |
if (is_array($posts)) {
|
| 441 |
foreach ($posts as $post) {
|
| 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.3.7.3
|
| 8 |
Author: uberdose
|
| 9 |
Author URI: http://wp.uberdose.com/
|
| 10 |
*/
|
| 28 |
|
| 29 |
class All_in_One_SEO_Pack {
|
| 30 |
|
| 31 |
+
var $version = "1.3.7.3";
|
| 32 |
|
| 33 |
/** Max numbers of chars in auto-generated description */
|
| 34 |
var $maximum_description_length = 160;
|
| 47 |
/** The title before rewriting */
|
| 48 |
var $orig_title = '';
|
| 49 |
|
|
|
|
|
|
|
|
|
|
| 50 |
function template_redirect() {
|
| 51 |
if (is_feed()) {
|
| 52 |
return;
|
| 156 |
$description = str_replace('%description%', $description, $description_format);
|
| 157 |
$description = str_replace('%blog_title%', get_bloginfo('name'), $description);
|
| 158 |
$description = str_replace('%blog_description%', get_bloginfo('description'), $description);
|
| 159 |
+
$description = str_replace('%title%', $this->get_original_title(), $description);
|
| 160 |
|
| 161 |
$meta_string .= sprintf("<meta name=\"description\" content=\"%s\"/>", $description);
|
| 162 |
}
|
| 242 |
return $in;
|
| 243 |
}
|
| 244 |
|
| 245 |
+
/** @return The original title as delivered by WP (well, in most cases) */
|
| 246 |
+
function get_original_title() {
|
| 247 |
+
global $wp_query;
|
| 248 |
+
if (!$wp_query) {
|
| 249 |
+
return null;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
$post = $wp_query->get_queried_object();
|
| 253 |
+
|
| 254 |
+
// the_search_query() is not suitable, it cannot just return
|
| 255 |
+
global $s;
|
| 256 |
+
|
| 257 |
+
$title = null;
|
| 258 |
+
|
| 259 |
+
if (is_home()) {
|
| 260 |
+
if ($this->is_static_posts_page()) {
|
| 261 |
+
$title = $this->internationalize(get_post_meta(get_option('page_for_posts'), "title", true));
|
| 262 |
+
if (!$title) {
|
| 263 |
+
$title = $this->internationalize(wp_title('', false));
|
| 264 |
+
}
|
| 265 |
+
} else {
|
| 266 |
+
$title = $this->internationalize(get_option('aiosp_home_title'));
|
| 267 |
+
}
|
| 268 |
+
} else if (is_single()) {
|
| 269 |
+
$title = $this->internationalize(get_post_meta($post->ID, "title", true));
|
| 270 |
+
if (!$title) {
|
| 271 |
+
$title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
|
| 272 |
+
if (!$title) {
|
| 273 |
+
$title = $this->internationalize(wp_title('', false));
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
} else if (is_search() && isset($s) && !empty($s)) {
|
| 277 |
+
if (function_exists('attribute_escape')) {
|
| 278 |
+
$search = attribute_escape(stripcslashes($s));
|
| 279 |
+
} else {
|
| 280 |
+
$search = wp_specialchars(stripcslashes($s), true);
|
| 281 |
+
}
|
| 282 |
+
$search = $this->capitalize($search);
|
| 283 |
+
$title = $search;
|
| 284 |
+
} else if (is_category() && !is_feed()) {
|
| 285 |
+
$category_description = $this->internationalize(category_description());
|
| 286 |
+
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
| 287 |
+
$title = $category_name;
|
| 288 |
+
} else if (is_page()) {
|
| 289 |
+
if ($this->is_static_front_page()) {
|
| 290 |
+
if ($this->internationalize(get_option('aiosp_home_title'))) {
|
| 291 |
+
$title = $this->internationalize(get_option('aiosp_home_title'));
|
| 292 |
+
}
|
| 293 |
+
} else {
|
| 294 |
+
$title = $this->internationalize(get_post_meta($post->ID, "title", true));
|
| 295 |
+
if (!$title) {
|
| 296 |
+
$title = $this->internationalize(wp_title('', false));
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
} else if (function_exists('is_tag') && is_tag()) {
|
| 300 |
+
global $utw;
|
| 301 |
+
if ($utw) {
|
| 302 |
+
$tags = $utw->GetCurrentTagSet();
|
| 303 |
+
$tag = $tags[0]->tag;
|
| 304 |
+
$tag = str_replace('-', ' ', $tag);
|
| 305 |
+
} else {
|
| 306 |
+
// wordpress > 2.3
|
| 307 |
+
$tag = $this->internationalize(wp_title('', false));
|
| 308 |
+
}
|
| 309 |
+
if ($tag) {
|
| 310 |
+
$title = $tag;
|
| 311 |
+
}
|
| 312 |
+
} else if (is_archive()) {
|
| 313 |
+
$date = $this->internationalize(wp_title('', false));
|
| 314 |
+
$title = $date;
|
| 315 |
+
} else if (is_404()) {
|
| 316 |
+
$title_format = get_option('aiosp_404_title_format');
|
| 317 |
+
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 318 |
+
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 319 |
+
$new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
|
| 320 |
+
$new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
|
| 321 |
+
$title = $new_title;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
return $title;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
function rewrite_title($header) {
|
| 328 |
global $wp_query;
|
| 329 |
if (!$wp_query) {
|
| 342 |
if (!$title) {
|
| 343 |
$title = $this->internationalize(wp_title('', false));
|
| 344 |
}
|
|
|
|
| 345 |
$title_format = get_option('aiosp_page_title_format');
|
| 346 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 347 |
$new_title = str_replace('%page_title%', $title, $new_title);
|
| 352 |
if ($this->internationalize(get_option('aiosp_home_title'))) {
|
| 353 |
$header = $this->replace_title($header, $this->internationalize(get_option('aiosp_home_title')));
|
| 354 |
}
|
|
|
|
| 355 |
}
|
| 356 |
} else if (is_single()) {
|
| 357 |
$categories = get_the_category();
|
| 366 |
$title = $this->internationalize(wp_title('', false));
|
| 367 |
}
|
| 368 |
}
|
|
|
|
| 369 |
$title_format = get_option('aiosp_post_title_format');
|
| 370 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 371 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 382 |
$search = wp_specialchars(stripcslashes($s), true);
|
| 383 |
}
|
| 384 |
$search = $this->capitalize($search);
|
|
|
|
| 385 |
$title_format = get_option('aiosp_search_title_format');
|
| 386 |
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 387 |
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
| 390 |
} else if (is_category() && !is_feed()) {
|
| 391 |
$category_description = $this->internationalize(category_description());
|
| 392 |
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
|
|
|
| 393 |
$title_format = get_option('aiosp_category_title_format');
|
| 394 |
$title = str_replace('%category_title%', $category_name, $title_format);
|
| 395 |
$title = str_replace('%category_description%', $category_description, $title);
|
| 399 |
} else if (is_page()) {
|
| 400 |
if ($this->is_static_front_page()) {
|
| 401 |
if ($this->internationalize(get_option('aiosp_home_title'))) {
|
|
|
|
| 402 |
$header = $this->replace_title($header, get_option('aiosp_home_title'));
|
| 403 |
}
|
| 404 |
} else {
|
| 406 |
if (!$title) {
|
| 407 |
$title = $this->internationalize(wp_title('', false));
|
| 408 |
}
|
|
|
|
| 409 |
$title_format = get_option('aiosp_page_title_format');
|
| 410 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 411 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 424 |
$tag = $this->internationalize(wp_title('', false));
|
| 425 |
}
|
| 426 |
if ($tag) {
|
|
|
|
| 427 |
$tag = $this->capitalize($tag);
|
| 428 |
$title_format = get_option('aiosp_tag_title_format');
|
| 429 |
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 433 |
}
|
| 434 |
} else if (is_archive()) {
|
| 435 |
$date = $this->internationalize(wp_title('', false));
|
|
|
|
| 436 |
$title_format = get_option('aiosp_archive_title_format');
|
| 437 |
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
| 438 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 445 |
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
| 446 |
$new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
|
| 447 |
$new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
|
|
|
|
| 448 |
$header = $this->replace_title($header, $new_title);
|
| 449 |
}
|
| 450 |
|
| 505 |
function get_all_keywords() {
|
| 506 |
global $posts;
|
| 507 |
|
| 508 |
+
if (is_404()) {
|
| 509 |
+
return null;
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
$keywords = array();
|
| 513 |
if (is_array($posts)) {
|
| 514 |
foreach ($posts as $post) {
|
