Example #1
0
 protected function build_option_page()
 {
     $page = $this->get_current_admin_page();
     $option_page = $this->current_option_page;
     if (empty($page)) {
         return;
     }
     $form_options = array();
     if ($page == BWP_GXS_GENERATOR) {
         $option_page->set_current_tab(1);
         $form = array('items' => array('heading', 'heading', 'section', 'section', 'section', 'heading', 'select', 'select', 'checkbox', 'heading', 'heading', 'input', 'checkbox', 'input', 'heading', 'select', 'select', 'select', 'heading', 'checkbox', 'section', 'section', 'input', 'heading', 'checkbox', 'input', 'checkbox'), 'item_labels' => array(__('Generated Sitemaps', $this->domain), __('Sitemaps to generate', $this->domain), __('Enable following sitemaps', $this->domain), __('Enable following post types', $this->domain), __('Enable following taxonomies', $this->domain), __('Exclude items', $this->domain), __('Exclude posts', $this->domain), __('Exclude terms', $this->domain), __('Exclude posts by terms', $this->domain), __('External pages', $this->domain), __('Item limits', $this->domain), __('Global limit', $this->domain), __('Split <strong>post-based</strong> sitemaps', $this->domain), __('Split limit', $this->domain), __('Default values', $this->domain), __('Default change frequency', $this->domain), __('Default priority', $this->domain), __('Minimum priority', $this->domain), __('Ping search engines', $this->domain), __('Enable pinging', $this->domain), __('Search engines to ping', $this->domain), __('Enable following post types', $this->domain), __('Ping limit', $this->domain), __('Look and Feel', $this->domain), __('Make sitemaps look pretty', $this->domain), __('Custom XSLT stylesheet URL', $this->domain), __('Enable credit', $this->domain)), 'item_names' => array('heading_submit', 'heading_contents', 'sec_index', 'sec_post', 'sec_tax', 'heading_exclude', 'select_exclude_post_type', 'select_exclude_taxonomy', 'enable_exclude_posts_by_terms', 'heading_external_pages', 'heading_limit', 'input_item_limit', 'enable_sitemap_split_post', 'input_split_limit_post', 'heading_default', 'select_default_freq', 'select_default_pri', 'select_min_pri', 'heading_ping', 'enable_ping', 'sec_ping_vendors', 'sec_post_ping', 'input_ping_limit', 'heading_look', 'enable_xslt', 'input_custom_xslt', 'enable_credit'), 'heading' => array('heading_submit' => '', 'heading_contents' => '<em>' . __('Choose appropriate sitemaps to generate.', $this->domain) . '</em>', 'heading_exclude' => '<em>' . sprintf(__('Exclude individual items for each sitemap.' . ' You can also use ' . '<a href="%s#exclude-items" target="_blank">filters</a> ' . 'to exclude items programmatically.', $this->domain), $this->plugin_url) . '</em>', 'heading_external_pages' => '<em>' . sprintf(__('Add non-WordPress pages to the %s sitemap. ' . 'You can also use %s to add external pages programmatically.', $this->domain), '<a href="' . $this->get_sitemap_url('page_external') . '" target="_blank">' . __('External pages', $this->domain) . '</a>', '<a href="' . $this->plugin_url . '#external-pages" target="_blank">' . __('filter', $this->domain) . '</a>') . '</em>', 'heading_limit' => '<em>' . __('Limit the number of items to output in one sitemap. ', $this->domain) . sprintf(__('Setting too high limits might lead to ' . 'white page error due to timeout or memory issue. ' . 'Refer to this plugin\'s <a target="_blank" href="%s">FAQ section</a> for more info.', $this->domain), $this->plugin_url . 'faq/') . '</em>', 'heading_default' => '<em>' . __('Default values are only used when valid ones can not ' . 'be calculated.', $this->domain) . '</em>', 'heading_look' => '<em>' . __('Customize the look and feel of your sitemaps. ' . 'Note that no stylesheet will be used ' . 'for the Google News sitemap.', $this->domain) . '</em>', 'heading_ping' => '<em>' . __('Whenever you post something new to your blog, ' . 'you can <em>ping</em> search engines with your sitemap index ' . 'to tell them your blog just got updated.', $this->domain) . '</em>'), 'sec_index' => array(array('checkbox', 'name' => 'enable_sitemap_site'), array('checkbox', 'name' => 'enable_sitemap_taxonomy'), array('checkbox', 'name' => 'enable_sitemap_date'), array('checkbox', 'name' => 'enable_sitemap_author'), array('checkbox', 'name' => 'enable_sitemap_external')), 'sec_post' => array(), 'sec_post_ping' => array(), 'sec_tax' => array(), 'sec_ping_vendors' => array(array('checkbox', 'name' => 'enable_ping_google'), array('checkbox', 'name' => 'enable_ping_bing')), 'select' => array('select_oldest_type' => array(__('second(s)', $this->domain) => 1, __('minute(s)', $this->domain) => 60, __('hour(s)', $this->domain) => 3600, __('day(s)', $this->domain) => 86400), 'select_default_freq' => $this->_get_frequencies_as_choices(), 'select_default_pri' => $this->priorities, 'select_min_pri' => $this->priorities, 'select_exclude_post_type' => $this->_get_post_types_as_choices(), 'select_exclude_taxonomy' => $this->_get_taxonomies_as_choices()), 'checkbox' => array('enable_sitemap_taxonomy' => array(__('Taxonomy (including custom taxonomies)', $this->domain) => ''), 'enable_sitemap_date' => array(__('Date archives', $this->domain) => ''), 'enable_sitemap_author' => array(__('Author archives', $this->domain) => ''), 'enable_sitemap_external' => array(__('External (non-WordPress) pages.', $this->domain) => ''), 'enable_exclude_posts_by_terms' => array(__('Also exclude posts that belong to excluded terms.', $this->domain) => ''), 'enable_credit' => array(__('Some copyrighted info is added to your sitemaps.', $this->domain) => ''), 'enable_xslt' => array(__('Default XSLT stylesheets will be used. Set your custom stylesheets below or filter the <code>bwp_gxs_xslt</code> hook.', $this->domain) => ''), 'enable_sitemap_split_post' => array(__('Sitemaps like <code>post.xml</code> are split into <code>post_part1.xml</code>, <code>post_part2.xml</code>, etc. when limit reached.', $this->domain) => ''), 'enable_sitemap_site' => array(__('Site Address', $this->domain) => ''), 'enable_ping' => array(__('Ping search engines when you publish new posts.', $this->domain) => ''), 'enable_ping_google' => array(__('Google', $this->domain) => ''), 'enable_ping_bing' => array(__('Bing', $this->domain) => '')), 'input' => array('input_item_limit' => array('size' => 5, 'label' => __('Maximum is <strong>50,000</strong>. ' . 'This setting is applied to all sitemaps.', $this->domain)), 'input_split_limit_post' => array('size' => 5, 'label' => __('Maximum is <strong>50,000</strong>. ' . 'Set to 0 to use the Global limit.', $this->domain)), 'input_custom_xslt' => array('size' => 91), 'input_oldest' => array('size' => 3, 'label' => '&mdash;'), 'input_ping_limit' => array('size' => 5, 'label' => __('time(s) per search engine per day. ' . 'Increase this limit if you ' . 'publish a lot of posts in a single day.', $this->domain))), 'container' => array('heading_submit' => array($this->_get_formatted_sitemap_logs()), 'select_exclude_post_type' => array($this->get_template_contents('templates/provider/admin/exclude-posts.html.php'), '_settings' => array('need_wrapper' => false)), 'select_exclude_taxonomy' => array($this->get_template_contents('templates/provider/admin/exclude-terms.html.php'), '_settings' => array('need_wrapper' => false)), 'heading_external_pages' => array($this->get_template_contents('templates/provider/admin/external-pages.html.php'))), 'formats' => array('input_item_limit' => 'int', 'input_split_limit_post' => 'int', 'input_ping_limit' => 'int'), 'helps' => array('enable_sitemap_site' => array('content' => __('For a multi-site installation of WordPress, ' . 'this sitemap will list all appropriate blogs\' addresses within your network, ' . 'not just the main blog\'s.', $this->domain)), 'enable_exclude_posts_by_terms' => array('target' => 'icon', 'content' => __('When a post belongs to multiple terms, ' . 'it will be excluded if <strong>ANY</strong> of those terms ' . 'is currently excluded.', $this->domain)), 'select_default_freq' => array('type' => 'link', 'content' => 'http://www.sitemaps.org/protocol.html#xmlTagDefinitions'), 'select_default_pri' => array('type' => 'link', 'content' => 'http://www.sitemaps.org/protocol.html#xmlTagDefinitions'), 'select_min_pri' => array('type' => 'link', 'content' => 'http://www.sitemaps.org/protocol.html#xmlTagDefinitions'), 'input_custom_xslt' => array('type' => 'focus', 'content' => __('Expect an absolute URL, ' . 'e.g. <code>http://example.com/my-stylesheet.xsl</code>. ' . 'You must also have a stylesheet for the sitemap index ' . 'that can be accessed through the above URL, ' . 'e.g. <code>my-stylesheet.xsl</code> and ' . '<code>my-stylesheetindex.xsl</code>. ' . 'Leave blank to use provided stylesheets.', $this->domain), 'size' => 'medium')), 'attributes' => array('enable_sitemap_external' => array('class' => 'bwp-switch-select bwp-switch-on-load', 'data-target' => 'external-pages'), 'select_exclude_post_type' => array('class' => 'bwp-switch-select', 'data-target' => 'wrapper-exclude-posts', 'data-callback-after' => 'bwp_select_exclude_post_cb'), 'select_exclude_taxonomy' => array('class' => 'bwp-switch-select', 'data-target' => 'wrapper-exclude-terms', 'data-callback-after' => 'bwp_select_exclude_term_cb'), 'enable_sitemap_split_post' => array('class' => 'bwp-switch-on-load bwp-switch-select', 'data-target' => 'input_split_limit_post')));
         $form_options = array('input_item_limit', 'input_split_limit_post', 'input_custom_xslt', 'input_ping_limit', 'enable_sitemap_date', 'enable_sitemap_taxonomy', 'enable_sitemap_external', 'enable_sitemap_author', 'enable_sitemap_site', 'enable_exclude_posts_by_terms', 'enable_sitemap_split_post', 'enable_ping', 'enable_ping_google', 'enable_ping_bing', 'enable_xslt', 'enable_credit', 'select_default_freq', 'select_default_pri', 'select_min_pri');
         $this->current_option_page->register_custom_submit_action('exclude_posts');
         $this->current_option_page->register_custom_submit_action('exclude_terms');
         add_action('bwp_option_page_custom_action_exclude_posts', array($this, 'handle_exclude_posts'));
         add_action('bwp_option_page_custom_action_exclude_terms', array($this, 'handle_exclude_terms'));
         $this->_add_checkboxes_to_generator_form('sec_post', 'ept_', $form, $form_options);
         $this->_add_checkboxes_to_generator_form('sec_tax', 'etax_', $form, $form_options);
         $this->_add_checkboxes_to_generator_form('sec_post_ping', 'eppt_', $form, $form_options);
         $this->_disable_overridden_inputs($form['input']);
         // add extra forms
         add_action('bwp_option_action_after_form', array($this, 'add_external_page_modal'));
         // build options dynamically
         add_filter('bwp_option_page_submit_options', array($this, 'handle_dynamic_generator_options'));
     } elseif ($page == BWP_GXS_EXTENSIONS) {
         $option_page->set_current_tab(2);
         $form = array('items' => array('heading', 'checkbox', 'section', 'heading', 'checkbox', 'checkbox', 'heading4', 'input', 'select', 'input', 'select', 'select', 'select', 'checkbox', 'checkbox', 'select'), 'item_labels' => array(__('Google Image Sitemap', $this->domain), __('Enable extension', $this->domain), __('Enable for following post types', $this->domain), __('Google News Sitemap', $this->domain), __('Enable extension', $this->domain), __('Enable pinging', $this->domain), __('Sitemap Contents', $this->domain), __('News name', $this->domain), __('News language', $this->domain), __('News age', $this->domain), __('News post type', $this->domain), __('News taxonomy', $this->domain), __('News terms and genres', $this->domain), __('Enable multi-term support', $this->domain), __('Enable keywords support', $this->domain), __('Keyword source', $this->domain)), 'item_names' => array('heading_image', 'enable_image_sitemap', 'sec_image_post_types', 'heading_news', 'enable_news_sitemap', 'enable_news_ping', 'heading_contents', 'input_news_name', 'select_news_lang', 'input_news_age', 'select_news_post_type', 'select_news_taxonomy', 'select_news_cat_action', 'enable_news_multicat', 'enable_news_keywords', 'select_news_keyword_source'), 'heading' => array('heading_image' => '<em>' . __('Add featured images to existing post-based sitemaps.', $this->domain) . '</em>', 'heading_news' => '<em>' . __('A Google News Sitemap is a file that ' . 'allows you to control which content ' . 'you submit to Google News. By creating and ' . 'submitting a Google News Sitemap, you\'re able ' . 'to help Google News discover and crawl your site\'s news articles ' . '&mdash; http://support.google.com/', $this->domain) . '</em>'), 'heading4' => array('heading_contents' => ''), 'select' => array('select_news_post_type' => $this->_get_post_types_as_choices(), 'select_news_taxonomy' => $this->_get_taxonomies_as_choices($this->options['select_news_post_type'] ? $this->options['select_news_post_type'] : null), 'select_news_lang' => $this->_get_news_languages_as_choices(), 'select_news_cat_action' => array(__('Include', $this->domain) => 'inc', __('Exclude', $this->domain) => 'exc'), 'select_news_keyword_source' => $this->_get_taxonomies_as_choices($this->options['select_news_post_type'] ? $this->options['select_news_post_type'] : null, __('Use the selected "News taxonomy"', $this->domain))), 'input' => array('input_news_name' => array('size' => 70), 'input_news_age' => array('size' => 3, 'label' => __('day(s).', $this->domain))), 'checkbox' => array('enable_image_sitemap' => array(__('Add an <code>&lt;image:image&gt;</code> entry to each sitemap item when possible.', $this->domain) => ''), 'enable_news_sitemap' => array(sprintf(__('Add <code>post_google_news.xml</code> to the main <a href="%s" target="_blank">sitemapindex.xml</a>.', $this->domain), $this->get_sitemap_index_url()) => ''), 'enable_news_keywords' => array('' => ''), 'enable_news_ping' => array(__('Ping search engines when a news article is published.', $this->domain) => ''), 'enable_news_multicat' => array(__('Enable this if you have posts assigned to more than one terms.', $this->domain) => '')), 'sec_image_post_types' => array(), 'inline_fields' => array(), 'post' => array('select_news_cat_action' => '&nbsp;<em>' . __('selected terms.', $this->domain) . '</em>&nbsp; ' . '<button type="button" class="button-secondary bwp-switch-button" ' . 'id="button-toggle-selected-term-genres" ' . 'data-target="wrapper-selected-term-genres" ' . 'data-loader="loader-selected-term-genres" ' . 'data-callback="bwp_button_view_selected_term_genres_cb"' . '>' . __('Show/Hide selected terms', $this->domain) . '</button>' . '<span style="display: none;" id="loader-selected-term-genres"> ' . '<em>' . __('... loading', $this->domain) . '</em>' . '</span>'), 'container' => array('sec_image_post_types' => '<strong>' . __('Note:', $this->domain) . '</strong> ' . sprintf(__('You can only select post types that <a href="%s" target="_blank">support the thumbnail feature</a>.', $this->domain), 'http://codex.wordpress.org/Function_Reference/register_post_type#supports'), 'select_news_cat_action' => $this->get_template_contents('templates/provider/admin/news-contents.html.php')), 'helps' => array('enable_image_sitemap' => array('type' => 'switch', 'target' => 'icon', 'content' => sprintf(__('Please make sure you have enabled the ' . '<a href="%s" target="_blank">Post Thumbnails feature</a> in your theme before ' . 'enabling this extension.', $this->domain), 'http://codex.wordpress.org/Post_Thumbnails') . '<br /><br />' . sprintf(__('Learn more about <a href="%s" target="_blank">Image sitemaps</a>.', $this->domain), 'https://support.google.com/webmasters/answer/178636?hl=en') . '<br /><br />' . '<strong>' . __('Important', $this->domain) . ':</strong> ' . __('This extension has an effect on performance, ' . 'if you notice any slowdown please try disabling ' . 'it first.', $this->domain)), 'enable_news_sitemap' => array('type' => 'switch', 'target' => 'icon', 'content' => sprintf(__('Please take a look at ' . '<a href="%s" target="_blank">Google News\'s guidelines</a> ' . 'before enabling this feature.', $this->domain), 'https://support.google.com/news/publisher/answer/74288?hl=en#sitemapguidelines') . '<br /><br />' . sprintf(__('Also, if you notice that some non-news contents are ' . 'indexed too, read <a href="%sfaq#google-news" target="_blank">this</a>.', $this->domain), $this->plugin_url)), 'input_news_name' => array('type' => 'focus', 'content' => __('Set a different name for your news sitemap. ' . 'By default, your <em>Site Title</em> is used.', $this->domain)), 'input_news_age' => array('type' => 'switch', 'content' => __('Articles that are older than specified day(s) will NOT be considered.', $this->domain) . '<br /><br />' . '<em>' . __('Set to <code>0</code> to disable (not recommended).', $this->domain) . '</em>' . '<br /><br />' . sprintf(__('Please take a look at ' . '<a href="%s" target="_blank">Google News\'s guidelines</a> ' . 'for more info.', $this->domain), 'https://support.google.com/news/publisher/answer/74288?hl=en#sitemapguidelines')), 'select_news_post_type' => array('target' => 'icon', 'content' => __('If you enable the "Google Image Extension" for ' . 'selected post type, featured image will also be ' . 'added automatically to the news sitemap.', $this->domain)), 'select_news_taxonomy' => array('target' => 'icon', 'content' => __('Due to performance reason, it is advised ' . 'to NOT use a tag-like taxonomy (such as <em>Post Tag</em>) ' . 'as the news taxonomy.', $this->domain)), 'enable_news_keywords' => array('type' => 'link', 'content' => 'https://support.google.com/news/publisher/answer/116037?hl=en&ref_topic=4359874'), 'enable_news_ping' => array('content' => __('This ping works separately from the sitemap index ping, ' . 'and only occurs when you publish an article ' . 'in one of the news categories set below.', $this->domain))), 'attributes' => array('input_news_name' => array('placeholder' => get_bloginfo('title')), 'select_news_post_type' => array('class' => 'bwp-switch-select', 'data-callback' => 'bwp_select_news_post_type_cb'), 'select_news_taxonomy' => array('class' => 'bwp-switch-select', 'data-target' => 'select_news_cat_action', 'data-callback' => 'bwp_select_news_taxonomy_cb'), 'enable_news_keywords' => array('class' => 'bwp-switch-on-load bwp-switch-select', 'data-target' => 'select_news_keyword_source')), 'formats' => array('input_news_age' => 'int'));
         $form_options = array('enable_image_sitemap', 'enable_news_sitemap', 'enable_news_ping', 'enable_news_keywords', 'enable_news_multicat', 'select_news_post_type', 'select_news_taxonomy', 'select_news_lang', 'select_news_keyword_source', 'select_news_cat_action', 'select_news_cats', 'input_news_name', 'input_news_age', 'input_news_genres');
         $this->_add_checkboxes_to_image_sitemap_form('sec_image_post_types', 'ipt_', $form, $form_options);
         // build options dynamically
         add_filter('bwp_option_page_submit_options', array($this, 'handle_dynamic_image_sitemap_options'));
         add_filter('bwp_option_page_submit_options', array($this, 'handle_dynamic_google_news_options'));
         // handle option changes
         add_filter('bwp_option_page_action_submitted', array($this, 'handle_google_news_option_changes'));
     } elseif ($page == BWP_GXS_GENERATOR_ADVANCED) {
         $option_page->set_current_tab(3);
         $form = array('items' => array('heading', 'checkbox', 'checkbox', 'heading', 'checkbox', 'checkbox', 'heading', 'checkbox', 'checkbox', 'input', 'input', 'heading', 'input', 'input', 'heading', 'checkbox', 'checkbox', 'checkbox', 'checkbox'), 'item_labels' => array(__('Formatting', $this->domain), __('Use GMT for Last Modified date', $this->domain), __('Compress sitemaps', $this->domain), __('Robots.txt', $this->domain), __('Enable robots.txt support', $this->domain), __('Enable multisite robots.txt support', $this->domain), __('Sitemap Cache', $this->domain), __('Enable caching', $this->domain), __('Enable auto cache re-generation', $this->domain), __('Cache expiry time', $this->domain), __('Cache directory', $this->domain), __('Sitemap modules', $this->domain), __('Database query limit', $this->domain), __('Custom module directory', $this->domain), __('Debugging', $this->domain), __('Enable build stats', $this->domain), __('Enable message log', $this->domain), __('Enable debugging mode', $this->domain), __('Enable extra debugging mode', $this->domain)), 'item_names' => array('heading_format', 'enable_gmt', 'enable_gzip', 'heading_robot', 'enable_robots', 'enable_global_robots', 'heading_cache', 'enable_cache', 'enable_cache_auto_gen', 'input_cache_age', 'input_cache_dir', 'heading_module', 'input_sql_limit', 'input_alt_module_dir', 'heading_debug', 'enable_stats', 'enable_log', 'enable_debug', 'enable_debug_extra'), 'heading' => array('heading_format' => '', 'heading_cache' => '<em>' . __('Cache your sitemaps for better performance. ' . 'If you are still configuring the plugin it\'s best to ' . 'disable caching or you might have to manually flush the cache ' . 'for any changes to show up.', $this->domain) . '</em>', 'heading_robot' => '<em>' . sprintf(__('WordPress generates a %svirtual robots.txt%s ' . 'file for your blog by default. ' . 'You can add the sitemap index file ' . 'to that robots.txt file using settings below.', $this->domain), !self::is_multisite() || self::is_subdomain_install() ? '<a href="' . home_url('robots.txt') . '" target="_blank">' : '', !self::is_multisite() || self::is_subdomain_install() ? '</a>' : '') . '</em>', 'heading_module' => '<em>' . sprintf(__('Extend this plugin using customizable modules. ' . 'More info <a href="%s#module-api">here</a>.', $this->domain), $this->plugin_url) . '</em>', 'heading_debug' => ''), 'checkbox' => array('enable_gmt' => array(__('Disable this to use the local timezone setting in <em>Settings >> General</em>.', $this->domain) => ''), 'enable_gzip' => array(__('Use gzip to make sitemaps ~70% smaller. If you see an error after enabling this, it\'s very likely that you have gzip active on your server already.', $this->domain) => ''), 'enable_cache' => array(__('Your sitemaps are generated and then cached to reduce unnecessary work.', $this->domain) => ''), 'enable_cache_auto_gen' => array(__('Re-generate sitemap cache when expired. If you disable this, remember to manually flush the cache once in a while.', $this->domain) => ''), 'enable_robots' => array(__('Add a sitemap index entry to blog\'s robots.txt', $this->domain) => ''), 'enable_global_robots' => array(__('Add sitemap index entries from all blogs to primary blog\'s robots.txt', $this->domain) => ''), 'enable_stats' => array(__('Print useful information such as build time, memory usage, SQL queries, etc.', $this->domain) => ''), 'enable_log' => array(sprintf(__('Log useful messages when sitemaps are generated. The log can be viewed <a href="%s">here</a>.', $this->domain), $this->get_admin_page_url(BWP_GXS_STATS)) => ''), 'enable_debug' => array(__('When this is on, NO caching is used and <code>WP_DEBUG</code> is respected, useful when developing new modules.', $this->domain) => ''), 'enable_debug_extra' => array(sprintf(__('When this is on, NO headers are sent and sitemaps are NOT compressed, useful when debugging <em>Content Encoding Error</em>. More info <a href="%s#sitemap-log-debug" target="_blank">here</a>.', $this->domain), $this->plugin_url) => '')), 'input' => array('input_cache_age' => array('size' => 5, 'label' => '&mdash;'), 'input_cache_dir' => array('size' => 91), 'input_alt_module_dir' => array('size' => 91), 'input_sql_limit' => array('size' => 5, 'label' => __('Maximum number of items to fetch ' . 'in each query to database. ' . 'This helps when a sitemap has thousands of items and ' . 'host is low on memory.', $this->domain))), 'select' => array('select_time_type' => array(__('second(s)', $this->domain) => 1, __('minute(s)', $this->domain) => 60, __('hour(s)', $this->domain) => 3600, __('day(s)', $this->domain) => 86400)), 'inline_fields' => array('input_cache_age' => array('select_time_type' => 'select')), 'inline' => array('cb_enable_autogen' => '<br /><br />'), 'helps' => array('enable_robots' => array('type' => 'switch', 'target' => 'icon', 'content' => sprintf(__('If you\'re on a Multi-site installation with <strong>Sub-domain</strong> enabled, ' . 'each blog will have its own robots.txt. ' . 'Blogs in <strong>sub-directory</strong> will not, however. ' . 'Please read the <a href="%s#robots.txt" target="_blank">documentation</a> for more info.', $this->domain), $this->plugin_url)), 'enable_global_robots' => array('type' => 'switch', 'target' => 'icon', 'content' => sprintf(__('If you have for example 50 blogs, 50 sitemap index entries ' . 'will be added to your primary blog\'s <a href="%s" target="_blank">robots.txt</a>.', $this->domain), get_site_option('home') . '/robots.txt')), 'input_cache_dir' => array('type' => 'focus', 'content' => __('Expect an absolute path to a writable directory ' . '(i.e. CHMOD to 755 or 777). ', $this->domain) . '<br />' . sprintf(__('Leave empty to use <code>%s</code>.', $this->domain), $this->_get_default_cache_directory()), 'size' => 'medium'), 'input_alt_module_dir' => array('type' => 'focus', 'content' => __('Expect an absolute path to the directory ' . 'where you put your custom modules ' . '(e.g. <code>/home/mysite/public_html/gxs-modules/</code>). ', $this->domain) . '<br />' . __('Override a built-in module by having a module ' . 'with the same filename in specified directory.', $this->domain), 'size' => 'large')), 'attributes' => array('input_cache_dir' => array('placeholder' => $this->_get_default_cache_directory())), 'env' => array('enable_global_robots' => 'multisite'), 'role' => array('heading_cache' => 'superadmin', 'heading_module' => 'superadmin', 'heading_debug' => 'superadmin'), 'formats' => array('input_cache_age' => 'int', 'select_time_type' => 'int', 'input_sql_limit' => 'int'));
         $form_options = array('enable_gmt', 'enable_gzip', 'enable_cache', 'enable_cache_auto_gen', 'input_cache_dir', 'input_cache_age', 'select_time_type', 'enable_robots', 'enable_global_robots', 'input_sql_limit', 'input_alt_module_dir', 'enable_stats', 'enable_log', 'enable_debug', 'enable_debug_extra');
         $this->_disable_overridden_inputs($form['input']);
         // use same option key as XML Sitemaps page
         add_filter('bwp_option_page_submit_form_name', create_function('', "return BWP_GXS_GENERATOR;"));
     } elseif ($page == BWP_GXS_STATS) {
         $option_page->set_current_tab(4);
         $form = array('items' => array('heading'), 'item_labels' => array(__('Message Log', $this->domain)), 'item_names' => array('h3'), 'heading' => array('h3' => 'yes' == $this->options['enable_log'] ? '<em>' . __('Below are messages logged when your sitemaps were generated, ' . 'including <span style="color: #999999;">notices</span>, ' . '<span style="color: #FF0000;">errors</span> and ' . '<span style="color: #009900;">success messages</span>.', $this->domain) . '</em>' : '<em>' . __('Logging is not currently enabled. ' . 'You can enable this feature by checking ' . '"Enable logging" in <strong>XML Sitemaps >> Sitemap log & debug</strong>.', $this->domain) . '</em>'), 'container' => array('h3' => 'yes' == $this->options['enable_log'] ? $this->_get_formatted_message_logs() : ''));
         if ('yes' != $this->options['enable_log'] || $this->message_logger->is_empty()) {
             // no log is found, or logging is disabled, hide sidebar and
             // save changes button to save space
             add_filter('bwp_feed_showable', create_function('', 'return "";'));
             add_filter('bwp_option_submit_button', create_function('', 'return "";'));
         } else {
             // add a clear log button, also remove the save changes button
             $this->current_option_page->register_custom_submit_action('clear_log');
             add_filter('bwp_option_submit_button', array($this, 'add_clear_log_button'));
             add_action('bwp_option_page_custom_action_clear_log', array($this, 'handle_clear_log_action'));
         }
     }
     // add flush cache buttons for super admins on main blog
     // @todo allow normal admins to flush the cache as well,
     // but only for sitemaps on their sites
     if (self::can_update_site_option() && (BWP_GXS_GENERATOR == $page || BWP_GXS_GENERATOR_ADVANCED == $page)) {
         $this->current_option_page->register_custom_submit_action('flush_cache');
         $this->current_option_page->register_custom_submit_action('save_flush_cache');
         add_filter('bwp_option_submit_button', array($this, 'add_flush_cache_buttons'));
         add_action('bwp_option_page_custom_action_flush_cache', array($this, 'handle_flush_action'));
         add_action('bwp_option_page_custom_action_save_flush_cache', array($this, 'handle_save_flush_action'));
     }
     $option_page->init($form, $form_options);
 }