當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。