Example #1
0
 /**
  * Build the option pages
  *
  * Utilizes BWP Option Page Builder (@see BWP_OPTION_PAGE)
  */
 public function build_option_pages()
 {
     if (!current_user_can(BWP_MINIFY_CAPABILITY)) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $page = $_GET['page'];
     $active_page = '';
     $original_options = $this->options;
     $bwp_option_page = new BWP_OPTION_PAGE($page, $this->site_options);
     // Get option from the database, general options are used for both
     // 'General Options' page and 'Manage enqueued' page
     if (BWP_MINIFY_OPTION_GENERAL == $page || BWP_MINIFY_MANAGE == $page) {
         $active_page = BWP_MINIFY_OPTION_GENERAL;
         $options = $bwp_option_page->get_db_options($active_page, $bwp_option_page->get_options(array('input_minurl', 'input_minpath', 'input_cache_dir', 'input_doc_root', 'input_maxfiles', 'input_maxage', 'input_custom_buster', 'enable_min_js', 'enable_min_css', 'enable_external_origin', 'enable_bloginfo', 'enable_css_bubble', 'enable_cache_file_lock', 'enable_debug', 'select_buster_type', 'select_time_type', 'input_ignore', 'input_header', 'input_direct', 'input_footer', 'input_oblivion', 'input_style_ignore', 'input_style_direct', 'input_style_oblivion'), $this->options));
     } else {
         $active_page = BWP_MINIFY_OPTION_ADVANCED;
         $options = $bwp_option_page->get_db_options($active_page, $bwp_option_page->get_options(array('enable_fly_min', 'input_fly_minpath', 'input_nginx_config_file', 'enable_cdn', 'input_cdn_host', 'input_cdn_host_js', 'input_cdn_host_css', 'select_cdn_ssl_type'), $this->options));
     }
     if (!empty($page)) {
         if ($page == BWP_MINIFY_OPTION_GENERAL) {
             $bwp_option_page->set_current_tab(1);
             // add two buttons to save and flush cache or to flush cache
             // right now we only support flushing by super admin, to be
             // improved in 1.3.x
             if (!self::is_normal_admin()) {
                 add_filter('bwp_option_submit_button', array($this, 'add_flush_cache_buttons'));
             }
             $form = array('items' => array('heading', 'checkbox', 'checkbox', 'checkbox', 'checkbox', 'input', 'input', 'select', 'heading', 'input', 'input', 'input', 'checkbox', 'checkbox', 'checkbox'), 'item_labels' => array(__('Plugin Functionality', $this->domain), __('Minify JS files automatically?', $this->domain), __('Minify CSS files automatically?', $this->domain), __('Minify <code>bloginfo()</code> stylesheets?', $this->domain), __('Leave external files at their original positions?', $this->domain), __('URL path to Minify library (relative to domain root)', $this->domain), __('One minify string will contain', $this->domain), __('For cache buster, use', $this->domain), __('Minify Library Settings', $this->domain), __('WordPress document root', $this->domain), __('Cache directory', $this->domain), __('Cache age', $this->domain), __('Enable bubble CSS import?', $this->domain), __('Enable cache file locking?', $this->domain), __('Enable debugging?', $this->domain)), 'item_names' => array('h1', 'cb1', 'cb3', 'cb2', 'ext_origin', 'input_minpath', 'input_maxfiles', 'select_buster_type', 'h2', 'input_doc_root', 'input_cache_dir', 'input_maxage', 'cb4', 'cb5', 'cb6'), 'heading' => array('h1' => '', 'h2' => '<a name="minify.config.php"></a>' . sprintf(__('<em>These options will let you control how the actual ' . '<a href="%s" target="_blank">Minify</a> library works.</em>', $this->domain), 'https://code.google.com/p/minify/')), '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), 'select_buster_type' => array(__('No cache buster', $this->domain) => 'none', __('Cache folder&#8217;s last modified time', $this->domain) => 'mtime', __('Your WordPress&#8217;s current version', $this->domain) => 'wpver', __('Your theme&#8217;s current version', $this->domain) => 'tver', __('A custom number', $this->domain) => 'custom')), 'checkbox' => array('cb1' => array(__('you can still use <code>bwp_minify()</code> helper function if you disable this.', $this->domain) => 'enable_min_js'), 'cb3' => array(__('you can still use <code>bwp_minify()</code> helper function if you disable this.', $this->domain) => 'enable_min_css'), 'cb2' => array(__('enable this for themes that use <code>bloginfo()</code> to print the main stylesheet (i.e. <code>style.css</code>). If you want to minify <code>style.css</code> with the rest of your css files, you must enqueue it.', $this->domain) => 'enable_bloginfo'), 'ext_origin' => array(__('enable this to improve compatibility with plugins/themes that print external JS/CSS files directly, for e.g. <code>Simple Google Maps Short Code</code> plugin or <code>Avada</code> theme.', $this->domain) => 'enable_external_origin'), 'cb4' => array(sprintf(__('move all <code>@import</code> rules in CSS files to the top. More info <a href="%s" target="_blank">here</a>.', $this->domain), $this->get_url('min_css_bubble')) => 'enable_css_bubble'), 'cb5' => array(__('disable this if filesystem is NFS.', $this->domain) => 'enable_cache_file_lock'), 'cb6' => array(sprintf(__('only enable this when minification does not work as expected. More info <a href="%s" target="_blank">here</a>.', $this->domain), $this->get_url('min_debug')) => 'enable_debug')), 'input' => array('input_minpath' => array('size' => 55, 'label' => '<br />' . sprintf(__('Leave empty to use default value, which is <code>%s</code>.<br />' . 'Please read <a href="%s#advanced_customization" target="_blank">here</a> ' . 'to know how to properly modify this.', $this->domain), $this->get_default_min_path(), $this->plugin_url)), 'input_doc_root' => array('size' => 55, 'label' => '<br />' . $this->_get_input_doc_root_label()), 'input_cache_dir' => array('size' => 55, 'label' => '<br />' . sprintf(__('Expect a full path to a publicly accessible directory ' . '(i.e. can be served under your document root). <br />' . 'Leave empty to use default value, which is <code>%s</code>.<br />' . 'Cache directory must be writable ' . '(i.e. CHMOD to 755 or 777). ' . 'More details can be found ' . '<a href="%s#minify_cache_directory" target="_blank">here</a>. ', $this->domain), $this->get_default_cache_dir(), $this->plugin_url)), 'input_maxfiles' => array('size' => 3, 'label' => __('file(s) at most.', $this->domain)), 'input_maxage' => array('size' => 5, 'label' => __('&mdash;', $this->domain)), 'input_custom_buster' => array('pre' => '<em>&rarr; /min/?f=file.js&#038;ver=</em> ', 'size' => 12, 'label' => '.', 'disabled' => ' disabled="disabled"')), 'textarea' => array('input_symlinks' => array('cols' => 90, 'rows' => 5)), 'container' => array('select_buster_type' => '<em><strong>' . __('Note', $this->domain) . ':</strong> ' . __('Whenever a new cache buster is used, ' . 'you are telling browsers to refresh cached JS and CSS files. ' . 'This is particularly useful when source files have been changed, ' . 'use this feature wisely.', $this->domain) . '</em>'), 'inline_fields' => array('input_maxage' => array('select_time_type' => 'select'), 'select_buster_type' => array('input_custom_buster' => 'input')), 'role' => array('input_minpath' => 'superadmin', 'h2' => 'superadmin', 'input_doc_root' => 'superadmin', 'input_cache_dir' => 'superadmin', 'input_maxage' => 'superadmin', 'select_time_type' => 'superadmin', 'cb4' => 'superadmin', 'cb5' => 'superadmin', 'cb6' => 'superadmin'));
             // Get a subset of the option array for this form
             $form_options = array('input_minurl', 'input_minpath', 'input_cache_dir', 'input_doc_root', 'input_maxfiles', 'input_maxage', 'input_custom_buster', 'enable_min_js', 'enable_min_css', 'enable_external_origin', 'enable_bloginfo', 'enable_css_bubble', 'enable_cache_file_lock', 'enable_debug', 'select_buster_type', 'select_time_type');
             // Flush the cache
             if ((isset($_POST['flush_cache']) || isset($_POST['save_flush'])) && !self::is_normal_admin()) {
                 check_admin_referer($page);
                 $deleted = $this->_flush_cache();
                 if (0 < $deleted) {
                     $this->add_notice('<strong>' . __('Notice', $this->domain) . ':</strong> ' . sprintf(__("<strong>%d</strong> cached files " . "have been deleted successfully!", $this->domain), $deleted));
                 } else {
                     $this->add_notice('<strong>' . __('Notice', $this->domain) . ':</strong> ' . __("Could not delete any cached files. " . "Please manually flush the cache directory.", $this->domain));
                 }
                 // this should also clear all saved Minify groups
                 $this->detector->clear_logs('group');
             }
         } else {
             if ($page == BWP_MINIFY_OPTION_ADVANCED) {
                 $bwp_option_page->set_current_tab(2);
                 $form = array('items' => array('heading', 'checkbox', 'input', 'input', 'heading', 'checkbox', 'select', 'input', 'input', 'input', 'textarea'), 'item_labels' => array(__('Friendly Minify Urls', $this->domain), __('Enable friendly Minify urls', $this->domain), sprintf(__('Friendly Minify url path (relative to ' . 'your Site/Network Address). More info <a href="%s#friendly_minify_urls" ' . 'target="_blank">here</a>.', $this->domain), $this->plugin_url), __('Path to Nginx config file', $this->domain), __('Content Delivery Network (CDN)', $this->domain), __('Enable CDN support', $this->domain), __('SSL support for CDN', $this->domain), __('CDN hostname (primary)', $this->domain), __('CDN hostname for JS files', $this->domain), __('CDN hostname for CSS files', $this->domain), __('Additional HTTP headers used with CDN', $this->domain)), 'item_names' => array('h1', 'cb1', 'input_fly_minpath', 'input_nginx_config_file', 'h2', 'cb2', 'select_cdn_ssl_type', 'input_cdn_host', 'input_cdn_host_js', 'input_cdn_host_css'), 'heading' => array('h1' => '<em>' . sprintf(__('Turn long and ugly Minify urls with ' . 'query variables (such as <code>%s</code>), ' . 'into more friendly ones (e.g. <code>%s</code>). ' . '', $this->domain), trailingslashit($this->min_url) . '?f=path/to/script1.js,path/to/script2.js', home_url('path/to/cache/somestring.js')) . '</em>', 'h2' => '<em>' . sprintf(__('Serve minified contents ' . 'using a <a href="%s" target="_blank">CDN</a> to improve performance.', $this->domain), $this->get_url('wikipedia_cdn')) . '</em>'), 'select' => array('select_fly_serve_method' => array(__('WordPress', $this->domain) => 'wp', __('Server rewrite rules', $this->domain) => 'server'), 'select_cdn_ssl_type' => array(__('Do not use SSL for CDN', $this->domain) => 'off', __('Use SSL when suitable', $this->domain) => 'on', __('Use protocol-relative URL', $this->domain) => 'less')), 'checkbox' => array('cb1' => array(__('for CDN support it is highly recommended that you enable this feature.', $this->domain) => 'enable_fly_min'), 'cb2' => array(__('please make sure that your CDN is property setup before enabling this feature.', $this->domain) => 'enable_cdn')), 'input' => array('input_fly_minpath' => array('size' => 55, 'label' => $this->_get_input_fly_min_path_label()), 'input_nginx_config_file' => array('size' => 55, 'label' => '<br />' . sprintf(__('Expect a full path to your Nginx ' . 'configuration file (e.g. <code>%s</code>). ' . 'If none specified or the config file ' . 'is not writable, you will have to manually update it. ' . 'Alternatively, if you have a config file ' . 'at <code>%s</code>, which is used by W3 Total Cache ' . 'plugin, you can leave this field blank and ' . 'BWP Minify will use that config file.', $this->domain), '/path/to/nginx.conf', $this->get_doc_root('nginx.conf'))), 'input_cdn_host' => array('size' => 40, 'label' => '<br />' . sprintf(__('Use either hostnames provided by your ' . 'CDN or custom ones. Please do NOT include ' . 'the scheme (i.e. <code>http://</code> or <code>https://</code>). ' . 'Good examples are: <code>%s</code>, <code>%s</code>, etc.', $this->domain), 'yourzone.yourcdn.com', 'cdn.yourdomain.com')), 'input_cdn_host_js' => array('size' => 40, 'label' => '&nbsp; ' . __('used when not empty.', $this->domain)), 'input_cdn_host_css' => array('size' => 40, 'label' => '&nbsp; ' . __('used when not empty.', $this->domain))), 'textarea' => array('input_cdn_headers' => array('')), 'container' => array('cb2' => '<p style="margin-left:220px;"><em>' . __('If you\'re looking for a CDN, I highly recommend ' . '<strong>MaxCDN</strong>. They provide the most reliable CDN service ' . 'for WordPress sites. Support is exceptional and ' . 'you got a 30-day Money Back Guarantee, too.', $this->domain) . '</em><br />' . '<a href="#" target="_blank" class="button-secondary" style="margin-top:10px;" ' . 'onclick="this.href=\'' . $this->get_url('aff_maxcdn') . '\';">' . __('Create a MaxCDN account today and save 25%</a>', $this->domain) . '</p>'), 'post' => array(), 'role' => array('input_fly_minpath' => 'superadmin'));
                 $form_options = array();
             } else {
                 if ($page == BWP_MINIFY_MANAGE) {
                     $bwp_option_page->set_current_tab(3);
                     remove_action('bwp_option_action_before_form', array($this, 'show_donation'), 12);
                     // add a secondary button to clear enqueued file lists (both)
                     add_filter('bwp_option_submit_button', array($this, 'add_clear_enqueue_button'));
                     if (isset($_POST['clear_enqueue'])) {
                         check_admin_referer($page);
                         $this->detector->clear_logs('enqueue');
                         $this->add_notice(__('Enqueued file lists have been cleared successfully. ' . 'Try refreshing this page to see updated file lists.', $this->domain));
                     }
                     $form = array('items' => array('heading', 'heading'), 'item_labels' => array(__('Manage enqueued JS files', $this->domain), __('Manage enqueued CSS files', $this->domain)), 'item_names' => array('h1', 'h2'), 'heading' => array('h1' => '<em>' . sprintf(__('Below you can find a list of enqueued JS files ' . 'detected by this plugin. Press <strong>select</strong> and ' . 'then choose to perform an appropriate action on selected JS file. ' . 'You can also directly type in one script handle (<strong>NOT ' . 'filename/script src</strong>) per line in the input field if ' . 'you want. More info <a href="%s#manage_enqueued_files" target="_blank">here</a>.', $this->domain), $this->plugin_url) . '</em>', 'h2' => '<em>' . sprintf(__('Below you can find a list of enqueued CSS files ' . 'detected by this plugin. Press <strong>select</strong> and ' . 'then choose to perform an appropriate action on selected CSS file. ' . 'You can also directly type in one style handle (<strong>NOT ' . 'filename/style src</strong>) per line in the input field if ' . 'you want. More info <a href="%s#manage_enqueued_files" target="_blank">here</a>.', $this->domain), $this->plugin_url) . '</em>'), 'container' => array('h1' => $this->_show_enqueued_scripts(), 'h2' => $this->_show_enqueued_styles()));
                     // Get a subset of the option array for this form
                     $form_options = array('input_ignore', 'input_header', 'input_direct', 'input_footer', 'input_oblivion', 'input_style_ignore', 'input_style_direct', 'input_style_oblivion');
                 }
             }
         }
     }
     $option_formats = array('input_maxfiles' => 'int', 'input_maxage' => 'int', 'select_time_type' => 'int');
     $option_super_admin = $this->site_options;
     // Get option from user input
     if ((isset($_POST['submit_' . $bwp_option_page->get_form_name()]) || isset($_POST['save_flush']) && $page == BWP_MINIFY_OPTION_GENERAL && !self::is_normal_admin()) && isset($options) && is_array($options)) {
         // basic security check
         check_admin_referer($page);
         foreach ($options as $key => &$option) {
             if (0 < sizeof($form_options) && !in_array($key, $form_options) || self::is_normal_admin() && in_array($key, $option_super_admin)) {
                 // field not found in options assigned to current form
                 // OR not a super admin, and this is a super-admin only setting
                 continue;
             } else {
                 if (isset($_POST[$key])) {
                     // make sure inputs are in expected format
                     $bwp_option_page->format_field($key, $option_formats);
                     $option = trim(stripslashes($_POST[$key]));
                 }
                 if (!isset($_POST[$key]) && !isset($form['input'][$key]['disabled'])) {
                     // checkbox, exclude disabled input
                     $option = '';
                 } else {
                     if (isset($option_formats[$key]) && 'int' == $option_formats[$key] && ('' === $_POST[$key] || 0 > $_POST[$key])) {
                         // expect integer but received empty string or negative integer
                         $option = $this->options_default[$key];
                     }
                 }
             }
         }
         // update per-blog options
         update_option($active_page, $options);
         // if current user is super admin, allow him to update site-only
         // options - this is WPMS compatible
         if (!self::is_normal_admin()) {
             update_site_option($active_page, $options);
         }
         // refresh the options property to include updated options
         $this->options = array_merge($this->options, $options);
         // success messages when settings are saved
         if ($page == BWP_MINIFY_MANAGE) {
             $this->detector->auto_detect();
             $this->add_notice(__('All positions have been saved. ' . 'Try refreshing this page for updated file lists.', $this->domain));
         } else {
             $this->add_notice(__('All options have been saved.', $this->domain));
         }
         // take care of some custom POST actions when form is submitted,
         // when multisite is active, only do this when the user is a superadmin
         if ($page == BWP_MINIFY_OPTION_GENERAL) {
             // other actions for the general option page
             if ($original_options['enable_min_js'] != $this->options['enable_min_js'] || $original_options['enable_min_css'] != $this->options['enable_min_css']) {
                 // @since 1.3.2 changed plugin functionality, clear the log
                 $this->detector->clear_logs();
             }
             if (!self::is_normal_admin()) {
                 // try to save the Minify config file
                 $result = $this->create_minify_config_file();
                 if (true === $result) {
                     // config file was successfully written
                     $this->add_notice(sprintf(__('Minify config file <code>%s</code> ' . 'has been updated successfully.', $this->domain), $this->min_dir . 'config.php'));
                 } else {
                     if ('config' === $result) {
                         // config file is missing
                         $this->add_error('<strong style="color:red">' . __('Error') . ':</strong> ' . sprintf(__('Minify config file <code>config.php</code> could not be found. ' . 'The auto-detected directory to look for the config file is <code>%s</code>. ' . 'Please manually check if that directory actually exists ' . 'and contains the config file.', $this->domain), $this->get_doc_root($this->get_min_path())));
                     } else {
                         if ('put' === $result) {
                             // the write process failed for some reasons
                             $this->add_error(sprintf('<strong style="color:red">' . __('Error') . ':</strong> ' . __('There was an error writing to Minify config file <code>%s</code>. ' . 'Please try again.', $this->domain), $this->min_dir . 'config.php'));
                         } else {
                             // config file is not writable, show the auto-generated
                             // contents to admin for manual update
                             $this->add_notice(sprintf('<strong>' . __('Notice', $this->domain) . ':</strong> ' . __('Minify config file <code>%s</code> ' . 'is not writable. See ' . '<a href="#minify.config.php">below</a> ' . 'for details.', $this->domain), $this->min_dir . 'config.php'));
                             $form['container']['h2'] = $this->_show_generated_config($result);
                         }
                     }
                 }
             }
         } else {
             if ($page == BWP_MINIFY_OPTION_ADVANCED) {
                 // friendly minify url is turned on, add rewrite rules to
                 // server directory config file (e.g. `.htaccess`). This should
                 // not require WordPress's pretty permalink to be turned on
                 if ('yes' != $original_options['enable_fly_min'] && 'yes' == $this->options['enable_fly_min']) {
                     $this->_toggle_rewrite_rules($options, $form);
                 } else {
                     if ('yes' == $original_options['enable_fly_min'] && 'yes' != $this->options['enable_fly_min']) {
                         // remove the rules and flush cache if this setting is
                         // turned off, ingore all error messages for now
                         $this->_remove_rewrite_rules();
                         $this->_flush_cache();
                     }
                 }
             }
         }
     }
     if ($page == BWP_MINIFY_OPTION_GENERAL) {
         // take care of non-POST actions when we're on General Options page
         // re-generate the buster string preview whenever buster type change
         $options['input_custom_buster'] = $this->get_buster($options['select_buster_type']);
         if ('custom' == $options['select_buster_type']) {
             unset($form['input']['input_custom_buster']['disabled']);
         }
         // warns admin that the cache directory does not exist or is not writable
         if (!self::is_normal_admin()) {
             $cache_dir = $this->get_cache_dir();
             if (!file_exists($cache_dir)) {
                 $this->add_notice('<strong>' . __('Warning') . ':</strong> ' . sprintf(__("Cache directory <code>%s</code> does not exist " . "and can not be created automatically. " . "Please manually create the cache folder " . "and make sure that it is writable " . "for Minify to perform more efficiently.", $this->domain), $cache_dir));
             } else {
                 if (!is_writable($cache_dir)) {
                     $this->add_notice('<strong>' . __('Warning') . ':</strong> ' . sprintf(__("Cache directory <code>%s</code> is not writable. " . "Please try CHMOD your cache directory to 755. " . "If you still see this warning, try CHMOD to 777.", $this->domain), $cache_dir));
                 }
             }
         }
     } else {
         if ($page == BWP_MINIFY_OPTION_ADVANCED) {
             // Also remove nginx config path if not on nginx server
             if (!self::is_nginx() || self::is_normal_admin()) {
                 $bwp_option_page->kill_html_fields($form, array('input_nginx_config_file'));
             }
             // Append rewrite rules to the form when fly min is enabled, only
             // for superadmin
             if ($this->options['enable_fly_min'] == 'yes' && !self::is_normal_admin()) {
                 $this->_append_fly_rewrite_rules_to_form($form);
             }
         }
     }
     /* // check for rewrite rules if needed, suppress error */
     /* if ('yes' == $this->options['enable_fly_min']) */
     /* 	$this->_add_rewrite_rules(); */
     // Assign the form and option array
     $bwp_option_page->init($form, $options, $this->form_tabs);
     // Build the option page
     echo $bwp_option_page->generate_html_form();
 }
 /**
  * Build the option pages
  *
  * Utilizes BWP Option Page Builder (@see BWP_OPTION_PAGE)
  */
 function build_option_pages()
 {
     if (!current_user_can(BWP_GXS_CAPABILITY)) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // Init the class
     $page = $_GET['page'];
     $bwp_option_page = new BWP_OPTION_PAGE($page, $this->site_options);
     $options = array();
     $dynamic_options = array();
     if (!empty($page)) {
         if ($page == BWP_GXS_STATS) {
             $bwp_option_page->set_current_tab(1);
             // Clear logs = @since 1.1.0
             if (isset($_POST['clear_log']) && !$this->is_normal_admin()) {
                 check_admin_referer($page);
                 $this->logs = array('log' => array(), 'sitemap' => array());
                 $this->commit_logs();
                 $this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . __("All logs have been cleared successfully!", 'bwp-simple-gxs'));
             }
             $form = array('items' => array('heading', 'heading', 'heading', 'heading', 'checkbox', 'section', 'heading', 'checkbox', 'checkbox'), 'item_labels' => array(__('What are Sitemaps?', 'bwp-simple-gxs'), __('Your sitemaps', 'bwp-simple-gxs'), __('Submit your sitemaps', 'bwp-simple-gxs'), __('Pinging search engines', 'bwp-simple-gxs'), __('Enable pinging functionality?', 'bwp-simple-gxs'), __('Enable pinging individual SE', 'bwp-simple-gxs'), __('Sitemap Generator\'s Log', 'bwp-simple-gxs'), __('Enable logging?', 'bwp-simple-gxs'), __('Enable debugging?', 'bwp-simple-gxs')), 'item_names' => array('h1', 'h2', 'h4', 'h5', 'cb1', 'sec1', 'h3', 'cb2', 'cb3'), 'sec1' => array(array('checkbox', 'name' => 'cb4'), array('checkbox', 'name' => 'cb6')), 'heading' => array('h1' => __('In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site &mdash; <em>http://www.sitemaps.org/</em>', 'bwp-simple-gxs') . '<br /><br />' . __('This plugin helps you generate both Sitemap Index files as well as normal Sitemap files. A Sitemap Index, as its name suggests, is one kind of sitemaps that allows you to group multiple sitemap files inside it.', 'bwp-simple-gxs'), 'h2' => __('<em>Basic information about all your sitemaps.</em>', 'bwp-simple-gxs'), 'h3' => __('<em>More detailed information about how your sitemaps are generated including <span style="color: #999999;">notices</span>, <span style="color: #FF0000;">errors</span> and <span style="color: #009900;">success messages</span>.</em>', 'bwp-simple-gxs'), 'h4' => sprintf(__('<em>Submit your sitemapindex to major search engines like <a href="%s" target="_blank">Google</a>, <a href="%s" target="_blank">Bing</a>.</em>', 'bwp-simple-gxs'), 'https://www.google.com/webmasters/tools/home?hl=en', 'http://www.bing.com/toolbox/webmasters/'), 'h5' => __('<em>Now when you post something new to your blog, you can <em>ping</em> those search engines to tell them your blog just got updated. Pinging could be less effective than you think it is but you should enable such feature anyway.</em>', 'bwp-simple-gxs')), 'input' => array(), 'checkbox' => array('cb1' => array(__('Selected SE below will be pinged when you publish new posts.', 'bwp-simple-gxs') => 'enable_ping'), 'cb2' => array(__('No additional load is needed so enabling this is recommended.', 'bwp-simple-gxs') => 'enable_log'), 'cb3' => array(__('Minor errors will be printed on screen. Also, when debug is on, no caching is used, useful when you develop new modules.', 'bwp-simple-gxs') => 'enable_debug'), 'cb4' => array(__('Google', 'bwp-simple-gxs') => 'enable_ping_google'), 'cb6' => array(__('Bing', 'bwp-simple-gxs') => 'enable_ping_bing')), 'container' => array('h4' => sprintf(__('After you activate this plugin, all sitemaps should be available right away. The next step is to submit the sitemapindex to major search engines. You only need the <strong>sitemapindex</strong> and nothing else, those search engines will automatically recognize other included sitemaps. You can read a small <a href="%s">How-to</a> if you are interested.', 'bwp-simple-gxs'), 'http://help.yahoo.com/l/us/yahoo/smallbusiness/store/promote/sitemap/sitemap-06.html'), 'h3' => $this->get_logs(), 'h2' => $this->get_logs(true)));
             // Add a clear log button - @since 1.1.0
             if (!$this->is_normal_admin()) {
                 add_filter('bwp_option_submit_button', array($this, 'add_clear_log_button'));
             }
             // Get the options
             $options = $bwp_option_page->get_options(array('enable_ping', 'enable_ping_google', 'enable_ping_bing', 'enable_log', 'enable_debug'), $this->options);
             // Get option from the database
             $options = $bwp_option_page->get_db_options($page, $options);
             $option_ignore = array('input_update_services');
             $option_formats = array();
             // [WPMS Compatible]
             $option_super_admin = $this->site_options;
         } else {
             if ($page == BWP_GXS_OPTION_GENERATOR) {
                 $bwp_option_page->set_current_tab(2);
                 //add_filter('bwp_ad_showable', function() { return false;});
                 $form = array('items' => array('input', 'select', 'select', 'select', 'checkbox', 'checkbox', 'input', 'checkbox', 'checkbox', 'checkbox', 'checkbox', 'heading', 'checkbox', 'checkbox', 'checkbox', 'section', 'section', 'section', 'heading', 'input', 'input', 'heading', 'checkbox', 'checkbox', 'input', 'input'), 'item_labels' => array(__('Output no more than', 'bwp-simple-gxs'), __('Default change frequency', 'bwp-simple-gxs'), __('Default priority', 'bwp-simple-gxs'), __('Minimum priority', 'bwp-simple-gxs'), __('Use GMT for Last Modified date?', 'bwp-simple-gxs'), __('Style your sitemaps with an XSLT stylesheet?', 'bwp-simple-gxs'), __('Custom XSLT stylesheet URL', 'bwp-simple-gxs'), __('Show build stats in sitemaps?', 'bwp-simple-gxs'), __('Enable credit?', 'bwp-simple-gxs'), __('Enable Gzip?', 'bwp-simple-gxs'), __('Clean unexpected output before sitemap generation?', 'bwp-simple-gxs'), __('Sitemap Index Options', 'bwp-simple-gxs'), __('Automatically split post-based sitemaps into smaller sitemaps?', 'bwp-simple-gxs'), __('Add sitemapindex to individual blog\'s virtual robots.txt?', 'bwp-simple-gxs'), __('Add sitemapindex from all blogs within network to primary blog\'s virtual robots.txt?', 'bwp-simple-gxs'), __('In sitemapindex, include', 'bwp-simple-gxs'), __('Exclude following post types:', 'bwp-simple-gxs'), __('Exclude following taxonomies:', 'bwp-simple-gxs'), __('Module Options', 'bwp-simple-gxs'), __('Alternate module directory', 'bwp-simple-gxs'), __('Get no more than', 'bwp-simple-gxs'), __('Caching Options', 'bwp-simple-gxs'), __('Enable caching?', 'bwp-simple-gxs'), __('Enable auto cache re-generation?', 'bwp-simple-gxs'), __('Cached sitemaps will last for', 'bwp-simple-gxs'), __('Cached sitemaps are stored in (auto detected)', 'bwp-simple-gxs')), 'item_names' => array('input_item_limit', 'select_default_freq', 'select_default_pri', 'select_min_pri', 'cb14', 'cb10', 'input_custom_xslt', 'cb3', 'cb6', 'cb4', 'cb15', 'h5', 'cb12', 'cb11', 'cb5', 'sec1', 'sec2', 'sec3', 'h4', 'input_alt_module_dir', 'input_sql_limit', 'h3', 'cb1', 'cb2', 'input_cache_age', 'input_cache_dir'), 'heading' => array('h3' => __('<em>Cache your sitemaps for better performance.</em>', 'bwp-simple-gxs'), 'h4' => sprintf(__('<em>This plugin uses modules to build sitemap data so it is recommended that you extend this plugin using modules rather than hooks. Some of the settings below only affect modules extending the base module class. Read more about using modules <a href="%s#using-modules">here</a>.</em>', 'bwp-simple-gxs'), $this->plugin_url), 'h5' => __('<em>Here you can change some settings that affect the default Sitemap Index file.</em>', 'bwp-simple-gxs')), 'sec1' => array(array('checkbox', 'name' => 'cb7'), array('checkbox', 'name' => 'cb9'), array('checkbox', 'name' => 'cb13'), array('checkbox', 'name' => 'cb16'), array('checkbox', 'name' => 'cb17')), 'sec2' => array(), 'sec3' => array(), 'select' => array('select_time_type' => array(__('second(s)', 'bwp-simple-gxs') => 1, __('minute(s)', 'bwp-simple-gxs') => 60, __('hour(s)', 'bwp-simple-gxs') => 3600, __('day(s)', 'bwp-simple-gxs') => 86400), 'select_oldest_type' => array(__('second(s)', 'bwp-simple-gxs') => 1, __('minute(s)', 'bwp-simple-gxs') => 60, __('hour(s)', 'bwp-simple-gxs') => 3600, __('day(s)', 'bwp-simple-gxs') => 86400), 'select_default_freq' => array(), 'select_default_pri' => $this->priority, 'select_min_pri' => $this->priority), 'post' => array('select_default_freq' => sprintf('<a href="%s" target="_blank">' . __('read more', 'bwp-simple-gxs') . '</a>', 'http://sitemaps.org/protocol.php#xmlTagDefinitions'), 'select_default_pri' => sprintf('<a href="%s" target="_blank">' . __('read more', 'bwp-simple-gxs') . '</a>', 'http://sitemaps.org/protocol.php#xmlTagDefinitions'), 'select_min_pri' => sprintf('<a href="%s" target="_blank">' . __('read more', 'bwp-simple-gxs') . '</a>', 'http://sitemaps.org/protocol.php#xmlTagDefinitions')), 'checkbox' => array('cb1' => array(__('your sitemaps are generated and then cached to reduce unnecessary work.', 'bwp-simple-gxs') => 'enable_cache'), 'cb2' => array(__('when a cached sitemap expires, this plugin will try to generate the cache again. If you disable this, remember to manually flush the cache once in a while.', 'bwp-simple-gxs') . ' <input type="submit" class="button-secondary action" name="flush_cache" value="' . __('Flush the cache', 'bwp-simple-gxs') . '" />' => 'enable_cache_auto_gen'), 'cb3' => array(__('tell you useful information such as build time, memory usage, SQL queries, etc.', 'bwp-simple-gxs') => 'enable_stats'), 'cb4' => array(__('make your sitemaps ~ 70% smaller. <strong>Important:</strong> If you see an error after enabling this, it\'s very likely that you have gzip active on your server already.', 'bwp-simple-gxs') => 'enable_gzip'), 'cb15' => array(__('only disable this when sitemaps appear in either blank page or plain text.', 'bwp-simple-gxs') => 'enable_php_clean'), 'cb5' => array(sprintf(__("If you have like 50 blogs, 50 <code>Sitemap: http://example.com/sitemapindex.xml</code> entries will be added to your primary blog's robots.txt, i.e. <code>%s</code>.", 'bwp-simple-gxs'), get_site_option('home') . '/robots.txt') => 'enable_global_robots'), 'cb7' => array(__("taxonomy archives' sitemaps, including custom taxonomies.", 'bwp-simple-gxs') => 'enable_sitemap_taxonomy'), 'cb9' => array(__("date archives' sitemaps.", 'bwp-simple-gxs') => 'enable_sitemap_date'), 'cb13' => array(__("external pages' sitemap. This allows you to add links to pages that do not belong to WordPress to the sitemap.", 'bwp-simple-gxs') => 'enable_sitemap_external'), 'cb6' => array(__('some copyrighted info is also added to your sitemaps. Thanks!', 'bwp-simple-gxs') => 'enable_credit'), 'cb10' => array(__('This will load the default style sheet provided by this plugin. You can set a custom style sheet below or filter the <code>bwp_gxs_xslt</code> hook.', 'bwp-simple-gxs') => 'enable_xslt'), 'cb11' => array(sprintf(__('If you\'re on a Multi-site installation with Sub-domain enabled, each site will have its own robots.txt, sites in sub-directory will not. Please read the <a href="%s#toc-robots" target="_blank">documentation</a> for more info.', 'bwp-simple-gxs'), $this->plugin_url) => 'enable_robots'), 'cb12' => array(__('e.g. post1.xml, post2.xml, etc. And each sitemap will contain', 'bwp-simple-gxs') => 'enable_sitemap_split_post'), 'cb14' => array(__('If you disable this, make sure you also use <code>date_default_timezone_set</code> to correctly set up a timezone for your application.', 'bwp-simple-gxs') => 'enable_gmt'), 'cb16' => array(__('author archives\' sitemap.', 'bwp-simple-gxs') => 'enable_sitemap_author'), 'cb17' => array(__('site\'s home URL sitemap. For a multi-site installation of WordPress, this sitemap will list all domains within your network, not just the main blog. This also supports WPMU Domain Mapping plugin.', 'bwp-simple-gxs') => 'enable_sitemap_site')), 'input' => array('input_item_limit' => array('size' => 5, 'label' => __('item(s) in one sitemap. You can not go over 50,000.', 'bwp-simple-gxs')), 'input_split_limit_post' => array('size' => 5, 'label' => __('item(s). Again , you can not go over 50,000.', 'bwp-simple-gxs')), 'input_alt_module_dir' => array('size' => 91, 'label' => __('Input a full path to the directory where you put your own modules (e.g. <code>/home/mysite/public_html/gxs-modules/</code>), you can also override a built-in module by having a module with the same filename in this directory. A filter is also available if you would like to use PHP instead.', 'bwp-simple-gxs')), 'input_cache_dir' => array('size' => 91, 'disabled' => ' disabled="disabled"', 'label' => __('The cache directory must be writable (i.e. CHMOD to 755 or 777).', 'bwp-simple-gxs')), 'input_sql_limit' => array('size' => 5, 'label' => __('item(s) in one SQL query. This helps you avoid running too heavy queries.', 'bwp-simple-gxs')), 'input_oldest' => array('size' => 3, 'label' => '&mdash;'), 'input_cache_age' => array('size' => 5, 'label' => '&mdash;'), 'input_custom_xslt' => array('size' => 56, 'label' => __('expected to be an absolute URL, e.g. <code>http://example.com/my-stylesheet.xsl</code>. You must also have a style sheet for the sitemapindex that can be accessed through the above URL, e.g. <code>my-stylesheet.xsl</code> and <code>my-stylesheetindex.xsl</code>). Please leave blank if you do not wish to use.', 'bwp-simple-gxs'))), 'inline_fields' => array('input_cache_age' => array('select_time_type' => 'select'), 'cb12' => array('input_split_limit_post' => 'input')), 'container' => array('input_item_limit' => sprintf(__('<em><strong>Note:</strong> If you encounter white page problem, please refer to the <a target="_blank" href="%s">FAQ section</a> to know how to change this limit appropriately to make this plugin work. Also note that, for post-based sitemaps, this option will be overridden by the limit you set in the Sitemap Index Options below.</em>', 'bwp-simple-gxs'), $this->plugin_url . 'faq/')));
                 foreach ($this->frequency as $freq) {
                     $changefreq[ucfirst($freq)] = $freq;
                 }
                 $form['select']['select_default_freq'] = $changefreq;
                 // Get the options
                 $options = $bwp_option_page->get_options(array('input_item_limit', 'input_split_limit_post', 'input_alt_module_dir', 'input_cache_dir', 'input_sql_limit', 'input_cache_age', 'input_custom_xslt', 'input_exclude_post_type', 'input_exclude_taxonomy', 'enable_gmt', 'enable_robots', 'enable_xslt', 'enable_cache', 'enable_cache_auto_gen', 'enable_stats', 'enable_credit', 'enable_sitemap_split_post', 'enable_global_robots', 'enable_sitemap_date', 'enable_sitemap_taxonomy', 'enable_sitemap_external', 'enable_sitemap_author', 'enable_sitemap_site', 'enable_gzip', 'enable_php_clean', 'select_time_type', 'select_default_freq', 'select_default_pri', 'select_min_pri'), $this->options);
                 // Get option from the database
                 $options = $bwp_option_page->get_db_options($page, $options);
                 // Get dynamic options
                 if (isset($_POST['submit_' . $bwp_option_page->get_form_name()])) {
                     check_admin_referer($page);
                     $ept = array();
                     $etax = array();
                     foreach ($_POST as $o => $v) {
                         if (strpos($o, 'ept_') === 0) {
                             $ept[] = trim(str_replace('ept_', '', $o));
                         } else {
                             if (strpos($o, 'etax_') === 0) {
                                 $etax[] = trim(str_replace('etax_', '', $o));
                             }
                         }
                     }
                     $options['input_exclude_post_type'] = implode(',', $ept);
                     $options['input_exclude_taxonomy'] = implode(',', $etax);
                 }
                 // Build dynamic options
                 $post_types = get_post_types(array('public' => true), 'objects');
                 $taxonomies = get_taxonomies(array('public' => true), '');
                 $exclude_options = array('post_types' => explode(',', $options['input_exclude_post_type']), 'taxonomies' => explode(',', $options['input_exclude_taxonomy']));
                 $dynamic_options = array();
                 foreach ($post_types as $post_type) {
                     if ('attachment' == $post_type->name) {
                         continue;
                     }
                     $key = 'ept_' . $post_type->name;
                     $form['sec2'][] = array('checkbox', 'name' => $key);
                     $form['checkbox'][$key] = array(__($post_type->label) => $key);
                     if (in_array($post_type->name, $exclude_options['post_types'])) {
                         $dynamic_options[$key] = 'yes';
                     } else {
                         $dynamic_options[$key] = '';
                     }
                 }
                 foreach ($taxonomies as $taxonomy) {
                     if ('post_format' == $taxonomy->name) {
                         continue;
                     }
                     $key = 'etax_' . $taxonomy->name;
                     $form['sec3'][] = array('checkbox', 'name' => $key);
                     $form['checkbox'][$key] = array(__($taxonomy->label) => $key);
                     if (in_array($taxonomy->name, $exclude_options['taxonomies'])) {
                         $dynamic_options[$key] = 'yes';
                     } else {
                         $dynamic_options[$key] = '';
                     }
                 }
                 $option_formats = array('input_item_limit' => 'int', 'input_split_limit_post' => 'int', 'input_sql_limit' => 'int', 'input_cache_age' => 'int', 'select_time_type' => 'int');
                 $option_ignore = array('input_cache_dir', 'input_exclude_post_type', 'input_exclude_taxonomy');
                 // [WPMS Compatible]
                 $option_super_admin = $this->site_options;
             } else {
                 if ($page == BWP_GXS_GOOGLE_NEWS) {
                     $bwp_option_page->set_current_tab(3);
                     // Save news categories settings
                     if (isset($_POST['submit_bwp_gxs_google_news'])) {
                         check_admin_referer($page);
                         // News cats & News genres
                         $news_cats = array();
                         $news_genres = array();
                         $categories = get_categories(array('hide_empty' => 0));
                         foreach ($categories as $category) {
                             if (!empty($_POST[$category->slug])) {
                                 $news_cats[] = $category->term_id;
                             }
                             if (isset($_POST[$category->slug . '_genres']) && is_array($_POST[$category->slug . '_genres'])) {
                                 $genres = $_POST[$category->slug . '_genres'];
                                 $genres_string = array();
                                 foreach ($genres as $genre) {
                                     $genres_string[] = trim($genre);
                                 }
                                 $news_genres['cat_' . $category->term_id] = implode(', ', $genres_string);
                             }
                         }
                         $this->options['select_news_cats'] = implode(',', $news_cats);
                         $this->options['input_news_genres'] = $news_genres;
                     }
                     $form = array('items' => array('heading', 'checkbox', 'checkbox', 'checkbox', 'checkbox', 'select', 'heading', 'select'), 'item_labels' => array(__('What is a Google News Sitemap?', 'bwp-simple-gxs'), __('Enable this module?', 'bwp-simple-gxs'), __('Enable Multi-category Mode?', 'bwp-simple-gxs'), __('Ping Search Engines when you publish a news article?', 'bwp-simple-gxs'), __('Use keywords in News Sitemap?', 'bwp-simple-gxs'), __('News Sitemap\'s language', 'bwp-simple-gxs'), __('News Categories', 'bwp-simple-gxs'), __('This module will', 'bwp-simple-gxs')), 'item_names' => array('h1', 'cb1', 'cb4', 'cb3', 'cb2', 'select_news_lang', 'h2', 'select_news_cat_action'), 'heading' => array('h1' => __('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 articles &mdash; <em>http://support.google.com/</em>', 'bwp-simple-gxs'), 'h2' => __('<em>Below you will be able to choose what categories to use (or not use) in the news sitemap. You can also assign genres to a specific category.</em>', 'bwp-simple-gxs')), 'post' => array('select_news_cat_action' => __('below selected categories in the news sitemap.', 'bwp-simple-gxs')), 'select' => array('select_news_lang' => array(__('English', 'bwp-simple-gxs') => 'en', __('Dutch', 'bwp-simple-gxs') => 'nl', __('French', 'bwp-simple-gxs') => 'fr', __('German', 'bwp-simple-gxs') => 'de', __('Italian', 'bwp-simple-gxs') => 'it', __('Norwegian', 'bwp-simple-gxs') => 'no', __('Portuguese', 'bwp-simple-gxs') => 'pt', __('Polish', 'bwp-simple-gxs') => 'pl', __('Russian', 'bwp-simple-gxs') => 'ru', __('Simplified Chinese', 'bwp-simple-gxs') => 'zh-cn', __('Spanish', 'bwp-simple-gxs') => 'es', __('Turkish', 'bwp-simple-gxs') => 'tr', __('Vietnamese', 'bwp-simple-gxs') => 'vi'), 'select_news_cat_action' => array(__('include', 'bwp-simple-gxs') => 'inc', __('exclude', 'bwp-simple-gxs') => 'exc'), 'select_news_keyword_type' => array(__('news categories', 'bwp-simple-gxs') => 'cat', __('news tags', 'bwp-simple-gxs') => 'tag')), 'input' => array(), 'checkbox' => array('cb1' => array(__('A new <code>post_google_news.xml</code> sitemap will be added to the main <code>sitemapindex.xml</code>.', 'bwp-simple-gxs') => 'enable_news_sitemap'), 'cb2' => array(__('Keywords are derived from', 'bwp-simple-gxs') => 'enable_news_keywords'), 'cb3' => array(__('This ping works separately from the sitemapindex ping, and only occurs when you publish an article in one of the news categories set below.', 'bwp-simple-gxs') => 'enable_news_ping'), 'cb4' => array(__('This mode is meant for News Blogs that have posts assigned to more than one categories. It is an advanced feature and should only be enabled if you do have similar blogs.', 'bwp-simple-gxs') => 'enable_news_multicat')), 'inline_fields' => array('cb2' => array('select_news_keyword_type' => 'select')), 'post' => array('select_news_keyword_type' => __('. Do <strong>NOT</strong> use news tags if your news sitemap contains a lot of posts as it can be very inefficient to do so. This will be improved in future versions.', 'bwp-simple-gxs')), 'container' => array('select_news_cat_action' => $this->get_news_cats()));
                     // Get the options
                     $options = $bwp_option_page->get_options(array('enable_news_sitemap', 'enable_news_ping', 'enable_news_keywords', 'enable_news_multicat', 'select_news_lang', 'select_news_keyword_type', 'select_news_cat_action', 'select_news_cats', 'input_news_genres'), $this->options);
                     // Get option from the database
                     $options = $bwp_option_page->get_db_options($page, $options);
                     $options['select_news_cats'] = $this->options['select_news_cats'];
                     $options['input_news_genres'] = $this->options['input_news_genres'];
                     $option_ignore = array('select_news_cats', 'input_news_genres');
                     $option_formats = array();
                     $option_super_admin = $this->site_options;
                 }
             }
         }
     }
     // Flush the cache
     if (isset($_POST['flush_cache']) && !$this->is_normal_admin()) {
         check_admin_referer($page);
         if ($deleted = $this->flush_cache()) {
             $this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . sprintf(__("<strong>%d</strong> cached sitemaps have been flushed successfully!", 'bwp-simple-gxs'), $deleted));
         } else {
             $this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . __("Could not delete any cached sitemaps. Please manually check the cache directory.", 'bwp-simple-gxs'));
         }
     }
     // Get option from user input
     if (isset($_POST['submit_' . $bwp_option_page->get_form_name()]) && isset($options) && is_array($options)) {
         check_admin_referer($page);
         $need_flushed = false;
         foreach ($options as $key => &$option) {
             $pre_option = $option;
             // Get rid of options that do not have a key
             if (preg_match('/^[0-9]+$/i', $key)) {
                 unset($options[$key]);
                 continue;
             }
             // [WPMS Compatible]
             if ($this->is_normal_admin() && in_array($key, $option_super_admin)) {
             } else {
                 if (in_array($key, $option_ignore)) {
                 } else {
                     if (isset($_POST[$key])) {
                         $bwp_option_page->format_field($key, $option_formats);
                     }
                     if (!isset($_POST[$key])) {
                         $option = '';
                     } else {
                         if (isset($option_formats[$key]) && 0 == $_POST[$key] && 'int' == $option_formats[$key]) {
                             $option = 0;
                         } else {
                             if (isset($option_formats[$key]) && empty($_POST[$key]) && 'int' == $option_formats[$key]) {
                                 $option = $this->options_default[$key];
                             } else {
                                 if (!empty($_POST[$key])) {
                                     $option = trim(stripslashes($_POST[$key]));
                                 } else {
                                     $option = $this->options_default[$key];
                                 }
                             }
                         }
                     }
                     // Mark that we need to flush rewrite rules
                     if (false !== strpos($key, 'enable_sitemap_') && $pre_option != $option) {
                         $need_flushed = true;
                     }
                 }
             }
         }
         update_option($page, $options);
         // Flush rewrite rules if needed
         if ($need_flushed) {
             self::flush_rewrite_rules();
         }
         // [WPMS Compatible]
         if (!$this->is_normal_admin()) {
             update_site_option($page, $options);
         }
         // Update options successfully
         $this->add_notice(__("All options have been saved.", 'bwp-simple-gxs'));
     }
     // [WPMS Compatible]
     if (!$this->is_multisite() && $page == BWP_GXS_OPTION_GENERATOR) {
         $bwp_option_page->kill_html_fields($form, array(14));
     }
     if ($this->is_normal_admin()) {
         switch ($page) {
             case BWP_GXS_OPTION_GENERATOR:
                 $bwp_option_page->kill_html_fields($form, array(9, 10, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25));
                 break;
             case BWP_GXS_STATS:
                 $bwp_option_page->kill_html_fields($form, array(3, 4, 5, 6, 7, 8));
                 add_filter('bwp_option_submit_button', create_function('', 'return "";'));
                 break;
         }
     }
     if (!@file_exists($this->options['input_cache_dir']) || !@is_writable($this->options['input_cache_dir'])) {
         $this->add_notice('<strong>' . __('Warning') . ':</strong> ' . __("Cache directory does not exist or is not writable. Please read more about directory permission <a href='http://www.zzee.com/solutions/unix-permissions.shtml'>here</a> (Unix).", 'bwp-simple-gxs'));
     }
     // Assign the form and option array
     $bwp_option_page->init($form, $options + $dynamic_options, $this->form_tabs);
     // Build the option page
     echo $bwp_option_page->generate_html_form();
 }