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


PHP ITSEC_Core::get_current_time方法代码示例

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


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

示例1: is_current_time_active

 public static function is_current_time_active($start, $end, $include_details = false)
 {
     $current_time = ITSEC_Core::get_current_time();
     $now = $current_time - strtotime(date('Y-m-d', $current_time));
     $active = false;
     if ($start <= $end) {
         if ($start <= $now && $now <= $end) {
             $active = true;
         }
     } else {
         if ($start <= $now || $now <= $end) {
             $active = true;
         }
     }
     if (!$include_details) {
         return $active;
     }
     $remaining = $end - $now;
     $next = $start - $now;
     $length = $end - $start;
     if ($active && $remaining < 0) {
         $remaining += DAY_IN_SECONDS;
     } else {
         if (!$active && $remaining >= 0) {
             $remaining -= DAY_IN_SECONDS;
         }
     }
     if ($next < 0) {
         $next += DAY_IN_SECONDS;
     }
     if ($length < 0) {
         $length += DAY_IN_SECONDS;
     }
     return compact('active', 'remaining', 'next', 'length');
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:35,代码来源:utilities.php

示例2: validate_settings

 protected function validate_settings()
 {
     $current_time = ITSEC_Core::get_current_time();
     if (defined('ITSEC_DOING_FILE_CHECK') && true === ITSEC_DOING_FILE_CHECK) {
         $this->settings['last_run'] = $current_time;
     } else {
         if ($this->settings['split']) {
             $interval = 12282;
         } else {
             $interval = 86340;
         }
         if ($this->settings['last_run'] <= $current_time - $interval) {
             $this->settings['last_run'] = $current_time - $interval + 120;
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:16,代码来源:validator.php

示例3: is_active

 /**
  * Check if away mode is active
  *
  * @since 4.4
  * @static
  *
  * @param bool $get_details Optional, defaults to false. True to receive details rather than a boolean response.
  *
  * @return mixed If $get_details is true, an array of status details. Otherwise, true if away and false otherwise.
  */
 public static function is_active($get_details = false)
 {
     require_once dirname(__FILE__) . '/utilities.php';
     $settings = ITSEC_Modules::get_settings('away-mode');
     if ('daily' === $settings['type']) {
         $details = ITSEC_Away_Mode_Utilities::is_current_time_active($settings['start_time'], $settings['end_time'], true);
     } else {
         $details = ITSEC_Away_Mode_Utilities::is_current_timestamp_active($settings['start'], $settings['end'], true);
     }
     $details['has_active_file'] = ITSEC_Away_Mode_Utilities::has_active_file();
     $details['override_type'] = $settings['override_type'];
     $details['override_end'] = $settings['override_end'];
     if (empty($settings['override_type']) || ITSEC_Core::get_current_time() > $settings['override_end']) {
         $details['override_active'] = false;
     } else {
         $details['override_active'] = true;
         if ('activate' === $details['override_type']) {
             $details['active'] = true;
         } else {
             $details['active'] = false;
         }
     }
     if (!$details['has_active_file']) {
         $details['active'] = false;
         $details['remaining'] = false;
         $details['next'] = false;
         $details['length'] = false;
     }
     if (!isset($details['error'])) {
         $details['error'] = false;
     }
     if ($get_details) {
         return $details;
     }
     return $details['active'];
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:46,代码来源:class-itsec-away-mode.php

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