当前位置: 首页>>代码示例>>PHP>>正文


PHP ITSEC_Modules::activate方法代码示例

本文整理汇总了PHP中ITSEC_Modules::activate方法的典型用法代码示例。如果您正苦于以下问题:PHP ITSEC_Modules::activate方法的具体用法?PHP ITSEC_Modules::activate怎么用?PHP ITSEC_Modules::activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITSEC_Modules的用法示例。


在下文中一共展示了ITSEC_Modules::activate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute_upgrade

 /**
  * Execute module upgrade
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_ipcheck');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             $settings = ITSEC_Modules::get_defaults('network-brute-force');
             if (isset($current_options['api_ban'])) {
                 $settings['enable_ban'] = $current_options['api_ban'];
             }
             // Make sure the new module is properly activated or deactivated
             if ($settings['enable_ban']) {
                 ITSEC_Modules::activate('network-brute-force');
             } else {
                 ITSEC_Modules::deactivate('network-brute-force');
             }
             if (!empty($current_options['api_key'])) {
                 $settings['api_key'] = $current_options['api_key'];
                 // Don't ask users to sign up if they already have
                 $settings['api_nag'] = false;
             }
             if (!empty($current_options['api_s'])) {
                 $settings['api_secret'] = $current_options['api_s'];
             }
             if (!empty($current_options['optin'])) {
                 $settings['updates_optin'] = $current_options['optin'];
             }
             ITSEC_Modules::set_settings('network-brute-force', $settings);
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:36,代码来源:setup.php

示例2: handle_ajax_request

 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();
 }
开发者ID:AcademicTechnologyCenter,项目名称:ATC-Quality-Tracking,代码行数:78,代码来源:page-settings.php

示例3: activate_network_brute_force

 public static function activate_network_brute_force()
 {
     $settings = ITSEC_Modules::get_settings('network-brute-force');
     $settings['email'] = $_POST['data']['email'];
     $settings['updates_optin'] = $_POST['data']['updates_optin'];
     $settings['api_nag'] = false;
     $results = ITSEC_Modules::set_settings('network-brute-force', $settings);
     if (is_wp_error($results)) {
         ITSEC_Response::add_error($results);
     } else {
         if ($results['saved']) {
             ITSEC_Modules::activate('network-brute-force');
             ITSEC_Response::add_js_function_call('setModuleToActive', 'network-brute-force');
             ITSEC_Response::set_response('<p>' . __('Your site is now using Network Brute Force Protection.', 'better-wp-security') . '</p>');
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:17,代码来源:scanner.php


注:本文中的ITSEC_Modules::activate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。