function wds_autolinks_settings()
{
    $name = 'wds_autolinks';
    $title = __('Automatic Links', 'wds');
    $description = __('<p>Sometimes you want to always link certain key words to a page on your blog or even a whole new site all together.</p>
	<p>For example, maybe anytime you write the words \'WordPress news\' you want to automatically create a link to the WordPress news blog, wpmu.org. Without this plugin, you would have to manually create these links each time you write the text in your pages and posts - which can be no fun at all.</p>
	<p>This section lets you set those key words and links. First, choose if you want to automatically link key words in posts, pages, or any custom post types you might be using. Usually when you are using automatic links, you will want to check all of the options here.</p>', 'wds');
    $fields = array();
    foreach (get_post_types() as $post_type) {
        if (!in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) {
            $pt = get_post_type_object($post_type);
            $key = strtolower($pt->name);
            $post_types["l{$key}"] = $pt->labels->name;
            $insert["{$key}"] = $pt->labels->name;
        }
    }
    foreach (get_taxonomies() as $taxonomy) {
        if (!in_array($taxonomy, array('nav_menu', 'link_category', 'post_format'))) {
            $tax = get_taxonomy($taxonomy);
            $key = strtolower($tax->labels->name);
            $taxonomies["l{$key}"] = $tax->labels->name;
        }
    }
    $linkto = array_merge($post_types, $taxonomies);
    $insert['comment'] = __('Comments', 'wds');
    $fields['internal'] = array('title' => '', 'intro' => '', 'options' => array(array('type' => 'checkbox', 'name' => 'insert', 'title' => __('Insert links in', 'wds'), 'items' => $insert), array('type' => 'checkbox', 'name' => 'linkto', 'title' => __('Link to', 'wds'), 'items' => $linkto), array('type' => 'dropdown', 'name' => 'cpt_char_limit', 'title' => __('Minimum post title length', 'wds'), 'description' => __('This is the minimum number of characters your post title has to have to be considered for insertion as auto-link.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 25)), array_merge(array(__('Default', 'wds')), range(1, 25)))), array('type' => 'dropdown', 'name' => 'tax_char_limit', 'title' => __('Minimum taxonomy title length', 'wds'), 'description' => __('This is the minimum number of characters your taxonomy title has to have to be considered for insertion as auto-link.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 25)), array_merge(array(__('Default', 'wds')), range(1, 25)))), array('type' => 'checkbox', 'name' => 'allow_empty_tax', 'title' => __('Empty taxonomies', 'wds'), 'items' => array('allow_empty_tax' => __('Allow autolinks to empty taxonomies', 'wds'))), array('type' => 'checkbox', 'name' => 'excludeheading', 'title' => __('Exclude Headings', 'wds'), 'items' => array('excludeheading' => __('Prevent linking in heading tags', 'wds'))), array('type' => 'text', 'name' => 'ignorepost', 'title' => __('Ignore posts and pages', 'wds'), 'description' => __('Paste in the IDs, slugs or titles for the post/pages you wish to exclude and separate them by commas', 'wds')), array('type' => 'text', 'name' => 'ignore', 'title' => __('Ignore keywords', 'wds'), 'description' => __('Paste in the keywords you wish to exclude and separate them by commas', 'wds')), array('type' => 'dropdown', 'name' => 'link_limit', 'title' => __('Maximum autolinks number limit', 'wds'), 'description' => __('This is the maximum number of autolinks that will be added to your posts.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 20)), array_merge(array(__('Unlimited', 'wds')), range(1, 20)))), array('type' => 'dropdown', 'name' => 'single_link_limit', 'title' => __('Maximum single autolink occurrence', 'wds'), 'description' => __('This is a number of single link replacement occurrences.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 10)), array_merge(array(__('Unlimited', 'wds')), range(1, 10)))), array('type' => 'textarea', 'name' => 'customkey', 'title' => __('Custom Keywords', 'wds'), 'description' => __('Paste in the extra keywords you want to automaticaly link. Use comma to seperate keywords and add target url at the end. Use a new line for new url and set of keywords.
				<br />Example:<br />
				<code>WPMU DEV, plugins, themes, http://premium.wpmudev.org/<br />
				WordPress News, http://wpmu.org/<br /></code>', 'wds')), array('type' => 'checkbox', 'name' => 'reduceload', 'title' => __('Other settings', 'wds'), 'items' => array('onlysingle' => __('Process only single posts and pages', 'wds'), 'allowfeed' => __('Process RSS feeds', 'wds'), 'casesens' => __('Case sensitive matching', 'wds'), 'customkey_preventduplicatelink' => __('Prevent duplicate links', 'wds'), 'target_blank' => __('Open links in new tab/window', 'wds'), 'rel_nofollow' => __('Autolinks <code>nofollow</code>', 'wds')))));
    $contextual_help = '';
    if (wds_is_wizard_step('5')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help);
    }
}
function wds_sitemaps_settings()
{
    //$name = 'wds_sitemaps'; // Removed plural
    global $wds_options;
    $name = 'wds_sitemap';
    // Added singular
    $title = __('Sitemaps', 'wds');
    $description = __('<p>Here we will help you create a site map which are used to help search engines find all of the information on your site.</p>
	<p>This is one of the basics of SEO. A sitemap helps search engines like Google, Bing and Yahoo to better index your blog. Search engines are better able to crawl through your site with a structured sitemap of where your content leads. This plugin supports all kinds of WordPress-generated pages as well as custom URLs. Whenever you create a new post, it will notify major search engines to come crawl your new content.</p>
	<p>You may also choose to not include posts, pages, custom post types, categories, or tags from your sitemap - but most situations you will want to leave these in.</p>
	<p>(Leaving these off of a sitemap won\'t guarantee that a search engine won\'t find the information by other means!)</p>', 'wds');
    $sitemap_options = get_option('wds_sitemap_options');
    $fields = array();
    $fields['sitemap'] = array('title' => __('XML Sitemap', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'class' => 'widefat', 'name' => 'sitemappath', 'title' => __('Path to the XML Sitemap', 'wds'), 'description' => '', 'text' => '<p><code>' . $sitemap_options['sitemappath'] . '</code></p>'), array('type' => 'content', 'name' => 'sitemapurl', 'title' => __('URL to the XML Sitemap', 'wds'), 'description' => '', 'text' => '<p><a href="' . $sitemap_options['sitemapurl'] . '" target="_blank">' . $sitemap_options['sitemapurl'] . '</a></p>')));
    foreach (get_post_types(array('public' => true, 'show_ui' => true)) as $post_type) {
        if (!in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) {
            $pt = get_post_type_object($post_type);
            $post_types['post_types-' . $post_type . '-not_in_sitemap'] = $pt->labels->name;
        }
    }
    foreach (get_taxonomies(array('public' => true, 'show_ui' => true)) as $taxonomy) {
        if (!in_array($taxonomy, array('nav_menu', 'link_category', 'post_format'))) {
            $tax = get_taxonomy($taxonomy);
            $taxonomies['taxonomies-' . $taxonomy . '-not_in_sitemap'] = $tax->labels->name;
        }
    }
    $fields['exclude'] = array('title' => __('Exclude', 'wds'), 'intro' => '', 'options' => array(array('type' => 'checkbox', 'name' => 'exclude_post_types', 'title' => __('Exclude post types', 'wds'), 'items' => $post_types), array('type' => 'checkbox', 'name' => 'exclude_taxonomies', 'title' => __('Exclude taxonomies', 'wds'), 'items' => $taxonomies)));
    if (defined('BP_VERSION')) {
        $fields['buddypress'] = _wds_get_buddypress_fields();
    }
    $fields['options'] = array('title' => __('Options', 'wds'), 'intro' => __('Miscellaneous Sitemap related options.', 'wds'), 'options' => array(array('type' => 'radio', 'name' => 'sitemap-images', 'title' => __('Include image items with the sitemap', 'wds'), 'description' => __('Enabling this option will considerably increase plugin memory consumption.', 'wds'), 'items' => array(__('No', 'wds'), __('Yes', 'wds'))), array('type' => 'radio', 'name' => 'sitemap-stylesheet', 'title' => __('Include stylesheet with the generated sitemap', 'wds'), 'description' => __('Stylesheet does not affect your sitemap functionality in any way.', 'wds'), 'items' => array(__('No', 'wds'), __('Yes', 'wds'))), array('type' => 'radio', 'name' => 'sitemap-dashboard-widget', 'title' => __('Show dashboard widget', 'wds'), 'description' => __('Enabling this option will add an Admin Dashboard widget that displays your sitemap information.', 'wds'), 'items' => array(__('No', 'wds'), __('Yes', 'wds'))), array('type' => 'radio', 'name' => 'sitemap-disable-automatic-regeneration', 'title' => __('Disable automatic sitemap updates', 'wds'), 'description' => __('Enable this option if you wish to update your sitemaps manually (by using the Dashboard widget or visiting this page) only.', 'wds'), 'items' => array(__('No', 'wds'), __('Yes', 'wds')))));
    $google_msg = @$wds_options['verification-google'] ? '<code>' . esc_html('<meta name="google-site-verification" value="') . esc_attr(@$wds_options['verification-google']) . esc_html('" />') . '</code>' : '<small>' . __('No META tag will be added', 'wds') . '</small>';
    $bing_msg = @$wds_options['verification-bing'] ? '<code>' . esc_html('<meta name="msvalidate.01" value="') . esc_attr(@$wds_options['verification-bing']) . esc_html('" />') . '</code>' : '<small>' . __('No META tag will be added', 'wds') . '</small>';
    $fields['search-engines'] = array('title' => __('Search engines', 'wds'), 'intro' => __('Options related to direct interaction with search engines.', 'wds'), 'options' => array(array('type' => 'text', 'class' => 'widefat', 'name' => 'verification-google', 'title' => __('Google site verification code', 'wds'), 'description' => "<p>{$google_msg}</p>"), array('type' => 'text', 'class' => 'widefat', 'name' => 'verification-bing', 'title' => __('Bing site verification code', 'wds'), 'description' => "<p>{$bing_msg}</p>"), array('type' => 'radio', 'name' => 'verification-pages', 'title' => __('Add verification code to:', 'wds'), 'items' => array('' => __('All pages', 'wds'), 'home' => __('Home page', 'wds'))), array('type' => 'checkbox', 'name' => 'engines', 'title' => __('Automatically notify search engines when my sitemap updates', 'wds'), 'items' => array('ping-google' => __('Google', 'wds'), 'ping-bing' => __('Bing', 'wds')))));
    $contextual_help = '';
    if (wds_is_wizard_step('2')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help);
    }
    require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps.php';
}
function wds_settings()
{
    $name = 'wds_settings';
    $title = __('Settings', 'wds');
    $default_roles = array('manage_network' => __('Super Admin'), 'list_users' => __('Site Admin'), 'moderate_comments' => __('Editor'), 'edit_published_posts' => __('Author'), 'edit_posts' => __('Contributor'));
    $seo_metabox_permission_levels = apply_filters('wds-seo_metabox_permission_levels', $default_roles);
    $seo_metabox_301_permission_levels = apply_filters('wds-seo_metabox_301_permission_levels', $default_roles);
    $urlmetrics_metabox_permission_levels = apply_filters('wds-urlmetrics_metabox_permission_level', $default_roles);
    $description = __('
		<p>Infinite SEO aims to take care of every SEO option that a site requires, in one easy bundle.</p>
		<p>It is made of several components which you complete as you work through our simple SEO Set Up Wizard:</p>
		<ul>
			<li><b>Step 1 Settings</b>: allows you to choose which steps you want to include in your SEO Set Up Wizard. In most situations you would want to leave all four of the active components below checked.</li>
			<li><b>Step 2 XML Sitemap</b>: generates an xml sitemap which helps search engines to better index your site.</li>
			<li><b>Step 3 Title & Meta Optimization</b>: allows you to optimize title and meta tags on every page of your site.</li>
			<li><b>Step 4 Moz Report</b>: provides detailed and accurate SEO information about your Web pages. It uses the Moz Free API.</li>
			<li><b>Step 5 Automatic Links</b>: allows you to automatically link phrases in your posts, pages, custom post types and comments to corresponding posts, pages, custom post types, categories, tags, custom taxonomies and external urls.</li>
		</ul>
	', 'wds');
    $fields = array('components' => array('title' => __('Active Components', 'wds'), 'intro' => __('In most situations you would want to leave all four of these components checked.', 'wds'), 'options' => array(array('type' => 'checkbox', 'name' => 'active-components', 'title' => __('Check/uncheck the boxes to add/remove a step from the SEO Set Up Wizard', 'wds'), 'items' => array('autolinks' => __('Automatic Links', 'wds'), 'onpage' => __('Title & Meta Optimization', 'wds'), 'seomoz' => __('Moz Report', 'wds'), 'sitemap' => __('XML Sitemap', 'wds')), 'description' => ''))));
    $boxes = array();
    if (!(defined('WDS_SEO_METABOX_ROLE') && WDS_SEO_METABOX_ROLE)) {
        $boxes[] = array('title' => __('Show SEO metabox to role', 'wds'), 'type' => 'dropdown', 'name' => 'seo_metabox_permission_level', 'items' => $seo_metabox_permission_levels);
    }
    if (!(defined('WDS_SEO_METABOX_301_ROLE') && WDS_SEO_METABOX_301_ROLE)) {
        $boxes[] = array('title' => __('Within SEO metabox, show 301 redirection to role', 'wds'), 'type' => 'dropdown', 'name' => 'seo_metabox_301_permission_level', 'items' => $seo_metabox_301_permission_levels);
    }
    if (!(defined('WDS_URLMETRICS_METABOX_ROLE') && WDS_URLMETRICS_METABOX_ROLE)) {
        $boxes[] = array('title' => __('Show Moz metabox to role', 'wds'), 'type' => 'dropdown', 'name' => 'urlmetrics_metabox_permission_level', 'items' => $urlmetrics_metabox_permission_levels);
    }
    if ($boxes) {
        $fields[] = array('title' => __('Show metaboxes to users', 'wds'), 'intro' => __('This applies to create/edit Post pages', 'wds'), 'options' => $boxes);
    }
    $contextual_help = '';
    if (wds_is_wizard_step('1')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help);
    }
}
 function options_page()
 {
     global $wds_options;
     $slug = $this->slug;
     $title = $this->title;
     $description = $this->description;
     $options_name = $this->options_name;
     $msg = '';
     if (isset($_GET['updated']) && $_GET['updated'] == 'true') {
         $msg = __('Settings updated', 'wds');
         if (function_exists('w3tc_pgcache_flush')) {
             w3tc_pgcache_flush();
             $msg .= __(' &amp; W3 Total Cache Page Cache flushed', 'wds');
         } else {
             if (function_exists('wp_cache_clear_cache')) {
                 wp_cache_clear_cache();
                 $msg .= __(' &amp; WP Super Cache flushed', 'wds');
             }
         }
         $msg = '<div id="message" style="width:94%;" class="message updated"><p><strong>' . $msg . '.</strong></p></div>';
     }
     $tabs = '';
     $step_title = array(0, __('Settings', 'wds'), __('Sitemaps', 'wds'), __('Title & Meta', 'wds'), __('Moz', 'wds'), __('Automatic Links', 'wds'));
     $blog_tabs = get_site_option('wds_blog_tabs');
     $blog_tabs = is_array($blog_tabs) ? $blog_tabs : array();
     for ($i = 1; $i <= 5; $i++) {
         $active = wds_is_wizard_step($i) ? ' nav-tab-active' : '';
         $tabs .= "<a href='admin.php?page=wds_wizard&step={$i}' class='wds_tab_item nav-tab{$active}' title='{$step_title[$i]}'>" . sprintf(__('Step %d: %s', 'wds'), $i, $step_title[$i]) . "</a>";
     }
     $action_url = admin_url('options.php');
     echo "<div class='wrap'>{$msg}\r\n\t\t\t<div class='icon32' id='icon-options-general'><br></div>\r\n\t\t\t<h2>" . __('Infinite SEO Wizard', 'wds') . "</h2>\r\n\t\t\t<h3 class='nav-tab-wrapper'>{$tabs}</h3>\r\n\t\t\t<h2>{$title}</h2>";
     if (!wds_is_allowed_tab($slug)) {
         printf(__("Your network admin prevented access to '%s', please move onto next step.", 'wds'), $title);
     } else {
         if ('settings' == $this->name || isset($wds_options[$this->name]) && ($wds_options[$this->name] = 'on')) {
             echo "{$description}\r\n\t\t\t\t<form action='{$action_url}' method='post'>";
             settings_fields($options_name);
             @do_settings_sections($slug);
             if (is_multisite() && WDS_SITEWIDE == true) {
                 $checked_y = in_array($slug, $blog_tabs) ? 'checked="checked"' : '';
                 $checked_n = in_array($slug, $blog_tabs) ? '' : 'checked="checked"';
                 echo '<h3>' . __('Allow Site Admin access', 'wds') . '</h3>';
                 _e('<p>If enabled, this tab will be available to Site Admins once you switch to per-blog mode.</p>', 'wds');
                 echo __('Show this to Site Admins:', 'wds') . "&nbsp;" . "<input type='radio' id='wds_blog_tabs-yes' name='wds_blog_tabs[{$slug}]' value='1' {$checked_y} />" . '<label for="wds_blog_tabs-yes">' . __("Yes", "wds") . '</label>' . "&nbsp;" . "<input type='radio' id='wds_blog_tabs-no' name='wds_blog_tabs[{$slug}]' value='0' {$checked_n} />" . '<label for="wds_blog_tabs-no">' . __("No", "wds") . '</label>';
             }
             echo "<p class='submit'>\r\n\t\t\t\t\t<input name='Submit' type='submit' class='button-primary' value='" . esc_attr(__('Save Settings', 'wds')) . "' />\r\n\t\t\t\t</p>\r\n\t\t\t\t</form>\r\n\t\t\t\t{$this->additional}";
         } else {
             printf(__("You've chosen not to set up '%s', please move onto next step.", 'wds'), $title);
         }
     }
     echo "</div>";
 }
