source: trunk/www.guidonia.net/wp/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 82.5 KB
Line 
1<?php
2
3class All_in_One_SEO_Pack {
4
5 var $version = "1.6.5";
6
7 /** Max numbers of chars in auto-generated description */
8 var $maximum_description_length = 160;
9
10 /** Minimum number of chars an excerpt should be so that it can be used
11 * as description. Touch only if you know what you're doing
12 */
13 var $minimum_description_length = 1;
14
15 var $ob_start_detected = false;
16
17 var $title_start = -1;
18
19 var $title_end = -1;
20
21 /** The title before rewriting */
22 var $orig_title = '';
23
24 /** Temp filename for the latest version. */
25// var $upgrade_filename = 'temp.zip';
26
27 /** Where to extract the downloaded newest version. */
28// var $upgrade_folder;
29
30 /** Any error in upgrading. */
31// var $upgrade_error;
32
33 /** Which zip to download in order to upgrade .*/
34// var $upgrade_url = 'http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip';
35
36 /** Filename of log file. */
37 var $log_file;
38
39 /** Flag whether there should be logging. */
40 var $do_log;
41
42 var $wp_version;
43
44 var $aioseop_op;
45 //var $aioseop_options = get_option('aioseop_options');
46
47 function All_in_One_SEO_Pack() {
48 global $wp_version;
49 global $aioseop_options;
50 $this->wp_version = $wp_version;
51
52 $this->log_file = dirname(__FILE__) . '/all_in_one_seo_pack.log';
53 if ($aioseop_options['aiosp_do_log']) {
54 $this->do_log = true;
55 } else {
56 $this->do_log = false;
57 }
58
59// $this->upgrade_filename = dirname(__FILE__) . '/' . $this->upgrade_filename;
60// $this->upgrade_folder = dirname(__FILE__);
61 }
62
63 /**
64 * Convert a string to lower case
65 * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
66 */
67 function strtolower($str) {
68 global $UTF8_TABLES;
69 return strtr($str, $UTF8_TABLES['strtolower']);
70 }
71
72 /**
73 * Convert a string to upper case
74 * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
75 */
76 function strtoupper($str) {
77 global $UTF8_TABLES;
78 return strtr($str, $UTF8_TABLES['strtoupper']);
79 }
80
81
82 function template_redirect() {
83 global $wp_query;
84 global $aioseop_options;
85
86 $post = $wp_query->get_queried_object();
87
88 if( $this->aioseop_mrt_exclude_this_page()){
89 return;
90 }
91
92 if (is_feed()) {
93 return;
94 }
95
96 if (is_single() || is_page()) {
97 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
98 if ($aiosp_disable) {
99 return;
100 }
101 }
102
103
104
105 if ($aioseop_options['aiosp_rewrite_titles']) {
106 ob_start(array($this, 'output_callback_for_title'));
107 }
108 }
109
110 function aioseop_mrt_exclude_this_page(){
111 global $aioseop_options;
112 $currenturl = trim($_SERVER['REQUEST_URI'],'/');
113 /* echo "<br /><br />";
114 echo $aioseop_options['aiosp_ex_pages'];
115 echo "<br /><br />";
116*/
117
118 $excludedstuff = explode(',',$aioseop_options['aiosp_ex_pages']);
119 foreach($excludedstuff as $exedd){
120 //echo $exedd;
121 if($exedd){
122 if(stristr($currenturl, trim($exedd))){
123 return true;
124 }
125 }
126 }
127 return false;
128 }
129
130 function output_callback_for_title($content) {
131 return $this->rewrite_title($content);
132 }
133
134
135
136
137
138
139//
140//CHECK IF ARRAY EXISTS IN DB, IF SO, GET ARRAY, ADD EVERYTHING, CHECK FOR ISSET?
141//
142 function init() {
143if (function_exists('load_plugin_textdomain')) {
144 if ( !defined('WP_PLUGIN_DIR') ) {
145 load_plugin_textdomain('all_in_one_seo_pack', str_replace( ABSPATH, '', dirname(__FILE__)));
146 } else {
147 load_plugin_textdomain('all_in_one_seo_pack', false, dirname(plugin_basename(__FILE__)));
148 }
149}
150
151
152/*
153 if (function_exists('load_plugin_textdomain')) {
154 load_plugin_textdomain('all_in_one_seo_pack', WP_PLUGIN_DIR . '/all-in-one-seo-pack');
155 }
156*/
157
158 }
159
160 function is_static_front_page() {
161 global $wp_query;
162 global $aioseop_options;
163 $post = $wp_query->get_queried_object();
164 return get_option('show_on_front') == 'page' && is_page() && $post->ID == get_option('page_on_front');
165 }
166
167 function is_static_posts_page() {
168 global $wp_query;
169 $post = $wp_query->get_queried_object();
170 return get_option('show_on_front') == 'page' && is_home() && $post->ID == get_option('page_for_posts');
171 }
172
173 function get_base() {
174 return '/'.end(explode('/', str_replace(array('\\','/all_in_one_seo_pack.php'),array('/',''),__FILE__)));
175 }
176
177 function seo_mrt_admin_head() {
178 $home = get_settings('siteurl');
179 $stylesheet = WP_PLUGIN_URL . '/all-in-one-seo-pack/style.css';
180 echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
181 }
182
183
184 function wp_head() {
185 if (is_feed()) {
186 return;
187 }
188
189 global $wp_query;
190 global $aioseop_options;
191 $post = $wp_query->get_queried_object();
192 $meta_string = null;
193 if($this->is_static_posts_page()){
194 $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
195
196 }
197 //echo("wp_head() " . wp_title('', false) . " is_home() => " . is_home() . ", is_page() => " . is_page() . ", is_single() => " . is_single() . ", is_static_front_page() => " . $this->is_static_front_page() . ", is_static_posts_page() => " . $this->is_static_posts_page());
198
199 if (is_single() || is_page()) {
200 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
201 if ($aiosp_disable) {
202 return;
203 }
204 }
205
206 if( $this->aioseop_mrt_exclude_this_page()==TRUE ){
207 return;
208 }
209
210 if ($aioseop_options['aiosp_rewrite_titles']) {
211 // make the title rewrite as short as possible
212 if (function_exists('ob_list_handlers')) {
213 $active_handlers = ob_list_handlers();
214 } else {
215 $active_handlers = array();
216 }
217 if (sizeof($active_handlers) > 0 &&
218 strtolower($active_handlers[sizeof($active_handlers) - 1]) ==
219 strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
220 ob_end_flush();
221 } else {
222 $this->log("another plugin interfering?");
223 // if we get here there *could* be trouble with another plugin :(
224 $this->ob_start_detected = true;
225 if (function_exists('ob_list_handlers')) {
226 foreach (ob_list_handlers() as $handler) {
227 $this->log("detected output handler $handler");
228 }
229 }
230 }
231 }
232
233 /*
234
235 echo trim($_SERVER['REQUEST_URI'],'/');
236 $currenturl = trim($_SERVER['REQUEST_URI'],'/');
237 echo "<br /><br />";
238
239 echo $aioseop_options['aiosp_ex_pages'];
240
241 echo "<br /><br />";
242
243 $excludedstuff = explode(',',$aioseop_options['aiosp_ex_pages']);
244 foreach($excludedstuff as $exedd){
245 echo $exedd;
246 //echo "<br /><br />substring: ". stristr($currenturl,trim($exedd)) . "<br />";
247 if(stristr($currenturl, trim($exedd))){
248 echo "<br />match, should not display<br /><br />";
249 }else{
250 echo "<br />( " . $exedd . " was not found in " . $currenturl . " ) - no match<br /><br />";
251 }
252 }
253 //print_r($excludedstuff);
254 */
255 echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
256 if ($this->ob_start_detected) {
257 echo "ob_start_detected ";
258 }
259 echo "[$this->title_start,$this->title_end] ";
260 echo "-->\n";
261 if ((is_home() && $aioseop_options['aiosp_home_keywords'] && !$this->is_static_posts_page()) || $this->is_static_front_page()) {
262 $keywords = trim($this->internationalize($aioseop_options['aiosp_home_keywords']));
263 } elseif($this->is_static_posts_page() && !$aioseop_options['aiosp_dynamic_postspage_keywords']){ // and if option = use page set keywords instead of keywords from recent posts
264 //$keywords = "posts keyyysss" . stripcslashes(get_post_meta($post->ID,'keywords',true));
265 $keywords = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
266
267// $keywords = $this->get_unique_keywords($keywords);
268
269 }else {
270 $keywords = $this->get_all_keywords();
271 }
272 if (is_single() || is_page() || $this->is_static_posts_page()) {
273 if ($this->is_static_front_page()) {
274 $description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
275 } else {
276 $description = $this->get_post_description($post);
277 $description = apply_filters('aioseop_description',$description);
278 }
279 } else if (is_home()) {
280 $description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
281 } else if (is_category()) {
282 $description = $this->internationalize(category_description());
283 }
284
285 if (isset($description) && (strlen($description) > $this->minimum_description_length) && !(is_home() && is_paged())) {
286 $description = trim(strip_tags($description));
287 $description = str_replace('"', '', $description);
288
289 // replace newlines on mac / windows?
290 $description = str_replace("\r\n", ' ', $description);
291
292 // maybe linux uses this alone
293 $description = str_replace("\n", ' ', $description);
294
295 if (isset($meta_string)) {
296 //$meta_string .= "\n";
297 } else {
298 $meta_string = '';
299 }
300
301 // description format
302 $description_format = $aioseop_options['aiosp_description_format'];
303 if (!isset($description_format) || empty($description_format)) {
304 $description_format = "%description%";
305 }
306 $description = str_replace('%description%', $description, $description_format);
307 $description = str_replace('%blog_title%', get_bloginfo('name'), $description);
308 $description = str_replace('%blog_description%', get_bloginfo('description'), $description);
309 $description = str_replace('%wp_title%', $this->get_original_title(), $description);
310 //$description = html_entity_decode($description, ENT_COMPAT, get_bloginfo('charset'));
311 if($aioseop_options['aiosp_can'] && is_attachment()){
312 $url = $this->aiosp_mrt_get_url($wp_query);
313 if ($url) {
314 preg_match_all('/(\d+)/', $url, $matches);
315 if (is_array($matches)){
316 $uniqueDesc = join('',$matches[0]);
317 }
318 }
319 $description .= ' ' . $uniqueDesc;
320 }
321 $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description);
322 }
323 $keywords = apply_filters('aioseop_keywords',$keywords);
324 if (isset ($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
325 if (isset($meta_string)) {
326 $meta_string .= "\n";
327 }
328 $meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords);
329 }
330
331 if (function_exists('is_tag')) {
332 $is_tag = is_tag();
333 }
334
335 if ((is_category() && $aioseop_options['aiosp_category_noindex']) ||
336 (!is_category() && is_archive() &&!$is_tag && $aioseop_options['aiosp_archive_noindex']) ||
337 ($aioseop_options['aiosp_tags_noindex'] && $is_tag)) {
338 if (isset($meta_string)) {
339 $meta_string .= "\n";
340 }
341 $meta_string .= '<meta name="robots" content="noindex,follow" />';
342 }
343
344 $page_meta = stripcslashes($aioseop_options['aiosp_page_meta_tags']);
345 $post_meta = stripcslashes($aioseop_options['aiosp_post_meta_tags']);
346 $home_meta = stripcslashes($aioseop_options['aiosp_home_meta_tags']);
347 if (is_page() && isset($page_meta) && !empty($page_meta) || $this->is_static_posts_page()) {
348 if (isset($meta_string)) {
349 $meta_string .= "\n";
350 }
351 echo "\n$page_meta";
352 }
353
354 if (is_single() && isset($post_meta) && !empty($post_meta)) {
355 if (isset($meta_string)) {
356 $meta_string .= "\n";
357 }
358 $meta_string .= "$post_meta";
359 }
360
361 if (is_home() && !empty($home_meta)) {
362 if (isset($meta_string)) {
363 $meta_string .= "\n";
364 }
365 $meta_string .= "$home_meta";
366 }
367
368 if ($meta_string != null) {
369 echo "$meta_string\n";
370 }
371
372 if($aioseop_options['aiosp_can']){
373 $url = $this->aiosp_mrt_get_url($wp_query);
374 if ($url) {
375 $url = apply_filters('aioseop_canonical_url',$url);
376
377 echo "".'<link rel="canonical" href="'.$url.'" />'."\n";
378 }
379 }
380
381 echo "<!-- /all in one seo pack -->\n";
382 }
383
384// Thank you, Yoast de Valk, for much of this code.
385
386 function aiosp_mrt_get_url($query) {
387 global $aioseop_options;
388 if ($query->is_404 || $query->is_search) {
389 return false;
390 }
391 $haspost = count($query->posts) > 0;
392 $has_ut = function_exists('user_trailingslashit');
393
394 if (get_query_var('m')) {
395 $m = preg_replace('/[^0-9]/', '', get_query_var('m'));
396 switch (strlen($m)) {
397 case 4:
398 $link = get_year_link($m);
399 break;
400 case 6:
401 $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
402 break;
403 case 8:
404 $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2),
405 substr($m, 6, 2));
406 break;
407 default:
408 return false;
409 }
410 } elseif (($query->is_single || $query->is_page) && $haspost) {
411 $post = $query->posts[0];
412 $link = get_permalink($post->ID);
413 $link = $this->yoast_get_paged($link);
414/* if ($page && $page > 1) {
415 $link = trailingslashit($link) . "page/". "$page";
416 if ($has_ut) {
417 $link = user_trailingslashit($link, 'paged');
418 } else {
419 $link .= '/';
420 }
421 }
422 if ($query->is_page && ('page' == get_option('show_on_front')) &&
423 $post->ID == get_option('page_on_front'))
424 {
425 $link = trailingslashit($link);
426 }*/
427 } elseif ($query->is_author && $haspost) {
428 global $wp_version;
429 if ($wp_version >= '2') {
430 $author = get_userdata(get_query_var('author'));
431 if ($author === false)
432 return false;
433 $link = get_author_link(false, $author->ID,
434 $author->user_nicename);
435 } else {
436 global $cache_userdata;
437 $userid = get_query_var('author');
438 $link = get_author_link(false, $userid,
439 $cache_userdata[$userid]->user_nicename);
440 }
441 } elseif ($query->is_category && $haspost) {
442 $link = get_category_link(get_query_var('cat'));
443 $link = $this->yoast_get_paged($link);
444 } else if ($query->is_tag && $haspost) {
445 $tag = get_term_by('slug',get_query_var('tag'),'post_tag');
446 if (!empty($tag->term_id)) {
447 $link = get_tag_link($tag->term_id);
448 }
449 $link = $this->yoast_get_paged($link);
450 } elseif ($query->is_day && $haspost) {
451 $link = get_day_link(get_query_var('year'),
452 get_query_var('monthnum'),
453 get_query_var('day'));
454 } elseif ($query->is_month && $haspost) {
455 $link = get_month_link(get_query_var('year'),
456 get_query_var('monthnum'));
457 } elseif ($query->is_year && $haspost) {
458 $link = get_year_link(get_query_var('year'));
459 } elseif ($query->is_home) {
460 if ((get_option('show_on_front') == 'page') &&
461 ($pageid = get_option('page_for_posts')))
462 {
463 $link = get_permalink($pageid);
464 $link = $this->yoast_get_paged($link);
465 $link = trailingslashit($link);
466 } else {
467 $link = get_option('home');
468 $link = $this->yoast_get_paged($link);
469 $link = trailingslashit($link); }
470 } else {
471 return false;
472 }
473
474 return $link;
475
476 }
477
478
479 function yoast_get_paged($link) {
480 $page = get_query_var('paged');
481 if ($page && $page > 1) {
482 $link = trailingslashit($link) ."page/". "$page";
483 if ($has_ut) {
484 $link = user_trailingslashit($link, 'paged');
485 } else {
486 $link .= '/';
487 }
488 }
489 return $link;
490 }
491
492
493 function get_post_description($post) {
494 global $aioseop_options;
495 $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_description", true))));
496 if (!$description) {
497 $description = $this->trim_excerpt_without_filters_full_length($this->internationalize($post->post_excerpt));
498 if (!$description && $aioseop_options["aiosp_generate_descriptions"]) {
499 $description = $this->trim_excerpt_without_filters($this->internationalize($post->post_content));
500 }
501 }
502
503 // "internal whitespace trim"
504 $description = preg_replace("/\s\s+/", " ", $description);
505
506 return $description;
507 }
508
509 function replace_title($content, $title) {
510 $title = trim(strip_tags($title));
511
512 $title_tag_start = "<title>";
513 $title_tag_end = "</title>";
514 $len_start = strlen($title_tag_start);
515 $len_end = strlen($title_tag_end);
516 $title = stripcslashes(trim($title));
517 $start = strpos($content, $title_tag_start);
518 $end = strpos($content, $title_tag_end);
519
520 $this->title_start = $start;
521 $this->title_end = $end;
522 $this->orig_title = $title;
523
524 if ($start && $end) {
525 $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
526 } else {
527 // this breaks some sitemap plugins (like wpg2)
528 //$header = $content . "<title>$title</title>";
529
530 $header = $content;
531 }
532
533 return $header;
534 }
535
536 function internationalize($in) {
537 if (function_exists('langswitch_filter_langs_with_message')) {
538 $in = langswitch_filter_langs_with_message($in);
539 }
540 if (function_exists('polyglot_filter')) {
541 $in = polyglot_filter($in);
542 }
543 if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
544 $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
545 }
546 $in = apply_filters('localization', $in);
547 return $in;
548 }
549
550 /** @return The original title as delivered by WP (well, in most cases) */
551 function get_original_title() {
552 global $wp_query;
553 global $aioseop_options;
554 if (!$wp_query) {
555 return null;
556 }
557
558 $post = $wp_query->get_queried_object();
559
560 // the_search_query() is not suitable, it cannot just return
561 global $s;
562
563 $title = null;
564
565 if (is_home()) {
566 $title = get_option('blogname');
567 } else if (is_single()) {
568 $title = $this->internationalize(wp_title('', false));
569 } else if (is_search() && isset($s) && !empty($s)) {
570 if (function_exists('attribute_escape')) {
571 $search = attribute_escape(stripcslashes($s));
572 } else {
573 $search = wp_specialchars(stripcslashes($s), true);
574 }
575 $search = $this->capitalize($search);
576 $title = $search;
577 } else if (is_category() && !is_feed()) {
578 $category_description = $this->internationalize(category_description());
579 $category_name = ucwords($this->internationalize(single_cat_title('', false)));
580 $title = $category_name;
581 } else if (is_page()) {
582 $title = $this->internationalize(wp_title('', false));
583 } else if (function_exists('is_tag') && is_tag()) {
584 global $utw;
585 if ($utw) {
586 $tags = $utw->GetCurrentTagSet();
587 $tag = $tags[0]->tag;
588 $tag = str_replace('-', ' ', $tag);
589 } else {
590 // wordpress > 2.3
591 $tag = $this->internationalize(wp_title('', false));
592 }
593 if ($tag) {
594 $title = $tag;
595 }
596 } else if (is_archive()) {
597 $title = $this->internationalize(wp_title('', false));
598 } else if (is_404()) {
599 $title_format = $aioseop_options['aiosp_404_title_format'];
600 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
601 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
602 $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
603 $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
604 $title = $new_title;
605 }
606
607 return trim($title);
608 }
609
610 function paged_title($title) {
611 // the page number if paged
612 global $paged;
613 global $aioseop_options;
614 // simple tagging support
615 global $STagging;
616
617 if (is_paged() || (isset($STagging) && $STagging->is_tag_view() && $paged)) {
618 $part = $this->internationalize($aioseop_options['aiosp_paged_format']);
619 if (isset($part) || !empty($part)) {
620 $part = " " . trim($part);
621 $part = str_replace('%page%', $paged, $part);
622 $this->log("paged_title() [$title] [$part]");
623 $title .= $part;
624 }
625 }
626 return $title;
627 }
628
629 function rewrite_title($header) {
630 global $aioseop_options;
631 global $wp_query;
632 if (!$wp_query) {
633 $header .= "<!-- no wp_query found! -->\n";
634 return $header;
635 }
636
637 $post = $wp_query->get_queried_object();
638
639 // the_search_query() is not suitable, it cannot just return
640 global $s;
641
642 global $STagging;
643
644 if (is_home() && !$this->is_static_posts_page()) {
645 $title = $this->internationalize($aioseop_options['aiosp_home_title']);
646 if (empty($title)) {
647 $title = $this->internationalize(get_option('blogname'));
648 }
649 $title = $this->paged_title($title);
650 $header = $this->replace_title($header, $title);
651 } else if (is_attachment()) {
652 $title = get_the_title($post->post_parent).' '.$post->post_title.' – '.get_option('blogname');
653 $header = $this->replace_title($header,$title);
654 } else if (is_single()) {
655 // we're not in the loop :(
656 $authordata = get_userdata($post->post_author);
657 $categories = get_the_category();
658 $category = '';
659 if (count($categories) > 0) {
660 $category = $categories[0]->cat_name;
661 }
662 $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
663 if (!$title) {
664 $title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
665 if (!$title) {
666 $title = $this->internationalize(wp_title('', false));
667 }
668 }
669 $title_format = $aioseop_options['aiosp_post_title_format'];
670 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
671 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
672 $new_title = str_replace('%post_title%', $title, $new_title);
673 $new_title = str_replace('%category%', $category, $new_title);
674 $new_title = str_replace('%category_title%', $category, $new_title);
675 $new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);
676 $new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);
677 $new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);
678 $new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);
679 $title = $new_title;
680 $title = trim($title);
681 $title = apply_filters('aioseop_title_single',$title);
682 $header = $this->replace_title($header, $title);
683 } else if (is_search() && isset($s) && !empty($s)) {
684 if (function_exists('attribute_escape')) {
685 $search = attribute_escape(stripcslashes($s));
686 } else {
687 $search = wp_specialchars(stripcslashes($s), true);
688 }
689 $search = $this->capitalize($search);
690 $title_format = $aioseop_options['aiosp_search_title_format'];
691 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
692 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
693 $title = str_replace('%search%', $search, $title);
694 $header = $this->replace_title($header, $title);
695 } else if (is_category() && !is_feed()) {
696 $category_description = $this->internationalize(category_description());
697 if($aioseop_options['aiosp_cap_cats']){
698 $category_name = ucwords($this->internationalize(single_cat_title('', false)));
699 }else{
700 $category_name = $this->internationalize(single_cat_title('', false));
701 }
702 //$category_name = ucwords($this->internationalize(single_cat_title('', false)));
703 $title_format = $aioseop_options['aiosp_category_title_format'];
704 $title = str_replace('%category_title%', $category_name, $title_format);
705 $title = str_replace('%category_description%', $category_description, $title);
706 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);
707 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
708 $title = $this->paged_title($title);
709 $header = $this->replace_title($header, $title);
710 } else if (is_page() || $this->is_static_posts_page()) {
711 // we're not in the loop :(
712 $authordata = get_userdata($post->post_author);
713 if ($this->is_static_front_page()) {
714 if ($this->internationalize($aioseop_options['aiosp_home_title'])) {
715 $header = $this->replace_title($header, $this->internationalize($aioseop_options['aiosp_home_title']));
716 }
717 } else {
718 $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
719 if (!$title) {
720 $title = $this->internationalize(wp_title('', false));
721 }
722 $title_format = $aioseop_options['aiosp_page_title_format'];
723 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
724 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
725 $new_title = str_replace('%page_title%', $title, $new_title);
726 $new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);
727 $new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);
728 $new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);
729 $new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);
730 $title = trim($new_title);
731 $title = apply_filters('aioseop_title_page',$title);
732 $header = $this->replace_title($header, $title);
733 }
734 } else if (function_exists('is_tag') && is_tag()) {
735 global $utw;
736 if ($utw) {
737 $tags = $utw->GetCurrentTagSet();
738 $tag = $tags[0]->tag;
739 $tag = str_replace('-', ' ', $tag);
740 } else {
741 // wordpress > 2.3
742 $tag = $this->internationalize(wp_title('', false));
743 }
744 if ($tag) {
745 $tag = $this->capitalize($tag);
746 $title_format = $aioseop_options['aiosp_tag_title_format'];
747 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
748 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
749 $title = str_replace('%tag%', $tag, $title);
750 $title = $this->paged_title($title);
751 $header = $this->replace_title($header, $title);
752 }
753 } else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support
754 $tag = $STagging->search_tag;
755 if ($tag) {
756 $tag = $this->capitalize($tag);
757 $title_format = $aioseop_options['aiosp_tag_title_format'];
758 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
759 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
760 $title = str_replace('%tag%', $tag, $title);
761 $title = $this->paged_title($title);
762 $header = $this->replace_title($header, $title);
763 }
764 } else if (is_archive()) {
765 $date = $this->internationalize(wp_title('', false));
766 $title_format = $aioseop_options['aiosp_archive_title_format'];
767 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
768 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
769 $new_title = str_replace('%date%', $date, $new_title);
770 $title = trim($new_title);
771 $title = $this->paged_title($title);
772 $header = $this->replace_title($header, $title);
773 } else if (is_404()) {
774 $title_format = $aioseop_options['aiosp_404_title_format'];
775 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
776 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
777 $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
778 $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
779 $new_title = str_replace('%404_title%', $this->internationalize(wp_title('', false)), $new_title);
780 $header = $this->replace_title($header, $new_title);
781 }
782
783 return $header;
784
785 }
786
787 /**
788 * @return User-readable nice words for a given request.
789 */
790 function request_as_words($request) {
791 $request = htmlspecialchars($request);
792 $request = str_replace('.html', ' ', $request);
793 $request = str_replace('.htm', ' ', $request);
794 $request = str_replace('.', ' ', $request);
795 $request = str_replace('/', ' ', $request);
796 $request_a = explode(' ', $request);
797 $request_new = array();
798 foreach ($request_a as $token) {
799 $request_new[] = ucwords(trim($token));
800 }
801 $request = implode(' ', $request_new);
802 return $request;
803 }
804
805 function capitalize($s) {
806 $s = trim($s);
807 $tokens = explode(' ', $s);
808 while (list($key, $val) = each($tokens)) {
809 $tokens[$key] = trim($tokens[$key]);
810 $tokens[$key] = strtoupper(substr($tokens[$key], 0, 1)) . substr($tokens[$key], 1);
811 }
812 $s = implode(' ', $tokens);
813 return $s;
814 }
815
816 function trim_excerpt_without_filters($text) {
817 $text = str_replace(']]>', ']]&gt;', $text);
818 $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
819 $text = strip_tags($text);
820 $max = $this->maximum_description_length;
821
822 if ($max < strlen($text)) {
823 while($text[$max] != ' ' && $max > $this->minimum_description_length) {
824 $max--;
825 }
826 }
827 $text = substr($text, 0, $max);
828 return trim(stripcslashes($text));
829 }
830
831 function trim_excerpt_without_filters_full_length($text) {
832 $text = str_replace(']]>', ']]&gt;', $text);
833 $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
834 $text = strip_tags($text);
835 return trim(stripcslashes($text));
836 }
837
838 /**
839 * @return comma-separated list of unique keywords
840 */
841 function get_all_keywords() {
842 global $posts;
843 global $aioseop_options;
844
845 if (is_404()) {
846 return null;
847 }
848
849 // if we are on synthetic pages
850 if (!is_home() && !is_page() && !is_single() &&!$this->is_static_front_page() && !$this->is_static_posts_page()) {
851 return null;
852 }
853
854 $keywords = array();
855 if (is_array($posts)) {
856 foreach ($posts as $post) {
857 if ($post) {
858
859 // custom field keywords
860 $keywords_a = $keywords_i = null;
861 $description_a = $description_i = null;
862
863 $id = (is_attachment())?($post->post_parent):($post->ID); // if attachment then use parent post id
864 $keywords_i = stripcslashes($this->internationalize(get_post_meta($id, "_aioseop_keywords", true)));
865 //$id = $post->ID;
866 //$keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
867 $keywords_i = str_replace('"', '', $keywords_i);
868 if (isset($keywords_i) && !empty($keywords_i)) {
869 $traverse = explode(',', $keywords_i);
870 foreach ($traverse as $keyword) {
871 $keywords[] = $keyword;
872 }
873 }
874
875 // WP 2.3 tags
876 if (function_exists('get_the_tags')) {
877 //$tags = get_the_tags($post->ID);
878 $tags = get_the_tags($id);
879 if ($tags && is_array($tags)) {
880 foreach ($tags as $tag) {
881 $keywords[] = $this->internationalize($tag->name);
882 }
883 }
884 }
885
886 // Ultimate Tag Warrior integration
887 global $utw;
888 if ($utw) {
889 $tags = $utw->GetTagsForPost($post);
890 if (is_array($tags)) {
891 foreach ($tags as $tag) {
892 $tag = $tag->tag;
893 $tag = str_replace('_',' ', $tag);
894 $tag = str_replace('-',' ',$tag);
895 $tag = stripcslashes($tag);
896 $keywords[] = $tag;
897 }
898 }
899 }
900
901 // autometa
902 $autometa = stripcslashes(get_post_meta($id, 'autometa', true));
903 //$autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
904 if (isset($autometa) && !empty($autometa)) {
905 $autometa_array = explode(' ', $autometa);
906 foreach ($autometa_array as $e) {
907 $keywords[] = $e;
908 }
909 }
910
911 if ($aioseop_options['aiosp_use_categories'] && !is_page()) {
912 $categories = get_the_category($id);
913 //$categories = get_the_category($post->ID);
914 foreach ($categories as $category) {
915 $keywords[] = $this->internationalize($category->cat_name);
916 }
917 }
918
919 }
920 }
921 }
922
923 return $this->get_unique_keywords($keywords);
924 }
925
926 function get_meta_keywords() {
927 global $posts;
928
929 $keywords = array();
930 if (is_array($posts)) {
931 foreach ($posts as $post) {
932 if ($post) {
933 // custom field keywords
934 $keywords_a = $keywords_i = null;
935 $description_a = $description_i = null;
936 $id = $post->ID;
937 $keywords_i = stripcslashes(get_post_meta($post->ID, "_aioseop_keywords", true));
938 $keywords_i = str_replace('"', '', $keywords_i);
939 if (isset($keywords_i) && !empty($keywords_i)) {
940 $keywords[] = $keywords_i;
941 }
942 }
943 }
944 }
945
946 return $this->get_unique_keywords($keywords);
947 }
948
949 function get_unique_keywords($keywords) {
950 $small_keywords = array();
951 foreach ($keywords as $word) {
952 if (function_exists('mb_strtolower'))
953 $small_keywords[] = mb_strtolower($word, get_bloginfo('charset'));
954 else
955 $small_keywords[] = $this->strtolower($word);
956 }
957 $keywords_ar = array_unique($small_keywords);
958 return implode(',', $keywords_ar);
959 }
960
961 function get_url($url) {
962 if (function_exists('file_get_contents')) {
963 $file = file_get_contents($url);
964 } else {
965 $curl = curl_init($url);
966 curl_setopt($curl, CURLOPT_HEADER, 0);
967 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
968 $file = curl_exec($curl);
969 curl_close($curl);
970 }
971 return $file;
972 }
973
974 function log($message) {
975 if ($this->do_log) {
976 error_log(date('Y-m-d H:i:s') . " " . $message . "\n", 3, $this->log_file);
977 }
978 }
979
980 function download_newest_version() {
981 $success = true;
982 $file_content = $this->get_url($this->upgrade_url);
983 if ($file_content === false) {
984 $this->upgrade_error = sprintf(__("Could not download distribution (%s)"), $this->upgrade_url);
985 $success = false;
986 } else if (strlen($file_content) < 100) {
987 $this->upgrade_error = sprintf(__("Could not download distribution (%s): %s"), $this->upgrade_url, $file_content);
988 $success = false;
989 } else {
990 $this->log(sprintf("filesize of download ZIP: %d", strlen($file_content)));
991 $fh = @fopen($this->upgrade_filename, 'w');
992 $this->log("fh is $fh");
993 if (!$fh) {
994 $this->upgrade_error = sprintf(__("Could not open %s for writing"), $this->upgrade_filename);
995 $this->upgrade_error .= "<br />";
996 $this->upgrade_error .= sprintf(__("Please make sure %s is writable"), $this->upgrade_folder);
997 $success = false;
998 } else {
999 $bytes_written = @fwrite($fh, $file_content);
1000 $this->log("wrote $bytes_written bytes");
1001 if (!$bytes_written) {
1002 $this->upgrade_error = sprintf(__("Could not write to %s"), $this->upgrade_filename);
1003 $success = false;
1004 }
1005 }
1006 if ($success) {
1007 fclose($fh);
1008 }
1009 }
1010 return $success;
1011 }
1012
1013 function install_newest_version() {
1014 $success = $this->download_newest_version();
1015 if ($success) {
1016 $success = $this->extract_plugin();
1017 unlink($this->upgrade_filename);
1018 }
1019 return $success;
1020 }
1021
1022 function extract_plugin() {
1023 if (!class_exists('PclZip')) {
1024 require_once ('pclzip.lib.php');
1025 }
1026 $archive = new PclZip($this->upgrade_filename);
1027 $files = $archive->extract(PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $this->upgrade_folder);
1028 $this->log("files is $files");
1029 if (is_array($files)) {
1030 $num_extracted = sizeof($files);
1031 $this->log("extracted $num_extracted files to $this->upgrade_folder");
1032 $this->log(print_r($files, true));
1033 return true;
1034 } else {
1035 $this->upgrade_error = $archive->errorInfo();
1036 return false;
1037 }
1038 }
1039
1040 /** crude approximization of whether current user is an admin */
1041 function is_admin() {
1042 return current_user_can('level_8');
1043 }
1044
1045
1046 function is_directory_writable($directory) {
1047 $filename = $directory . '/' . 'tmp_file_' . time();
1048 $fh = @fopen($filename, 'w');
1049 if (!$fh) {
1050 return false;
1051 }
1052
1053 $written = fwrite($fh, "test");
1054 fclose($fh);
1055 unlink($filename);
1056 if ($written) {
1057 return true;
1058 } else {
1059 return false;
1060 }
1061 }
1062
1063
1064 function is_upgrade_directory_writable() {
1065 //return $this->is_directory_writable($this->upgrade_folder);
1066 // let's assume it is
1067 return true;
1068 }
1069
1070
1071 function post_meta_tags($id) {
1072 $awmp_edit = $_POST["aiosp_edit"];
1073 $nonce = $_POST['nonce-aioseop-edit'];
1074// if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1075 if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) {
1076 $keywords = $_POST["aiosp_keywords"];
1077 $description = $_POST["aiosp_description"];
1078 $title = $_POST["aiosp_title"];
1079 $aiosp_meta = $_POST["aiosp_meta"];
1080 $aiosp_disable = $_POST["aiosp_disable"];
1081 $aiosp_titleatr = $_POST["aiosp_titleatr"];
1082 $aiosp_menulabel = $_POST["aiosp_menulabel"];
1083
1084 delete_post_meta($id, '_aioseop_keywords');
1085 delete_post_meta($id, '_aioseop_description');
1086 delete_post_meta($id, '_aioseop_title');
1087 delete_post_meta($id, '_aioseop_titleatr');
1088 delete_post_meta($id, '_aioseop_menulabel');
1089
1090
1091 if ($this->is_admin()) {
1092 delete_post_meta($id, '_aioseop_disable');
1093 }
1094 //delete_post_meta($id, 'aiosp_meta');
1095
1096 if (isset($keywords) && !empty($keywords)) {
1097 add_post_meta($id, '_aioseop_keywords', $keywords);
1098 }
1099 if (isset($description) && !empty($description)) {
1100 add_post_meta($id, '_aioseop_description', $description);
1101 }
1102 if (isset($title) && !empty($title)) {
1103 add_post_meta($id, '_aioseop_title', $title);
1104 }
1105 if (isset($aiosp_titleatr) && !empty($aiosp_titleatr)) {
1106 add_post_meta($id, '_aioseop_titleatr', $aiosp_titleatr);
1107 }
1108 if (isset($aiosp_menulabel) && !empty($aiosp_menulabel)) {
1109 add_post_meta($id, '_aioseop_menulabel', $aiosp_menulabel);
1110 }
1111 if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
1112 add_post_meta($id, '_aioseop_disable', $aiosp_disable);
1113 }
1114 /*
1115 if (isset($aiosp_meta) && !empty($aiosp_meta)) {
1116 add_post_meta($id, 'aiosp_meta', $aiosp_meta);
1117 }
1118 */
1119 }
1120 }
1121
1122 function edit_category($id) {
1123 global $wpdb;
1124 $id = $wpdb->escape($id);
1125 $awmp_edit = $_POST["aiosp_edit"];
1126 if (isset($awmp_edit) && !empty($awmp_edit)) {
1127 $keywords = $wpdb->escape($_POST["aiosp_keywords"]);
1128 $title = $wpdb->escape($_POST["aiosp_title"]);
1129 $old_category = $wpdb->get_row("select * from $this->table_categories where category_id=$id", OBJECT);
1130 if ($old_category) {
1131 $wpdb->query($wpdb->prepare("update $this->table_categories
1132 set meta_title='$title', meta_keywords='$keywords'
1133 where category_id=$id"));
1134 } else {
1135 $wpdb->query($wpdb->prepare("insert into $this->table_categories(meta_title, meta_keywords, category_id)
1136 values ('$title', '$keywords', $id"));
1137 }
1138 //$wpdb->query($wpdb->prepare("insert into $this->table_categories"))
1139 /*
1140 delete_post_meta($id, 'keywords');
1141 delete_post_meta($id, 'description');
1142 delete_post_meta($id, 'title');
1143
1144 if (isset($keywords) && !empty($keywords)) {
1145 add_post_meta($id, 'keywords', $keywords);
1146 }
1147 if (isset($description) && !empty($description)) {
1148 add_post_meta($id, 'description', $description);
1149 }
1150 if (isset($title) && !empty($title)) {
1151 add_post_meta($id, 'title', $title);
1152 }
1153 */
1154 }
1155 }
1156
1157 /**
1158 * @deprecated This was for the feature of dedicated meta tags for categories which never went mainstream.
1159 */
1160 function edit_category_form() {
1161 global $post;
1162 $keywords = stripcslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
1163 $title = stripcslashes(get_post_meta($post->ID, '_aioseop_title', true));
1164 $description = stripcslashes(get_post_meta($post->ID, '_aioseop_description', true));
1165 ?>
1166 <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1167 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
1168 <tr>
1169 <th width="33%" scope="row" valign="top">
1170 <a href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></a>
1171 </th>
1172 </tr>
1173 <tr>
1174 <th width="33%" scope="row" valign="top"><label for="aiosp_title"><?php _e('Title:', 'all_in_one_seo_pack') ?></label></th>
1175 <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="70"/></td>
1176 </tr>
1177 <tr>
1178 <th width="33%" scope="row" valign="top"><label for="aiosp_keywords"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></label></th>
1179 <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="70"/></td>
1180 </tr>
1181 </table>
1182 <?php
1183 }
1184
1185 function add_meta_tags_textinput() {
1186 global $post;
1187 $post_id = $post;
1188 if (is_object($post_id)) {
1189 $post_id = $post_id->ID;
1190 }
1191 $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true)));
1192 $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true)));
1193 $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true)));
1194 $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_meta', true)));
1195 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable', true)));
1196 $aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true)));
1197 $aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true)));
1198
1199 ?>
1200 <SCRIPT LANGUAGE="JavaScript">
1201 <!-- Begin
1202 function countChars(field,cntfield) {
1203 cntfield.value = field.value.length;
1204 }
1205 // End -->
1206 </script>
1207
1208 <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1209 <div id="postaiosp" class="postbox closed">
1210 <h3><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1211 <div class="inside">
1212 <div id="postaiosp">
1213 <?php } else { ?>
1214 <div class="dbx-b-ox-wrapper">
1215 <fieldset id="seodiv" class="dbx-box">
1216 <div class="dbx-h-andle-wrapper">
1217 <h3 class="dbx-handle"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1218 </div>
1219 <div class="dbx-c-ontent-wrapper">
1220 <div class="dbx-content">
1221 <?php } ?>
1222
1223 <a target="__blank" href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
1224 <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1225 <table style="margin-bottom:40px">
1226 <tr>
1227 <th style="text-align:left;" colspan="2">
1228 </th>
1229 </tr>
1230 <tr>
1231 <th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
1232 <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
1233 </tr>
1234 <tr>
1235 <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
1236 <td><textarea name="aiosp_description" rows="1" cols="60"
1237 onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
1238 onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
1239 <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
1240 <?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
1241 </td>
1242 </tr>
1243 <tr>
1244 <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
1245 <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
1246 </tr>
1247<input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce'); ?>" />
1248 <?php if ($this->is_admin()) { ?>
1249 <tr>
1250 <th scope="row" style="text-align:right; vertical-align:top;">
1251 <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
1252 </th>
1253 <td>
1254 <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
1255 </td>
1256 </tr>
1257
1258 <tr>
1259 <th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th>
1260 <td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td>
1261 </tr>
1262
1263 <tr>
1264 <th scope="row" style="text-align:right;"><?php _e('Menu Label:', 'all_in_one_seo_pack') ?></th>
1265 <td><input value="<?php echo $aiosp_menulabel ?>" type="text" name="aiosp_menulabel" size="62"/></td>
1266 </tr>
1267
1268
1269
1270
1271
1272
1273 <?php } ?>
1274
1275 </table>
1276
1277 <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1278 </div></div></div>
1279 <?php } else { ?>
1280 </div>
1281 </fieldset>
1282 </div>
1283 <?php } ?>
1284
1285 <?php
1286 }
1287
1288 function admin_menu() {
1289 $file = __FILE__;
1290
1291 // hack for 1.5
1292 if (substr($this->wp_version, 0, 3) == '1.5') {
1293 $file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
1294 }
1295 //add_management_page(__('All in One SEO Title', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'management_panel'));
1296 add_submenu_page('options-general.php', __('All in One SEO', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'options_panel'));
1297 }
1298
1299 function management_panel() {
1300 $message = null;
1301 $base_url = "edit.php?page=" . __FILE__;
1302 //echo($base_url);
1303 $type = $_REQUEST['type'];
1304 if (!isset($type)) {
1305 $type = "posts";
1306 }
1307?>
1308
1309 <ul class="aiosp_menu">
1310 <li><a href="<?php echo $base_url ?>&type=posts">Posts</a>
1311 </li>
1312 <li><a href="<?php echo $base_url ?>&type=pages">Pages</a>
1313 </li>
1314 </ul>
1315
1316<?php
1317
1318 if ($type == "posts") {
1319 echo("posts");
1320 } elseif ($type == "pages") {
1321 echo("pages");
1322 }
1323
1324 }
1325
1326 function options_panel() {
1327 $message = null;
1328 $message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
1329 global $aioseop_options;
1330
1331
1332 if(!$aioseop_options['aiosp_cap_cats']){
1333 $aioseop_options['aiosp_cap_cats'] = '1';
1334 }
1335
1336 // update options
1337 if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
1338 $nonce = $_POST['nonce-aioseop'];
1339 if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1340 $message = $message_updated;
1341 $aioseop_options['aiosp_can'] = $_POST['aiosp_can'];
1342 $aioseop_options['aiosp_donate'] = $_POST['aiosp_donate'];
1343 $aioseop_options['aiosp_home_title'] = $_POST['aiosp_home_title'];
1344 $aioseop_options['aiosp_home_description'] = $_POST['aiosp_home_description'];
1345 $aioseop_options['aiosp_home_keywords'] = $_POST['aiosp_home_keywords'];
1346 $aioseop_options['aiosp_max_words_excerpt'] = $_POST['aiosp_max_words_excerpt'];
1347 $aioseop_options['aiosp_rewrite_titles'] = $_POST['aiosp_rewrite_titles'];
1348 $aioseop_options['aiosp_post_title_format'] = $_POST['aiosp_post_title_format'];
1349 $aioseop_options['aiosp_page_title_format'] = $_POST['aiosp_page_title_format'];
1350 $aioseop_options['aiosp_category_title_format'] = $_POST['aiosp_category_title_format'];
1351 $aioseop_options['aiosp_archive_title_format'] = $_POST['aiosp_archive_title_format'];
1352 $aioseop_options['aiosp_tag_title_format'] = $_POST['aiosp_tag_title_format'];
1353 $aioseop_options['aiosp_search_title_format'] = $_POST['aiosp_search_title_format'];
1354 $aioseop_options['aiosp_description_format'] = $_POST['aiosp_description_format'];
1355 $aioseop_options['aiosp_404_title_format'] = $_POST['aiosp_404_title_format'];
1356 $aioseop_options['aiosp_paged_format'] = $_POST['aiosp_paged_format'];
1357 $aioseop_options['aiosp_use_categories'] = $_POST['aiosp_use_categories'];
1358 $aioseop_options['aiosp_dynamic_postspage_keywords'] = $_POST['aiosp_dynamic_postspage_keywords'];
1359 $aioseop_options['aiosp_category_noindex'] = $_POST['aiosp_category_noindex'];
1360 $aioseop_options['aiosp_archive_noindex'] = $_POST['aiosp_archive_noindex'];
1361 $aioseop_options['aiosp_tags_noindex'] = $_POST['aiosp_tags_noindex'];
1362 $aioseop_options['aiosp_generate_descriptions'] = $_POST['aiosp_generate_descriptions'];
1363 $aioseop_options['aiosp_cap_cats'] = $_POST['aiosp_cap_cats'];
1364 $aioseop_options['aiosp_debug_info'] = $_POST['aiosp_debug_info'];
1365 $aioseop_options['aiosp_post_meta_tags'] = $_POST['aiosp_post_meta_tags'];
1366 $aioseop_options['aiosp_page_meta_tags'] = $_POST['aiosp_page_meta_tags'];
1367 $aioseop_options['aiosp_home_meta_tags'] = $_POST['aiosp_home_meta_tags'];
1368 $aioseop_options['aiosp_ex_pages'] = $_POST['aiosp_ex_pages'];
1369 $aioseop_options['aiosp_do_log'] = $_POST['aiosp_do_log'];
1370 $aioseop_options['aiosp_enabled'] = $_POST['aiosp_enabled'];
1371
1372 update_option('aioseop_options', $aioseop_options);
1373
1374 if (function_exists('wp_cache_flush')) {
1375 wp_cache_flush();
1376 }
1377 } /*elseif ($_POST['aiosp_upgrade']) {
1378 $message = __("Upgraded to newest version. Please revisit the options page to make sure you see the newest version.", 'all_in_one_seo_pack');
1379 $success = $this->install_newest_version();
1380 if (!$success) {
1381 $message = __("Upgrade failed", 'all_in_one_seo_pack');
1382 if (isset($this->upgrade_error) && !empty($this->upgrade_error)) {
1383 $message .= ": " . $this->upgrade_error;
1384 } else {
1385 $message .= ".";
1386 }
1387 }
1388 }*/
1389
1390?>
1391<?php if ($message) : ?>
1392<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
1393<?php endif; ?>
1394<div id="dropmessage" class="updated" style="display:none;"></div>
1395<div class="wrap">
1396<h2><?php _e('All in One SEO Plugin Options', 'all_in_one_seo_pack'); ?></h2>
1397<p>
1398<?php //_e("This is version ", 'all_in_one_seo_pack') ?><?php //_e("$this->version ", 'all_in_one_seo_pack') ?>
1399&nbsp;<a target="_blank" title="<?php _e('All in One SEO Plugin Release History', 'all_in_one_seo_pack')?>"
1400href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/"><?php _e("Changelog", 'all_in_one_seo_pack')?>
1401</a>
1402| <a target="_blank" title="<?php _e('FAQ', 'all_in_one_seo_pack') ?>"
1403href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/"><?php _e('FAQ', 'all_in_one_seo_pack') ?></a>
1404| <a target="_blank" title="<?php _e('All in One SEO Plugin Support Forum', 'all_in_one_seo_pack') ?>"
1405href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/forum/"><?php _e('Support', 'all_in_one_seo_pack') ?></a>
1406| <a target="_blank" title="<?php _e('All in One SEO Plugin Translations', 'all_in_one_seo_pack') ?>"
1407href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/"><?php _e('Translations', 'all_in_one_seo_pack') ?></a>
1408<br />
1409<div style="width:75%;background-color:yellow;">
1410<em>Thank you for using <strong>All in One SEO Pack</strong> by <strong>Michael Torbert</strong> of <strong>Semper Fi Web Design</strong>. If you like this plugin and find it useful, feel free to click the <strong>donate</strong> button or send me a gift from my <strong>Amazon wishlist</strong>. Also, don't forget to follow me on <strong>Twitter</strong>.</em>
1411</div>
1412<br />
1413<a target="_blank" title="<?php echo 'Donate' ?>"
1414href="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"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" width="" alt="Donate" /><?php //echo 'Donate' ?></a>
1415| <a target="_blank" title="Amazon Wish List" href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web"><img src="https://images-na.ssl-images-amazon.com/images/G/01/gifts/registries/wishlist/v2/web/wl-btn-74-b._V46774601_.gif" width="74" alt="My Amazon.com Wish List" height="42" border="0" /></a>
1416| <a target="_blank" title="<?php _e('Follow us on Twitter', 'all_in_one_seo_pack') ?>"
1417href="http://twitter.com/michaeltorbert/"><img src="<?php echo WP_PLUGIN_URL; ?>/all-in-one-seo-pack/images/twitter.png" alt="<?php _e('Follow Us on Twitter', 'all_in_one_seo_pack') ?>" height="47px" /></a>
1418
1419</p>
1420
1421
1422<!--
1423<p>
1424<?php
1425//$canwrite = $this->is_upgrade_directory_writable();
1426//$canwrite = false;
1427?>
1428<form class="form-table" name="dofollow" action="" method="post">
1429<p class="submit">
1430<input type="submit" <?php //if (!$canwrite) echo(' disabled="disabled" ');?> name="aiosp_upgrade" value="<?php //_e('One Click Upgrade', 'all_in_one_seo_pack')?> &raquo;" />
1431<strong><?php //_e("(Remember: Backup early, backup often!)", 'all_in_one_seo_pack') ?></strong>
1432</form>
1433</p>
1434<p></p>
1435
1436
1437<?php //if (!$canwrite) {
1438 //echo("<p><strong>"); echo(sprintf(__("Please make sure that %s is writable.", 'all_in_one_seo_pack'), $this->upgrade_folder)); echo("</p></strong>");
1439// } ?>
1440</p>
1441-->
1442
1443<script type="text/javascript">
1444<!--
1445 function toggleVisibility(id) {
1446 var e = document.getElementById(id);
1447 if(e.style.display == 'block')
1448 e.style.display = 'none';
1449 else
1450 e.style.display = 'block';
1451 }
1452//-->
1453</script>
1454
1455<h3><?php _e('Click on option titles to get help!', 'all_in_one_seo_pack') ?></h3>
1456
1457<?php
1458$uri = "feed://donations.semperfiwebdesign.com/category/highest-donations/feed/";
1459include_once(ABSPATH . WPINC . '/rss.php');
1460$rss = fetch_rss($uri);
1461if($rss){
1462echo "Highest Donations";
1463$maxitems = 5;
1464if(is_array($rss->items)){
1465$items = array_slice($rss->items, 0, $maxitems);
1466?>
1467<ul>
1468<?php if (empty($items)) echo '<li>No items</li>';
1469else
1470foreach ( $items as $item ) : ?>
1471<li><a href='<?php echo $item['description']; ?>'
1472title='<?php echo $item['title']; ?>'>
1473<?php echo $item['title']; ?>
1474</a></li>
1475<?php endforeach; ?>
1476</ul>
1477<?php } }else{
1478 //do something else for feed here
1479}
1480
1481
1482 ?>
1483
1484<?php
1485$uri = "feed://donations.semperfiwebdesign.com/category/all-in-one-seo-pack/feed/";
1486include_once(ABSPATH . WPINC . '/rss.php');
1487$rss = fetch_rss($uri);
1488if($rss){
1489echo "Latest Donations";
1490$maxitems = 5;
1491if(is_array($rss->items)){
1492$items = array_slice($rss->items, 0, $maxitems);
1493?>
1494<ul>
1495<?php if (empty($items)) echo '<li>No items</li>';
1496else
1497foreach ( $items as $item ) : ?>
1498<li><a href='<?php echo $item['link']; ?>'
1499title='<?php echo $item['title']; ?>'>
1500<?php echo $item['title']; ?>
1501</a></li>
1502<?php endforeach; ?>
1503</ul>
1504<?php } }else{
1505 //fall back on something else for feed here
1506}?>
1507
1508<?php
1509global $wpdb;
1510$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'keywords'");
1511$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'title'") + $somecount;
1512$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'description'") + $somecount;
1513$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_meta'") + $somecount;
1514$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_disable'") + $somecount;
1515if($somecount > 0){
1516echo "<div class='error' style='text-align:center;'><p><strong>Your database meta needs to be updated. " . $somecount . " old fields remaining</strong> <em>(Back up your database before updating.)</em>
1517 <FORM action='' method='post' name='aioseop-migrate'>
1518 <input type='hidden' name='nonce-aioseop-migrate' value='" . wp_create_nonce('aioseop-migrate-nonce') . "' />
1519 <input type='submit' name='aioseop_migrate' class='button-primary' value='Update Database'>
1520 </FORM>
1521</p></div>";
1522}
1523
1524if(!get_option('aioseop_options')){
1525 echo "<div class='error' style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
1526 <FORM action='' method='post' name='aioseop-migrate-options'>
1527 <input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce('aioseop-migrate-nonce-options') . "' />
1528 <input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
1529 </FORM>
1530 </p></div>";
1531
1532}
1533
1534?>
1535
1536
1537<form name="dofollow" action="" method="post">
1538<table class="form-table">
1539<?php $aioseop_options = get_option('aioseop_options'); ?>
1540<?php if (!$aioseop_options['aiosp_donate']){?>
1541<tr>
1542<th scope="row" style="text-align:right; vertical-align:top;">
1543<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
1544<?php _e('I enjoy this plugin and have made a donation:', 'all_in_one_seo_pack')?>
1545</a>
1546</td>
1547<td>
1548<input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
1549<div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
1550<?php
1551_e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
1552 ?>
1553</div>
1554</td>
1555</tr>
1556<?php } ?>
1557
1558<tr>
1559<th scope="row" style="text-align:right; vertical-align:top;">
1560<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_enabled_tip');">
1561<?php _e('Plugin Status:', 'all_in_one_seo_pack')?>
1562</a>
1563</td>
1564<td>
1565<input type="radio" name="aiosp_enabled" value="1" <?php if($aioseop_options['aiosp_enabled']) echo "checked"?> > Enabled<br>
1566<input type="radio" name="aiosp_enabled" value="0" <?php if(!$aioseop_options['aiosp_enabled']) echo "checked"?>> Disabled
1567<div style="max-width:500px; text-align:left; display:none" id="aiosp_enabled_tip">
1568<?php
1569_e('All in One SEO Pack must be enabled for use.', 'all_in_one_seo_pack');
1570 ?>
1571</div>
1572</td>
1573</tr>
1574
1575<tr>
1576<th scope="row" style="text-align:right; vertical-align:top;">
1577<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_title_tip');">
1578<?php _e('Home Title:', 'all_in_one_seo_pack')?>
1579</a>
1580</td>
1581<td>
1582<textarea cols="57" rows="2" name="aiosp_home_title"><?php echo stripcslashes($aioseop_options['aiosp_home_title']); ?></textarea>
1583<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_title_tip">
1584<?php
1585_e('As the name implies, this will be the title of your homepage. This is independent of any other option. If not set, the default blog title will get used.', 'all_in_one_seo_pack');
1586 ?>
1587</div>
1588</td>
1589</tr>
1590
1591<tr>
1592<th scope="row" style="text-align:right; vertical-align:top;">
1593<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_description_tip');">
1594<?php _e('Home Description:', 'all_in_one_seo_pack')?>
1595</a>
1596</td>
1597<td>
1598<textarea cols="57" rows="2" name="aiosp_home_description"><?php echo stripcslashes($aioseop_options['aiosp_home_description']); ?></textarea>
1599<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_description_tip">
1600<?php
1601_e('The META description for your homepage. Independent of any other options, the default is no META description at all if this is not set.', 'all_in_one_seo_pack');
1602 ?>
1603</div>
1604</td>
1605</tr>
1606
1607<tr>
1608<th scope="row" style="text-align:right; vertical-align:top;">
1609<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_keywords_tip');">
1610<?php _e('Home Keywords (comma separated):', 'all_in_one_seo_pack')?>
1611</a>
1612</td>
1613<td>
1614<textarea cols="57" rows="2" name="aiosp_home_keywords"><?php echo stripcslashes($aioseop_options['aiosp_home_keywords']); ?></textarea>
1615<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_keywords_tip">
1616<?php
1617_e("A comma separated list of your most important keywords for your site that will be written as META keywords on your homepage. Don't stuff everything in here.", 'all_in_one_seo_pack');
1618 ?>
1619</div>
1620</td>
1621</tr>
1622
1623<tr>
1624<th scope="row" style="text-align:right; vertical-align:top;">
1625<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_can_tip');">
1626<?php _e('Canonical URLs:', 'all_in_one_seo_pack')?>
1627</a>
1628</td>
1629<td>
1630<input type="checkbox" name="aiosp_can" <?php if ($aioseop_options['aiosp_can']) echo "checked=\"1\""; ?>/>
1631<div style="max-width:500px; text-align:left; display:none" id="aiosp_can_tip">
1632<?php
1633_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');
1634 ?>
1635</div>
1636</td>
1637</tr>
1638
1639<tr>
1640<th scope="row" style="text-align:right; vertical-align:top;">
1641<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
1642<?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
1643</a>
1644</td>
1645<td>
1646<input type="checkbox" name="aiosp_rewrite_titles" <?php if ($aioseop_options['aiosp_rewrite_titles']) echo "checked=\"1\""; ?>/>
1647<div style="max-width:500px; text-align:left; display:none" id="aiosp_rewrite_titles_tip">
1648<?php
1649_e("Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the window title bar and of course in the source. If set, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: The default templates puts the title tag of posts like this: “Blog Archive >> Blog Name >> Post Title” (maybe I've overdone slightly). This is far from optimal. With the default post title format, Rewrite Title rewrites this to “Post Title | Blog Name”. If you have manually defined a title (in one of the text fields for All in One SEO Plugin input) this will become the title of your post in the format string.", 'all_in_one_seo_pack');
1650 ?>
1651</div>
1652</td>
1653</tr>
1654
1655<tr>
1656<th scope="row" style="text-align:right; vertical-align:top;">
1657<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_title_format_tip');">
1658<?php _e('Post Title Format:', 'all_in_one_seo_pack')?>
1659</a>
1660</td>
1661<td>
1662<input size="59" name="aiosp_post_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_post_title_format']); ?>"/>
1663<div style="max-width:500px; text-align:left; display:none" id="aiosp_post_title_format_tip">
1664<?php
1665_e('The following macros are supported:', 'all_in_one_seo_pack');
1666echo('<ul>');
1667echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1668echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1669echo('<li>'); _e('%post_title% - The original title of the post', 'all_in_one_seo_pack'); echo('</li>');
1670echo('<li>'); _e('%category_title% - The (main) category of the post', 'all_in_one_seo_pack'); echo('</li>');
1671echo('<li>'); _e('%category% - Alias for %category_title%', 'all_in_one_seo_pack'); echo('</li>');
1672echo('<li>'); _e("%post_author_login% - This post's author' login", 'all_in_one_seo_pack'); echo('</li>');
1673echo('<li>'); _e("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1674echo('<li>'); _e("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1675echo('<li>'); _e("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1676echo('</ul>');
1677 ?>
1678</div>
1679</td>
1680</tr>
1681
1682<tr>
1683<th scope="row" style="text-align:right; vertical-align:top;">
1684<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_title_format_tip');">
1685<?php _e('Page Title Format:', 'all_in_one_seo_pack')?>
1686</a>
1687</td>
1688<td>
1689<input size="59" name="aiosp_page_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_page_title_format']); ?>"/>
1690<div style="max-width:500px; text-align:left; display:none" id="aiosp_page_title_format_tip">
1691<?php
1692_e('The following macros are supported:', 'all_in_one_seo_pack');
1693echo('<ul>');
1694echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1695echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1696echo('<li>'); _e('%page_title% - The original title of the page', 'all_in_one_seo_pack'); echo('</li>');
1697echo('<li>'); _e("%page_author_login% - This page's author' login", 'all_in_one_seo_pack'); echo('</li>');
1698echo('<li>'); _e("%page_author_nicename% - This page's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1699echo('<li>'); _e("%page_author_firstname% - This page's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1700echo('<li>'); _e("%page_author_lastname% - This page's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1701echo('</ul>');
1702 ?>
1703</div>
1704</td>
1705</tr>
1706
1707<tr>
1708<th scope="row" style="text-align:right; vertical-align:top;">
1709<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_title_format_tip');">
1710<?php _e('Category Title Format:', 'all_in_one_seo_pack')?>
1711</a>
1712</td>
1713<td>
1714<input size="59" name="aiosp_category_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_category_title_format']); ?>"/>
1715<div style="max-width:500px; text-align:left; display:none" id="aiosp_category_title_format_tip">
1716<?php
1717_e('The following macros are supported:', 'all_in_one_seo_pack');
1718echo('<ul>');
1719echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1720echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1721echo('<li>'); _e('%category_title% - The original title of the category', 'all_in_one_seo_pack'); echo('</li>');
1722echo('<li>'); _e('%category_description% - The description of the category', 'all_in_one_seo_pack'); echo('</li>');
1723echo('</ul>');
1724 ?>
1725</div>
1726</td>
1727</tr>
1728
1729<tr>
1730<th scope="row" style="text-align:right; vertical-align:top;">
1731<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_title_format_tip');">
1732<?php _e('Archive Title Format:', 'all_in_one_seo_pack')?>
1733</a>
1734</td>
1735<td>
1736<input size="59" name="aiosp_archive_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_archive_title_format']); ?>"/>
1737<div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_title_format_tip">
1738<?php
1739_e('The following macros are supported:', 'all_in_one_seo_pack');
1740echo('<ul>');
1741echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1742echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1743echo('<li>'); _e('%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all_in_one_seo_pack'); echo('</li>');
1744echo('</ul>');
1745 ?>
1746</div>
1747</td>
1748</tr>
1749
1750<tr>
1751<th scope="row" style="text-align:right; vertical-align:top;">
1752<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tag_title_format_tip');">
1753<?php _e('Tag Title Format:', 'all_in_one_seo_pack')?>
1754</a>
1755</td>
1756<td>
1757<input size="59" name="aiosp_tag_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_tag_title_format']); ?>"/>
1758<div style="max-width:500px; text-align:left; display:none" id="aiosp_tag_title_format_tip">
1759<?php
1760_e('The following macros are supported:', 'all_in_one_seo_pack');
1761echo('<ul>');
1762echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1763echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1764echo('<li>'); _e('%tag% - The name of the tag', 'all_in_one_seo_pack'); echo('</li>');
1765echo('</ul>');
1766 ?>
1767</div>
1768</td>
1769</tr>
1770
1771<tr>
1772<th scope="row" style="text-align:right; vertical-align:top;">
1773<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_search_title_format_tip');">
1774<?php _e('Search Title Format:', 'all_in_one_seo_pack')?>
1775</a>
1776</td>
1777<td>
1778<input size="59" name="aiosp_search_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_search_title_format']); ?>"/>
1779<div style="max-width:500px; text-align:left; display:none" id="aiosp_search_title_format_tip">
1780<?php
1781_e('The following macros are supported:', 'all_in_one_seo_pack');
1782echo('<ul>');
1783echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1784echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1785echo('<li>'); _e('%search% - What was searched for', 'all_in_one_seo_pack'); echo('</li>');
1786echo('</ul>');
1787 ?>
1788</div>
1789</td>
1790</tr>
1791
1792<tr>
1793<th scope="row" style="text-align:right; vertical-align:top;">
1794<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_description_format_tip');">
1795<?php _e('Description Format:', 'all_in_one_seo_pack')?>
1796</a>
1797</td>
1798<td>
1799<input size="59" name="aiosp_description_format" value="<?php echo stripcslashes($aioseop_options['aiosp_description_format']); ?>"/>
1800<div style="max-width:500px; text-align:left; display:none" id="aiosp_description_format_tip">
1801<?php
1802_e('The following macros are supported:', 'all_in_one_seo_pack');
1803echo('<ul>');
1804echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1805echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1806echo('<li>'); _e('%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set', 'all_in_one_seo_pack'); echo('</li>');
1807echo('<li>'); _e('%wp_title% - The original wordpress title, e.g. post_title for posts', 'all_in_one_seo_pack'); echo('</li>');
1808echo('</ul>');
1809 ?>
1810</div>
1811</td>
1812</tr>
1813
1814<tr>
1815<th scope="row" style="text-align:right; vertical-align:top;">
1816<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_404_title_format_tip');">
1817<?php _e('404 Title Format:', 'all_in_one_seo_pack')?>
1818</a>
1819</td>
1820<td>
1821<input size="59" name="aiosp_404_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_404_title_format']); ?>"/>
1822<div style="max-width:500px; text-align:left; display:none" id="aiosp_404_title_format_tip">
1823<?php
1824_e('The following macros are supported:', 'all_in_one_seo_pack');
1825echo('<ul>');
1826echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1827echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1828echo('<li>'); _e('%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all_in_one_seo_pack'); echo('</li>');
1829echo('<li>'); _e('%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all_in_one_seo_pack'); echo('</li>');
1830echo('<li>'); _e('%404_title% - Additional 404 title input"', 'all_in_one_seo_pack'); echo('</li>');
1831echo('</ul>');
1832 ?>
1833</div>
1834</td>
1835</tr>
1836
1837<tr>
1838<th scope="row" style="text-align:right; vertical-align:top;">
1839<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_paged_format_tip');">
1840<?php _e('Paged Format:', 'all_in_one_seo_pack')?>
1841</a>
1842</td>
1843<td>
1844<input size="59" name="aiosp_paged_format" value="<?php echo stripcslashes($aioseop_options['aiosp_paged_format']); ?>"/>
1845<div style="max-width:500px; text-align:left; display:none" id="aiosp_paged_format_tip">
1846<?php
1847_e('This string gets appended/prepended to titles when they are for paged index pages (like home or archive pages).', 'all_in_one_seo_pack');
1848_e('The following macros are supported:', 'all_in_one_seo_pack');
1849echo('<ul>');
1850echo('<li>'); _e('%page% - The page number', 'all_in_one_seo_pack'); echo('</li>');
1851echo('</ul>');
1852 ?>
1853</div>
1854</td>
1855</tr>
1856
1857<tr>
1858<th scope="row" style="text-align:right; vertical-align:top;">
1859<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_use_categories_tip');">
1860<?php _e('Use Categories for META keywords:', 'all_in_one_seo_pack')?>
1861</td>
1862<td>
1863<input type="checkbox" name="aiosp_use_categories" <?php if ($aioseop_options['aiosp_use_categories']) echo "checked=\"1\""; ?>/>
1864<div style="max-width:500px; text-align:left; display:none" id="aiosp_use_categories_tip">
1865<?php
1866_e('Check this if you want your categories for a given post used as the META keywords for this post (in addition to any keywords and tags you specify on the post edit page).', 'all_in_one_seo_pack');
1867 ?>
1868</div>
1869</td>
1870</tr>
1871
1872<tr>
1873<th scope="row" style="text-align:right; vertical-align:top;">
1874<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_dynamic_postspage_keywords_tip');">
1875<?php _e('Dynamically Generate Keywords for Posts Page:', 'all_in_one_seo_pack')?>
1876</td>
1877<td>
1878<input type="checkbox" name="aiosp_dynamic_postspage_keywords" <?php if ($aioseop_options['aiosp_dynamic_postspage_keywords']) echo "checked=\"1\""; ?>/>
1879<div style="max-width:500px; text-align:left; display:none" id="aiosp_dynamic_postspage_keywords_tip">
1880<?php
1881_e('Check this if you want your keywords on a custom posts page (set it in options->reading) to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all_in_one_seo_pack');
1882 ?>
1883</div>
1884</td>
1885</tr>
1886
1887<tr>
1888<th scope="row" style="text-align:right; vertical-align:top;">
1889<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_noindex_tip');">
1890<?php _e('Use noindex for Categories:', 'all_in_one_seo_pack')?>
1891</a>
1892</td>
1893<td>
1894<input type="checkbox" name="aiosp_category_noindex" <?php if ($aioseop_options['aiosp_category_noindex']) echo "checked=\"1\""; ?>/>
1895<div style="max-width:500px; text-align:left; display:none" id="aiosp_category_noindex_tip">
1896<?php
1897_e('Check this for excluding category pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1898 ?>
1899</div>
1900</td>
1901</tr>
1902
1903<tr>
1904<th scope="row" style="text-align:right; vertical-align:top;">
1905<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_noindex_tip');">
1906<?php _e('Use noindex for Archives:', 'all_in_one_seo_pack')?>
1907</a>
1908</td>
1909<td>
1910<input type="checkbox" name="aiosp_archive_noindex" <?php if ($aioseop_options['aiosp_archive_noindex']) echo "checked=\"1\""; ?>/>
1911<div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_noindex_tip">
1912<?php
1913_e('Check this for excluding archive pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1914 ?>
1915</div>
1916</td>
1917</tr>
1918
1919<tr>
1920<th scope="row" style="text-align:right; vertical-align:top;">
1921<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tags_noindex_tip');">
1922<?php _e('Use noindex for Tag Archives:', 'all_in_one_seo_pack')?>
1923</a>
1924</td>
1925<td>
1926<input type="checkbox" name="aiosp_tags_noindex" <?php if ($aioseop_options['aiosp_tags_noindex']) echo "checked=\"1\""; ?>/>
1927<div style="max-width:500px; text-align:left; display:none" id="aiosp_tags_noindex_tip">
1928<?php
1929_e('Check this for excluding tag pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1930 ?>
1931</div>
1932</td>
1933</tr>
1934
1935<tr>
1936<th scope="row" style="text-align:right; vertical-align:top;">
1937<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_generate_descriptions_tip');">
1938<?php _e('Autogenerate Descriptions:', 'all_in_one_seo_pack')?>
1939</a>
1940</td>
1941<td>
1942<input type="checkbox" name="aiosp_generate_descriptions" <?php if ($aioseop_options['aiosp_generate_descriptions']) echo "checked=\"1\""; ?>/>
1943<div style="max-width:500px; text-align:left; display:none" id="aiosp_generate_descriptions_tip">
1944<?php
1945_e("Check this and your META descriptions will get autogenerated if there's no excerpt.", 'all_in_one_seo_pack');
1946 ?>
1947</div>
1948</td>
1949</tr>
1950
1951<tr>
1952<th scope="row" style="text-align:right; vertical-align:top;">
1953<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_cap_cats_tip');">
1954<?php _e('Capitalize Category Titles:', 'all_in_one_seo_pack')?>
1955</a>
1956</td>
1957<td>
1958<input type="checkbox" name="aiosp_cap_cats" <?php if ($aioseop_options['aiosp_cap_cats']) echo "checked=\"1\""; ?>/>
1959<div style="max-width:500px; text-align:left; display:none" id="aiosp_cap_cats_tip">
1960<?php
1961_e("Check this and Category Titles will have the first letter of each word capitalized.", 'all_in_one_seo_pack');
1962 ?>
1963</div>
1964</td>
1965</tr>
1966
1967<!-- new crap start -->
1968<tr>
1969<th scope="row" style="text-align:right; vertical-align:top;">
1970<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_ex_pages_tip');">
1971<?php _e('Exclude Pages:', 'all_in_one_seo_pack')?>
1972</a>
1973</td>
1974<td>
1975 <textarea cols="57" rows="2" name="aiosp_ex_pages"><?php echo stripcslashes($aioseop_options['aiosp_ex_pages']); ?></textarea>
1976<div style="max-width:500px; text-align:left; display:none" id="aiosp_ex_pages_tip">
1977<?php
1978_e("Enter any comma separated pages here to be excluded by All in One SEO Pack. This is helpful when using plugins which generate their own non-WordPress dynamic pages. Ex: <em>/forum/,/contact/</em> For instance, if you want to exclude the virtual pages generated by a forum plugin, all you have to do is give forum or /forum or /forum/ or and any URL with the word \"forum\" in it, such as http://mysite.com/forum or http://mysite.com/forum/someforumpage will be excluded from All in One SEO Pack.", 'all_in_one_seo_pack');
1979 ?>
1980</div>
1981</td>
1982</tr>
1983<!-- new crap end -->
1984
1985<tr>
1986<th scope="row" style="text-align:right; vertical-align:top;">
1987<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
1988<?php _e('Additional Post Headers:', 'all_in_one_seo_pack')?>
1989</a>
1990</td>
1991<td>
1992<textarea cols="57" rows="2" name="aiosp_post_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_post_meta_tags']); ?></textarea>
1993<div style="max-width:500px; text-align:left; display:none" id="aiosp_post_meta_tags_tip">
1994<?php
1995_e('What you enter here will be copied verbatim to your header on post pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
1996 ?>
1997</div>
1998</td>
1999</tr>
2000
2001<tr>
2002<th scope="row" style="text-align:right; vertical-align:top;">
2003<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_meta_tags_tip');">
2004<?php _e('Additional Page Headers:', 'all_in_one_seo_pack')?>
2005</a>
2006</td>
2007<td>
2008<textarea cols="57" rows="2" name="aiosp_page_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_page_meta_tags']); ?></textarea>
2009<div style="max-width:500px; text-align:left; display:none" id="aiosp_page_meta_tags_tip">
2010<?php
2011_e('What you enter here will be copied verbatim to your header on pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
2012 ?>
2013</div>
2014</td>
2015</tr>
2016
2017<tr>
2018<th scope="row" style="text-align:right; vertical-align:top;">
2019<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_meta_tags_tip');">
2020<?php _e('Additional Home Headers:', 'all_in_one_seo_pack')?>
2021</a>
2022</td>
2023<td>
2024<textarea cols="57" rows="2" name="aiosp_home_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_home_meta_tags']); ?></textarea>
2025<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_meta_tags_tip">
2026<?php
2027_e('What you enter here will be copied verbatim to your header on the home page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
2028 ?>
2029</div>
2030</td>
2031</tr>
2032
2033<tr>
2034<th scope="row" style="text-align:right; vertical-align:top;">
2035<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'auto_social')?>" onclick="toggleVisibility('aiosp_do_log_tip');">
2036<?php _e('Log important events:', 'all_in_one_seo_pack')?>
2037</a>
2038</td>
2039<td>
2040<input type="checkbox" name="aiosp_do_log" <?php if ($aioseop_options['aiosp_do_log']) echo "checked=\"1\""; ?>/>
2041<div style="max-width:500px; text-align:left; display:none" id="aiosp_do_log_tip">
2042<?php
2043_e('Check this and SEO pack will create a log of important events (all_in_one_seo_pack.log) in its plugin directory which might help debugging it. Make sure this directory is writable.', 'all_in_one_seo_pack');
2044 ?>
2045</div>
2046</td>
2047</tr>
2048
2049<?php if ($aioseop_options['aiosp_donate']){?>
2050<tr>
2051<th scope="row" style="text-align:right; vertical-align:top;">
2052<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
2053<?php _e('Thank you for your donation:', 'all_in_one_seo_pack')?>
2054</a>
2055</td>
2056<td>
2057<input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
2058<div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
2059<?php
2060_e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
2061 ?>
2062</div>
2063</td>
2064</tr>
2065<?php } ?>
2066
2067</table>
2068<p class="submit">
2069 <?php if($aioseop_options) { ?>
2070
2071<input type="hidden" name="action" value="aiosp_update" />
2072<input type="hidden" name="nonce-aioseop" value="<?php echo wp_create_nonce('aioseop-nonce'); ?>" />
2073<input type="hidden" name="page_options" value="aiosp_home_description" />
2074<input type="submit" class='button-primary' name="Submit" value="<?php _e('Update Options', 'all_in_one_seo_pack')?> &raquo;" />
2075</p>
2076<?php } ?>
2077
2078<p><br />
2079<strong>Check out these other great plugins!</strong><br />
2080<a href="http://semperfiwebdesign.com/custom-applications/sms-text-message/" title="SMS Text Message WordPress plugin">SMS Text Message</a> - sends SMS updates to your readers<br />
2081<a href="http://semperfiwebdesign.com/custom-applications/wp-security-scan/" title="WordPress Security">WordPress Security Scan</a> - provides vital security for your WordPress site
2082</p>
2083</form>
2084</div>
2085<?php
2086
2087 } // options_panel
2088
2089}
2090
2091?>
Note: See TracBrowser for help on using the repository browser.