public function handle_ajax_request()
 {
     global $itsec_globals;
     if (WP_DEBUG) {
         ini_set('display_errors', 1);
     }
     $method = isset($_POST['method']) && is_string($_POST['method']) ? $_POST['method'] : '';
     $module = isset($_POST['module']) && is_string($_POST['module']) ? $_POST['module'] : '';
     if (false === check_ajax_referer('itsec-settings-nonce', 'nonce', false)) {
         ITSEC_Response::add_error(new WP_Error('itsec-settings-page-failed-nonce', __('A nonce security check failed, preventing the request from completing as expected. Please try reloading the page and trying again.', 'better-wp-security')));
     } else {
         if (!ITSEC_Core::current_user_can_manage()) {
             ITSEC_Response::add_error(new WP_Error('itsec-settings-page-insufficient-privileges', __('A permissions security check failed, preventing the request from completing as expected. The currently logged in user does not have sufficient permissions to make this request. Please try reloading the page and trying again.', 'better-wp-security')));
         } else {
             if (empty($method)) {
                 ITSEC_Response::add_error(new WP_Error('itsec-settings-page-missing-method', __('The server did not receive a valid request. The required "method" argument is missing. Please try again.', 'better-wp-security')));
             } else {
                 if ('save' === $method) {
                     $this->handle_post();
                 } else {
                     if (empty($module)) {
                         ITSEC_Response::add_error(new WP_Error('itsec-settings-page-missing-module', __('The server did not receive a valid request. The required "module" argument is missing. Please try again.', 'better-wp-security')));
                     } else {
                         if ('activate' === $method) {
                             ITSEC_Response::set_response(ITSEC_Modules::activate($module));
                         } else {
                             if ('deactivate' === $method) {
                                 ITSEC_Response::set_response(ITSEC_Modules::deactivate($module));
                             } else {
                                 if ('is_active' === $method) {
                                     ITSEC_Response::set_response(ITSEC_Modules::is_active($module));
                                 } else {
                                     if ('get_refreshed_module_settings' === $method) {
                                         ITSEC_Response::set_response($this->get_module_settings($module));
                                     } else {
                                         if ('get_refreshed_widget_settings' === $method) {
                                             ITSEC_Response::set_response($this->get_widget_settings($module));
                                         } else {
                                             if ('handle_module_request' === $method) {
                                                 if (isset($this->modules[$module])) {
                                                     if (isset($_POST['data'])) {
                                                         $returned_value = $this->modules[$module]->handle_ajax_request($_POST['data']);
                                                         if (!is_null($returned_value)) {
                                                             ITSEC_Response::set_response($returned_value);
                                                         }
                                                     } else {
                                                         ITSEC_Response::add_error(new WP_Error('itsec-settings-page-module-request-missing-data', __('The server did not receive a valid request. The required "data" argument for the module is missing. Please try again.', 'better-wp-security')));
                                                     }
                                                 } else {
                                                     ITSEC_Response::add_error(new WP_Error('itsec-settings-page-module-request-invalid-module', __("The server did not receive a valid request. The supplied module, \"{$module}\", does not exist. Please try again.", 'better-wp-security')));
                                                 }
                                             } else {
                                                 if ('handle_widget_request' === $method) {
                                                     if (isset($this->widgets[$module])) {
                                                         if (isset($_POST['data'])) {
                                                             $this->widgets[$module]->handle_ajax_request($_POST['data']);
                                                         } else {
                                                             ITSEC_Response::add_error(new WP_Error('itsec-settings-page-widget-request-missing-data', __('The server did not receive a valid request. The required "data" argument for the widget is missing. Please try again.', 'better-wp-security')));
                                                         }
                                                     } else {
                                                         ITSEC_Response::add_error(new WP_Error('itsec-settings-page-widget-request-invalid-widget', __("The server did not receive a valid request. The supplied widget, \"{$module}\", does not exist. Please try again.", 'better-wp-security')));
                                                     }
                                                 } else {
                                                     ITSEC_Response::add_error(new WP_Error('itsec-settings-page-unknown-method', __('The server did not receive a valid request. An unknown "method" argument was supplied. Please try again.', 'better-wp-security')));
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     ITSEC_Response::send_json();
 }