XOOPS
2.6.0
|
Public Member Functions | |
__construct ($path= '', $create=true, $mode=false) | |
cd ($path) | |
chmod ($path, $mode=false, $recursive=true, $exceptions=array()) | |
copy ($options=array()) | |
create ($pathname, $mode=false) | |
delete ($path) | |
dirsize () | |
errors () | |
find ($regexp_pattern= '.*', $sort=false) | |
findRecursive ($pattern= '.*', $sort=false) | |
inPath ($path= '', $reverse=false) | |
inXoopsPath ($path= '') | |
messages () | |
move ($options) | |
pwd () | |
read ($sort=true, $exceptions=false) | |
realpath ($path) | |
tree ($path, $hidden=true, $type=null) | |
Static Public Member Functions | |
static | addPathElement ($path, $element) |
static | correctSlashFor ($path) |
static | isAbsolute ($path) |
static | isSlashTerm ($path) |
static | isWindowsPath ($path) |
static | normalizePath ($path) |
static | slashTerm ($path) |
Public Attributes | |
$mode = '0755' | |
$path = null | |
$sort = false | |
Private Member Functions | |
findRecursiveHelper ($pattern, $sort=false) | |
treeHelper ($path, $hidden) | |
Private Attributes | |
$directories | |
$errors = false | |
$files | |
$messages = array() | |
Definition at line 37 of file folder.php.
Constructor.
string | $path | Path to folder |
bool | $create | Create folder if not found |
mixed | $mode | Mode (CHMOD) to apply to created folder, false to ignore |
Definition at line 102 of file folder.php.
References $mode, $path, cd(), create(), XoopsLoad\fileExists(), XoopsBaseConfig\get(), isAbsolute(), and realpath().
|
static |
Returns $path with $element added, with correct slash in-between.
string | $path | Path |
string | $element | Element to and at end of path |
Definition at line 355 of file folder.php.
References $path.
Referenced by copy(), findRecursiveHelper(), read(), and realpath().
XoopsFolderHandler::cd | ( | $path | ) |
Change directory to $desired_path.
string | $path | Path to the directory to change to |
Definition at line 138 of file folder.php.
References $path, XoopsLoad\fileExists(), and realpath().
Referenced by __construct(), copy(), findRecursive(), findRecursiveHelper(), and move().
Change the mode on a directory structure recursively.
string | $path | The path to chmod |
int | bool | $mode | octal value 0755 |
bool | $recursive | chmod recursively |
array | $exceptions | array of files, directories to skip |
Definition at line 407 of file folder.php.
References $count, $mode, $path, errors(), messages(), and tree().
Referenced by copy().
XoopsFolderHandler::copy | ( | $options = array() | ) |
Recursive directory copy.
array | $options | (to, from, chmod, skip) |
Definition at line 638 of file folder.php.
References $mode, $options, addPathElement(), cd(), chmod(), errors(), XoopsLoad\fileExists(), and messages().
Referenced by move().
|
static |
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
string | $path | Path to check |
Definition at line 320 of file folder.php.
References $path.
XoopsFolderHandler::create | ( | $pathname, | |
$mode = false |
|||
) |
Create a directory structure recursively.
string | $pathname | The directory structure to create |
int | bool | $mode | octal value 0755 |
Definition at line 520 of file folder.php.
References $mode, errors(), XoopsLoad\fileExists(), and messages().
Referenced by __construct().
XoopsFolderHandler::delete | ( | $path | ) |
Recursively Remove directories if system allow.
string | $path | Path of directory to delete |
Definition at line 592 of file folder.php.
References $file, $files, $hidden_files, $path, errors(), messages(), and slashTerm().
XoopsFolderHandler::dirsize | ( | ) |
Returns the size in bytes of this Folder.
Definition at line 552 of file folder.php.
References $count, $dir, $i, $j, and slashTerm().
XoopsFolderHandler::errors | ( | ) |
XoopsFolderHandler::find | ( | $regexp_pattern = '.*' , |
|
$sort = false |
|||
) |
Returns an array of all matching files in current directory.
string | $regexp_pattern | Preg_match pattern (Defaults to: .*) |
bool | $sort | sort file list or not |
Definition at line 203 of file folder.php.
References $file, $files, $sort, and read().
XoopsFolderHandler::findRecursive | ( | $pattern = '.*' , |
|
$sort = false |
|||
) |
Returns an array of all matching files in and below current directory.
string | $pattern | Preg_match pattern (Defaults to: .*) |
bool | $sort | sort files or not |
Definition at line 228 of file folder.php.
References $path, $sort, cd(), and findRecursiveHelper().
Referenced by findRecursiveHelper().
|
private |
Private helper function for findRecursive.
string | $pattern | Pattern to match against |
bool | $sort | sort files or not. |
Definition at line 245 of file folder.php.
References $dir, $file, $files, $path, $sort, $start, addPathElement(), cd(), findRecursive(), and read().
Referenced by findRecursive().
XoopsFolderHandler::inPath | ( | $path = '' , |
|
$reverse = false |
|||
) |
Returns true if the File is in given path.
string | $path | Path to search |
bool | $reverse | reverse lookup |
Definition at line 384 of file folder.php.
References $current, $dir, $path, pwd(), and slashTerm().
Referenced by inXoopsPath().
XoopsFolderHandler::inXoopsPath | ( | $path = '' | ) |
Returns true if the File is in a given XoopsPath.
string | $path | path to look for file in |
Definition at line 368 of file folder.php.
References $dir, $path, $xoops_root_path, XoopsBaseConfig\get(), inPath(), and slashTerm().
|
static |
Returns true if given $path is an absolute path.
string | $path | Path to check |
Definition at line 288 of file folder.php.
References $path.
Referenced by __construct(), and realpath().
|
static |
Returns true if given $path ends in a slash (i.e. is slash-terminated).
string | $path | Path to check |
Definition at line 810 of file folder.php.
References $path.
|
static |
Returns true if given $path is a Windows path.
string | $path | Path to check |
Definition at line 271 of file folder.php.
References $path.
XoopsFolderHandler::messages | ( | ) |
XoopsFolderHandler::move | ( | $options | ) |
Recursive directory move.
array | $options | (to, from, chmod, skip) |
Definition at line 715 of file folder.php.
References $options, cd(), and copy().
|
static |
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
string | $path | Path to check |
Definition at line 303 of file folder.php.
References $path.
XoopsFolderHandler::pwd | ( | ) |
Return current path.
Definition at line 125 of file folder.php.
References $path.
Referenced by inPath().
Returns an array of the contents of the current directory, or false on failure. The returned array holds two arrays: one of dirs and one of files.
boolean | $sort | sort list or not |
mixed | $exceptions | either an array or boolean true will no grab dot files |
Definition at line 157 of file folder.php.
References $dir, $files, $sort, and addPathElement().
Referenced by find(), and findRecursiveHelper().
XoopsFolderHandler::realpath | ( | $path | ) |
Get the real path (taking ".." and such into account)
string | $path | Path to resolve |
Definition at line 768 of file folder.php.
References $path, addPathElement(), and isAbsolute().
Referenced by __construct(), and cd().
|
static |
Returns $path with added terminating slash (corrected for Windows or other OS).
string | $path | Path to check |
Definition at line 337 of file folder.php.
References $path.
Referenced by delete(), dirsize(), inPath(), and inXoopsPath().
XoopsFolderHandler::tree | ( | $path, | |
$hidden = true , |
|||
$type = null |
|||
) |
Returns an array of nested directories and files in each directory
string | $path | the directory path to build the tree from |
boolean | $hidden | return hidden files and directories |
string | $type | either file or dir. null returns both files and directories |
Definition at line 454 of file folder.php.
References $dir, $directories, $files, $path, $type, and treeHelper().
Referenced by chmod().
|
private |
Private method to list directories and files in each directory
string | $path | path name of directory |
boolean | $hidden | show hidden files |
private
Definition at line 488 of file folder.php.
References $path.
Referenced by tree().
|
private |
Definition at line 85 of file folder.php.
Referenced by tree().
|
private |
Definition at line 77 of file folder.php.
Referenced by errors().
|
private |
Definition at line 93 of file folder.php.
Referenced by delete(), find(), findRecursiveHelper(), read(), and tree().
|
private |
Definition at line 69 of file folder.php.
Referenced by messages().
XoopsFolderHandler::$mode = '0755' |
Definition at line 61 of file folder.php.
Referenced by __construct(), chmod(), copy(), and create().
XoopsFolderHandler::$path = null |
Definition at line 45 of file folder.php.
Referenced by __construct(), addPathElement(), cd(), chmod(), correctSlashFor(), delete(), findRecursive(), findRecursiveHelper(), inPath(), inXoopsPath(), isAbsolute(), isSlashTerm(), isWindowsPath(), normalizePath(), pwd(), realpath(), slashTerm(), tree(), and treeHelper().
XoopsFolderHandler::$sort = false |
Definition at line 53 of file folder.php.
Referenced by find(), findRecursive(), findRecursiveHelper(), and read().