PHP Class File_Find

Author: Pan.Chao
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Свойство Type Description
$_dirs array internal dir-list
$directories array found dirs
$dirsep string directory separator
$files array found files

Méthodes publiques

Méthode Description
_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).

Method Details

_build() public méthode

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
Résultat void

_determineRegex() public méthode

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
Résultat string kind of function ( "eregi", "ereg" or "preg_match") ;

glob() public méthode

Search specified directory to find matches for specified pattern
Author: 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').
Résultat array containing all of the files and directories matching the pattern or null if no matches

isError() public méthode

Determine whether or not a variable is a PEAR error
public isError ( &$var ) : boolean
Résultat boolean returns true if the variable is a PEAR error, otherwise it returns false.

mapTreeMultiple() public méthode

Map the directory tree given by the directory parameter.
Author: 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
Résultat 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() public méthode

Map the directory tree given by the directory_path parameter.
Author: Sterling Hughes ([email protected])
public maptree ( string $directory ) : array
$directory string contains the directory path that you want to map.
Résultat 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.

Property Details

$_dirs public_oe property

internal dir-list
public array $_dirs
Résultat array

$directories public_oe property

found dirs
public array $directories
Résultat array

$dirsep public_oe property

directory separator
public string $dirsep
Résultat string

$files public_oe property

found files
public array $files
Résultat array