. */ class All_in_One_SEO_Pack { var $version = "1.2.3.2"; /** * Number of words to be used (max) for generating an excerpt. */ var $maximum_excerpt_length = 25; /** * Minimum number of chars an excerpt should be so that it can be used * as description. Touch only if you know what you're doing. */ var $minimum_excerpt_length = 1; function template_redirect() { if (get_option('aiosp_max_words_excerpt') && is_numeric(get_option('aiosp_max_words_excerpt'))) { $this->maximum_excerpt_length = get_option('aiosp_max_words_excerpt'); } ob_start(array($this, 'output_callback_for_title')); } function output_callback_for_title($content) { return $this->rewrite_title($content); } function init_textdomain() { if(function_exists('load_plugin_textdomain')) { load_plugin_textdomain('all_in_one_seo_pack', 'wp-content/plugins/all-in-one-seo-pack'); } } function wp_head() { if (is_feed()) { return; } global $post; $meta_string = null; echo "\n"; if (is_home() && get_option('aiosp_home_keywords')) { $keywords = trim(get_option('aiosp_home_keywords')); } else { $keywords = $this->get_all_keywords(); } if (is_single() || is_page()) { $description = trim(stripslashes(get_post_meta($post->ID, "description", true))); if (!$description) { $description = $this->trim_excerpt_without_filters_full_length($post->post_excerpt); if (!$description && get_option("aiosp_generate_descriptions")) { $description = $this->trim_excerpt_without_filters($post->post_content); } } } else if (is_home()) { $description = trim(stripslashes(get_option('aiosp_home_description'))); } if (isset($description) && strlen($description) > $this->minimum_excerpt_length) { $description = str_replace('"', '', $description); // replace newlines on mac / windows? $description = str_replace("\r\n", ' ', $description); // maybe linux uses this alone $description = str_replace("\n", ' ', $description); if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string .= sprintf("", $description); } if (isset ($keywords) && !empty($keywords)) { if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string .= sprintf("", $keywords); } if((is_category() && get_option('aiosp_category_noindex')) || (!is_category() && is_archive() && get_option('aiosp_archive_noindex')) || (get_option('aiosp_tags_noindex') && function_exists('is_tag') && is_tag())) { if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string = ''; } if ($meta_string != null) { echo "$meta_string\n"; } } function replace_title($content, $title) { $title = trim(stripslashes(addslashes($title))); $header = preg_replace_callback("/.*<\/title>/", create_function('$match_not_needed',"return '<title>$title';"), $content); return $header; } function rewrite_title($header) { global $post, $s; if (is_home()) { if (get_option('aiosp_home_title')) { $header = $this->replace_title($header, get_option('aiosp_home_title')); } } else if (is_single()) { $title = get_post_meta($post->ID, "title", true); if ($title) { $header = $this->replace_title($header, $title); } else if (get_option('aiosp_rewrite_titles')) { $title = wp_title('', false); $title_format = get_option('aiosp_post_title_format'); $new_title = str_replace('%blog_title%', get_bloginfo('name'), $title_format); $new_title = str_replace('%post_title%', $title, $new_title); $title = $new_title; $title = trim($title); $header = $this->replace_title($header, $title); } } else if (is_search() && isset($s) && !empty($s)) { if (function_exists('attribute_escape')) { $title = attribute_escape(stripslashes($s)); } else { $title = wp_specialchars(stripslashes($s), true); } $header = $this->replace_title($header, $title); } else if (is_category() && !is_feed) { $title = category_description(); if (!$title) { $title = single_cat_title('', false); } $header = $this->replace_title($header, $title); } else if (is_page()) { $title = get_post_meta($post->ID, "title", true); if (!$title) { $title = wp_title('', false); } $header = $this->replace_title($header, $title); } return $header; } function trim_excerpt_without_filters($text) { $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = $this->maximum_excerpt_length; $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '...'); $text = implode(' ', $words); } return trim(stripslashes($text)); } function trim_excerpt_without_filters_full_length($text) { $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = $this->maximum_excerpt_length; $words = explode(' ', $text, $excerpt_length + 1); return trim(stripslashes($text)); } /** * @return comma-separated list of unique keywords */ function get_all_keywords() { global $posts; $keywords = array(); if (is_array($posts)) { foreach ($posts as $post) { if ($post) { if (get_option('aiosp_use_categories') && !is_page()) { $categories = get_the_category($post->ID); foreach ($categories as $category) { $keywords[] = $category->cat_name; } } // Ultimate Tag Warrior integration global $utw; if ($utw) { $tags = $utw->GetTagsForPost($post); foreach ($tags as $tag) { $tag = $tag->tag; $tag = str_replace('_',' ', $tag); $tag = str_replace('-',' ',$tag); $tag = stripslashes($tag); $keywords[] = $tag; } } $keywords_a = $keywords_i = null; $description_a = $description_i = null; $id = $post->ID; $keywords_i = stripslashes(get_post_meta($post->ID, "keywords", true)); if (isset($keywords_i) && !empty($keywords_i)) { $keywords[] = $keywords_i; } } } } return $this->get_unique_keywords($keywords); } function get_unique_keywords($keywords) { $keywords_ar = array_unique($keywords); return implode(',', $keywords_ar); } function post_meta_tags($id) { $awmp_edit = $_POST["aiosp_edit"]; if (isset($awmp_edit) && !empty($awmp_edit)) { $keywords = $_POST["aiosp_keywords"]; $description = $_POST["aiosp_description"]; $title = $_POST["aiosp_title"]; delete_post_meta($id, 'keywords'); delete_post_meta($id, 'description'); delete_post_meta($id, 'title'); if (isset($keywords) && !empty($keywords)) { add_post_meta($id, 'keywords', $keywords); } if (isset($description) && !empty($description)) { add_post_meta($id, 'description', $description); } if (isset($title) && !empty($title)) { add_post_meta($id, 'title', $title); } } } function add_meta_tags_textinput() { global $post; $keywords = stripslashes(get_post_meta($post->ID, 'keywords', true)); $title = stripslashes(get_post_meta($post->ID, 'title', true)); $description = stripslashes(get_post_meta($post->ID, 'description', true)); ?>
All in One SEO Pack
ID, 'keywords', true)); $description = stripslashes(get_post_meta($post->ID, 'description', true)); $title = stripslashes(get_post_meta($post->ID, 'title', true)); ?>

version. " . 'Should I upgrade?', 'all_in_one_seo_pack') ?>

Help', 'all_in_one_seo_pack') ?> | FAQ', 'all_in_one_seo_pack') ?> | Feedback', 'all_in_one_seo_pack') ?>

/>
/>
/>
/>
/>
/>