コード例 #1
0
ファイル: Plugin.php プロジェクト: ballistiq/revive-adserver
 /**
  * A private method to return a list list of files from a directory
  * (and subdirectories, if appropriate)  which match the defined
  * plugin file mask (MAX_PLUGINS_FILE_MASK).
  *
  * @static
  * @access private
  * @param string $directory The directory to search for files in.
  * @param mixed $recursive If the boolean 'true', returns all files in the given
  *                         directory and all subdirectories that match the file
  *                         mask.
  *                         If an integer, returns all files in the given
  *                         directory and subdirectories down to the depth
  *                         specified by the parameter that match the file mask.
  * @return array An array of the files found, indexed by "directory:filename",
  *               where "directory" is the relative directory path below the
  *               given directory parameter, and "filename" is the filename
  *               before the MAX_PLUGINS_EXTENSION extension of the file.
  */
 function _getPluginsFilesFromDirectory($directory, $recursive = 1)
 {
     if (is_readable($directory)) {
         $fileMask = MAX_Plugin::_getFileMask();
         $oFileScanner = new MAX_FileScanner();
         $oFileScanner->addFileTypes(array('php', 'inc'));
         $oFileScanner->setFileMask($fileMask);
         $oFileScanner->addDir($directory, $recursive);
         return $oFileScanner->getAllFiles();
     } else {
         return array();
     }
 }