PageRenderTime 68ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php

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