function wds_seomoz_settings()
{
    global $wds_options;
    $name = 'wds_seomoz';
    $title = 'Moz';
    $description = __('<p>We make it easy to integrate with Moz - the industry leader in SEO reports.</p>
	<p><a href="http://moz.com/products/api" target="_blank">Sign-up for a free account</a> to gain access to reports that will tell you how your site stacks up against the competition with all of the important SEO measurement tools - ranking, links, and much more.</p>', 'wds');
    $fields = array('authentication' => array('title' => __('Authentication', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'access-id', 'title' => __('Access ID', 'wds'), 'description' => ''), array('type' => 'text', 'name' => 'secret-key', 'title' => __('Secret Key', 'wds'), 'description' => ''))));
    $contextual_help = '';
    $target_url = str_replace('http://', '', get_bloginfo('url'));
    //if( $pagenow = 'wds_seomoz' && isset( $_GET['updated'] ) ) { // <-- This is the way it was before. It doesn't really work.
    if (wds_is_wizard_step('4') && isset($_GET['settings-updated'])) {
        // Changed how we determine settings being saved
        delete_transient("seomoz_urlmetrics_{$target_url}");
    }
    $additional = '';
    if (isset($wds_options['access-id']) && isset($wds_options['secret-key'])) {
        $seomozapi = new SEOMozAPI($wds_options['access-id'], $wds_options['secret-key']);
        $urlmetrics = $seomozapi->urlmetrics($target_url);
        $attribution = str_replace('/', '%252F', untrailingslashit($target_url));
        $attribution = "http://www.opensiteexplorer.org/links?site={$attribution}";
        $additional = is_object($urlmetrics) ? '
<h3>' . __('Domain Metrics', 'wds') . '</h3>
<table class="widefat" style="width:500px">
	<thead>
		<tr>
			<th width="75%">' . __('Metric', 'wds') . '</th>
			<th>' . __('Value', 'wds') . '</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th>' . __('Metric', 'wds') . '</th>
			<th>' . __('Value', 'wds') . '</th>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td><b>' . __('Domain mozRank', 'wds') . '</b><br />Measure of the mozRank <a href="http://www.opensiteexplorer.org/About#faq_5" target="_blank">(?)</a> of the domain in the Linkscape index</td>
			<td>' . sprintf(__('10-point score: %s', 'wds'), "<a href='{$attribution}'>{$urlmetrics->fmrp}</a>") . '<br />' . sprintf(__('Raw score: %s', 'wds'), "<a href='{$attribution}' target='_blank'>{$urlmetrics->fmrr}</a>") . '
			</td>
		</tr>
		<tr class="alt">
			<td><b>' . __('Domain Authority', 'wds') . '</b> <a href="http://apiwiki.seomoz.org/w/page/20902104/Domain-Authority/" target="_blank">(?)</a></td>
			<td><a href="' . $attribution . '" target="_blank">' . (!empty($urlmetrics->pda) ? $urlmetrics->pda : '') . '</a></td>
		</tr>
		<tr>
			<td><b>' . __('External Links to Homepage', 'wds') . '</b><br />The number of external (from other subdomains), juice passing links <a href="http://apiwiki.seomoz.org/w/page/13991139/Juice-Passing" target="_blank">(?)</a> to the target URL in the Linkscape index </td>
			<td><a href="' . $attribution . '" target="_blank">' . (!empty($urlmetrics->ueid) ? $urlmetrics->ueid : '') . '</a></td>
		</tr>
		<tr>
			<td><b>' . __('Links to Homepage', 'wds') . '</b><br />The number of internal and external, juice and non-juice passing links <a href="http://apiwiki.seomoz.org/w/page/13991139/Juice-Passing" target="_blank">(?)</a> to the target URL in the Linkscape index</td>
			<td><a href="' . $attribution . '" target="_blank">' . (!empty($urlmetrics->uid) ? $urlmetrics->uid : '') . '</a></td>
		</tr>
		<tr>
			<td><b>' . __('Homepage mozRank', 'wds') . '</b><br />Measure of the mozRank <a href="http://www.opensiteexplorer.org/About#faq_5" target="_blank">(?)</a> of the homepage URL in the Linkscape index</td>
			<td>' . sprintf(__('10-point score: %s', 'wds'), "<a href='{$attribution}'>{$urlmetrics->umrp}</a>") . '<br />' . sprintf(__('Raw score: %s', 'wds'), "<a href='{$attribution}' target='_blank'>{$urlmetrics->umrr}</a>") . '</td>
		</tr>
		<tr>
			<td><b>' . __('Homepage Authority', 'wds') . '</b> <a href="http://apiwiki.seomoz.org/Page-Authority" target="_blank">(?)</a></td>
			<td><a href="' . $attribution . '" target="_blank">' . (!empty($urlmetrics->upa) ? $urlmetrics->upa : '') . '</a></td>
		</tr>
	</tbody>
</table>
<p>' . __('For posts / pages specific metrics refer to the Moz URL metrics module on the Edit Post / Page screen,', 'wds') . '</p>
' : '<p>' . sprintf(__('Unable to retrieve data from the Moz API. Error: %s.', 'wds'), $urlmetrics) . '</p>';
    }
    $additional .= '<p><a href="http://moz.com/" target="_blank"><img src="' . WDS_PLUGIN_URL . 'images/linkscape-logo.png" title="Moz Linkscape API" /></a></p>';
    if (wds_is_wizard_step('4')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help, $additional);
    }
}
function wds_seoopt_settings()
{
    $name = 'wds_onpage';
    $title = __('Title & Meta', 'wds');
    $description = sprintf(__('<p>Modify the fields below to customize the titles and meta descriptions of your site pages. <a href="#contextual-help" class="toggle-contextual-help">Click here to see the list of the supported macros.</a></p>
	<p>Search engines read the title and description for each element of your site.  The fields below are set by macros to fill in default information.  You can customize them as you wish and refer to the supported macros, by clicking the Help button.</p>
	<p>It seems to be generally agreed that the "title" and the "description" meta tags are important to write effectively, since several major search engines use them in their indices.   Use relevant keywords in your title, and vary the titles on the different pages that make up your website, in order to target as many keywords as possible.  As for the "description" meta tag, some search engines will use it as their short summary of your url, so make sure your description is one that will entice surfers to your site.</p>
	<p>The "description" meta tag is generally held to be the most valuable, and the most likely to be indexed, so pay special attention to this one.</p>
	<p>Here\'s an example of how it\'s been customized on WPMU DEV.</p>
	<p>The site description (tagline) is:
	<blockquote>WPMU DEV WordPress, Multisite & BuddyPress</blockquote>
	but it has been customized so that the Home Meta Description is WPMU DEV Premium is:
	<blockquote>devoted to plugins, themes, resources and support to assist you in creating the absolute best WordPress MU (WPMU) site you can.</blockquote>
	<p><img src="%s" alt="title and description sample" /></p>
	<p>This plugin also adds a Infinite SEO module below the Write Post / Page editor which you can use to customise SEO options for individual posts and pages.</p>', 'wds'), WDS_PLUGIN_URL . 'images/onpagesample.png');
    $fields = array();
    if (WDS_SITEWIDE || 'posts' == get_option('show_on_front')) {
        $fields['home'] = array('title' => __('Home', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-home', 'title' => __('Home Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-home', 'title' => __('Home Meta Description', 'wds'), 'description' => ''), array('type' => 'text', 'name' => 'keywords-home', 'title' => __('Home page keywords', 'wds'), 'description' => __('Comma-separated keywords, e.g. <code>word1,word2</code>', 'wds')), array('type' => 'checkbox', 'name' => 'meta_robots-main_blog_archive', 'title' => __('Main Blog archive Meta Robots', 'wds'), 'items' => array("meta_robots-noindex-main_blog_archive" => __('Noindex', 'wds'), "meta_robots-nofollow-main_blog_archive" => __('Nofollow', 'wds'), "meta_robots-main_blog_archive-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    } else {
        $intro = '<p>' . __('You seem to be using a static front page. You can tweak its SEO settings using the Infinite SEO metabox in your Page editor.', 'wds') . '</p>';
        if ((int) get_option('page_for_posts')) {
            $intro .= '<p>' . __('You can do the same for your selected posts page', 'wds') . '</p>';
        }
        $fields['home'] = array('title' => __('Home', 'wds'), 'intro' => $intro, 'options' => array());
    }
    foreach (get_post_types() as $posttype) {
        if (in_array($posttype, array('revision', 'nav_menu_item'))) {
            continue;
        }
        if (isset($wds_options['redirectattachment']) && $wds_options['redirectattachment'] && $posttype == 'attachment') {
            continue;
        }
        $type_obj = get_post_type_object($posttype);
        if (!is_object($type_obj)) {
            continue;
        }
        $fields[$posttype] = array('title' => $type_obj->labels->name, 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-' . $posttype, 'title' => sprintf(__('%s Title', 'wds'), $type_obj->labels->singular_name), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-' . $posttype, 'title' => sprintf(__('%s Meta Description', 'wds'), $type_obj->labels->singular_name), 'description' => '')));
    }
    foreach (get_taxonomies(array('_builtin' => false), 'objects') as $taxonomy) {
        $fields[$taxonomy->name] = array('title' => $taxonomy->label, 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-' . $taxonomy->name, 'title' => sprintf(__('%s Title', 'wds'), ucfirst($taxonomy->label)), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-' . $taxonomy->name, 'title' => sprintf(__('%s Meta Description', 'wds'), ucfirst($taxonomy->label)), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-' . $taxonomy->name, 'title' => sprintf(__('%s Meta Robots', 'wds'), ucfirst($taxonomy->label)), 'items' => array("meta_robots-noindex-{$taxonomy->name}" => __('Noindex', 'wds'), "meta_robots-nofollow-{$taxonomy->name}" => __('Nofollow', 'wds'), "meta_robots-{$taxonomy->name}-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    }
    // Adding the builtin ones we need
    $fields['category'] = array('title' => __('Post Categories', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-category', 'title' => __('Category Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-category', 'title' => __('Category Meta Description', 'wds'), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-category', 'title' => sprintf(__('Category Meta Robots', 'wds')), 'items' => array("meta_robots-noindex-category" => __('Noindex', 'wds'), "meta_robots-nofollow-category" => __('Nofollow', 'wds'), "meta_robots-category-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    $fields['post_tag'] = array('title' => __('Post Tags', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-post_tag', 'title' => __('Tag Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-post_tag', 'title' => __('Tag Meta Description', 'wds'), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-post_tag', 'title' => sprintf(__('Tag Meta Robots', 'wds')), 'items' => array("meta_robots-noindex-post_tag" => __('Noindex', 'wds'), "meta_robots-nofollow-post_tag" => __('Nofollow', 'wds'), "meta_robots-post_tag-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    $fields['author'] = array('title' => __('Author Archive', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-author', 'title' => __('Author Archive Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-author', 'title' => __('Author Archive Meta Description', 'wds'), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-author', 'title' => sprintf(__('Author Meta Robots', 'wds')), 'items' => array("meta_robots-noindex-author" => __('Noindex', 'wds'), "meta_robots-nofollow-author" => __('Nofollow', 'wds'), "meta_robots-author-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    $fields['date'] = array('title' => __('Date Archives', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-date', 'title' => __('Date Archives Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-date', 'title' => __('Date Archives Description', 'wds'), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-date', 'title' => sprintf(__('Date Meta Robots', 'wds')), 'items' => array("meta_robots-noindex-date" => __('Noindex', 'wds'), "meta_robots-nofollow-date" => __('Nofollow', 'wds'), "meta_robots-date-subsequent_pages" => __('Leave the first page alone, but apply to subsequent pages', 'wds')))));
    $fields['search'] = array('title' => __('Search Page', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-search', 'title' => __('Search Page Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-search', 'title' => __('Search Page Description', 'wds'), 'description' => ''), array('type' => 'checkbox', 'name' => 'meta_robots-search', 'title' => __('Search results Meta Robots', 'wds'), 'items' => array("meta_robots-noindex-search" => __('Noindex', 'wds'), "meta_robots-nofollow-search" => __('Nofollow', 'wds')))));
    $fields['404'] = array('title' => __('404 Page', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-404', 'title' => __('404 Page Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-404', 'title' => __('404 Page Description', 'wds'), 'description' => '')));
    // BuddyPress groups
    if (function_exists('groups_get_groups') && (is_network_admin() || is_main_site())) {
        $fields['bp_groups'] = array('title' => __('BuddyPress Groups', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-bp_groups', 'title' => __('BuddyPress Group Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-bp_groups', 'title' => __('BuddyPress Group Description', 'wds'), 'description' => '')));
    }
    // BuddyPress profiles
    if (defined('BP_VERSION') && (is_network_admin() || is_main_site())) {
        $fields['bp_profile'] = array('title' => __('BuddyPress Profile', 'wds'), 'intro' => '', 'options' => array(array('type' => 'text', 'name' => 'title-bp_profile', 'title' => __('BuddyPress Profile Title', 'wds'), 'description' => ''), array('type' => 'textarea', 'name' => 'metadesc-bp_profile', 'title' => __('BuddyPress Profile Description', 'wds'), 'description' => '')));
    }
    $contextual_help = __('
<p>The following macros are supported:</p>
<table class="widefat">
	<thead>
		<tr>
			<th>Tag</th>
			<th>Description</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th>Tag</th>
			<th>Description</th>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<th>%%date%%</th>
			<td>Replaced with the date of the post/page</td>
		</tr>
		<tr class="alt">
			<th>%%title%%</th>
			<td>Replaced with the title of the post/page</td>
		</tr>
		<tr>
			<th>%%sitename%%</th>
			<td>The site\'s name</td>
		</tr>
		<tr class="alt">
			<th>%%sitedesc%%</th>
			<td>The site\'s tagline / description</td>
		</tr>
		<tr>
			<th>%%excerpt%%</th>
			<td>Replaced with the post/page excerpt (or auto-generated if it does not exist)</td>
		</tr>
		<tr class="alt">
			<th>%%excerpt_only%%</th>
			<td>Replaced with the post/page excerpt (without auto-generation)</td>
		</tr>
		<tr>
			<th>%%tag%%</th>
			<td>Replaced with the current tag/tags</td>
		</tr>
		<tr class="alt">
			<th>%%category%%</th>
			<td>Replaced with the post categories (comma separated)</td>
		</tr>
		<tr>
			<th>%%category_description%%</th>
			<td>Replaced with the category description</td>
		</tr>
		<tr class="alt">
			<th>%%tag_description%%</th>
			<td>Replaced with the tag description</td>
		</tr>
		<tr>
			<th>%%term_description%%</th>
			<td>Replaced with the term description</td>
		</tr>
		<tr class="alt">
			<th>%%term_title%%</th>
			<td>Replaced with the term name</td>
		</tr>
		<tr>
			<th>%%modified%%</th>
			<td>Replaced with the post/page modified time</td>
		</tr>
		<tr class="alt">
			<th>%%id%%</th>
			<td>Replaced with the post/page ID</td>
		</tr>
		<tr>
			<th>%%name%%</th>
			<td>Replaced with the post/page author\'s \'nicename\'</td>
		</tr>
		<tr class="alt">
			<th>%%userid%%</th>
			<td>Replaced with the post/page author\'s userid</td>
		</tr>
		<tr>
			<th>%%searchphrase%%</th>
			<td>Replaced with the current search phrase</td>
		</tr>
		<tr class="alt">
			<th>%%currenttime%%</th>
			<td>Replaced with the current time</td>
		</tr>
		<tr>
			<th>%%currentdate%%</th>
			<td>Replaced with the current date</td>
		</tr>
		<tr class="alt">
			<th>%%currentmonth%%</th>
			<td>Replaced with the current month</td>
		</tr>
		<tr>
			<th>%%currentyear%%</th>
			<td>Replaced with the current year</td>
		</tr>
		<tr class="alt">
			<th>%%page%%</th>
			<td>Replaced with the current page number (i.e. page 2 of 4)</td>
		</tr>
		<tr>
			<th>%%pagetotal%%</th>
			<td>Replaced with the current page total</td>
		</tr>
		<tr class="alt">
			<th>%%pagenumber%%</th>
			<td>Replaced with the current page number</td>
		</tr>
		<tr>
			<th>%%caption%%</th>
			<td>Attachment caption</td>
		</tr>
		<tr class="alt">
			<th>%%spell_pagenumber%%</th>
			<td>Replaced with the current page number, spelled out as numeral in English</td>
		</tr>
		<tr>
			<th>%%spell_pagetotal%%</th>
			<td>Replaced with the current page total, spelled out as numeral in English</td>
		</tr>
		<tr class="alt">
			<th>%%spell_page%%</th>
			<td>Replaced with the current page number, spelled out as numeral in English</td>
		</tr>
	</tbody>
</table>', 'wds');
    if (wds_is_wizard_step('3')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help);
    }
}