'."\n"; } public function HTTP404() { if(is_404()) { status_header(200); add_filter('wp_robots', 'wp_robots_no_robots'); } } function RenderSettingsPage() { ?>

4DUser Plugin Settings

Page indexing options

'; } function SettingRemoveFromSearchIndexPagesThatDoNotExist() { $options = get_option('4duser_seo_plugin_options'); $option_key = 'remove_from_search_index_pages_that_do_not_exist'; $is_checked = isset($options[$option_key]) && $options[$option_key] === 'on'; echo ''; } function SanitizeOptions($array) { if(IsSet($array)) { foreach($array as $key => &$value) { if(is_array($value)) { $value = $this->SanitizeOptions($value); } else { switch($key) { case 'remove_from_search_index_pages_that_do_not_exist': default: $value = sanitize_text_field($value); break; } } } } return $array; } function RegisterSettings() { register_setting('4duser_seo_plugin_options', '4duser_seo_plugin_options', array( 'type'=>'array', 'default'=>array( 'remove_from_search_index_pages_that_do_not_exist'=>'on' ), 'sanitize_callback' => array($this, 'SanitizeOptions'), )); add_settings_section('seo_settings', 'Search Engine Optimization Options', array($this, 'SettingsHeader'), '4duser_seo_plugin'); add_settings_field('for_the_user_plugin_settings_remove_from_search_index_pages_that_do_not_exist', 'Remove from search engines\' index pages that do not exist', array($this, 'SettingRemoveFromSearchIndexPagesThatDoNotExist'), '4duser_seo_plugin', 'seo_settings'); } public function Initialize() { if($this->debug) add_action('admin_head', array($this, 'AdminHead')); add_action('template_redirect', array( $this, 'HTTP404')); add_action('admin_menu', array($this, 'AddSettingsPage')); add_action('admin_init', array($this, 'RegisterSettings')); return true; } public function Process() { return false; } public function Finalize($success) { return $success; } }; $for_the_user_seo = new plugin_use_case_class; if($for_the_user_seo->Initialize()) { $success = $for_the_user_seo->Initialize(); $success = $for_the_user_seo->Finalize($success); }