PageRenderTime 53ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/wordpress/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php

https://github.com/prabhu/desistartups
PHP | 1620 lines | 1433 code | 103 blank | 84 comment | 176 complexity | c8f2c088a78abe1174b296cab9f43eca MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. Plugin Name: All in One SEO Pack
  4. Plugin URI: http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/
  5. Description: Out-of-the-box SEO for your Wordpress blog.
  6. Version: 1.4.6.8
  7. Author: uberdose
  8. Author URI: http://wp.uberdose.com/
  9. */
  10. /*
  11. Copyright (C) 2008 uberdose.com (seopack AT uberdose DOT com)
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 3 of the License, or
  15. (at your option) any later version.
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20. You should have received a copy of the GNU General Public License
  21. along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. class All_in_One_SEO_Pack {
  24. var $version = "1.4.6.8";
  25. /** Max numbers of chars in auto-generated description */
  26. var $maximum_description_length = 160;
  27. /** Minimum number of chars an excerpt should be so that it can be used
  28. * as description. Touch only if you know what you're doing
  29. */
  30. var $minimum_description_length = 1;
  31. var $ob_start_detected = false;
  32. var $title_start = -1;
  33. var $title_end = -1;
  34. /** The title before rewriting */
  35. var $orig_title = '';
  36. /** Temp filename for the latest version. */
  37. var $upgrade_filename = 'temp.zip';
  38. /** Where to extract the downloaded newest version. */
  39. var $upgrade_folder;
  40. /** Any error in upgrading. */
  41. var $upgrade_error;
  42. /** Which zip to download in order to upgrade .*/
  43. var $upgrade_url = 'http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip';
  44. /** Filename of log file. */
  45. var $log_file;
  46. /** Flag whether there should be logging. */
  47. var $do_log;
  48. var $wp_version;
  49. function All_in_One_SEO_Pack() {
  50. global $wp_version;
  51. $this->wp_version = $wp_version;
  52. $this->log_file = dirname(__FILE__) . '/all_in_one_seo_pack.log';
  53. if (get_option('aiosp_do_log')) {
  54. $this->do_log = true;
  55. } else {
  56. $this->do_log = false;
  57. }
  58. $this->upgrade_filename = dirname(__FILE__) . '/' . $this->upgrade_filename;
  59. $this->upgrade_folder = dirname(__FILE__);
  60. }
  61. function template_redirect() {
  62. global $wp_query;
  63. $post = $wp_query->get_queried_object();
  64. if (is_feed()) {
  65. return;
  66. }
  67. if (is_single() || is_page()) {
  68. $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'aiosp_disable', true)));
  69. if ($aiosp_disable) {
  70. return;
  71. }
  72. }
  73. if (get_option('aiosp_rewrite_titles')) {
  74. ob_start(array($this, 'output_callback_for_title'));
  75. }
  76. }
  77. function output_callback_for_title($content) {
  78. return $this->rewrite_title($content);
  79. }
  80. function init() {
  81. if (function_exists('load_plugin_textdomain')) {
  82. load_plugin_textdomain('all_in_one_seo_pack', 'wp-content/plugins/all-in-one-seo-pack');
  83. }
  84. }
  85. function is_static_front_page() {
  86. global $wp_query;
  87. $post = $wp_query->get_queried_object();
  88. return get_option('show_on_front') == 'page' && is_page() && $post->ID == get_option('page_on_front');
  89. }
  90. function is_static_posts_page() {
  91. global $wp_query;
  92. $post = $wp_query->get_queried_object();
  93. return get_option('show_on_front') == 'page' && is_home() && $post->ID == get_option('page_for_posts');
  94. }
  95. function get_base() {
  96. return '/'.end(explode('/', str_replace(array('\\','/all_in_one_seo_pack.php'),array('/',''),__FILE__)));
  97. }
  98. function admin_head() {
  99. $home = get_settings('siteurl');
  100. $stylesheet = $home.'/wp-content/plugins' . $this->get_base() . '/css/all_in_one_seo_pack.css';
  101. echo('<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />');
  102. }
  103. function wp_head() {
  104. if (is_feed()) {
  105. return;
  106. }
  107. global $wp_query;
  108. $post = $wp_query->get_queried_object();
  109. $meta_string = null;
  110. //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());
  111. if (is_single() || is_page()) {
  112. $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'aiosp_disable', true)));
  113. if ($aiosp_disable) {
  114. return;
  115. }
  116. }
  117. if (get_option('aiosp_rewrite_titles')) {
  118. // make the title rewrite as short as possible
  119. if (function_exists('ob_list_handlers')) {
  120. $active_handlers = ob_list_handlers();
  121. } else {
  122. $active_handlers = array();
  123. }
  124. if (sizeof($active_handlers) > 0 &&
  125. strtolower($active_handlers[sizeof($active_handlers) - 1]) ==
  126. strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
  127. ob_end_flush();
  128. } else {
  129. $this->log("another plugin interfering?");
  130. // if we get here there *could* be trouble with another plugin :(
  131. $this->ob_start_detected = true;
  132. if (function_exists('ob_list_handlers')) {
  133. foreach (ob_list_handlers() as $handler) {
  134. $this->log("detected output handler $handler");
  135. }
  136. }
  137. }
  138. }
  139. echo "\n<!-- all in one seo pack $this->version ";
  140. if ($this->ob_start_detected) {
  141. echo "ob_start_detected ";
  142. }
  143. echo "[$this->title_start,$this->title_end] ";
  144. echo "-->\n";
  145. if ((is_home() && get_option('aiosp_home_keywords')) || $this->is_static_front_page()) {
  146. $keywords = trim($this->internationalize(get_option('aiosp_home_keywords')));
  147. } else {
  148. $keywords = $this->get_all_keywords();
  149. }
  150. if (is_single() || is_page()) {
  151. if ($this->is_static_front_page()) {
  152. $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description'))));
  153. } else {
  154. $description = $this->get_post_description($post);
  155. }
  156. } else if (is_home()) {
  157. $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description'))));
  158. } else if (is_category()) {
  159. $description = $this->internationalize(category_description());
  160. }
  161. if (isset($description) && (strlen($description) > $this->minimum_description_length) && !(is_home() && is_paged())) {
  162. $description = trim(strip_tags($description));
  163. $description = str_replace('"', '', $description);
  164. // replace newlines on mac / windows?
  165. $description = str_replace("\r\n", ' ', $description);
  166. // maybe linux uses this alone
  167. $description = str_replace("\n", ' ', $description);
  168. if (isset($meta_string)) {
  169. //$meta_string .= "\n";
  170. } else {
  171. $meta_string = '';
  172. }
  173. // description format
  174. $description_format = get_option('aiosp_description_format');
  175. if (!isset($description_format) || empty($description_format)) {
  176. $description_format = "%description%";
  177. }
  178. $description = str_replace('%description%', $description, $description_format);
  179. $description = str_replace('%blog_title%', get_bloginfo('name'), $description);
  180. $description = str_replace('%blog_description%', get_bloginfo('description'), $description);
  181. $description = str_replace('%wp_title%', $this->get_original_title(), $description);
  182. $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description);
  183. }
  184. if (isset ($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
  185. if (isset($meta_string)) {
  186. $meta_string .= "\n";
  187. }
  188. $meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords);
  189. }
  190. if (function_exists('is_tag')) {
  191. $is_tag = is_tag();
  192. }
  193. if ((is_category() && get_option('aiosp_category_noindex')) ||
  194. (!is_category() && is_archive() &&!$is_tag && get_option('aiosp_archive_noindex')) ||
  195. (get_option('aiosp_tags_noindex') && $is_tag)) {
  196. if (isset($meta_string)) {
  197. $meta_string .= "\n";
  198. }
  199. $meta_string .= '<meta name="robots" content="noindex,follow" />';
  200. }
  201. $page_meta = stripcslashes(get_option('aiosp_page_meta_tags'));
  202. $post_meta = stripcslashes(get_option('aiosp_post_meta_tags'));
  203. $home_meta = stripcslashes(get_option('aiosp_home_meta_tags'));
  204. if (is_page() && isset($page_meta) && !empty($page_meta)) {
  205. if (isset($meta_string)) {
  206. $meta_string .= "\n";
  207. }
  208. echo "\n$page_meta";
  209. }
  210. if (is_single() && isset($post_meta) && !empty($post_meta)) {
  211. if (isset($meta_string)) {
  212. $meta_string .= "\n";
  213. }
  214. $meta_string .= "$post_meta";
  215. }
  216. if (is_home() && !empty($home_meta)) {
  217. if (isset($meta_string)) {
  218. $meta_string .= "\n";
  219. }
  220. $meta_string .= "$home_meta";
  221. }
  222. if ($meta_string != null) {
  223. echo "$meta_string\n";
  224. }
  225. echo "<!-- /all in one seo pack -->\n";
  226. }
  227. function get_post_description($post) {
  228. $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "description", true))));
  229. if (!$description) {
  230. $description = $this->trim_excerpt_without_filters_full_length($this->internationalize($post->post_excerpt));
  231. if (!$description && get_option("aiosp_generate_descriptions")) {
  232. $description = $this->trim_excerpt_without_filters($this->internationalize($post->post_content));
  233. }
  234. }
  235. // "internal whitespace trim"
  236. $description = preg_replace("/\s\s+/", " ", $description);
  237. return $description;
  238. }
  239. function replace_title($content, $title) {
  240. $title = trim(strip_tags($title));
  241. $title_tag_start = "<title>";
  242. $title_tag_end = "</title>";
  243. $len_start = strlen($title_tag_start);
  244. $len_end = strlen($title_tag_end);
  245. $title = stripcslashes(trim($title));
  246. $start = strpos($content, $title_tag_start);
  247. $end = strpos($content, $title_tag_end);
  248. $this->title_start = $start;
  249. $this->title_end = $end;
  250. $this->orig_title = $title;
  251. if ($start && $end) {
  252. $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
  253. } else {
  254. // this breaks some sitemap plugins (like wpg2)
  255. //$header = $content . "<title>$title</title>";
  256. $header = $content;
  257. }
  258. return $header;
  259. }
  260. function internationalize($in) {
  261. if (function_exists('langswitch_filter_langs_with_message')) {
  262. $in = langswitch_filter_langs_with_message($in);
  263. }
  264. if (function_exists('polyglot_filter')) {
  265. $in = polyglot_filter($in);
  266. }
  267. if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
  268. $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
  269. }
  270. $in = apply_filters('localization', $in);
  271. return $in;
  272. }
  273. /** @return The original title as delivered by WP (well, in most cases) */
  274. function get_original_title() {
  275. global $wp_query;
  276. if (!$wp_query) {
  277. return null;
  278. }
  279. $post = $wp_query->get_queried_object();
  280. // the_search_query() is not suitable, it cannot just return
  281. global $s;
  282. $title = null;
  283. if (is_home()) {
  284. $title = get_option('blogname');
  285. } else if (is_single()) {
  286. $title = $this->internationalize(wp_title('', false));
  287. } else if (is_search() && isset($s) && !empty($s)) {
  288. if (function_exists('attribute_escape')) {
  289. $search = attribute_escape(stripcslashes($s));
  290. } else {
  291. $search = wp_specialchars(stripcslashes($s), true);
  292. }
  293. $search = $this->capitalize($search);
  294. $title = $search;
  295. } else if (is_category() && !is_feed()) {
  296. $category_description = $this->internationalize(category_description());
  297. $category_name = ucwords($this->internationalize(single_cat_title('', false)));
  298. $title = $category_name;
  299. } else if (is_page()) {
  300. $title = $this->internationalize(wp_title('', false));
  301. } else if (function_exists('is_tag') && is_tag()) {
  302. global $utw;
  303. if ($utw) {
  304. $tags = $utw->GetCurrentTagSet();
  305. $tag = $tags[0]->tag;
  306. $tag = str_replace('-', ' ', $tag);
  307. } else {
  308. // wordpress > 2.3
  309. $tag = $this->internationalize(wp_title('', false));
  310. }
  311. if ($tag) {
  312. $title = $tag;
  313. }
  314. } else if (is_archive()) {
  315. $title = $this->internationalize(wp_title('', false));
  316. } else if (is_404()) {
  317. $title_format = get_option('aiosp_404_title_format');
  318. $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  319. $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
  320. $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
  321. $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
  322. $title = $new_title;
  323. }
  324. return trim($title);
  325. }
  326. function paged_title($title) {
  327. // the page number if paged
  328. global $paged;
  329. // simple tagging support
  330. global $STagging;
  331. if (is_paged() || (isset($STagging) && $STagging->is_tag_view() && $paged)) {
  332. $part = $this->internationalize(get_option('aiosp_paged_format'));
  333. if (isset($part) || !empty($part)) {
  334. $part = " " . trim($part);
  335. $part = str_replace('%page%', $paged, $part);
  336. $this->log("paged_title() [$title] [$part]");
  337. $title .= $part;
  338. }
  339. }
  340. return $title;
  341. }
  342. function rewrite_title($header) {
  343. global $wp_query;
  344. if (!$wp_query) {
  345. $header .= "<!-- no wp_query found! -->\n";
  346. return $header;
  347. }
  348. $post = $wp_query->get_queried_object();
  349. // the_search_query() is not suitable, it cannot just return
  350. global $s;
  351. // simple tagging support
  352. global $STagging;
  353. if (is_home()) {
  354. $title = $this->internationalize(get_option('aiosp_home_title'));
  355. if (empty($title)) {
  356. $title = $this->internationalize(get_option('blogname'));
  357. }
  358. $title = $this->paged_title($title);
  359. $header = $this->replace_title($header, $title);
  360. } else if (is_single()) {
  361. // we're not in the loop :(
  362. $authordata = get_userdata($post->post_author);
  363. $categories = get_the_category();
  364. $category = '';
  365. if (count($categories) > 0) {
  366. $category = $categories[0]->cat_name;
  367. }
  368. $title = $this->internationalize(get_post_meta($post->ID, "title", true));
  369. if (!$title) {
  370. $title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
  371. if (!$title) {
  372. $title = $this->internationalize(wp_title('', false));
  373. }
  374. }
  375. $title_format = get_option('aiosp_post_title_format');
  376. $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  377. $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
  378. $new_title = str_replace('%post_title%', $title, $new_title);
  379. $new_title = str_replace('%category%', $category, $new_title);
  380. $new_title = str_replace('%category_title%', $category, $new_title);
  381. $new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);
  382. $new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);
  383. $new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);
  384. $new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);
  385. $title = $new_title;
  386. $title = trim($title);
  387. $header = $this->replace_title($header, $title);
  388. } else if (is_search() && isset($s) && !empty($s)) {
  389. if (function_exists('attribute_escape')) {
  390. $search = attribute_escape(stripcslashes($s));
  391. } else {
  392. $search = wp_specialchars(stripcslashes($s), true);
  393. }
  394. $search = $this->capitalize($search);
  395. $title_format = get_option('aiosp_search_title_format');
  396. $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  397. $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
  398. $title = str_replace('%search%', $search, $title);
  399. $header = $this->replace_title($header, $title);
  400. } else if (is_category() && !is_feed()) {
  401. $category_description = $this->internationalize(category_description());
  402. $category_name = ucwords($this->internationalize(single_cat_title('', false)));
  403. $title_format = get_option('aiosp_category_title_format');
  404. $title = str_replace('%category_title%', $category_name, $title_format);
  405. $title = str_replace('%category_description%', $category_description, $title);
  406. $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);
  407. $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
  408. $title = $this->paged_title($title);
  409. $header = $this->replace_title($header, $title);
  410. } else if (is_page()) {
  411. // we're not in the loop :(
  412. $authordata = get_userdata($post->post_author);
  413. if ($this->is_static_front_page()) {
  414. if ($this->internationalize(get_option('aiosp_home_title'))) {
  415. $header = $this->replace_title($header, $this->internationalize(get_option('aiosp_home_title')));
  416. }
  417. } else {
  418. $title = $this->internationalize(get_post_meta($post->ID, "title", true));
  419. if (!$title) {
  420. $title = $this->internationalize(wp_title('', false));
  421. }
  422. $title_format = get_option('aiosp_page_title_format');
  423. $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  424. $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
  425. $new_title = str_replace('%page_title%', $title, $new_title);
  426. $new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);
  427. $new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);
  428. $new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);
  429. $new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);
  430. $title = trim($new_title);
  431. $header = $this->replace_title($header, $title);
  432. }
  433. } else if (function_exists('is_tag') && is_tag()) {
  434. global $utw;
  435. if ($utw) {
  436. $tags = $utw->GetCurrentTagSet();
  437. $tag = $tags[0]->tag;
  438. $tag = str_replace('-', ' ', $tag);
  439. } else {
  440. // wordpress > 2.3
  441. $tag = $this->internationalize(wp_title('', false));
  442. }
  443. if ($tag) {
  444. $tag = $this->capitalize($tag);
  445. $title_format = get_option('aiosp_tag_title_format');
  446. $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  447. $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
  448. $title = str_replace('%tag%', $tag, $title);
  449. $title = $this->paged_title($title);
  450. $header = $this->replace_title($header, $title);
  451. }
  452. } else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support
  453. $tag = $STagging->search_tag;
  454. if ($tag) {
  455. $tag = $this->capitalize($tag);
  456. $title_format = get_option('aiosp_tag_title_format');
  457. $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  458. $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
  459. $title = str_replace('%tag%', $tag, $title);
  460. $title = $this->paged_title($title);
  461. $header = $this->replace_title($header, $title);
  462. }
  463. } else if (is_archive()) {
  464. $date = $this->internationalize(wp_title('', false));
  465. $title_format = get_option('aiosp_archive_title_format');
  466. $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  467. $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
  468. $new_title = str_replace('%date%', $date, $new_title);
  469. $title = trim($new_title);
  470. $title = $this->paged_title($title);
  471. $header = $this->replace_title($header, $title);
  472. } else if (is_404()) {
  473. $title_format = get_option('aiosp_404_title_format');
  474. $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
  475. $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
  476. $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
  477. $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
  478. $header = $this->replace_title($header, $new_title);
  479. }
  480. return $header;
  481. }
  482. /**
  483. * @return User-readable nice words for a given request.
  484. */
  485. function request_as_words($request) {
  486. $request = htmlspecialchars($request);
  487. $request = str_replace('.html', ' ', $request);
  488. $request = str_replace('.htm', ' ', $request);
  489. $request = str_replace('.', ' ', $request);
  490. $request = str_replace('/', ' ', $request);
  491. $request_a = explode(' ', $request);
  492. $request_new = array();
  493. foreach ($request_a as $token) {
  494. $request_new[] = ucwords(trim($token));
  495. }
  496. $request = implode(' ', $request_new);
  497. return $request;
  498. }
  499. function capitalize($s) {
  500. $s = trim($s);
  501. $tokens = explode(' ', $s);
  502. while (list($key, $val) = each($tokens)) {
  503. $tokens[$key] = trim($tokens[$key]);
  504. $tokens[$key] = strtoupper(substr($tokens[$key], 0, 1)) . substr($tokens[$key], 1);
  505. }
  506. $s = implode(' ', $tokens);
  507. return $s;
  508. }
  509. function trim_excerpt_without_filters($text) {
  510. $text = str_replace(']]>', ']]&gt;', $text);
  511. $text = strip_tags($text);
  512. $max = $this->maximum_description_length;
  513. if ($max < strlen($text)) {
  514. while($text[$max] != ' ' && $max > $this->minimum_description_length) {
  515. $max--;
  516. }
  517. }
  518. $text = substr($text, 0, $max);
  519. return trim(stripcslashes($text));
  520. }
  521. function trim_excerpt_without_filters_full_length($text) {
  522. $text = str_replace(']]>', ']]&gt;', $text);
  523. $text = strip_tags($text);
  524. return trim(stripcslashes($text));
  525. }
  526. /**
  527. * @return comma-separated list of unique keywords
  528. */
  529. function get_all_keywords() {
  530. global $posts;
  531. if (is_404()) {
  532. return null;
  533. }
  534. // if we are on synthetic pages
  535. if (!is_home() && !is_page() && !is_single() &&!$this->is_static_front_page() && !$this->is_static_posts_page()) {
  536. return null;
  537. }
  538. $keywords = array();
  539. if (is_array($posts)) {
  540. foreach ($posts as $post) {
  541. if ($post) {
  542. // custom field keywords
  543. $keywords_a = $keywords_i = null;
  544. $description_a = $description_i = null;
  545. $id = $post->ID;
  546. $keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, "keywords", true)));
  547. $keywords_i = str_replace('"', '', $keywords_i);
  548. if (isset($keywords_i) && !empty($keywords_i)) {
  549. $traverse = explode(',', $keywords_i);
  550. foreach ($traverse as $keyword) {
  551. $keywords[] = $keyword;
  552. }
  553. }
  554. // WP 2.3 tags
  555. if (function_exists('get_the_tags')) {
  556. $tags = get_the_tags($post->ID);
  557. if ($tags && is_array($tags)) {
  558. foreach ($tags as $tag) {
  559. $keywords[] = $this->internationalize($tag->name);
  560. }
  561. }
  562. }
  563. // Ultimate Tag Warrior integration
  564. global $utw;
  565. if ($utw) {
  566. $tags = $utw->GetTagsForPost($post);
  567. if (is_array($tags)) {
  568. foreach ($tags as $tag) {
  569. $tag = $tag->tag;
  570. $tag = str_replace('_',' ', $tag);
  571. $tag = str_replace('-',' ',$tag);
  572. $tag = stripcslashes($tag);
  573. $keywords[] = $tag;
  574. }
  575. }
  576. }
  577. // autometa
  578. $autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
  579. if (isset($autometa) && !empty($autometa)) {
  580. $autometa_array = explode(' ', $autometa);
  581. foreach ($autometa_array as $e) {
  582. $keywords[] = $e;
  583. }
  584. }
  585. if (get_option('aiosp_use_categories') && !is_page()) {
  586. $categories = get_the_category($post->ID);
  587. foreach ($categories as $category) {
  588. $keywords[] = $this->internationalize($category->cat_name);
  589. }
  590. }
  591. }
  592. }
  593. }
  594. return $this->get_unique_keywords($keywords);
  595. }
  596. function get_meta_keywords() {
  597. global $posts;
  598. $keywords = array();
  599. if (is_array($posts)) {
  600. foreach ($posts as $post) {
  601. if ($post) {
  602. // custom field keywords
  603. $keywords_a = $keywords_i = null;
  604. $description_a = $description_i = null;
  605. $id = $post->ID;
  606. $keywords_i = stripcslashes(get_post_meta($post->ID, "keywords", true));
  607. $keywords_i = str_replace('"', '', $keywords_i);
  608. if (isset($keywords_i) && !empty($keywords_i)) {
  609. $keywords[] = $keywords_i;
  610. }
  611. }
  612. }
  613. }
  614. return $this->get_unique_keywords($keywords);
  615. }
  616. function get_unique_keywords($keywords) {
  617. $small_keywords = array();
  618. foreach ($keywords as $word) {
  619. $small_keywords[] = strtolower($word);
  620. }
  621. $keywords_ar = array_unique($small_keywords);
  622. return implode(',', $keywords_ar);
  623. }
  624. function get_url($url) {
  625. if (function_exists('file_get_contents')) {
  626. $file = file_get_contents($url);
  627. } else {
  628. $curl = curl_init($url);
  629. curl_setopt($curl, CURLOPT_HEADER, 0);
  630. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  631. $file = curl_exec($curl);
  632. curl_close($curl);
  633. }
  634. return $file;
  635. }
  636. function log($message) {
  637. if ($this->do_log) {
  638. error_log(date('Y-m-d H:i:s') . " " . $message . "\n", 3, $this->log_file);
  639. }
  640. }
  641. function download_newest_version() {
  642. $success = true;
  643. $file_content = $this->get_url($this->upgrade_url);
  644. if ($file_content === false) {
  645. $this->upgrade_error = sprintf(__("Could not download distribution (%s)"), $this->upgrade_url);
  646. $success = false;
  647. } else if (strlen($file_content) < 100) {
  648. $this->upgrade_error = sprintf(__("Could not download distribution (%s): %s"), $this->upgrade_url, $file_content);
  649. $success = false;
  650. } else {
  651. $this->log(sprintf("filesize of download ZIP: %d", strlen($file_content)));
  652. $fh = @fopen($this->upgrade_filename, 'w');
  653. $this->log("fh is $fh");
  654. if (!$fh) {
  655. $this->upgrade_error = sprintf(__("Could not open %s for writing"), $this->upgrade_filename);
  656. $this->upgrade_error .= "<br />";
  657. $this->upgrade_error .= sprintf(__("Please make sure %s is writable"), $this->upgrade_folder);
  658. $success = false;
  659. } else {
  660. $bytes_written = @fwrite($fh, $file_content);
  661. $this->log("wrote $bytes_written bytes");
  662. if (!$bytes_written) {
  663. $this->upgrade_error = sprintf(__("Could not write to %s"), $this->upgrade_filename);
  664. $success = false;
  665. }
  666. }
  667. if ($success) {
  668. fclose($fh);
  669. }
  670. }
  671. return $success;
  672. }
  673. function install_newest_version() {
  674. $success = $this->download_newest_version();
  675. if ($success) {
  676. $success = $this->extract_plugin();
  677. unlink($this->upgrade_filename);
  678. }
  679. return $success;
  680. }
  681. function extract_plugin() {
  682. if (!class_exists('PclZip')) {
  683. require_once ('pclzip.lib.php');
  684. }
  685. $archive = new PclZip($this->upgrade_filename);
  686. $files = $archive->extract(PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $this->upgrade_folder);
  687. $this->log("files is $files");
  688. if (is_array($files)) {
  689. $num_extracted = sizeof($files);
  690. $this->log("extracted $num_extracted files to $this->upgrade_folder");
  691. $this->log(print_r($files, true));
  692. return true;
  693. } else {
  694. $this->upgrade_error = $archive->errorInfo();
  695. return false;
  696. }
  697. }
  698. /** crude approximization of whether current user is an admin */
  699. function is_admin() {
  700. return current_user_can('level_8');
  701. }
  702. function is_directory_writable($directory) {
  703. $filename = $directory . '/' . 'tmp_file_' . time();
  704. $fh = @fopen($filename, 'w');
  705. if (!$fh) {
  706. return false;
  707. }
  708. $written = fwrite($fh, "test");
  709. fclose($fh);
  710. unlink($filename);
  711. if ($written) {
  712. return true;
  713. } else {
  714. return false;
  715. }
  716. }
  717. function is_upgrade_directory_writable() {
  718. //return $this->is_directory_writable($this->upgrade_folder);
  719. // let's assume it is
  720. return true;
  721. }
  722. function post_meta_tags($id) {
  723. $awmp_edit = $_POST["aiosp_edit"];
  724. if (isset($awmp_edit) && !empty($awmp_edit)) {
  725. $keywords = $_POST["aiosp_keywords"];
  726. $description = $_POST["aiosp_description"];
  727. $title = $_POST["aiosp_title"];
  728. $aiosp_meta = $_POST["aiosp_meta"];
  729. $aiosp_disable = $_POST["aiosp_disable"];
  730. delete_post_meta($id, 'keywords');
  731. delete_post_meta($id, 'description');
  732. delete_post_meta($id, 'title');
  733. if ($this->is_admin()) {
  734. delete_post_meta($id, 'aiosp_disable');
  735. }
  736. //delete_post_meta($id, 'aiosp_meta');
  737. if (isset($keywords) && !empty($keywords)) {
  738. add_post_meta($id, 'keywords', $keywords);
  739. }
  740. if (isset($description) && !empty($description)) {
  741. add_post_meta($id, 'description', $description);
  742. }
  743. if (isset($title) && !empty($title)) {
  744. add_post_meta($id, 'title', $title);
  745. }
  746. if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
  747. add_post_meta($id, 'aiosp_disable', $aiosp_disable);
  748. }
  749. /*
  750. if (isset($aiosp_meta) && !empty($aiosp_meta)) {
  751. add_post_meta($id, 'aiosp_meta', $aiosp_meta);
  752. }
  753. */
  754. }
  755. }
  756. function edit_category($id) {
  757. global $wpdb;
  758. $id = $wpdb->escape($id);
  759. $awmp_edit = $_POST["aiosp_edit"];
  760. if (isset($awmp_edit) && !empty($awmp_edit)) {
  761. $keywords = $wpdb->escape($_POST["aiosp_keywords"]);
  762. $title = $wpdb->escape($_POST["aiosp_title"]);
  763. $old_category = $wpdb->get_row("select * from $this->table_categories where category_id=$id", OBJECT);
  764. if ($old_category) {
  765. $wpdb->query("update $this->table_categories
  766. set meta_title='$title', meta_keywords='$keywords'
  767. where category_id=$id");
  768. } else {
  769. $wpdb->query("insert into $this->table_categories(meta_title, meta_keywords, category_id)
  770. values ('$title', '$keywords', $id");
  771. }
  772. //$wpdb->query("insert into $this->table_categories")
  773. /*
  774. delete_post_meta($id, 'keywords');
  775. delete_post_meta($id, 'description');
  776. delete_post_meta($id, 'title');
  777. if (isset($keywords) && !empty($keywords)) {
  778. add_post_meta($id, 'keywords', $keywords);
  779. }
  780. if (isset($description) && !empty($description)) {
  781. add_post_meta($id, 'description', $description);
  782. }
  783. if (isset($title) && !empty($title)) {
  784. add_post_meta($id, 'title', $title);
  785. }
  786. */
  787. }
  788. }
  789. /**
  790. * @deprecated This was for the feature of dedicated meta tags for categories which never went mainstream.
  791. */
  792. function edit_category_form() {
  793. global $post;
  794. $keywords = stripcslashes(get_post_meta($post->ID, 'keywords', true));
  795. $title = stripcslashes(get_post_meta($post->ID, 'title', true));
  796. $description = stripcslashes(get_post_meta($post->ID, 'description', true));
  797. ?>
  798. <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
  799. <table class="editform" width="100%" cellspacing="2" cellpadding="5">
  800. <tr>
  801. <th width="33%" scope="row" valign="top">
  802. <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>
  803. </th>
  804. </tr>
  805. <tr>
  806. <th width="33%" scope="row" valign="top"><label for="aiosp_title"><?php _e('Title:', 'all_in_one_seo_pack') ?></label></th>
  807. <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="70"/></td>
  808. </tr>
  809. <tr>
  810. <th width="33%" scope="row" valign="top"><label for="aiosp_keywords"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></label></th>
  811. <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="70"/></td>
  812. </tr>
  813. </table>
  814. <?php
  815. }
  816. function add_meta_tags_textinput() {
  817. global $post;
  818. $post_id = $post;
  819. if (is_object($post_id)) {
  820. $post_id = $post_id->ID;
  821. }
  822. $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'keywords', true)));
  823. $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'title', true)));
  824. $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'description', true)));
  825. $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_meta', true)));
  826. $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_disable', true)));
  827. ?>
  828. <SCRIPT LANGUAGE="JavaScript">
  829. <!-- Begin
  830. function countChars(field,cntfield) {
  831. cntfield.value = field.value.length;
  832. }
  833. // End -->
  834. </script>
  835. <?php if (substr($this->wp_version, 0, 3) == '2.5') { ?>
  836. <div id="postaiosp" class="postbox closed">
  837. <h3><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
  838. <div class="inside">
  839. <div id="postaiosp">
  840. <?php } else { ?>
  841. <div class="dbx-b-ox-wrapper">
  842. <fieldset id="seodiv" class="dbx-box">
  843. <div class="dbx-h-andle-wrapper">
  844. <h3 class="dbx-handle"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
  845. </div>
  846. <div class="dbx-c-ontent-wrapper">
  847. <div class="dbx-content">
  848. <?php } ?>
  849. <a target="__blank" href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
  850. <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
  851. <table style="margin-bottom:40px">
  852. <tr>
  853. <th style="text-align:left;" colspan="2">
  854. </th>
  855. </tr>
  856. <tr>
  857. <th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
  858. <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
  859. </tr>
  860. <tr>
  861. <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
  862. <td><textarea name="aiosp_description" rows="1" cols="60"
  863. onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
  864. onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
  865. <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
  866. <?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
  867. </td>
  868. </tr>
  869. <tr>
  870. <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
  871. <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
  872. </tr>
  873. <?php if ($this->is_admin()) { ?>
  874. <tr>
  875. <th scope="row" style="text-align:right; vertical-align:top;">
  876. <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
  877. </th>
  878. <td>
  879. <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
  880. </td>
  881. </tr>
  882. <?php } ?>
  883. </table>
  884. <?php if (substr($this->wp_version, 0, 3) == '2.5') { ?>
  885. </div></div></div>
  886. <?php } else { ?>
  887. </div>
  888. </fieldset>
  889. </div>
  890. <?php } ?>
  891. <?php
  892. }
  893. function admin_menu() {
  894. $file = __FILE__;
  895. // hack for 1.5
  896. if (substr($this->wp_version, 0, 3) == '1.5') {
  897. $file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
  898. }
  899. //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'));
  900. 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'));
  901. }
  902. function management_panel() {
  903. $message = null;
  904. $base_url = "edit.php?page=" . __FILE__;
  905. //echo($base_url);
  906. $type = $_REQUEST['type'];
  907. if (!isset($type)) {
  908. $type = "posts";
  909. }
  910. ?>
  911. <ul class="aiosp_menu">
  912. <li><a href="<?php echo $base_url ?>&type=posts">Posts</a>
  913. </li>
  914. <li><a href="<?php echo $base_url ?>&type=pages">Pages</a>
  915. </li>
  916. </ul>
  917. <?php
  918. if ($type == "posts") {
  919. echo("posts");
  920. } elseif ($type == "pages") {
  921. echo("pages");
  922. }
  923. }
  924. function options_panel() {
  925. $message = null;
  926. $message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
  927. // update options
  928. if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
  929. $message = $message_updated;
  930. update_option('aiosp_home_title', $_POST['aiosp_home_title']);
  931. update_option('aiosp_home_description', $_POST['aiosp_home_description']);
  932. update_option('aiosp_home_keywords', $_POST['aiosp_home_keywords']);
  933. update_option('aiosp_max_words_excerpt', $_POST['aiosp_max_words_excerpt']);
  934. update_option('aiosp_rewrite_titles', $_POST['aiosp_rewrite_titles']);
  935. update_option('aiosp_post_title_format', $_POST['aiosp_post_title_format']);
  936. update_option('aiosp_page_title_format', $_POST['aiosp_page_title_format']);
  937. update_option('aiosp_category_title_format', $_POST['aiosp_category_title_format']);
  938. update_option('aiosp_archive_title_format', $_POST['aiosp_archive_title_format']);
  939. update_option('aiosp_tag_title_format', $_POST['aiosp_tag_title_format']);
  940. update_option('aiosp_search_title_format', $_POST['aiosp_search_title_format']);
  941. update_option('aiosp_description_format', $_POST['aiosp_description_format']);
  942. update_option('aiosp_404_title_format', $_POST['aiosp_404_title_format']);
  943. update_option('aiosp_paged_format', $_POST['aiosp_paged_format']);
  944. update_option('aiosp_use_categories', $_POST['aiosp_use_categories']);
  945. update_option('aiosp_category_noindex', $_POST['aiosp_category_noindex']);
  946. update_option('aiosp_archive_noindex', $_POST['aiosp_archive_noindex']);
  947. update_option('aiosp_tags_noindex', $_POST['aiosp_tags_noindex']);
  948. update_option('aiosp_generate_descriptions', $_POST['aiosp_generate_descriptions']);
  949. update_option('aiosp_debug_info', $_POST['aiosp_debug_info']);
  950. update_option('aiosp_post_meta_tags', $_POST['aiosp_post_meta_tags']);
  951. update_option('aiosp_page_meta_tags', $_POST['aiosp_page_meta_tags']);
  952. update_option('aiosp_home_meta_tags', $_POST['aiosp_home_meta_tags']);
  953. update_option('aiosp_do_log', $_POST['aiosp_do_log']);
  954. if (function_exists('wp_cache_flush')) {
  955. wp_cache_flush();
  956. }
  957. } elseif ($_POST['aiosp_upgrade']) {
  958. $message = __("Upgraded to newest version. Please revisit the options page to make sure you see the newest version.", 'all_in_one_seo_pack');
  959. $success = $this->install_newest_version();
  960. if (!$success) {
  961. $message = __("Upgrade failed", 'all_in_one_seo_pack');
  962. if (isset($this->upgrade_error) && !empty($this->upgrade_error)) {
  963. $message .= ": " . $this->upgrade_error;
  964. } else {
  965. $message .= ".";
  966. }
  967. }
  968. }
  969. ?>
  970. <?php if ($message) : ?>
  971. <div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
  972. <?php endif; ?>
  973. <div id="dropmessage" class="updated" style="display:none;"></div>
  974. <div class="wrap">
  975. <h2><?php _e('All in One SEO Plugin Options', 'all_in_one_seo_pack'); ?></h2>
  976. <p>
  977. <?php _e("This is version ", 'all_in_one_seo_pack') ?><?php _e("$this->version ", 'all_in_one_seo_pack') ?>
  978. &nbsp;<a target="_blank" title="<?php _e('All in One SEO Plugin Release History', 'all_in_one_seo_pack')?>"
  979. href="http://wp.uberdose.com/2007/07/27/all-in-one-seo-pack-release-history/"><?php _e("Should I upgrade?", 'all_in_one_seo_pack')?>
  980. </a>
  981. | <a target="_blank" title="<?php _e('FAQ', 'all_in_one_seo_pack') ?>"
  982. href="http://wp.uberdose.com/2007/07/11/all-in-one-seo-pack-faq/"><?php _e('FAQ', 'all_in_one_seo_pack') ?></a>
  983. | <a target="_blank" title="<?php _e('All in One SEO Plugin Feedback', 'all_in_one_seo_pack') ?>"
  984. href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('Feedback', 'all_in_one_seo_pack') ?></a>
  985. | <a target="_blank" title="<?php _e('All in One SEO Plugin Translations', 'all_in_one_seo_pack') ?>"
  986. href="http://wp.uberdose.com/2007/10/02/translations-for-all-in-one-seo-pack/"><?php _e('Translations', 'all_in_one_seo_pack') ?></a>
  987. </p>
  988. <p>
  989. <?php
  990. $canwrite = $this->is_upgrade_directory_writable();
  991. //$canwrite = false;
  992. ?>
  993. <form class="form-table" name="dofollow" action="" method="post">
  994. <p class="submit">
  995. <input type="submit" <?php if (!$canwrite) echo(' disabled="disabled" ');?> name="aiosp_upgrade" value="<?php _e('One Click Upgrade', 'all_in_one_seo_pack')?> &raquo;" />
  996. <strong><?php _e("(Remember: Backup early, backup often!)", 'all_in_one_seo_pack') ?></strong>
  997. </form>
  998. </p>
  999. <p></p>
  1000. <?php if (!$canwrite) {
  1001. echo("<p><strong>"); echo(sprintf(__("Please make sure that %s is writable.", 'all_in_one_seo_pack'), $this->upgrade_folder)); echo("</p></strong>");
  1002. } ?>
  1003. </p>
  1004. <script type="text/javascript">
  1005. <!--
  1006. function toggleVisibility(id) {
  1007. var e = document.getElementById(id);
  1008. if(e.style.display == 'block')
  1009. e.style.display = 'none';
  1010. else
  1011. e.style.display = 'block';
  1012. }
  1013. //-->
  1014. </script>
  1015. <h3><?php _e('Click on option titles to get help!', 'all_in_one_seo_pack') ?></h3>
  1016. <form name="dofollow" action="" method="post">
  1017. <table class="form-table">
  1018. <tr>
  1019. <th scope="row" style="text-align:right; vertical-align:top;">
  1020. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_title_tip');">
  1021. <?php _e('Home Title:', 'all_in_one_seo_pack')?>
  1022. </a>
  1023. </td>
  1024. <td>
  1025. <textarea cols="57" rows="2" name="aiosp_home_title"><?php echo stripcslashes(get_option('aiosp_home_title')); ?></textarea>
  1026. <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_title_tip">
  1027. <?php
  1028. _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');
  1029. ?>
  1030. </div>
  1031. </td>
  1032. </tr>
  1033. <tr>
  1034. <th scope="row" style="text-align:right; vertical-align:top;">
  1035. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_description_tip');">
  1036. <?php _e('Home Description:', 'all_in_one_seo_pack')?>
  1037. </a>
  1038. </td>
  1039. <td>
  1040. <textarea cols="57" rows="2" name="aiosp_home_description"><?php echo stripcslashes(get_option('aiosp_home_description')); ?></textarea>
  1041. <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_description_tip">
  1042. <?php
  1043. _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');
  1044. ?>
  1045. </div>
  1046. </td>
  1047. </tr>
  1048. <tr>
  1049. <th scope="row" style="text-align:right; vertical-align:top;">
  1050. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_keywords_tip');">
  1051. <?php _e('Home Keywords (comma separated):', 'all_in_one_seo_pack')?>
  1052. </a>
  1053. </td>
  1054. <td>
  1055. <textarea cols="57" rows="2" name="aiosp_home_keywords"><?php echo stripcslashes(get_option('aiosp_home_keywords')); ?></textarea>
  1056. <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_keywords_tip">
  1057. <?php
  1058. _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');
  1059. ?>
  1060. </div>
  1061. </td>
  1062. </tr>
  1063. <tr>
  1064. <th scope="row" style="text-align:right; vertical-align:top;">
  1065. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
  1066. <?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
  1067. </a>
  1068. </td>
  1069. <td>
  1070. <input type="checkbox" name="aiosp_rewrite_titles" <?php if (get_option('aiosp_rewrite_titles')) echo "checked=\"1\""; ?>/>
  1071. <div style="max-width:500px; text-align:left; display:none" id="aiosp_rewrite_titles_tip">
  1072. <?php
  1073. _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');
  1074. ?>
  1075. </div>
  1076. </td>
  1077. </tr>
  1078. <tr>
  1079. <th scope="row" style="text-align:right; vertical-align:top;">
  1080. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_title_format_tip');">
  1081. <?php _e('Post Title Format:', 'all_in_one_seo_pack')?>
  1082. </a>
  1083. </td>
  1084. <td>
  1085. <input size="59" name="aiosp_post_title_format" value="<?php echo stripcslashes(get_option('aiosp_post_title_format')); ?>"/>
  1086. <div style="max-width:500px; text-align:left; display:none" id="aiosp_post_title_format_tip">
  1087. <?php
  1088. _e('The following macros are supported:', 'all_in_one_seo_pack');
  1089. echo('<ul>');
  1090. echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
  1091. echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
  1092. echo('<li>'); _e('%post_title% - The original title of the post', 'all_in_one_seo_pack'); echo('</li>');
  1093. echo('<li>'); _e('%category_title% - The (main) category of the post', 'all_in_one_seo_pack'); echo('</li>');
  1094. echo('<li>'); _e('%category% - Alias for %category_title%', 'all_in_one_seo_pack'); echo('</li>');
  1095. echo('<li>'); _e("%post_author_login% - This post's author' login", 'all_in_one_seo_pack'); echo('</li>');
  1096. echo('<li>'); _e("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
  1097. echo('<li>'); _e("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
  1098. echo('<li>'); _e("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
  1099. echo('</ul>');
  1100. ?>
  1101. </div>
  1102. </td>
  1103. </tr>
  1104. <tr>
  1105. <th scope="row" style="text-align:right; vertical-align:top;">
  1106. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_title_format_tip');">
  1107. <?php _e('Page Title Format:', 'all_in_one_seo_pack')?>
  1108. </a>
  1109. </td>
  1110. <td>
  1111. <input size="59" name="aiosp_page_title_format" value="<?php echo stripcslashes(get_option('aiosp_page_title_format')); ?>"/>
  1112. <div style="max-width:500px; text-align:left; display:none" id="aiosp_page_title_format_tip">
  1113. <?php
  1114. _e('The following macros are supported:', 'all_in_one_seo_pack');
  1115. echo('<ul>');
  1116. echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
  1117. echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
  1118. echo('<li>'); _e('%page_title% - The original title of the page', 'all_in_one_seo_pack'); echo('</li>');
  1119. echo('<li>'); _e("%page_author_login% - This page's author' login", 'all_in_one_seo_pack'); echo('</li>');
  1120. echo('<li>'); _e("%page_author_nicename% - This page's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
  1121. echo('<li>'); _e("%page_author_firstname% - This page's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
  1122. echo('<li>'); _e("%page_author_lastname% - This page's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
  1123. echo('</ul>');
  1124. ?>
  1125. </div>
  1126. </td>
  1127. </tr>
  1128. <tr>
  1129. <th scope="row" style="text-align:right; vertical-align:top;">
  1130. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_title_format_tip');">
  1131. <?php _e('Category Title Format:', 'all_in_one_seo_pack')?>
  1132. </a>
  1133. </td>
  1134. <td>
  1135. <input size="59" name="aiosp_category_title_format" value="<?php echo stripcslashes(get_option('aiosp_category_title_format')); ?>"/>
  1136. <div style="max-width:500px; text-align:left; display:none" id="aiosp_category_title_format_tip">
  1137. <?php
  1138. _e('The following macros are supported:', 'all_in_one_seo_pack');
  1139. echo('<ul>');
  1140. echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
  1141. echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
  1142. echo('<li>'); _e('%category_title% - The original title of the category', 'all_in_one_seo_pack'); echo('</li>');
  1143. echo('<li>'); _e('%category_description% - The description of the category', 'all_in_one_seo_pack'); echo('</li>');
  1144. echo('</ul>');
  1145. ?>
  1146. </div>
  1147. </td>
  1148. </tr>
  1149. <tr>
  1150. <th scope="row" style="text-align:right; vertical-align:top;">
  1151. <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_title_format_tip');">
  1152. <?php _e('Archive Title Format:', 'all_in_one_seo_pack')?>
  1153. </a>
  1154. </td>
  1155. <t

Large files files are truncated, but you can click here to view the full file