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


PHP ITSEC_Modules::get_settings方法代码示例

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


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

示例1: validate_settings

 protected function validate_settings()
 {
     if (!$this->can_save()) {
         return;
     }
     $previous_settings = ITSEC_Modules::get_settings($this->get_id());
     $diff = array_diff_assoc($this->settings, $previous_settings);
     if (!empty($diff)) {
         ITSEC_Response::regenerate_server_config();
     }
     if ($this->settings['write_permissions']) {
         // Always set permissions to 0444 when saving the settings.
         // This ensures that the file permissions are fixed each time the settings are saved.
         $new_permissions = 0444;
     } else {
         if ($this->settings['write_permissions'] !== $previous_settings['write_permissions']) {
             // Only revert the settings to the defaults when disabling the setting.
             // This avoids changing the file permissions when the setting has yet to be enabled and disabled.
             $new_permissions = 0664;
         }
     }
     if (isset($new_permissions)) {
         // Only change the permissions when needed.
         require_once ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-config-file.php';
         require_once ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-file.php';
         $server_config_file = ITSEC_Lib_Config_File::get_server_config_file_path();
         $wp_config_file = ITSEC_Lib_Config_File::get_wp_config_file_path();
         ITSEC_Lib_File::chmod($server_config_file, $new_permissions);
         ITSEC_Lib_File::chmod($wp_config_file, $new_permissions);
         ITSEC_Response::reload_module('file-permissions');
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:32,代码来源:validator.php

示例2: __construct

 private function __construct()
 {
     global $itsec_globals;
     $this->settings = ITSEC_Modules::get_settings('file-change');
     $this->running = false;
     $this->excludes = array('file_change.lock', ITSEC_Modules::get_setting('backup', 'location'), ITSEC_Modules::get_setting('global', 'log_location'), '.lock');
 }
开发者ID:Haydt45,项目名称:justinhaydt.com,代码行数:7,代码来源:scanner.php

示例3: run

 /**
  * Setup the module's functionality.
  *
  * Loads the backup detection module's unpriviledged functionality including
  * performing the scans themselves.
  *
  * @since 4.0.0
  *
  * @return void
  */
 function run()
 {
     global $itsec_globals;
     $this->settings = ITSEC_Modules::get_settings('backup');
     add_action('itsec_execute_backup_cron', array($this, 'do_backup'));
     add_filter('itsec_logger_modules', array($this, 'register_logger'));
     if (defined('ITSEC_BACKUP_CRON') && true === ITSEC_BACKUP_CRON) {
         if (!wp_next_scheduled('itsec_execute_backup_cron')) {
             wp_schedule_event(time(), 'daily', 'itsec_execute_backup_cron');
         }
         // When ITSEC_BACKUP_CRON is enabled, skip the regular scheduling system.
         return;
     }
     if (defined('DOING_AJAX') && DOING_AJAX) {
         // Don't run on AJAX requests.
         return;
     }
     if (class_exists('pb_backupbuddy')) {
         // Don't run when BackupBuddy is active.
         return;
     }
     if ($this->settings['interval'] <= 0) {
         // Don't run when the interval is zero or less.
         return;
     }
     $next_run = $this->settings['last_run'] + $this->settings['interval'] * DAY_IN_SECONDS;
     if ($next_run <= $itsec_globals['current_time_gmt']) {
         add_action('init', array($this, 'do_backup'), 10, 0);
     }
 }
开发者ID:Haydt45,项目名称:justinhaydt.com,代码行数:40,代码来源:class-itsec-backup.php

示例4: enqueue_scripts_and_styles

 public function enqueue_scripts_and_styles()
 {
     $settings = ITSEC_Modules::get_settings($this->id);
     $vars = array('resetting_button_text' => __('Resetting...', 'better-wp-security'));
     wp_enqueue_script('itsec-network-brute-force-settings-page-script', plugins_url('js/settings-page.js', __FILE__), array('jquery'), $this->script_version, true);
     wp_localize_script('itsec-network-brute-force-settings-page-script', 'itsec_network_brute_force', $vars);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:7,代码来源:settings-page.php

示例5: run

 function run()
 {
     $this->settings = ITSEC_Modules::get_settings('hide-backend');
     if (!$this->settings['enabled']) {
         return;
     }
     add_filter('itsec_filter_apache_server_config_modification', array($this, 'filter_apache_server_config_modification'));
     add_filter('itsec_filter_litespeed_server_config_modification', array($this, 'filter_apache_server_config_modification'));
     add_filter('itsec_filter_nginx_server_config_modification', array($this, 'filter_nginx_server_config_modification'));
     $jetpack_active_modules = get_option('jetpack_active_modules');
     if (is_multisite() && function_exists('is_plugin_active_for_network')) {
         //see if Jetpack is active
         $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
     } else {
         $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
     }
     if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
         $this->auth_cookie_expired = false;
         add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
         add_action('init', array($this, 'execute_hide_backend'), 1000);
         add_action('login_init', array($this, 'execute_hide_backend_login'));
         add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
         add_filter('body_class', array($this, 'remove_admin_bar'));
         add_filter('loginout', array($this, 'filter_loginout'));
         add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
         add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
         add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
         add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
         add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
         remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:32,代码来源:class-itsec-hide-backend.php

示例6: init

 public function init()
 {
     if (ITSEC_Core::is_iwp_call()) {
         return;
     }
     if (current_user_can('manage_options')) {
         return;
     }
     $settings = ITSEC_Modules::get_settings('multisite-tweaks');
     if ($settings['theme_updates']) {
         remove_action('load-update-core.php', 'wp_update_themes');
         add_filter('pre_site_transient_update_themes', '__return_null');
         wp_clear_scheduled_hook('wp_update_themes');
     }
     if ($settings['plugin_updates']) {
         remove_action('load-update-core.php', 'wp_update_plugins');
         add_filter('pre_site_transient_update_plugins', '__return_null');
         wp_clear_scheduled_hook('wp_update_plugins');
     }
     if ($settings['core_updates']) {
         remove_action('admin_notices', 'update_nag', 3);
         add_filter('pre_site_transient_update_core', '__return_null');
         wp_clear_scheduled_hook('wp_version_check');
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:25,代码来源:class-itsec-multisite-tweaks.php

示例7: run

 function run()
 {
     $this->settings = ITSEC_Modules::get_settings('404-detection');
     add_filter('itsec_lockout_modules', array($this, 'register_lockout'));
     add_filter('itsec_logger_modules', array($this, 'register_logger'));
     add_filter('itsec_logger_displays', array($this, 'register_logger_displays'));
     add_action('wp_head', array($this, 'check_404'));
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:8,代码来源:class-itsec-four-oh-four.php

示例8: sanitize_settings

 protected function sanitize_settings()
 {
     $previous_settings = ITSEC_Modules::get_settings($this->get_id());
     if (!isset($this->settings['last_generated'])) {
         $this->settings['last_generated'] = $previous_settings['last_generated'];
     }
     $this->sanitize_setting('bool', 'regenerate', __('Change WordPress Salts', 'better-wp-security'), false);
     $this->sanitize_setting('positive-int', 'last_generated', __('Last Generated', 'better-wp-security'), false);
     $this->vars_to_skip_validate_matching_fields[] = 'regenerate';
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:10,代码来源:validator.php

示例9: validate

 public function validate($settings)
 {
     $this->settings = $settings;
     $this->previous_settings = ITSEC_Modules::get_settings($this->get_id());
     $this->sanitize_settings();
     if ($this->run_validate_matching_fields) {
         $this->validate_matching_fields();
     }
     if ($this->run_validate_matching_types) {
         $this->validate_matching_types();
     }
     $this->validate_settings();
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:13,代码来源:validator.php

示例10: do_conditional_ssl_redirect

 /**
  * Redirects to or from SSL where appropriate
  *
  * @since 4.0
  *
  * @return void
  */
 public function do_conditional_ssl_redirect()
 {
     $hide_options = get_site_option('itsec_hide_backend', array());
     if (isset($hide_options['enabled']) && $hide_options['enabled'] === true && $_SERVER['REQUEST_URI'] == ITSEC_Lib::get_home_root() . $hide_options['slug']) {
         return;
     }
     $settings = ITSEC_Modules::get_settings('ssl');
     if (2 === $settings['frontend']) {
         $protocol = 'https';
     } else {
         if (1 === $settings['frontend'] && is_singular()) {
             global $post;
             $bwps_ssl = get_post_meta($post->ID, 'bwps_enable_ssl');
             if (!empty($bwps_ssl)) {
                 if ($bwps_ssl[0]) {
                     $protocol = 'https';
                     update_post_meta($post->ID, 'itsec_enable_ssl', true);
                 }
                 delete_post_meta($post->ID, 'bwps_enable_ssl');
             }
             if (!isset($protocol)) {
                 $enable_ssl = get_post_meta($post->ID, 'itsec_enable_ssl');
                 if (!empty($enable_ssl)) {
                     if ($enable_ssl[0]) {
                         $protocol = 'https';
                     } else {
                         delete_post_meta($post->ID, 'itsec_enable_ssl');
                     }
                 }
             }
         } else {
             return;
         }
     }
     if (!isset($protocol)) {
         $protocol = 'http';
     }
     $is_ssl = is_ssl();
     if ($is_ssl && 'http' == $protocol) {
         $redirect = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     } else {
         if (!$is_ssl && 'https' == $protocol) {
             $redirect = "https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
         }
     }
     if (isset($redirect)) {
         wp_redirect($redirect, 301);
         exit;
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:57,代码来源:class-itsec-ssl.php

示例11: execute_upgrade

 /**
  * Execute module upgrade
  *
  * @since 4.0
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         ITSEC_Lib::create_database_tables();
         $current_options = get_site_option('itsec_tweaks');
         // 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['protect_files'] = isset($itsec_bwps_options['st_ht_files']) && $itsec_bwps_options['st_ht_files'] == 1 ? true : false;
             $current_options['directory_browsing'] = isset($itsec_bwps_options['st_ht_browsing']) && $itsec_bwps_options['st_ht_browsing'] == 1 ? true : false;
             $current_options['request_methods'] = isset($itsec_bwps_options['st_ht_request']) && $itsec_bwps_options['st_ht_request'] == 1 ? true : false;
             $current_options['suspicious_query_strings'] = isset($itsec_bwps_options['st_ht_query']) && $itsec_bwps_options['st_ht_query'] == 1 ? true : false;
             $current_options['non_english_characters'] = isset($itsec_bwps_options['st_ht_foreign']) && $itsec_bwps_options['st_ht_foreign'] == 1 ? true : false;
             $current_options['long_url_strings'] = isset($itsec_bwps_options['st_longurl']) && $itsec_bwps_options['st_longurl'] == 1 ? true : false;
             $current_options['write_permissions'] = isset($itsec_bwps_options['st_fileperm']) && $itsec_bwps_options['st_fileperm'] == 1 ? true : false;
             update_site_option('itsec_tweaks', $current_options);
             ITSEC_Response::regenerate_server_config();
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4035) {
         ITSEC_Response::regenerate_server_config();
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_tweaks');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             $new_module_settings = ITSEC_Modules::get_settings('system-tweaks');
             // Reduce to only settings in new module
             $current_options = array_intersect_key($current_options, $new_module_settings);
             // Use new module settings as defaults for any missing settings
             $current_options = array_merge($new_module_settings, $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('system-tweaks');
             } else {
                 ITSEC_Modules::deactivate('system-tweaks');
             }
             ITSEC_Modules::set_settings('system-tweaks', $current_options);
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:56,代码来源:setup.php

示例12: run

 function run()
 {
     $this->settings = ITSEC_Modules::get_settings('brute-force');
     $this->username = null;
     add_action('wp_login', array($this, 'wp_login'), 10, 2);
     add_action('wp_login_failed', array($this, 'wp_login_failed'), 1, 1);
     add_filter('itsec_logger_displays', array($this, 'itsec_logger_displays'));
     //adds logs metaboxes
     add_filter('authenticate', array($this, 'authenticate'), 10, 3);
     add_filter('itsec_lockout_modules', array($this, 'itsec_lockout_modules'));
     add_filter('itsec_logger_modules', array($this, 'itsec_logger_modules'));
     add_filter('xmlrpc_login_error', array($this, 'xmlrpc_login_error'), 10, 2);
     add_filter('jetpack_get_default_modules', array($this, 'jetpack_get_default_modules'));
     //disable jetpack protect via Geoge Stephanis
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:15,代码来源:class-itsec-brute-force.php

示例13: run

 /**
  * Setup the module's functionality.
  *
  * Loads the backup detection module's unpriviledged functionality including
  * performing the scans themselves.
  *
  * @since 4.0.0
  *
  * @return void
  */
 function run()
 {
     global $itsec_globals;
     $this->settings = ITSEC_Modules::get_settings('backup');
     add_action('itsec_execute_backup_cron', array($this, 'do_backup'));
     //Action to execute during a cron run.
     add_filter('itsec_logger_modules', array($this, 'register_logger'));
     if ((!defined('DOING_AJAX') || false === DOING_AJAX) && (!defined('ITSEC_BACKUP_CRON') || false === ITSEC_BACKUP_CRON) && !class_exists('pb_backupbuddy') && $this->settings['interval'] > 0 && $itsec_globals['current_time_gmt'] - $this->settings['interval'] * DAY_IN_SECONDS > $this->settings['last_run']) {
         add_action('init', array($this, 'do_backup'), 10, 0);
     } else {
         if (defined('ITSEC_BACKUP_CRON') && true === ITSEC_BACKUP_CRON && !wp_next_scheduled('itsec_execute_backup_cron')) {
             //Use cron if needed
             wp_schedule_event(time(), 'daily', 'itsec_execute_backup_cron');
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:26,代码来源:class-itsec-backup.php

示例14: init

 public function init()
 {
     $this->add_config_hooks();
     if (defined('WP_CLI') && WP_CLI) {
         // Don't risk blocking anything with WP_CLI.
         return;
     }
     $this->settings = ITSEC_Modules::get_settings('wordpress-tweaks');
     add_action('wp_print_scripts', array($this, 'store_jquery_version'));
     // Functional code for the allow_xmlrpc_multiauth setting.
     if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST && !$this->settings['allow_xmlrpc_multiauth']) {
         add_filter('authenticate', array($this, 'block_multiauth_attempts'), 0, 3);
     }
     //remove wlmanifest link if turned on
     if ($this->settings['wlwmanifest_header']) {
         remove_action('wp_head', 'wlwmanifest_link');
     }
     //remove rsd link from header if turned on
     if ($this->settings['edituri_header']) {
         remove_action('wp_head', 'rsd_link');
     }
     //Disable XML-RPC
     if (2 == $this->settings['disable_xmlrpc']) {
         add_filter('xmlrpc_enabled', '__return_null');
         add_filter('bloginfo_url', array($this, 'remove_pingback_url'), 10, 2);
     } else {
         if (1 == $this->settings['disable_xmlrpc']) {
             add_filter('xmlrpc_methods', array($this, 'xmlrpc_methods'));
         }
     }
     if ($this->settings['safe_jquery']) {
         add_action('wp_enqueue_scripts', array($this, 'current_jquery'));
     }
     //Process remove login errors
     if ($this->settings['login_errors']) {
         add_filter('login_errors', '__return_null');
     }
     //Process require unique nicename
     if ($this->settings['force_unique_nicename']) {
         add_action('user_profile_update_errors', array($this, 'force_unique_nicename'), 10, 3);
     }
     //Process remove extra author archives
     if ($this->settings['disable_unused_author_pages']) {
         add_action('template_redirect', array($this, 'disable_unused_author_pages'));
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:46,代码来源:class-itsec-wordpress-tweaks.php

示例15: filter_nginx_server_config_modification

 public static function filter_nginx_server_config_modification($modification)
 {
     $input = ITSEC_Modules::get_settings('wordpress-tweaks');
     if (2 == $input['disable_xmlrpc']) {
         $modification .= "\n";
         $modification .= "\t# " . __('Disable XML-RPC - Security > Settings > WordPress Tweaks > XML-RPC', 'better-wp-security') . "\n";
         $modification .= "\tlocation ~ xmlrpc.php { deny all; }\n";
     }
     if ($input['comment_spam']) {
         $valid_referers = self::get_valid_referers('nginx');
         $modification .= "\n";
         $modification .= "\t# " . __('Reduce Comment Spam - Security > Settings > WordPress Tweaks > Comment Spam', 'better-wp-security') . "\n";
         $modification .= "\tlocation = /wp-comments-post.php {\n";
         $modification .= "\t\tlimit_except POST { deny all; }\n";
         $modification .= "\t\tif (\$http_user_agent ~ \"^\$\") { return 403; }\n";
         if (!empty($valid_referers) && !in_array('*', $valid_referers)) {
             $modification .= "\t\tvalid_referers " . implode(' ', $valid_referers) . ";\n";
             $modification .= "\t\tif (\$invalid_referer) { return 403; }\n";
         }
         $modification .= "\t}\n";
     }
     return $modification;
 }
开发者ID:Haydt45,项目名称:justinhaydt.com,代码行数:23,代码来源:config-generators.php


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