本文整理汇总了PHP中ITSEC_Modules::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP ITSEC_Modules::get_instance方法的具体用法?PHP ITSEC_Modules::get_instance怎么用?PHP ITSEC_Modules::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITSEC_Modules
的用法示例。
在下文中一共展示了ITSEC_Modules::get_instance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute_upgrade
/**
* Execute upgrade for version after 4.0
*
* @since 4.0.6
*
* @return void
*/
public function execute_upgrade()
{
global $itsec_globals;
//require plugin setup information
if (!class_exists('ITSEC_Setup')) {
require trailingslashit($itsec_globals['plugin_dir']) . 'core/class-itsec-setup.php';
}
new ITSEC_Setup('upgrade', $itsec_globals['data']['build']);
//run upgrade scripts
$itsec_modules = ITSEC_Modules::get_instance();
$itsec_modules->run_activation();
}
示例2: 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_ban_users');
// 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['enabled'] = isset($itsec_bwps_options['bu_enabled']) && $itsec_bwps_options['bu_enabled'] == 1 ? true : false;
$current_options['default'] = isset($itsec_bwps_options['bu_blacklist']) && $itsec_bwps_options['bu_blacklist'] == 1 ? true : false;
if (isset($itsec_bwps_options['bu_banlist']) && !is_array($itsec_bwps_options['bu_banlist']) && strlen($itsec_bwps_options['bu_banlist']) > 1) {
$raw_hosts = explode(PHP_EOL, $itsec_bwps_options['bu_banlist']);
foreach ($raw_hosts as $host) {
if (strlen($host) > 1) {
$current_options['host_list'][] = $host;
}
}
}
if (isset($itsec_bwps_options['bu_banagent']) && !is_array($itsec_bwps_options['bu_banagent']) && strlen($itsec_bwps_options['bu_banagent']) > 1) {
$current_options['agent_list'] = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']);
$raw_agents = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']);
foreach ($raw_agents as $agent) {
if (strlen($agent) > 1) {
$current_options['agent_list'][] = $agent;
}
}
}
update_site_option('itsec_ban_users', $current_options);
ITSEC_Response::regenerate_server_config();
}
}
if ($itsec_old_version < 4027) {
ITSEC_Response::regenerate_server_config();
}
if ($itsec_old_version < 4041) {
$current_options = get_site_option('itsec_ban_users');
// If there are no current options, go with the new defaults by not saving anything
if (is_array($current_options)) {
$itsec_modules = ITSEC_Modules::get_instance();
// 'enable_ban_lists' was previously just 'enabled'
// Make sure the new module is properly activated or deactivated
if ($current_options['enabled']) {
ITSEC_Modules::activate('backup');
$current_options['enable_ban_lists'] = true;
} else {
ITSEC_Modules::deactivate('backup');
$current_options['enable_ban_lists'] = false;
}
unset($current_options['enabled']);
// Filter out invalid IPs
$current_options['host_list'] = array_map('trim', $current_options['host_list']);
if (!class_exists('ITSEC_Lib_IP_Tools')) {
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php';
}
foreach ($current_options['host_list'] as $index => $ip) {
if ('' === $ip || false === ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr($ip)) {
unset($current_options['host_list'][$index]);
}
}
$itsec_modules->set_settings('ban-users', $current_options);
}
}
}
示例3: deactivate_execute
/**
* Deactivate execution
*
* @since 4.0
*
* @return void
* */
private function deactivate_execute()
{
global $itsec_globals, $itsec_files, $wpdb;
wp_clear_scheduled_hook('itsec_purge_lockouts');
require_once trailingslashit($itsec_globals['plugin_dir']) . 'core/class-itsec-modules.php';
$itsec_modules = ITSEC_Modules::get_instance();
$itsec_modules->run_deactivation();
$itsec_files->do_deactivate();
delete_site_option('itsec_flush_old_rewrites');
delete_site_option('itsec_manual_update');
delete_site_option('itsec_rewrites_changed');
delete_site_option('itsec_config_changed');
delete_site_option('itsec_had_other_version');
delete_site_option('itsec_no_file_lock_release');
delete_site_option('itsec_clear_login');
delete_site_option('itsec_temp_whitelist_ip');
delete_site_option('itsec_api_nag');
delete_site_transient('ITSEC_SHOW_WRITE_FILES_TOOLTIP');
delete_site_transient('itsec_upload_dir');
delete_site_transient('itsec_notification_running');
wp_clear_scheduled_hook('itsec_digest_email');
$htaccess = ITSEC_Lib::get_htaccess();
//Make sure we can write to the file
$perms = substr(sprintf('%o', @fileperms($htaccess)), -4);
if ($perms == '0444') {
@chmod($htaccess, 0664);
}
flush_rewrite_rules();
//reset file permissions if we changed them
if ($perms == '0444') {
@chmod($htaccess, 0444);
}
ITSEC_Lib::clear_caches();
}
示例4: execute_upgrade
/**
* Execute upgrade for version after 4.0
*
* @since 4.0.6
*
* @return void
*/
public function execute_upgrade($current_data_build = false)
{
global $itsec_globals;
$this->doing_data_upgrade = true;
//require plugin setup information
if (!class_exists('ITSEC_Setup')) {
require self::get_core_dir() . '/class-itsec-setup.php';
}
if (empty($current_data_build)) {
$current_data_build = $itsec_globals['data']['build'];
}
new ITSEC_Setup('upgrade', $current_data_build);
//run upgrade scripts
$itsec_modules = ITSEC_Modules::get_instance();
$itsec_modules->run_activation();
}
示例5: do_action
$this->load_module_file('setup.php');
do_action('itsec_modules_do_plugin_upgrade', $old_version, $new_version);
}
public function load_settings_page()
{
if ($this->_settings_files_loaded) {
return;
}
$modules = $this->get_available_modules();
foreach ($modules as $path) {
include "{$path}/settings.php";
}
$this->_settings_files_loaded = true;
}
}
ITSEC_Modules::get_instance();
abstract class ITSEC_Module_Init
{
protected $_id = '';
protected $_name = '';
protected $_desc = '';
public function get_id()
{
return $this->_id;
}
public function get_name()
{
return $this->_name;
}
public function get_desc()
{
示例6: do_modules
/**
* Execute setup script for each module installed
*
* @return void
*/
function do_modules()
{
$itsec_modules = ITSEC_Modules::get_instance();
$itsec_modules->run_activation();
}