PHP Класс File_Find

Автор: Pan.Chao
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_dirs array internal dir-list
$directories array found dirs
$dirsep string directory separator
$files array found files

Открытые методы

Метод Описание
_build ( string $directory, string $separator = "/" ) : void internal function to build singular directory trees, used by File_Find::maptree()
_determineRegex ( $pattern, string $type ) : string internal function to determine the type of regular expression to use, implemented by File_Find::glob() and File_Find::search()
glob ( string $pattern, string $dirpath, string $pattern_type = 'php' ) : array Search specified directory to find matches for specified pattern
isError ( &$var ) : boolean Determine whether or not a variable is a PEAR error
mapTreeMultiple ( string $directory, integer $maxrecursion, $count ) : array Map the directory tree given by the directory parameter.
maptree ( string $directory ) : array Map the directory tree given by the directory_path parameter.
search ( string $pattern, string $directory, string $type = 'php', boolean $fullpath = true, string $match = 'files' ) : array Search the specified directory tree with the specified pattern. Return an array containing all matching files (no directories included).

Описание методов

_build() публичный Метод

internal function to build singular directory trees, used by File_Find::maptree()
public _build ( string $directory, string $separator = "/" ) : void
$directory string name of the directory to read
$separator string directory separator
Результат void

_determineRegex() публичный Метод

internal function to determine the type of regular expression to use, implemented by File_Find::glob() and File_Find::search()
public _determineRegex ( $pattern, string $type ) : string
$type string given RegExp type
Результат string kind of function ( "eregi", "ereg" or "preg_match") ;

glob() публичный Метод

Search specified directory to find matches for specified pattern
Автор: Sterling Hughes ([email protected])
public glob ( string $pattern, string $dirpath, string $pattern_type = 'php' ) : array
$pattern string a string containing the pattern to search the directory for.
$dirpath string a string containing the directory path to search.
$pattern_type string a string containing the type of pattern matching functions to use (can either be 'php', 'perl' or 'shell').
Результат array containing all of the files and directories matching the pattern or null if no matches

isError() публичный Метод

Determine whether or not a variable is a PEAR error
public isError ( &$var ) : boolean
Результат boolean returns true if the variable is a PEAR error, otherwise it returns false.

mapTreeMultiple() публичный Метод

Map the directory tree given by the directory parameter.
Автор: Mika Tuupola ([email protected])
public mapTreeMultiple ( string $directory, integer $maxrecursion, $count ) : array
$directory string contains the directory path that you want to map.
$maxrecursion integer maximun number of folders to recursive map
Результат array a multidimensional array containing all subdirectories and their files. For example: Array ( [0] => file_1.php [1] => file_2.php [subdirname] => Array ( [0] => file_1.php ) )

maptree() публичный Метод

Map the directory tree given by the directory_path parameter.
Автор: Sterling Hughes ([email protected])
public maptree ( string $directory ) : array
$directory string contains the directory path that you want to map.
Результат array a two element array, the first element containing a list of all the directories, the second element containing a list of all the files.

Описание свойств

$_dirs публичное свойство

internal dir-list
public array $_dirs
Результат array

$directories публичное свойство

found dirs
public array $directories
Результат array

$dirsep публичное свойство

directory separator
public string $dirsep
Результат string

$files публичное свойство

found files
public array $files
Результат array