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


PHP ITSEC_Modules::set_settings方法代码示例

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


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

示例1: execute_upgrade

 /**
  * Execute module upgrade
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         $current_options = get_site_option('itsec_ssl');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['frontend'] = isset($itsec_bwps_options['ssl_frontend']) ? intval($itsec_bwps_options['ssl_frontend']) : 0;
             update_site_option('itsec_ssl', $current_options);
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_ssl');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $on) {
                 if ($on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('ssl');
             } else {
                 ITSEC_Modules::deactivate('ssl');
             }
             // remove 'enabled' which isn't used in the new module
             unset($current_options['enabled']);
             ITSEC_Modules::set_settings('ssl', $current_options);
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:40,代码来源:setup.php

示例2: handle_form_post

 public function handle_form_post($data)
 {
     $retval = ITSEC_Modules::set_settings($this->id, $data);
     if ($retval['saved']) {
         if ($retval['old_settings']['show_error_codes'] !== $retval['new_settings']['show_error_codes']) {
             ITSEC_Response::add_js_function_call('itsec_change_show_error_codes', array((bool) $retval['new_settings']['show_error_codes']));
         }
         if ($retval['old_settings']['write_files'] !== $retval['new_settings']['write_files']) {
             ITSEC_Response::add_js_function_call('itsec_change_write_files', array((bool) $retval['new_settings']['write_files']));
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:12,代码来源:settings-page.php

示例3: handle_ajax_request

 public function handle_ajax_request($data)
 {
     if ('reset-api-key' === $data['method']) {
         $defaults = ITSEC_Modules::get_defaults($this->id);
         $results = ITSEC_Modules::set_settings($this->id, $defaults);
         ITSEC_Response::set_response($results['saved']);
         ITSEC_Response::add_errors($results['errors']);
         ITSEC_Response::add_messages($results['messages']);
         if ($results['saved']) {
             ITSEC_Response::reload_module($this->id);
         } else {
             if (empty($results['errors'])) {
                 ITSEC_Response::add_error(new WP_Error('itsec-network-brute-force-settings-page-handle-ajax-request-bad-response', __('An unknown error prevented the API key from being reset properly. An unrecognized response was received. Please wait a few minutes and try again.', 'better-wp-security')));
             }
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:17,代码来源:settings-page.php

示例4: execute_file_check

 public function execute_file_check($scheduled_call = true, $return_data = false)
 {
     global $itsec_logger, $itsec_globals;
     if (false === $this->running) {
         $this->running = true;
         $send_email = true;
         ITSEC_Lib::set_minimum_memory_limit('256M');
         $itsec_files = ITSEC_Core::get_itsec_files();
         if ($itsec_files->get_file_lock('file_change', 300)) {
             //make sure it isn't already running
             define('ITSEC_DOING_FILE_CHECK', true);
             //figure out what chunk we're on
             if (isset($this->settings['split']) && true === $this->settings['split']) {
                 if (isset($this->settings['last_chunk']) && false !== $this->settings['last_chunk'] && $this->settings['last_chunk'] < 6) {
                     $chunk = $this->settings['last_chunk'] + 1;
                 } else {
                     $chunk = 0;
                 }
             } else {
                 $chunk = false;
             }
             if (false !== $chunk) {
                 $db_field = 'itsec_local_file_list_' . $chunk;
             } else {
                 $db_field = 'itsec_local_file_list';
             }
             //set base memory
             $memory_used = @memory_get_peak_usage();
             $logged_files = get_site_option($db_field);
             //if there are no old files old file list is an empty array
             if (false === $logged_files) {
                 $send_email = false;
                 $logged_files = array();
                 if (is_multisite()) {
                     add_site_option($db_field, $logged_files);
                 } else {
                     add_option($db_field, $logged_files, '', 'no');
                 }
             }
             do_action('itsec-file-change-start-scan');
             $current_files = $this->scan_files('', $scheduled_call, $chunk);
             //scan current files
             do_action('itsec-file-change-end-scan');
             $files_added = @array_diff_assoc($current_files, $logged_files);
             //files added
             $files_removed = @array_diff_assoc($logged_files, $current_files);
             //files deleted
             $current_minus_added = @array_diff_key($current_files, $files_added);
             //remove all added files from current filelist
             $logged_minus_deleted = @array_diff_key($logged_files, $files_removed);
             //remove all deleted files from old file list
             $files_changed = array();
             //array of changed files
             do_action('itsec-file-change-start-hash-comparisons');
             //compare file hashes and mod dates
             foreach ($current_minus_added as $current_file => $current_attr) {
                 if (array_key_exists($current_file, $logged_minus_deleted)) {
                     //if attributes differ added to changed files array
                     if (isset($current_attr['mod_date']) && 0 != strcmp($current_attr['mod_date'], $logged_minus_deleted[$current_file]['mod_date']) || 0 != strcmp($current_attr['d'], $logged_minus_deleted[$current_file]['d']) || (isset($current_attr['hash']) && 0 != strcmp($current_attr['hash'], $logged_minus_deleted[$current_file]['hash']) || 0 != strcmp($current_attr['h'], $logged_minus_deleted[$current_file]['h']))) {
                         $remote_check = apply_filters('itsec_process_changed_file', true, $current_file, $current_attr['h']);
                         //hook to run actions on a changed file at time of discovery
                         if (true === $remote_check) {
                             //don't list the file if it matches the WordPress.org hash
                             $files_changed[$current_file]['h'] = isset($current_attr['hash']) ? $current_attr['hash'] : $current_attr['h'];
                             $files_changed[$current_file]['d'] = isset($current_attr['mod_date']) ? $current_attr['mod_date'] : $current_attr['d'];
                         }
                     }
                 }
             }
             //get count of changes
             $files_added_count = sizeof($files_added);
             $files_deleted_count = sizeof($files_removed);
             $files_changed_count = sizeof($files_changed);
             if (0 < $files_added_count) {
                 $files_added = apply_filters('itsec_process_added_files', $files_added);
                 //hook to run actions on all files added
                 $files_added_count = sizeof($files_added);
             }
             if (0 < $files_deleted_count) {
                 do_action('itsec_process_removed_files', $files_removed);
                 //hook to run actions on all files removed
             }
             do_action('itsec-file-change-end-hash-comparisons');
             //create single array of all changes
             $full_change_list = array('added' => $files_added, 'removed' => $files_removed, 'changed' => $files_changed);
             $this->settings['latest_changes'] = array('added' => count($files_added), 'removed' => count($files_removed), 'changed' => count($files_changed));
             update_site_option($db_field, $current_files);
             //Cleanup variables when we're done with them
             unset($files_added);
             unset($files_removed);
             unset($files_changed);
             unset($current_files);
             $this->settings['last_run'] = $itsec_globals['current_time'];
             $this->settings['last_chunk'] = $chunk;
             ITSEC_Modules::set_settings('file-change', $this->settings);
             //get new max memory
             $check_memory = @memory_get_peak_usage();
             if ($check_memory > $memory_used) {
                 $memory_used = $check_memory - $memory_used;
             }
//.........这里部分代码省略.........
开发者ID:Haydt45,项目名称:justinhaydt.com,代码行数:101,代码来源:scanner.php

示例5: handle_form_post

 /**
  * Process form input.
  *
  * This function should be left as-is in subclasses unless specific processing is required.
  *
  * @access public
  *
  * @param array $data Array of form inputs to be processed and stored.
  */
 public function handle_form_post($data)
 {
     ITSEC_Modules::set_settings($this->id, $data);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:13,代码来源:module-settings.php

示例6: 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

示例7: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     $details = ITSEC_Away_Mode::is_active(true);
     $settings = ITSEC_Modules::get_settings('away-mode');
     $defaults = ITSEC_Modules::get_defaults('away-mode');
     $errors = array();
     if ('activate' === $arguments['intention']) {
         if ($details['active']) {
             $action = 'stayed-active';
             $success = true;
         } else {
             if ($details['override_active'] && 'deactivate' === $details['override_type']) {
                 $action = 'removed-deactivate-override';
                 $settings['override_type'] = $defaults['override_type'];
                 $settings['override_end'] = $defaults['override_end'];
             } else {
                 if (false === $details['next']) {
                     $action = 'denied-activate';
                     $errors[] = new WP_Error('itsec-sync-verb-itsec-override-away-mode-cannot-override-activate-expired-one-time', __('iThemes Security received a request to modify the override behavior of the Away Mode module. However, the request is invalid as the module is configured for a one-time lockout that occurred in the past. Allowing an activate override would result in an unending Away Mode lockout.', 'better-wp-security'));
                     $success = false;
                 } else {
                     $action = 'added-activate-override';
                     $settings['override_type'] = 'activate';
                     $settings['override_end'] = ITSEC_Core::get_current_time() + $details['next'];
                 }
             }
         }
     } else {
         if ('deactivate' === $arguments['intention']) {
             if (!$details['active']) {
                 $action = 'stayed-inactive';
                 $success = true;
             } else {
                 if ($details['override_active'] && 'activate' === $details['override_type']) {
                     $action = 'removed-activate-override';
                     $settings['override_type'] = $defaults['override_type'];
                     $settings['override_end'] = $defaults['override_end'];
                 } else {
                     $action = 'added-deactivate-override';
                     $settings['override_type'] = 'deactivate';
                     $settings['override_end'] = ITSEC_Core::get_current_time() + $details['remaining'];
                 }
             }
         } else {
             if (empty($arguments['intention'])) {
                 $action = 'missing-intention';
                 $errors[] = new WP_Error('itsec-sync-verb-itsec-override-away-mode-missing-intention', __('iThemes Security received a request to modify the override behavior of the Away Mode module. However, the request is invalid as the required "intention" argument is missing.', 'better-wp-security'));
                 $success = false;
             } else {
                 $action = 'unknown-intention';
                 $errors[] = new WP_Error('itsec-sync-verb-itsec-override-away-mode-unknown-intention', sprintf(__('iThemes Security received a request to modify the override behavior of the Away Mode module. However, the request is invalid as the required "intention" argument is set to an unrecognized value: "".', 'better-wp-security'), $arguments['intention']));
                 $success = false;
             }
         }
     }
     if (!isset($success)) {
         ITSEC_Core::set_interactive(false);
         $results = ITSEC_Modules::set_settings('away-mode', $settings);
         if ($results['saved']) {
             $success = true;
         } else {
             $errors = $results['errors'];
             $success = false;
         }
     }
     if ($success) {
         $status = "{$arguments['intention']}d";
     } else {
         $status = 'error';
     }
     $response = array('api' => '1', 'status' => $status, 'action' => $action, 'errors' => $errors, 'details' => ITSEC_Away_Mode::is_active(true));
     return $response;
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:74,代码来源:class-ithemes-sync-verb-itsec-override-away-mode.php


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