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


PHP AIOWPSecurity_Utility::explode_trim_filter_empty方法代码示例

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


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

示例1: do_file_change_scan

 /**
  * Recursively scan the entire $start_dir directory and return file size
  * and last modified date of every regular file. Ignore files and file
  * types specified in file scanner settings.
  * @global AIO_WP_Security $aio_wp_security
  * @param string $start_dir
  * @return array
  */
 function do_file_change_scan($start_dir = ABSPATH)
 {
     global $aio_wp_security;
     $filescan_data = array();
     // Iterator key is absolute file path, iterator value is SplFileInfo object,
     // iteration skips '..' and '.' records, because we're not interested in directories.
     $dit = new RecursiveDirectoryIterator($start_dir, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS);
     $rit = new RecursiveIteratorIterator($dit, RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
     // Grab files/directories to skip
     $files_to_skip = AIOWPSecurity_Utility::explode_trim_filter_empty($aio_wp_security->configs->get_value('aiowps_fcd_exclude_files'));
     // Grab (lowercased) file types to skip
     $file_types_to_skip = AIOWPSecurity_Utility::explode_trim_filter_empty(strtolower($aio_wp_security->configs->get_value('aiowps_fcd_exclude_filetypes')));
     $start_dir_length = strlen($start_dir);
     foreach ($rit as $filename => $fileinfo) {
         if (!file_exists($filename) || is_dir($filename)) {
             continue;
             // if file doesn't exist or is a directory move on to next iteration
         }
         if ($fileinfo->getFilename() == 'wp-security-log-cron-job.txt' || $fileinfo->getFilename() == 'wp-security-log.txt') {
             continue;
             // skip aiowps log files
         }
         // Let's omit any file types from the scan which were specified in the settings if necessary
         if (!empty($file_types_to_skip)) {
             //$current_file_ext = strtolower($fileinfo->getExtension()); //getExtension() only available on PHP 5.3.6 or higher
             $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
             if (in_array($ext, $file_types_to_skip)) {
                 continue;
             }
         }
         // Let's omit specific files or directories from the scan which were specified in the settings
         if (!empty($files_to_skip)) {
             $skip_this = false;
             foreach ($files_to_skip as $f_or_dir) {
                 // Expect files/dirs to be specified relatively to $start_dir,
                 // so start searching at $start_dir_length offset.
                 if (strpos($filename, $f_or_dir, $start_dir_length) !== false) {
                     $skip_this = true;
                     break;
                     // !
                 }
             }
             if ($skip_this) {
                 continue;
             }
         }
         $filescan_data[$filename] = array('last_modified' => $fileinfo->getMTime(), 'filesize' => $fileinfo->getSize());
     }
     return $filescan_data;
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:58,代码来源:wp-security-file-scan.php


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