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


PHP ITSEC_Lib::get_current_url方法代码示例

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


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

示例1: plugins_loaded

 /**
  * Execute scheduled scans during plugins_loaded
  *
  * @since 4.3
  *
  * @return mixed false on error or void
  */
 public function plugins_loaded()
 {
     global $itsec_globals, $itsec_malware, $itsec_files;
     if ($itsec_files->get_file_lock('maleware-scheduling')) {
         $last_scans = get_site_option('itsec_malware_scheduling_last_scans');
         $scan_executed = false;
         //Flag to prevent multiple executions per page load (reduce API overage)
         //build the full array of last scans
         $last_scans_count = isset($last_scans['count']) ? $last_scans['count'] : 0;
         $scan_resources = array();
         $scan_meta = array();
         for ($i = 0; $i < $last_scans_count + 1; $i++) {
             $scans = get_site_option('itsec_malware_scheduling_last_scans_' . $i);
             if (is_array($scans)) {
                 $scan_resources = array_merge($scans, $scan_resources);
             }
             delete_site_option('itsec_malware_scheduling_last_scans_' . $i);
         }
         //Always make sure last scans and standard scans are arrays
         if (!is_array($last_scans)) {
             $last_scans = array();
         }
         if (!isset($last_scans['overall']) || $last_scans['overall'] < $itsec_globals['current_time_gmt'] - 30) {
             //only allow 1 scan every 30 seconds
             $queued = get_site_option('itsec_malware_scheduling_report_queue');
             if ($queued === false) {
                 $queued = array();
             }
             if (sizeof($queued) > 0) {
                 $reverse_queued = array_reverse($queued);
                 $resource = array_pop($reverse_queued);
                 $report = $itsec_malware->scan_report($resource);
                 $queued = array_reverse($reverse_queued);
             }
             //process individual scans first
             if (isset($this->settings['individual']) && is_array($this->settings['individual'])) {
                 foreach ($this->settings['individual'] as $item) {
                     if (isset($item['resource']) && strlen($item['resource']) > 0 && $scan_executed === false && isset($last_scans[$item['resource']]) && $last_scans[$item['resource']] < $itsec_globals['current_time_gmt'] - 604800) {
                         $scan = $itsec_malware->scheduled_scan($item['type'], $item['resource']);
                         if (isset($scan['response_code']) && $scan['response_code'] === 1) {
                             //Don't request a report if it isn't ready
                             $report = $itsec_malware->scan_report($scan['resource']);
                         } else {
                             //Queue result for later
                             $queued[] = $scan['resource'];
                         }
                         $scan_executed = true;
                         $scan_resources[$item['resource']] = $itsec_globals['current_time_gmt'];
                     }
                 }
             }
             //Standard scheduled scan
             if ($scan_executed === false) {
                 $standard_period = isset($this->settings['standard_interval']) ? absint($this->settings['standard_interval']) * 60 * 60 : 3600;
                 //get interval in minutes
                 $resource = ITSEC_Lib::get_current_url();
                 if (isset($this->settings['standard']) && $this->settings['standard'] === true) {
                     if (!isset($last_scans['standard']) || !isset($scan_resources[$resource]) || $last_scans['standard'] < $itsec_globals['current_time_gmt'] - $standard_period && $scan_resources[$resource] < $itsec_globals['current_time_gmt'] - 604800) {
                         $scan = $itsec_malware->scheduled_scan(0, $resource);
                         if (isset($scan['response_code']) && $scan['response_code'] === 1) {
                             //Don't request a report if it isn't ready
                             $report = $itsec_malware->scan_report($scan['resource']);
                         } else {
                             //Queue result for later
                             if (isset($scan['resource'])) {
                                 $queued[] = $scan['resource'];
                             } elseif (ITSEC_Lib::validate_url($resource) === true) {
                                 $queued[] = $resource;
                             }
                         }
                         $scan_meta['standard'] = $itsec_globals['current_time_gmt'];
                         $scan_resources[$resource] = $itsec_globals['current_time_gmt'];
                     }
                 }
             }
             //Update scan time and save last scans
             $scan_meta['overall'] = $itsec_globals['current_time_gmt'];
             $chunk = array_chunk($scan_resources, 100, true);
             for ($i = 0; $i < sizeof($chunk); $i++) {
                 if (is_multisite()) {
                     update_site_option('itsec_malware_scheduling_last_scans_' . $i, $chunk[$i]);
                 } else {
                     add_option('itsec_malware_scheduling_last_scans_' . $i, $chunk[$i], '', false);
                 }
             }
             $scan_meta['count'] = sizeof($chunk);
             update_site_option('itsec_malware_scheduling_last_scans', $scan_meta);
             if (sizeof($queued) > 0) {
                 update_site_option('itsec_malware_scheduling_report_queue', $queued);
             } else {
                 delete_site_option('itsec_malware_scheduling_report_queue');
             }
         }
//.........这里部分代码省略.........
开发者ID:femgineer,项目名称:website,代码行数:101,代码来源:class-itsec-malware-scheduling.php


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