本文整理匯總了PHP中ITSEC_Core::get_storage_dir方法的典型用法代碼示例。如果您正苦於以下問題:PHP ITSEC_Core::get_storage_dir方法的具體用法?PHP ITSEC_Core::get_storage_dir怎麽用?PHP ITSEC_Core::get_storage_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ITSEC_Core
的用法示例。
在下文中一共展示了ITSEC_Core::get_storage_dir方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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, $itsec_globals;
$current_options = get_site_option('itsec_away_mode');
$current_time = $itsec_globals['current_time'];
// 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['am_enabled']) && $itsec_bwps_options['am_enabled'] == 1 ? true : false;
$current_options['type'] = isset($itsec_bwps_options['am_type']) && $itsec_bwps_options['am_type'] == 1 ? 1 : 2;
if (isset($itsec_bwps_options['am_startdate']) && isset($itsec_bwps_options['am_starttime'])) {
$current_options['start'] = strtotime(date('Y-m-d', $itsec_bwps_options['am_startdate'])) + intval($itsec_bwps_options['am_starttime']);
} elseif (isset($current_options['am_starttime']) && $current_options['type'] == 1) {
$current_options['start'] = strtotime(date('Y-m-d', $current_time)) + intval($itsec_bwps_options['am_starttime']);
} else {
$current_options['enabled'] = false;
//didn't have the whole start picture so disable
}
if (isset($itsec_bwps_options['am_enddate']) && isset($itsec_bwps_options['am_endtime'])) {
$current_options['end'] = strtotime(date('Y-m-d', $itsec_bwps_options['am_enddate'])) + intval($itsec_bwps_options['am_endtime']);
} elseif (isset($itsec_bwps_options['am_endtime']) && $itsec_bwps_options['type'] == 1) {
$current_options['end'] = strtotime(date('Y-m-d', $current_time)) + intval($itsec_bwps_options['am_endtime']);
} else {
$current_options['enabled'] = false;
//didn't have the whole start picture so disable
}
update_site_option('itsec_away_mode', $current_options);
$away_file = ITSEC_Core::get_storage_dir() . '/itsec_away.confg';
//override file
if ($current_options['enabled'] === true && !file_exists($away_file)) {
@file_put_contents($away_file, 'true');
} else {
@unlink($away_file);
}
}
}
if ($itsec_old_version < 4041) {
$current_options = get_site_option('itsec_away_mode');
$current_override_options = get_site_option('itsec_away_mode_sync_override');
// If there are no current options, go with the new defaults by not saving anything
if (is_array($current_options) || is_array($current_override_options)) {
$settings = ITSEC_Modules::get_defaults('away-mode');
$original_settings = $settings;
if (is_array($current_options)) {
$settings['type'] = 1 == $current_options['type'] ? 'daily' : 'one-time';
$settings['start'] = intval($current_options['start'] - ITSEC_Core::get_time_offset());
$settings['start_time'] = $current_options['start'] - strtotime(date('Y-m-d', $current_options['start']));
$settings['end'] = intval($current_options['end'] - ITSEC_Core::get_time_offset());
$settings['end_time'] = $current_options['end'] - strtotime(date('Y-m-d', $current_options['end']));
}
if (is_array($current_override_options)) {
$settings['override_type'] = $current_override_options['intention'];
$settings['override_end'] = $current_override_options['expires'];
}
ITSEC_Modules::set_settings('away-mode', $settings);
if (isset($current_options['enabled']) && $current_options['enabled']) {
ITSEC_Modules::activate('away-mode');
} else {
ITSEC_Modules::deactivate('away-mode');
}
}
}
}
示例2: get_defaults
public function get_defaults()
{
return array('all_sites' => false, 'method' => 1, 'location' => ITSEC_Core::get_storage_dir('backups'), 'retain' => 0, 'zip' => true, 'exclude' => array('itsec_log', 'itsec_temp', 'itsec_lockouts'), 'enabled' => false, 'interval' => 3, 'last_run' => 0);
}
示例3: release_file_lock
/**
* Release the lock.
*
* Releases a file lock to allow others to use it.
*
* @since 4.0.0
*
* @param string $lock_file file name of lock
*
* @return bool true if released, false otherwise
*/
public function release_file_lock($lock_file)
{
if (ITSEC_Modules::get_setting('global', 'lock_file')) {
return true;
}
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-directory.php';
$lock_file = ITSEC_Core::get_storage_dir() . '/' . sanitize_text_field($lock_file) . '.lock';
$result = ITSEC_Lib_Directory::remove($lock_file);
if (is_wp_error($result)) {
return false;
}
return true;
}
示例4: get_active_file_name
public static function get_active_file_name()
{
global $itsec_globals;
$file_name = apply_filters('itsec_filer_away_mode_active_file', ITSEC_Core::get_storage_dir() . '/itsec_away.confg');
return $file_name;
}
示例5: uninstall_execute
/**
* Uninstall execution
*
* @since 4.0
*
* @return void
* */
private function uninstall_execute()
{
global $itsec_globals, $wpdb;
$this->deactivate_execute();
require_once $itsec_globals['plugin_dir'] . 'core/class-itsec-modules.php';
ITSEC_Modules::run_uninstall();
$itsec_files = ITSEC_Core::get_itsec_files();
$itsec_files->do_deactivate();
delete_site_option('itsec-storage');
delete_site_option('itsec_global');
delete_site_option('itsec_data');
delete_site_option('itsec_initials');
delete_site_option('itsec_jquery_version');
delete_site_option('itsec_message_queue');
$wpdb->query("DROP TABLE IF EXISTS " . $wpdb->base_prefix . "itsec_log;");
$wpdb->query("DROP TABLE IF EXISTS " . $wpdb->base_prefix . "itsec_lockouts;");
$wpdb->query("DROP TABLE IF EXISTS " . $wpdb->base_prefix . "itsec_temp;");
if (is_dir(ITSEC_Core::get_storage_dir())) {
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-directory.php';
ITSEC_Lib_Directory::remove(ITSEC_Core::get_storage_dir());
}
ITSEC_Lib::clear_caches();
}