PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wordpress-seo/admin/class-config.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 1141 lines | 1046 code | 92 blank | 3 comment | 155 complexity | 67e0dc6652fa57d551a7d7efab2917e1 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.1, GPL-3.0, LGPL-2.0, AGPL-3.0

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

  1. <?php
  2. if ( ! class_exists( 'WPSEO_Admin' ) ) {
  3. class WPSEO_Admin extends Yoast_WPSEO_Plugin_Admin {
  4. var $hook = 'wordpress-seo';
  5. var $filename = 'wordpress-seo/wp-seo.php';
  6. var $longname = 'WordPress SEO Configuration';
  7. var $shortname = 'SEO';
  8. var $currentoption = 'wpseo';
  9. var $ozhicon = 'tag.png';
  10. function WPSEO_Admin() {
  11. $this->multisite_defaults();
  12. add_action( 'init', array(&$this, 'init') );
  13. }
  14. function init() {
  15. if ( $this->grant_access() ) {
  16. add_action( 'admin_init', array(&$this, 'options_init') );
  17. add_action( 'admin_menu', array(&$this, 'register_settings_page') );
  18. add_action( 'network_admin_menu', array(&$this, 'register_network_settings_page') );
  19. add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
  20. add_action( 'admin_print_scripts', array(&$this,'config_page_scripts'));
  21. add_action( 'admin_print_styles', array(&$this,'config_page_styles'));
  22. }
  23. add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
  24. add_action( 'wp_dashboard_setup', array(&$this,'widget_setup'));
  25. add_action( 'wp_network_dashboard_setup', array(&$this,'widget_setup'));
  26. add_filter( 'wp_dashboard_widgets', array(&$this, 'widget_order'));
  27. add_filter( 'wp_network_dashboard_widgets', array(&$this, 'widget_order'));
  28. add_action( 'show_user_profile', array(&$this,'wpseo_user_profile'));
  29. add_action( 'edit_user_profile', array(&$this,'wpseo_user_profile'));
  30. add_action( 'personal_options_update', array(&$this,'wpseo_process_user_option_update'));
  31. add_action( 'edit_user_profile_update', array(&$this,'wpseo_process_user_option_update'));
  32. if ( '0' == get_option('blog_public') )
  33. add_action('admin_footer', array(&$this,'blog_public_warning'));
  34. }
  35. function options_init() {
  36. register_setting( 'yoast_wpseo_options', 'wpseo' );
  37. register_setting( 'yoast_wpseo_indexation_options', 'wpseo_indexation' );
  38. register_setting( 'yoast_wpseo_permalinks_options', 'wpseo_permalinks' );
  39. register_setting( 'yoast_wpseo_titles_options', 'wpseo_titles' );
  40. register_setting( 'yoast_wpseo_rss_options', 'wpseo_rss' );
  41. register_setting( 'yoast_wpseo_internallinks_options', 'wpseo_internallinks' );
  42. register_setting( 'yoast_wpseo_xml_sitemap_options', 'wpseo_xml' );
  43. if ( function_exists('is_multisite') && is_multisite() )
  44. register_setting( 'yoast_wpseo_multisite_options', 'wpseo_multisite' );
  45. }
  46. function multisite_defaults() {
  47. $option = get_option('wpseo');
  48. if ( function_exists('is_multisite') && is_multisite() && !is_array($option) ) {
  49. $options = get_site_option('wpseo_ms');
  50. if ( is_array($options) && isset($options['defaultblog']) && !empty($options['defaultblog']) && $options['defaultblog'] != 0 ) {
  51. foreach ( get_wpseo_options_arr() as $option ) {
  52. update_option( $option, get_blog_option( $options['defaultblog'], $option) );
  53. }
  54. }
  55. $option['ms_defaults_set'] = true;
  56. update_option( 'wpseo', $option );
  57. }
  58. }
  59. function blog_public_warning() {
  60. if ( function_exists('is_network_admin') && is_network_admin() )
  61. return;
  62. $options = get_option('wpseo');
  63. if ( isset($options['ignore_blog_public_warning']) && $options['ignore_blog_public_warning'] == 'ignore' )
  64. return;
  65. echo "<div id='message' class='error'>";
  66. echo "<p><strong>Huge SEO Issue: You're blocking access to robots.</strong> You must <a href='options-privacy.php'>go to your Privacy settings</a> and set your blog visible to everyone. <a href='javascript:wpseo_setIgnore(\"blog_public_warning\",\"message\",\"".wp_create_nonce('wpseo-ignore')."\");' class='button'>I know, don't bug me.</a></p></div>";
  67. }
  68. function admin_sidebar() {
  69. ?>
  70. <div class="postbox-container" style="width:20%;">
  71. <div class="metabox-holder">
  72. <div class="meta-box-sortables">
  73. <?php
  74. $this->plugin_like();
  75. $this->postbox('donate','<strong class="red">Donate $10, $20 or $50!</strong>','<p>This plugin has cost me countless hours of work, if you use it, please donate a token of your appreciation!</p><br/><form style="margin-left:30px;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  76. <input type="hidden" name="cmd" value="_s-xclick">
  77. <input type="hidden" name="hosted_button_id" value="83KQ269Q2SR82">
  78. <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  79. <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
  80. </form>');
  81. $this->plugin_support();
  82. $this->news();
  83. ?>
  84. </div>
  85. <br/><br/><br/>
  86. </div>
  87. </div>
  88. <?php
  89. }
  90. function admin_header($title, $expl = true, $form = true, $option = 'yoast_wpseo_options', $optionshort = 'wpseo', $contains_files = false) {
  91. ?>
  92. <div class="wrap">
  93. <?php
  94. if ( (isset($_GET['updated']) && $_GET['updated'] == 'true') || (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') ) {
  95. $msg = __('Settings updated');
  96. if ( function_exists('w3tc_pgcache_flush') ) {
  97. w3tc_pgcache_flush();
  98. $msg .= __(' &amp; W3 Total Cache Page Cache flushed');
  99. } else if (function_exists('wp_cache_clear_cache() ')) {
  100. wp_cache_clear_cache();
  101. $msg .= __(' &amp; WP Super Cache flushed');
  102. }
  103. // flush rewrite rules if XML sitemap settings have been updated.
  104. if ( isset($_GET['page']) && 'wpseo_xml' == $_GET['page'] )
  105. flush_rewrite_rules();
  106. echo '<div id="message" style="width:94%;" class="message updated"><p><strong>'.$msg.'.</strong></p></div>';
  107. }
  108. ?>
  109. <a href="http://yoast.com/"><div id="yoast-icon" style="background: url(<?php echo WPSEO_URL; ?>images/wordpress-SEO-32x32.png) no-repeat;" class="icon32"><br /></div></a>
  110. <h2><?php _e("Yoast WordPress SEO: ".$title, 'yoast-wpseo'); ?></h2>
  111. <div class="postbox-container" style="width:70%;">
  112. <div class="metabox-holder">
  113. <div class="meta-box-sortables">
  114. <?php
  115. if ($form) {
  116. echo '<form action="'.admin_url('options.php').'" method="post" id="wpseo-conf"' . ($contains_files ? ' enctype="multipart/form-data"' : '') . '>';
  117. settings_fields($option);
  118. $this->currentoption = $optionshort;
  119. // Set some of the ignore booleans here to prevent unsetting.
  120. echo $this->hidden('ignore_blog_public_warning');
  121. echo $this->hidden('ignore_page_comments');
  122. echo $this->hidden('ignore_permalink');
  123. echo $this->hidden('ms_defaults_set');
  124. }
  125. if ($expl)
  126. $this->postbox('pluginsettings',__('Plugin Settings', 'yoast-wpseo'),$this->checkbox('disableexplanation',__('Hide verbose explanations of settings', 'yoast-wpseo')));
  127. }
  128. function admin_footer($title, $submit = true) {
  129. if ($submit) {
  130. ?>
  131. <div class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e("Save ".$title." Settings", 'yoast-wpseo'); ?>" /></div>
  132. <?php } ?>
  133. </form>
  134. </div>
  135. </div>
  136. </div>
  137. <?php $this->admin_sidebar(); ?>
  138. </div>
  139. <?php
  140. }
  141. function replace_meta($old_metakey, $new_metakey, $replace = false) {
  142. global $wpdb;
  143. $oldies = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE meta_key = '$old_metakey'");
  144. foreach ($oldies as $old) {
  145. // Prevent inserting new meta values for posts that already have a value for that new meta key
  146. $check = $wpdb->get_var("SELECT count(*) FROM $wpdb->postmeta WHERE meta_key = '$new_metakey' AND post_id = ".$old->post_id);
  147. if ($check == 0)
  148. $wpdb->query("INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES (".$old->post_id.",'".$new_metakey."','".addslashes($old->meta_value)."')");
  149. }
  150. if ($replace) {
  151. $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '$old_metakey'");
  152. }
  153. }
  154. function delete_meta($metakey) {
  155. global $wpdb;
  156. $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '$metakey'");
  157. }
  158. function grant_access() {
  159. if ( !function_exists('is_multisite') || !is_multisite() )
  160. return true;
  161. $options = get_site_option('wpseo_ms');
  162. if ( !is_array( $options ) || !isset( $options['access'] ) )
  163. return true;
  164. if ( $options['access'] == 'superadmin' && !is_super_admin() )
  165. return false;
  166. return true;
  167. }
  168. function network_config_page() {
  169. $options = get_site_option('wpseo_ms');
  170. if ( isset( $_POST['wpseo_submit'] ) ) {
  171. foreach ( array('access', 'defaultblog') as $opt ) {
  172. $options[$opt] = $_POST['wpseo_ms'][$opt];
  173. }
  174. update_site_option('wpseo_ms', $options);
  175. echo '<div id="message" class="updated">'.__('Settings Updated.').'</div>';
  176. }
  177. if ( isset( $_POST['wpseo_restore_blog'] ) ) {
  178. if ( isset( $_POST['wpseo_ms']['restoreblog'] ) && is_numeric( $_POST['wpseo_ms']['restoreblog'] ) ) {
  179. $blog = get_blog_details( $_POST['wpseo_ms']['restoreblog'] );
  180. if ( $blog ) {
  181. foreach ( get_wpseo_options_arr() as $option ) {
  182. $new_options = get_blog_option( $options['defaultblog'], $option );
  183. if ( count($new_options) > 0 )
  184. update_blog_option( $_POST['wpseo_ms']['restoreblog'], $option, $new_options );
  185. }
  186. echo '<div id="message" class="updated"><p>'.$blog->blogname.' '.__('restored to default SEO settings.').'</p></div>';
  187. }
  188. }
  189. }
  190. $this->admin_header('MultiSite Settings', false, false);
  191. $content = '<form method="post">';
  192. $content .= $this->select('access',__('Who should have access to the WordPress SEO settings'),
  193. array(
  194. 'admin' => 'Site Admins (default)',
  195. 'superadmin' => 'Super Admins only'
  196. ), 'wpseo_ms'
  197. );
  198. $content .= $this->textinput('defaultblog',__('New blogs get the SEO settings from this blog'),'wpseo_ms');
  199. $content .= '<p>'.__('Enter the Blog ID for the site whose settings you want to use as default for all sites that are added to your network. Leave empty for none.').'</p>';
  200. $content .= '<input type="submit" name="wpseo_submit" class="button-primary" value="'.__('Save MultiSite Settings').'"/>';
  201. $content .= '</form>';
  202. $this->postbox('wpseo_export',__('MultiSite Settings', 'yoast-wpseo'),$content);
  203. $content = '<form method="post">';
  204. $content .= '<p>'.__( 'Using this form you can reset a site to the default SEO settings.' ).'</p>';
  205. $content .= $this->textinput( 'restoreblog', __('Blog ID'), 'wpseo_ms' );
  206. $content .= '<input type="submit" name="wpseo_restore_blog" value="'.__('Restore site to defaults').'" class="button"/>';
  207. $content .= '</form>';
  208. $this->postbox('wpseo_export',__('Restore site to default settings', 'yoast-wpseo'),$content);
  209. $this->admin_footer('Restore to Default', false);
  210. }
  211. function import_page() {
  212. $msg = '';
  213. if ( isset($_POST['import']) ) {
  214. global $wpdb;
  215. $msg = '';
  216. $replace = false;
  217. $deletekw = false;
  218. if (isset($_POST['wpseo']['deleteolddata']) && $_POST['wpseo']['deleteolddata'] == 'on') {
  219. $replace = true;
  220. }
  221. if ( isset($_POST['wpseo']['importheadspace']) ) {
  222. $this->replace_meta('_headspace_description', '_yoast_wpseo_metadesc', $replace);
  223. $this->replace_meta('_headspace_keywords', '_yoast_wpseo_metakeywords', $replace);
  224. $this->replace_meta('_headspace_page_title', '_yoast_wpseo_title', $replace);
  225. $this->replace_meta('_headspace_noindex', '_yoast_wpseo_meta-robots-noindex', $replace);
  226. $this->replace_meta('_headspace_nofollow', '_yoast_wpseo_meta-robots-nofollow', $replace);
  227. $posts = $wpdb->get_results("SELECT ID FROM $wpdb->posts");
  228. foreach ($posts as $post) {
  229. $custom = get_post_custom($post->ID);
  230. $robotsmeta_adv = '';
  231. if (isset($custom['_headspace_noarchive'])) {
  232. $robotsmeta_adv .= 'noarchive,';
  233. }
  234. if (isset($custom['_headspace_noodp'])) {
  235. $robotsmeta_adv .= 'noodp,';
  236. }
  237. if (isset($custom['_headspace_noydir'])) {
  238. $robotsmeta_adv .= 'noydir';
  239. }
  240. $robotsmeta_adv = preg_replace('/,$/','',$robotsmeta_adv);
  241. wpseo_set_value('meta-robots-adv', $robotsmeta_adv, $post->ID);
  242. if ($replace) {
  243. foreach (array('noindex','nofollow','noarchive','noodp','noydir') as $meta) {
  244. delete_post_meta($post->ID, '_headspace_'.$meta);
  245. }
  246. }
  247. }
  248. $msg .= '<p>HeadSpace2 data successfully imported.</p>';
  249. }
  250. if ( isset($_POST['wpseo']['importaioseo']) ) {
  251. $this->replace_meta('_aioseop_description', '_yoast_wpseo_metadesc', $replace);
  252. $this->replace_meta('_aioseop_keywords', '_yoast_wpseo_metakeywords', $replace);
  253. $this->replace_meta('_aioseop_title', '_yoast_wpseo_title', $replace);
  254. $msg .= '<p>All in One SEO data successfully imported.</p>';
  255. }
  256. if ( isset($_POST['wpseo']['importaioseoold']) ) {
  257. $this->replace_meta('description', '_yoast_wpseo_metadesc', $replace);
  258. $this->replace_meta('keywords', '_yoast_wpseo_metakeywords', $replace);
  259. $this->replace_meta('title', '_yoast_wpseo_title', $replace);
  260. $msg .= '<p>'.__('All in One SEO (Old version) data successfully imported.').'</p>';
  261. }
  262. if ( isset($_POST['wpseo']['importrobotsmeta']) ) {
  263. $posts = $wpdb->get_results("SELECT ID, robotsmeta FROM $wpdb->posts");
  264. foreach ($posts as $post) {
  265. if ( strpos($post->robotsmeta, 'noindex') !== false )
  266. wpseo_set_value('meta-robots-noindex', true, $post->ID);
  267. if ( strpos($post->robotsmeta, 'nofollow') !== false )
  268. wpseo_set_value('meta-robots-nofollow', true, $post->ID);
  269. }
  270. $msg .= '<p>'.__('Robots Meta values imported.').'</p>';
  271. }
  272. if ( isset($_POST['wpseo']['importrssfooter']) ) {
  273. $optold = get_option( 'RSSFooterOptions' );
  274. $optnew = get_option( 'wpseo_rss' );
  275. if ($optold['position'] == 'after') {
  276. if ( empty($optnew['rssafter']) )
  277. $optnew['rssafter'] = $optold['footerstring'];
  278. } else {
  279. if ( empty($optnew['rssbefore']) )
  280. $optnew['rssbefore'] = $optold['footerstring'];
  281. }
  282. update_option( 'wpseo_rss', $optnew );
  283. $msg .= '<p>'.__('RSS Footer options imported successfully.').'</p>';
  284. }
  285. if ( isset($_POST['wpseo']['importbreadcrumbs']) ) {
  286. $optold = get_option( 'yoast_breadcrumbs' );
  287. $optnew = get_option( 'wpseo_internallinks' );
  288. if (is_array($optold)) {
  289. foreach ($optold as $opt => $val) {
  290. if (is_bool($val) && $val == true)
  291. $optnew['breadcrumbs-'.$opt] = 'on';
  292. else
  293. $optnew['breadcrumbs-'.$opt] = $val;
  294. }
  295. update_option( 'wpseo_internallinks', $optnew );
  296. $msg .= '<p>'.__('Yoast Breadcrumbs options imported successfully.').'</p>';
  297. } else {
  298. $msg .= '<p>'.__('Yoast Breadcrumbs options could not be found').'</p>';
  299. }
  300. }
  301. if ($replace)
  302. $msg .= __(', and old data deleted');
  303. if ($deletekw)
  304. $msg .= __(', and meta keywords data deleted');
  305. }
  306. $this->admin_header('Import', false, false);
  307. if ($msg != '')
  308. echo '<div id="message" class="message updated" style="width:94%;">'.$msg.'</div>';
  309. $content = "<p>".__("No doubt you've used an SEO plugin before if this site isn't new. Let's make it easy on you, you can import the data below. If you want, you can import first, check if it was imported correctly, and then import &amp; delete. No duplicate data will be imported.")."</p>";
  310. $content .= '<p>'.__("If you've used another SEO plugin, try the <a href='http://wordpress.org/extend/plugins/seo-data-transporter/'>SEO Data Transporter</a> plugin to move your data into this plugin, it rocks!").'</p>';
  311. $content .= '<form action="" method="post">';
  312. $content .= $this->checkbox('importheadspace',__('Import from HeadSpace2?','yoast-wpseo'));
  313. $content .= $this->checkbox('importaioseo',__('Import from All-in-One SEO?','yoast-wpseo'));
  314. $content .= $this->checkbox('importaioseoold',__('Import from OLD All-in-One SEO?','yoast-wpseo'));
  315. $content .= '<br/>';
  316. $content .= $this->checkbox('deleteolddata',__('Delete the old data after import? (recommended)','yoast-wpseo'));
  317. $content .= '<input type="submit" class="button-primary" name="import" value="Import" />';
  318. $content .= '<br/><br/>';
  319. $content .= '<form action="" method="post">';
  320. $content .= '<h2>Import settings from other plugins</h2>';
  321. $content .= $this->checkbox('importrobotsmeta',__('Import from Robots Meta (by Yoast)?','yoast-wpseo'));
  322. $content .= $this->checkbox('importrssfooter',__('Import from RSS Footer (by Yoast)?','yoast-wpseo'));
  323. $content .= $this->checkbox('importbreadcrumbs',__('Import from Yoast Breadcrumbs?','yoast-wpseo'));
  324. $content .= '<input type="submit" class="button-primary" name="import" value="Import" />';
  325. $content .= '</form>';
  326. $this->postbox('import',__('Import', 'yoast-wpseo'),$content);
  327. do_action('wpseo_import', $this);
  328. $content = '</form>';
  329. $content .= '<strong>Export</strong><br/>';
  330. $content .= '<form method="post">';
  331. $content .= '<p>'.__('Export your WordPress SEO settings here, to import them again later or to import them on another site.').'</p>';
  332. if ( phpversion() > 5.2 )
  333. $content .= $this->checkbox('include_taxonomy_meta', __('Include Taxonomy Metadata'));
  334. $content .= '<input type="submit" class="button" name="wpseo_export" value="'.__('Export settings').'"/>';
  335. $content .= '</form>';
  336. if ( isset($_POST['wpseo_export']) ) {
  337. $include_taxonomy = false;
  338. if ( isset($_POST['wpseo']['include_taxonomy_meta']) )
  339. $include_taxonomy = true;
  340. $url = wpseo_export_settings( $include_taxonomy );
  341. if ($url) {
  342. $content .= '<script type="text/javascript">
  343. document.location = \''.$url.'\';
  344. </script>';
  345. } else {
  346. $content .= 'Error: '.$url;
  347. }
  348. }
  349. $content .= '<br class="clear"/><br/><strong>Import</strong><br/>';
  350. if ( !isset($_FILES['settings_import_file']) || empty($_FILES['settings_import_file']) ) {
  351. $content .= '<p>'.__('Import settings by locating <em>settings.zip</em> and clicking').' "'.__('Import settings').'":</p>';
  352. $content .= '<form method="post" enctype="multipart/form-data">';
  353. $content .= '<input type="file" name="settings_import_file"/>';
  354. $content .= '<input type="hidden" name="action" value="wp_handle_upload"/>';
  355. $content .= '<input type="submit" class="button" value="'.__('Import settings').'"/>';
  356. $content .= '</form>';
  357. } else {
  358. $file = wp_handle_upload($_FILES['settings_import_file']);
  359. if ( isset( $file['file'] ) && !is_wp_error($file) ) {
  360. require_once (ABSPATH . 'wp-admin/includes/class-pclzip.php');
  361. $zip = new PclZip( $file['file'] );
  362. $unzipped = $zip->extract( $p_path = WP_CONTENT_DIR.'/wpseo-import/' );
  363. if ( $unzipped[0]['stored_filename'] == 'settings.ini' ) {
  364. $options = parse_ini_file( WP_CONTENT_DIR.'/wpseo-import/settings.ini', true );
  365. foreach ($options as $name => $optgroup) {
  366. if ($name != 'wpseo_taxonomy_meta') {
  367. update_option($name, $optgroup);
  368. } else {
  369. update_option($name, json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ) );
  370. }
  371. }
  372. @unlink( WP_CONTENT_DIR.'/wpseo-import/' );
  373. $content .= '<p><strong>'.__('Settings successfully imported.').'</strong></p>';
  374. } else {
  375. $content .= '<p><strong>'.__('Settings could not be imported:').' '.__('Unzipping failed.').'</strong></p>';
  376. }
  377. } else {
  378. if ( is_wp_error($file) )
  379. $content .= '<p><strong>'.__('Settings could not be imported:').' '.$file['error'].'</strong></p>';
  380. else
  381. $content .= '<p><strong>'.__('Settings could not be imported:').' '.__('Upload failed.').'</strong></p>';
  382. }
  383. }
  384. $this->postbox('wpseo_export',__('Export & Import SEO Settings', 'yoast-wpseo'),$content);
  385. $this->admin_footer('Import', false);
  386. }
  387. function titles_page() {
  388. $this->admin_header(__('Titles'), false, true, 'yoast_wpseo_titles_options', 'wpseo_titles');
  389. $options = get_wpseo_options();
  390. $content = '<p>'.__('Be aware that for WordPress SEO to be able to modify your page titles, the title section of your header.php file should look like this:').'</p>';
  391. $content .= '<pre>&lt;title&gt;&lt;?php wp_title(&#x27;&#x27;); ?&gt;&lt;/title&gt;</pre>';
  392. $content .= '<p>'.__('If you can\'t modify or don\'t know how to modify your template, check the box below. Be aware that changing your template will be faster.').'</p>';
  393. $content .= $this->checkbox('forcerewritetitle',__('Force rewrite titles','yoast-wpseo'));
  394. $content .= '<h4 class="big">'.__('Singular pages').'</h4>';
  395. $content .= '<p>'.__("For some pages, like the homepage, you'll want to set a fixed title in some occasions. For others, you can define a template here.").'</p>';
  396. if ( 'page' != get_option('show_on_front') ) {
  397. $content .= '<h4>'.__('Homepage').'</h4>';
  398. $content .= $this->textinput('title-home',__('Title template'));
  399. $content .= $this->textarea('metadesc-home',__('Meta description template'), '', 'metadesc');
  400. if ( isset($options['usemetakeywords']) && $options['usemetakeywords'] )
  401. $content .= $this->textinput('metakey-home',__('Meta keywords template'));
  402. } else {
  403. $content .= '<h4>'.__('Homepage &amp; Front page').'</h4>';
  404. $content .= '<p>'.__('You can determine the title and description for the front page by').' <a href="'.get_edit_post_link( get_option('page_on_front') ).'">'.__('editing the front page itself').' &raquo;</a>.</p>';
  405. if ( is_numeric( get_option('page_for_posts') ) )
  406. $content .= '<p>'.__('You can determine the title and description for the blog page by').' <a href="'.get_edit_post_link( get_option('page_for_posts') ).'">'.__('editing the blog page itself').' &raquo;</a>.</p>';
  407. }
  408. foreach (get_post_types() as $posttype) {
  409. if ( in_array($posttype, array('revision','nav_menu_item') ) )
  410. continue;
  411. if (isset($options['redirectattachment']) && $options['redirectattachment'] && $posttype == 'attachment')
  412. continue;
  413. $content .= '<h4 id="'.$posttype.'">'.ucfirst($posttype).'</h4>';
  414. $content .= $this->textinput('title-'.$posttype,__('Title template'));
  415. $content .= $this->textarea('metadesc-'.$posttype,__('Meta description template'), '', 'metadesc');
  416. if ( isset($options['usemetakeywords']) && $options['usemetakeywords'] )
  417. $content .= $this->textinput('metakey-'.$posttype,__('Meta keywords template'));
  418. $content .= '<br/>';
  419. }
  420. $content .= '<br/>';
  421. $content .= '<h4 class="big">'.__('Taxonomies').'</h4>';
  422. foreach (get_taxonomies() as $taxonomy) {
  423. if ( in_array($taxonomy, array('link_category','nav_menu','post_format') ) )
  424. continue;
  425. $content .= '<h4>'.ucfirst($taxonomy).'</h4>';
  426. $content .= $this->textinput('title-'.$taxonomy,__('Title template'));
  427. $content .= $this->textarea('metadesc-'.$taxonomy,__('Meta description template'), '', 'metadesc' );
  428. if ( isset($options['usemetakeywords']) && $options['usemetakeywords'] )
  429. $content .= $this->textinput('metakey-'.$taxonomy,__('Meta keywords template'));
  430. $content .= '<br/>';
  431. }
  432. $content .= '<br/>';
  433. $content .= '<h4 class="big">'.__('Special pages').'</h4>';
  434. $content .= '<h4>'.__('Author Archives').'</h4>';
  435. $content .= $this->textinput('title-author',__('Title template'));
  436. $content .= $this->textarea('metadesc-author',__('Meta description template'), '', 'metadesc' );
  437. if ( isset($options['usemetakeywords']) && $options['usemetakeywords'] )
  438. $content .= $this->textinput('metakey-author',__('Meta keywords template'));
  439. $content .= '<br/>';
  440. $content .= '<h4>'.__('Date Archives').'</h4>';
  441. $content .= $this->textinput('title-archive',__('Title template'));
  442. $content .= $this->textarea('metadesc-archive',__('Meta description template'), '', 'metadesc' );
  443. $content .= '<br/>';
  444. $content .= '<h4>'.__('Search pages').'</h4>';
  445. $content .= $this->textinput('title-search','Title template');
  446. $content .= '<h4>'.__('404 pages').'</h4>';
  447. $content .= $this->textinput('title-404',__('Title template'));
  448. $content .= '<br class="clear"/>';
  449. $i = 1;
  450. foreach ( get_post_types() as $post_type ) {
  451. if ( in_array($post_type, array('post','page','attachment','revision','nav_menu_item') ) )
  452. continue;
  453. $pt = get_post_type_object($post_type);
  454. if ( !$pt->has_archive )
  455. continue;
  456. if ( $i == 1 ) {
  457. $content .= '<h4 class="big">'.__('Custom Post Type Archives').'</h4>';
  458. $content .= '<p>'.__('Note: instead of templates these are the actual titles and meta descriptions for these custom post type archive pages.').'</p>';
  459. }
  460. $content .= '<h4>'.$pt->labels->name.'</h4>';
  461. $content .= $this->textinput( 'title-ptarchive-' . $post_type, __('Title') );
  462. $content .= $this->textarea( 'metadesc-ptarchive-' . $post_type, __('Meta description'), '', 'metadesc' );
  463. if ( isset($options['breadcrumbs-enable']) && $options['breadcrumbs-enable'] )
  464. $content .= $this->textinput( 'bctitle-ptarchive-' . $post_type, __('Breadcrumbs Title') );
  465. $i++;
  466. }
  467. unset($i, $pt, $post_type);
  468. $this->postbox('titles',__('Title Settings', 'yoast-wpseo'), $content);
  469. $content = '
  470. <p>These tags can be included and will be replaced by Yoast WordPress SEO when a page is displayed. For convenience sake, they\'re the same as HeadSpace2 uses.</p>
  471. <table class="yoast_help">
  472. <tr>
  473. <th>%%date%%</th>
  474. <td>Replaced with the date of the post/page</td>
  475. </tr>
  476. <tr class="alt">
  477. <th>%%title%%</th>
  478. <td>Replaced with the title of the post/page</td>
  479. </tr>
  480. <tr>
  481. <th>%%sitename%%</th>
  482. <td>The site\'s name</td>
  483. </tr>
  484. <tr class="alt">
  485. <th>%%sitedesc%%</th>
  486. <td>The site\'s tagline / description</td>
  487. </tr>
  488. <tr>
  489. <th>%%excerpt%%</th>
  490. <td>Replaced with the post/page excerpt (or auto-generated if it does not exist)</td>
  491. </tr>
  492. <tr class="alt">
  493. <th>%%excerpt_only%%</th>
  494. <td>Replaced with the post/page excerpt (without auto-generation)</td>
  495. </tr>
  496. <tr>
  497. <th>%%tag%%</th>
  498. <td>Replaced with the current tag/tags</td>
  499. </tr>
  500. <tr class="alt">
  501. <th>%%category%%</th>
  502. <td>Replaced with the post categories (comma separated)</td>
  503. </tr>
  504. <tr>
  505. <th>%%category_description%%</th>
  506. <td>Replaced with the category description</td>
  507. </tr>
  508. <tr class="alt">
  509. <th>%%tag_description%%</th>
  510. <td>Replaced with the tag description</td>
  511. </tr>
  512. <tr>
  513. <th>%%term_description%%</th>
  514. <td>Replaced with the term description</td>
  515. </tr>
  516. <tr class="alt">
  517. <th>%%term_title%%</th>
  518. <td>Replaced with the term name</td>
  519. </tr>
  520. <tr>
  521. <th>%%modified%%</th>
  522. <td>Replaced with the post/page modified time</td>
  523. </tr>
  524. <tr class="alt">
  525. <th>%%id%%</th>
  526. <td>Replaced with the post/page ID</td>
  527. </tr>
  528. <tr>
  529. <th>%%name%%</th>
  530. <td>Replaced with the post/page author\'s \'nicename\'</td>
  531. </tr>
  532. <tr class="alt">
  533. <th>%%userid%%</th>
  534. <td>Replaced with the post/page author\'s userid</td>
  535. </tr>
  536. <tr>
  537. <th>%%searchphrase%%</th>
  538. <td>Replaced with the current search phrase</td>
  539. </tr>
  540. <tr class="alt">
  541. <th>%%currenttime%%</th>
  542. <td>Replaced with the current time</td>
  543. </tr>
  544. <tr>
  545. <th>%%currentdate%%</th>
  546. <td>Replaced with the current date</td>
  547. </tr>
  548. <tr class="alt">
  549. <th>%%currentmonth%%</th>
  550. <td>Replaced with the current month</td>
  551. </tr>
  552. <tr>
  553. <th>%%currentyear%%</th>
  554. <td>Replaced with the current year</td>
  555. </tr>
  556. <tr class="alt">
  557. <th>%%page%%</th>
  558. <td>Replaced with the current page number (i.e. page 2 of 4)</td>
  559. </tr>
  560. <tr>
  561. <th>%%pagetotal%%</th>
  562. <td>Replaced with the current page total</td>
  563. </tr>
  564. <tr class="alt">
  565. <th>%%pagenumber%%</th>
  566. <td>Replaced with the current page number</td>
  567. </tr>
  568. <tr>
  569. <th>%%caption%%</th>
  570. <td>Attachment caption</td>
  571. </tr>
  572. <tr class="alt">
  573. <th>%%focuskw%%</th>
  574. <td>Replaced with the posts focus keyword</td>
  575. </tr>
  576. </table>';
  577. $this->postbox('titleshelp',__('Help on Title Settings', 'yoast-wpseo'), $content);
  578. $this->admin_footer('Titles');
  579. }
  580. function settings_advice_page() {
  581. $this->admin_header('Settings Advice', false, true, 'yoast_wpseo_advice_options', 'wpseo_advice');
  582. }
  583. function permalinks_page() {
  584. if ( isset( $_GET['settings-updated'] ) ) {
  585. delete_option('rewrite_rules');
  586. }
  587. $this->admin_header('Permalinks', true, true, 'yoast_wpseo_permalinks_options', 'wpseo_permalinks');
  588. $content = $this->checkbox('stripcategorybase',__('Strip the category base (usually <code>/category/</code>) from the category URL.'));
  589. $content .= $this->checkbox('trailingslash',__('Enforce a trailing slash on all category and tag URL\'s'));
  590. $content .= '<p class="desc">'.__('If you choose a permalink for your posts with <code>.html</code>, or anything else but a / on the end, this will force WordPress to add a trailing slash to non-post pages nonetheless.', 'yoast-wpseo').'</p>';
  591. $content .= $this->checkbox('redirectattachment',__('Redirect attachment URL\'s to parent post URL.'));
  592. $content .= '<p class="desc">'.__('Attachments to posts are stored in the database as posts, this means they\'re accessible under their own URL\'s if you do not redirect them, enabling this will redirect them to the post they were attached to.', 'yoast-wpseo').'</p>';
  593. $content .= $this->checkbox('cleanpermalinks',__('Redirect ugly URL\'s to clean permalinks. (Not recommended in many cases!)'));
  594. $content .= '<p class="desc">'.__('People make mistakes in their links towards you sometimes, or unwanted parameters are added to the end of your URLs, this allows you to redirect them all away. Please note that while this is a feature that is actively maintained, it is known to break several plugins, and should for that reason be the first feature you disable when you encounter issues after installing this plugin.', 'yoast-wpseo').'</p>';
  595. $this->postbox('permalinks',__('Permalink Settings', 'yoast-wpseo'),$content);
  596. $content = $this->select('force_transport', 'Force Transport', array('default' => 'Leave default', 'http' => 'Force http', 'https' => 'Force https'));
  597. $content .= '<p class="desc">'.__('Force the canonical to either http or https, when your blog runs under both.', 'yoast-wpseo').'</p>';
  598. $this->postbox('canonical',__('Canonical Settings', 'yoast-wpseo'),$content);
  599. $content = $this->checkbox('cleanpermalink-googlesitesearch',__('Prevent cleaning out Google Site Search URL\'s.'));
  600. $content .= '<p class="desc">'.__('Google Site Search URL\'s look weird, and ugly, but if you\'re using Google Site Search, you probably do not want them cleaned out.', 'yoast-wpseo').'</p>';
  601. $content .= $this->checkbox('cleanpermalink-googlecampaign',__('Prevent cleaning out Google Analytics Campaign Parameters.'));
  602. $content .= '<p class="desc">'.__('If you use Google Analytics campaign parameters starting with <code>?utm_</code>, check this box. You shouldn\'t use these btw, you should instead use the hash tagged version instead.', 'yoast-wpseo').'</p>';
  603. $content .= $this->textinput('cleanpermalink-extravars',__('Other variables not to clean'));
  604. $content .= '<p class="desc">'.__('You might have extra variables you want to prevent from cleaning out, add them here, comma separarted.', 'yoast-wpseo').'</p>';
  605. $this->postbox('cleanpermalinksdiv',__('Clean Permalink Settings', 'yoast-wpseo'),$content);
  606. $this->admin_footer('Permalinks');
  607. }
  608. function internallinks_page() {
  609. $this->admin_header(__('Internal Links'), false, true, 'yoast_wpseo_internallinks_options', 'wpseo_internallinks');
  610. $content = $this->checkbox('breadcrumbs-enable',__('Enable Breadcrumbs'));
  611. $content .= '<br/>';
  612. $content .= $this->textinput('breadcrumbs-sep',__('Separator between breadcrumbs'));
  613. $content .= $this->textinput('breadcrumbs-home',__('Anchor text for the Homepage'));
  614. $content .= $this->textinput('breadcrumbs-prefix',__('Prefix for the breadcrumb path'));
  615. $content .= $this->textinput('breadcrumbs-archiveprefix',__('Prefix for Archive breadcrumbs'));
  616. $content .= $this->textinput('breadcrumbs-searchprefix',__('Prefix for Search Page breadcrumbs'));
  617. $content .= $this->textinput('breadcrumbs-404crumb',__('Breadcrumb for 404 Page'));
  618. $content .= $this->checkbox('breadcrumbs-blog-remove',__('Remove Blog page from Breadcrumbs'));
  619. $content .= '<br/><br/>';
  620. $content .= '<strong>'.__('Taxonomy to show in breadcrumbs for:').'</strong><br/>';
  621. foreach (get_post_types() as $pt) {
  622. if (in_array($pt, array('revision', 'attachment', 'nav_menu_item')))
  623. continue;
  624. $taxonomies = get_object_taxonomies($pt);
  625. if (count($taxonomies) > 0) {
  626. $values = array(0 => 'None');
  627. foreach (get_object_taxonomies($pt) as $tax) {
  628. $taxobj = get_taxonomy($tax);
  629. $values[$tax] = $taxobj->labels->singular_name;
  630. }
  631. $ptobj = get_post_type_object($pt);
  632. $content .= $this->select('post_types-'.$pt.'-maintax', $ptobj->labels->name, $values);
  633. }
  634. }
  635. $content .= '<br/>';
  636. $content .= '<strong>'.__('Post type archive to show in breadcrumbs for:').'</strong><br/>';
  637. foreach (get_taxonomies() as $taxonomy) {
  638. if ( !in_array( $taxonomy, array('nav_menu','link_category','post_format', 'category', 'post_tag') ) ) {
  639. $tax = get_taxonomy($taxonomy);
  640. $values = array( '' => 'None' );
  641. if ( get_option('show_on_front') == 'page' )
  642. $values['post'] = 'Blog';
  643. foreach (get_post_types() as $pt) {
  644. if (in_array($pt, array('revision', 'attachment', 'nav_menu_item')))
  645. continue;
  646. $ptobj = get_post_type_object($pt);
  647. if ($ptobj->has_archive)
  648. $values[$pt] = $ptobj->labels->name;
  649. }
  650. $content .= $this->select('taxonomy-'.$taxonomy.'-ptparent', $tax->labels->singular_name, $values);
  651. }
  652. }
  653. $content .= $this->checkbox('breadcrumbs-boldlast',__('Bold the last page in the breadcrumb'));
  654. $content .= $this->checkbox('breadcrumbs-trytheme',__('Try to add automatically'));
  655. $content .= '<p class="desc">'.__('If you\'re using Hybrid, Thesis or Thematic, check this box for some lovely simple action').'.</p>';
  656. $content .= '<br class="clear"/>';
  657. $content .= '<h4>'.__('How to insert breadcrumbs in your theme').'</h4>';
  658. $content .= '<p>'.__('Usage of this breadcrumbs feature is explained <a href="http://yoast.com/wordpress/breadcrumbs/">here</a>. For the more code savvy, insert this in your theme:').'</p>';
  659. $content .= '<pre>&lt;?php if ( function_exists(&#x27;yoast_breadcrumb&#x27;) ) {
  660. yoast_breadcrumb(&#x27;&lt;p id=&quot;breadcrumbs&quot;&gt;&#x27;,&#x27;&lt;/p&gt;&#x27;);
  661. } ?&gt;</pre>';
  662. $this->postbox('internallinks',__('Breadcrumbs Settings', 'yoast-wpseo'),$content);
  663. $this->admin_footer('Internal Links');
  664. }
  665. function files_page() {
  666. if ( isset($_POST['submitrobots']) ) {
  667. if (!current_user_can('manage_options')) die(__('You cannot edit the robots.txt file.', 'yoast-wpseo'));
  668. check_admin_referer('wpseo-robotstxt');
  669. if (file_exists( get_home_path()."robots.txt") ) {
  670. $robots_file = get_home_path()."robots.txt";
  671. $robotsnew = stripslashes($_POST['robotsnew']);
  672. if (is_writable($robots_file)) {
  673. $f = fopen($robots_file, 'w+');
  674. fwrite($f, $robotsnew);
  675. fclose($f);
  676. $msg = 'Updated Robots.txt';
  677. }
  678. }
  679. }
  680. if ( isset($_POST['submithtaccess']) ) {
  681. if (!current_user_can('manage_options')) die(__('You cannot edit the .htaccess file.', 'yoast-wpseo'));
  682. check_admin_referer('wpseo-htaccess');
  683. if (file_exists( get_home_path().".htaccess" ) ) {
  684. $htaccess_file = get_home_path().".htaccess";
  685. $htaccessnew = stripslashes($_POST['htaccessnew']);
  686. if (is_writeable($htaccess_file)) {
  687. $f = fopen($htaccess_file, 'w+');
  688. fwrite($f, $htaccessnew);
  689. fclose($f);
  690. }
  691. }
  692. }
  693. if ( isset($_POST['submitcachehtaccess']) ) {
  694. if (!current_user_can('manage_options')) die(__('You cannot edit the .htaccess file.', 'yoast-wpseo'));
  695. check_admin_referer('wpseo-htaccess-cache');
  696. if (file_exists(WP_CONTENT_DIR."/cache/.htaccess")) {
  697. $htaccess_file = WP_CONTENT_DIR."/cache/.htaccess";
  698. $htaccessnew = stripslashes($_POST['cachehtaccessnew']);
  699. if (is_writeable($htaccess_file)) {
  700. $f = fopen($htaccess_file, 'w+');
  701. fwrite($f, $htaccessnew);
  702. fclose($f);
  703. }
  704. }
  705. }
  706. $this->admin_header('Files', false, false);
  707. if (isset($msg) && !empty($msg)) {
  708. echo '<div id="message" style="width:94%;" class="updated fade"><p>'.$msg.'</p></div>';
  709. }
  710. if (file_exists( get_home_path()."robots.txt")) {
  711. $robots_file = get_home_path()."robots.txt";
  712. $f = fopen($robots_file, 'r');
  713. if (filesize($robots_file) > 0)
  714. $content = fread($f, filesize($robots_file));
  715. else
  716. $content = '';
  717. $robotstxtcontent = htmlspecialchars($content);
  718. if (!is_writable($robots_file)) {
  719. $content = "<p><em>".__("If your robots.txt were writable, you could edit it from here.", 'yoast-wpseo')."</em></p>";
  720. $content .= '<textarea disabled="disabled" style="width: 90%;" rows="15" name="robotsnew">'.$robotstxtcontent.'</textarea><br/>';
  721. } else {
  722. $content = '<form action="" method="post" id="robotstxtform">';
  723. $content .= wp_nonce_field('wpseo-robotstxt', '_wpnonce', true, false);
  724. $content .= "<p>".__("Edit the content of your robots.txt:", 'yoast-wpseo')."</p>";
  725. $content .= '<textarea style="width: 90%;" rows="15" name="robotsnew">'.$robotstxtcontent.'</textarea><br/>';
  726. $content .= '<div class="submit"><input class="button" type="submit" name="submitrobots" value="'.__("Save changes to Robots.txt", 'yoast-wpseo').'" /></div>';
  727. $content .= '</form>';
  728. }
  729. $this->postbox('robotstxt',__('Robots.txt', 'yoast-wpseo'),$content);
  730. }
  731. if (file_exists( get_home_path().".htaccess" )) {
  732. $htaccess_file = get_home_path()."/.htaccess";
  733. $f = fopen($htaccess_file, 'r');
  734. $contentht = fread($f, filesize($htaccess_file));
  735. $contentht = htmlspecialchars($contentht);
  736. if (!is_writable($htaccess_file)) {
  737. $content = "<p><em>".__("If your .htaccess were writable, you could edit it from here.", 'yoast-wpseo')."</em></p>";
  738. $content .= '<textarea disabled="disabled" style="width: 90%;" rows="15" name="robotsnew">'.$contentht.'</textarea><br/>';
  739. } else {
  740. $content = '<form action="" method="post" id="htaccessform">';
  741. $content .= wp_nonce_field('wpseo-htaccess', '_wpnonce', true, false);
  742. $content .= "<p>Edit the content of your .htaccess:</p>";
  743. $content .= '<textarea style="width: 90%;" rows="15" name="htaccessnew">'.$contentht.'</textarea><br/>';
  744. $content .= '<div class="submit"><input class="button" type="submit" name="submithtaccess" value="'.__('Save changes to .htaccess', 'yoast-wpseo').'" /></div>';
  745. $content .= '</form>';
  746. }
  747. $this->postbox('htaccess',__('.htaccess file', 'yoast-wpseo'),$content);
  748. }
  749. if (is_plugin_active('wp-super-cache/wp-cache.php')) {
  750. $cachehtaccess = WP_CONTENT_DIR.'/cache/.htaccess';
  751. $f = fopen($cachehtaccess, 'r');
  752. $cacheht = fread($f, filesize($cachehtaccess));
  753. $cacheht = htmlspecialchars($cacheht);
  754. if (!is_writable($cachehtaccess)) {
  755. $content = "<p><em>".__("If your", 'yoast-wpseo')." ".WP_CONTENT_DIR."/cache/.htaccess ".__("were writable, you could edit it from here.", 'yoast-wpseo')."</em></p>";
  756. $content .= '<textarea disabled="disabled" style="width: 90%;" rows="15" name="robotsnew">'.$cacheht.'</textarea><br/>';
  757. } else {
  758. $content = '<form action="" method="post" id="htaccessform">';
  759. $content .= wp_nonce_field('wpseo-htaccess-cache', '_wpnonce', true, false);
  760. $content .= "<p>".__("Edit the content of your cache directory's .htaccess:", 'yoast-wpseo')."</p>";
  761. $content .= '<textarea style="width: 90%;" rows="15" name="cachehtaccessnew">'.$cacheht.'</textarea><br/>';
  762. $content .= '<div class="submit"><input class="button" type="submit" name="submitcachehtaccess" value="'.__('Save changes to .htaccess', 'yoast-wpseo').'" /></div>';
  763. $content .= '</form>';
  764. }
  765. $this->postbox('cachehtaccess',__('wp-super-cache cache dir .htaccess file', 'yoast-wpseo'),$content);
  766. }
  767. $this->admin_footer('', false);
  768. }
  769. function indexation_page() {
  770. $this->admin_header('Indexation', true, true, 'yoast_wpseo_indexation_options', 'wpseo_indexation');
  771. $content = $this->checkbox('opengraph',__('Add OpenGraph meta data', 'yoast-wpseo') );
  772. $content .= '<p class="desc">'.__('Add OpenGraph meta data to your site\'s &lt;head&gt; section. You can specify some of the ID\'s that are sometimes needed below:', 'yoast-wpseo').'</p>';
  773. $content .= $this->textinput('fb_pageid', __('Facebook Page ID') );
  774. $content .= $this->textinput('fb_adminid', __('Facebook Admin ID') );
  775. $content .= '<p class="desc">'.__('Separate multiple admin ID\'s with comma\'s.', 'yoast-wpseo').'</p>';
  776. $content .= $this->textinput('fb_appid', __('Facebook App ID') );
  777. $this->postbox('opengraph',__('OpenGraph (Facebook)', 'yoast-wpseo'),$content);
  778. $content = '<p>'.__("Below you'll find checkboxes for each of the sections of your site that you might want to disallow the search engines from indexing. Be aware that this is a powerful tool, blocking category archives, for instance, really blocks all category archives from showing up in the index.").'</p>';
  779. $content .= $this->checkbox('noindexsubpages',__('Subpages of archives and taxonomies', 'yoast-wpseo') );
  780. $content .= '<p class="desc">'.__('Prevent the search engines from indexing (not from crawling and following the links) your taxonomies & archives subpages.', 'yoast-wpseo').'</p>';
  781. $content .= $this->checkbox('noindexauthor',__('Author archives', 'yoast-wpseo') );
  782. $content .= '<p class="desc">'.__('By default, WordPress creates author archives for each user, usually available under <code>/author/username</code>. If you have sufficient other archives, or yours is a one person blog, there\'s no need and you can best disable them or prevent search engines from indexing them.', 'yoast-wpseo').'</p>';
  783. $content .= $this->checkbox('noindexdate',__('Date-based archives', 'yoast-wpseo') );
  784. $content .= '<p class="desc">'.__('If you want to offer your users the option of crawling your site by date, but have ample other ways for the search engines to find the content on your site, I highly encourage you to prevent your date-based archives from being indexed.', 'yoast-wpseo').'</p>';
  785. $content .= $this->checkbox('noindexcat',__('Category archives', 'yoast-wpseo') );
  786. $content .= '<p class="desc">'.__('If you\'re using tags as your only way of structure on your site, you would probably be better off when you prevent your categories from being indexed.', 'yoast-wpseo').'</p>';
  787. $content .= $this->checkbox('noindextag',__('Tag archives', 'yoast-wpseo') );
  788. $content .= '<p class="desc">'.__('Read the categories explanation above for categories and switch the words category and tag around ;)', 'yoast-wpseo').'</p>';
  789. if ( current_theme_supports('post-formats') ) {
  790. $content .= $this->checkbox('noindexpostformat',__('Post Formats archives', 'yoast-wpseo') );
  791. $content .= '<p class="desc">'.__('Post formats have publicly queriable archives by default that should be disabled below or noindexed here.', 'yoast-wpseo').'</p>';
  792. }
  793. $this->postbox('preventindexing',__('Indexation Rules', 'yoast-wpseo'),$content);
  794. $content = $this->checkbox('nofollowmeta',__('Nofollow login and registration links', 'yoast-wpseo') );
  795. $content .= '<p class="desc">'.__('This might have happened to you: logging in to your admin panel to notice that it has become PR6... Nofollow those admin and login links, there\'s no use flowing PageRank to those pages!', 'yoast-wpseo').'</p>';
  796. $content .= $this->checkbox('nofollowcommentlinks',__('Nofollow comments links', 'yoast-wpseo') );
  797. $content .= '<p class="desc">'.__('Simple way to decrease the number of links on your pages: nofollow all the links pointing to comment sections.', 'yoast-wpseo').'</p>';
  798. $content .= $this->checkbox('replacemetawidget',__('Replace the Meta Widget with a nofollowed one', 'yoast-wpseo') );
  799. $content .= '<p class="desc">'.__('By default the Meta widget links to your RSS feeds and to WordPress.org with a follow link, this will replace that widget by a custom one in which all these links are nofollowed.', 'yoast-wpseo').'</p>';
  800. $this->postbox('internalnofollow',__('Internal nofollow settings', 'yoast-wpseo'),$content);
  801. $content = $this->checkbox('disableauthor',__('Disable the author archives', 'yoast-wpseo') );
  802. $content .= '<p class="desc">'.__('If you\'re running a one author blog, the author archive will always look exactly the same as your homepage. And even though you may not link to it, others might, to do you harm. Disabling them here will make sure any link to those archives will be 301 redirected to the blog homepage.', 'yoast-wpseo').'</p>';
  803. $content .= $this->checkbox('disabledate',__('Disable the date-based archives', 'yoast-wpseo') );
  804. $content .= '<p class="desc">'.__('For the date based archives, the same applies: they probably look a lot like your homepage, and could thus be seen as duplicate content.', 'yoast-wpseo').'</p>';
  805. if ( current_theme_supports('post-formats') ) {
  806. $content .= $this->checkbox('disablepostformats',__('Disable the post format archives', 'yoast-wpseo') );
  807. $content .= '<p class="desc">'.__('This completely disables the archives for post formats.', 'yoast-wpseo').'</p>';
  808. }
  809. $this->postbox('archivesettings',__('Archive Settings', 'yoast-wpseo'),$content);
  810. $content = '<p>'.__("You can add all these on a per post / page basis from the edit screen, by clicking on advanced. Should you wish to use any of these sitewide, you can do so here. (This is <em>not</em> recommended.)").'</p>';
  811. $content .= $this->checkbox('noodp',__('Add <code>noodp</code> meta robots tag sitewide', 'yoast-wpseo') );
  812. $content .= '<p class="desc">'.__('Prevents search engines from using the DMOZ description for pages from this site in the search results.', 'yoast-wpseo').'</p>';
  813. $content .= $this->checkbox('noydir',__('Add <code>noydir</code> meta robots tag sitewide', 'yoast-wpseo') );
  814. $content .= '<p class="desc">'.__('Prevents search engines from using the Yahoo! directory description for pages from this site in the search results.', 'yoast-wpseo').'</p>';
  815. $this->postbox('directories',__('Robots Meta Settings', 'yoast-wpseo'),$content);
  816. $content = '<p>'.__('Some of us like to keep our &lt;heads&gt; clean. The settings below allow you to make it happen.', 'yoast-wpseo').'</p>';
  817. $content .= $this->checkbox('hidersdlink','Hide RSD Links');
  818. $content .= '<p class="desc">'.__('Might be necessary if you or other people on this site use remote editors.', 'yoast-wpseo').'</p>';
  819. $content .= $this->checkbox('hidewlwmanifest','Hide WLW Manifest Links');
  820. $content .= '<p class="desc">'.__('Might be necessary if you or other people on this site use Windows Live Writer.', 'yoast-wpseo').'</p>';
  821. $content .= $this->checkbox('hideshortlink','Hide Shortlink for posts');
  822. $content .= '<p class="desc">'.__('Hides the shortlink for the current post.', 'yoast-wpseo').'</p>';
  823. $content .= $this->checkbox('hidefeedlinks','Hide RSS Links');
  824. $content .= '<p class="desc">'.__('Check this box only if you\'re absolutely positive your site doesn\'t need and use RSS feeds.', 'yoast-wpseo').'</p>';
  825. $this->postbox('headsection','Clean up &lt;head&gt; section',$content);
  826. $this->admin_footer('Indexation');
  827. }
  828. function rss_page() {
  829. $options = get_wpseo_options();
  830. $this->admin_header('RSS', false, true, 'yoast_wpseo_rss_options', 'wpseo_rss');
  831. $content = '<p>'."This feature is used to automatically add content to your RSS, more specifically, it's meant to add links back to your blog and your blog posts, so dumb scrapers will automatically add these links too, helping search engines identify you as the original source of the content.".'</p>';
  832. $rows = array();
  833. $rssbefore = '';
  834. if ( isset($options['rssbefore']) )
  835. $rssbefore = esc_html(stripslashes($options['rssbefore']));
  836. $rssafter = '';
  837. if ( isset($options['rssafter']) )
  838. $rssafte

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