settings = SettingsManager::get_instance(); $this->init_hooks(); } private function get_setting($key, $default = '') { return $this->settings->get('secure_guard', $key, $default); } private function init_hooks() { if ($this->get_setting('disable_xmlrpc')) { add_filter('xmlrpc_enabled', '__return_false'); } if ($this->get_setting('disable_file_editing')) { if (!defined('DISALLOW_FILE_EDIT')) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound define('DISALLOW_FILE_EDIT', true); } } if ($this->get_setting('hide_wp_version')) { add_filter('the_generator', '__return_empty_string'); } if ($this->get_setting('login_errors')) { add_filter('login_errors', function() { return __('Login failed. Please try again.', 'admin-menu-optimizer'); }); } } public function render_settings() { $settings = [ 'disable_xmlrpc' => ['type' => 'checkbox', 'label' => __('Disable XML-RPC', 'admin-menu-optimizer')], 'disable_file_editing' => ['type' => 'checkbox', 'label' => __('Disable File Editing', 'admin-menu-optimizer')], 'hide_wp_version' => ['type' => 'checkbox', 'label' => __('Hide WordPress Version', 'admin-menu-optimizer')], 'login_errors' => ['type' => 'checkbox', 'label' => __('Generic Login Error Message', 'admin-menu-optimizer')], ]; echo '
| ' . esc_html($field['label']) . ' | '; echo ''; if ($field['type'] === 'checkbox') { echo ''; } echo ' | '; echo '
|---|