PHP Class File_Find

Author: Pan.Chao
Exibir arquivo Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$_dirs array internal dir-list
$directories array found dirs
$dirsep string directory separator
$files array found files

Public Methods

Method 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 method

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
return void

_determineRegex() public method

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

glob() public method

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').
return array containing all of the files and directories matching the pattern or null if no matches

isError() public method

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

mapTreeMultiple() public method

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
return 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 method

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.
return 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
return array

$directories public_oe property

found dirs
public array $directories
return array

$dirsep public_oe property

directory separator
public string $dirsep
return string

$files public_oe property

found files
public array $files
return array