XOOPS  2.6.0
XoopsFolderHandler Class Reference

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()
 

Detailed Description

Definition at line 37 of file folder.php.

Constructor & Destructor Documentation

XoopsFolderHandler::__construct (   $path = '',
  $create = true,
  $mode = false 
)

Constructor.

Parameters
string$pathPath to folder
bool$createCreate folder if not found
mixed$modeMode (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().

Here is the call graph for this function:

Member Function Documentation

static XoopsFolderHandler::addPathElement (   $path,
  $element 
)
static

Returns $path with $element added, with correct slash in-between.

Parameters
string$pathPath
string$elementElement to and at end of path
Returns
string Combined path public

Definition at line 355 of file folder.php.

References $path.

Referenced by copy(), findRecursiveHelper(), read(), and realpath().

Here is the caller graph for this function:

XoopsFolderHandler::cd (   $path)

Change directory to $desired_path.

Parameters
string$pathPath to the directory to change to
Returns
string|false The new path. Returns false on failure public

Definition at line 138 of file folder.php.

References $path, XoopsLoad\fileExists(), and realpath().

Referenced by __construct(), copy(), findRecursive(), findRecursiveHelper(), and move().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::chmod (   $path,
  $mode = false,
  $recursive = true,
  $exceptions = array() 
)

Change the mode on a directory structure recursively.

Parameters
string$pathThe path to chmod
int | bool$modeoctal value 0755
bool$recursivechmod recursively
array$exceptionsarray of files, directories to skip
Returns
bool Returns TRUE on success, FALSE on failure public

Definition at line 407 of file folder.php.

References $count, $mode, $path, errors(), messages(), and tree().

Referenced by copy().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::copy (   $options = array())

Recursive directory copy.

Parameters
array$options(to, from, chmod, skip)
Returns
bool public

Definition at line 638 of file folder.php.

References $mode, $options, addPathElement(), cd(), chmod(), errors(), XoopsLoad\fileExists(), and messages().

Referenced by move().

Here is the call graph for this function:

Here is the caller graph for this function:

static XoopsFolderHandler::correctSlashFor (   $path)
static

Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)

Parameters
string$pathPath to check
Returns
string Set of slashes ("\\" or "/") public

Definition at line 320 of file folder.php.

References $path.

XoopsFolderHandler::create (   $pathname,
  $mode = false 
)

Create a directory structure recursively.

Parameters
string$pathnameThe directory structure to create
int | bool$modeoctal value 0755
Returns
bool Returns TRUE on success, FALSE on failure public

Definition at line 520 of file folder.php.

References $mode, errors(), XoopsLoad\fileExists(), and messages().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::delete (   $path)

Recursively Remove directories if system allow.

Parameters
string$pathPath of directory to delete
Returns
boolean Success public

Definition at line 592 of file folder.php.

References $file, $files, $hidden_files, $path, errors(), messages(), and slashTerm().

Here is the call graph for this function:

XoopsFolderHandler::dirsize ( )

Returns the size in bytes of this Folder.

Returns
int

Definition at line 552 of file folder.php.

References $count, $dir, $i, $j, and slashTerm().

Here is the call graph for this function:

XoopsFolderHandler::errors ( )

get error from latest method

Returns
array public

Definition at line 756 of file folder.php.

References $errors.

Referenced by chmod(), copy(), create(), and delete().

Here is the caller graph for this function:

XoopsFolderHandler::find (   $regexp_pattern = '.*',
  $sort = false 
)

Returns an array of all matching files in current directory.

Parameters
string$regexp_patternPreg_match pattern (Defaults to: .*)
bool$sortsort file list or not
Returns
array Files that match given pattern public

Definition at line 203 of file folder.php.

References $file, $files, $sort, and read().

Here is the call graph for this function:

XoopsFolderHandler::findRecursive (   $pattern = '.*',
  $sort = false 
)

Returns an array of all matching files in and below current directory.

Parameters
string$patternPreg_match pattern (Defaults to: .*)
bool$sortsort files or not
Returns
array Files matching $pattern public

Definition at line 228 of file folder.php.

References $path, $sort, cd(), and findRecursiveHelper().

Referenced by findRecursiveHelper().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::findRecursiveHelper (   $pattern,
  $sort = false 
)
private

Private helper function for findRecursive.

Parameters
string$patternPattern to match against
bool$sortsort files or not.
Returns
array Files matching pattern private

Definition at line 245 of file folder.php.

References $dir, $file, $files, $path, $sort, $start, addPathElement(), cd(), findRecursive(), and read().

Referenced by findRecursive().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::inPath (   $path = '',
  $reverse = false 
)

Returns true if the File is in given path.

Parameters
string$pathPath to search
bool$reversereverse lookup
Returns
bool

Definition at line 384 of file folder.php.

References $current, $dir, $path, pwd(), and slashTerm().

Referenced by inXoopsPath().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::inXoopsPath (   $path = '')

Returns true if the File is in a given XoopsPath.

Parameters
string$pathpath to look for file in
Returns
bool public

Definition at line 368 of file folder.php.

References $dir, $path, $xoops_root_path, XoopsBaseConfig\get(), inPath(), and slashTerm().

Here is the call graph for this function:

static XoopsFolderHandler::isAbsolute (   $path)
static

Returns true if given $path is an absolute path.

Parameters
string$pathPath to check
Returns
bool public

Definition at line 288 of file folder.php.

References $path.

Referenced by __construct(), and realpath().

Here is the caller graph for this function:

static XoopsFolderHandler::isSlashTerm (   $path)
static

Returns true if given $path ends in a slash (i.e. is slash-terminated).

Parameters
string$pathPath to check
Returns
boolean true if path ends with slash, false otherwise public

Definition at line 810 of file folder.php.

References $path.

static XoopsFolderHandler::isWindowsPath (   $path)
static

Returns true if given $path is a Windows path.

Parameters
string$pathPath to check
Returns
boolean true if windows path, false otherwise public

Definition at line 271 of file folder.php.

References $path.

XoopsFolderHandler::messages ( )

get messages from latest method

Returns
array public

Definition at line 745 of file folder.php.

References $messages.

Referenced by chmod(), copy(), create(), and delete().

Here is the caller graph for this function:

XoopsFolderHandler::move (   $options)

Recursive directory move.

Parameters
array$options(to, from, chmod, skip)
Returns
string|false Success public

Definition at line 715 of file folder.php.

References $options, cd(), and copy().

Here is the call graph for this function:

static XoopsFolderHandler::normalizePath (   $path)
static

Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)

Parameters
string$pathPath to check
Returns
string Set of slashes ("\\" or "/") public

Definition at line 303 of file folder.php.

References $path.

XoopsFolderHandler::pwd ( )

Return current path.

Returns
string Current path public

Definition at line 125 of file folder.php.

References $path.

Referenced by inPath().

Here is the caller graph for this function:

XoopsFolderHandler::read (   $sort = true,
  $exceptions = false 
)

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.

Parameters
boolean$sortsort list or not
mixed$exceptionseither an array or boolean true will no grab dot files
Returns
mixed Contents of current directory as an array, false on failure public

Definition at line 157 of file folder.php.

References $dir, $files, $sort, and addPathElement().

Referenced by find(), and findRecursiveHelper().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::realpath (   $path)

Get the real path (taking ".." and such into account)

Parameters
string$pathPath to resolve
Returns
string The resolved path

Definition at line 768 of file folder.php.

References $path, addPathElement(), and isAbsolute().

Referenced by __construct(), and cd().

Here is the call graph for this function:

Here is the caller graph for this function:

static XoopsFolderHandler::slashTerm (   $path)
static

Returns $path with added terminating slash (corrected for Windows or other OS).

Parameters
string$pathPath to check
Returns
string Path with ending slash public

Definition at line 337 of file folder.php.

References $path.

Referenced by delete(), dirsize(), inPath(), and inXoopsPath().

Here is the caller graph for this function:

XoopsFolderHandler::tree (   $path,
  $hidden = true,
  $type = null 
)

Returns an array of nested directories and files in each directory

Parameters
string$paththe directory path to build the tree from
boolean$hiddenreturn hidden files and directories
string$typeeither file or dir. null returns both files and directories
Returns
mixed array of nested directories and files in each directory public

Definition at line 454 of file folder.php.

References $dir, $directories, $files, $path, $type, and treeHelper().

Referenced by chmod().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::treeHelper (   $path,
  $hidden 
)
private

Private method to list directories and files in each directory

Parameters
string$pathpath name of directory
boolean$hiddenshow hidden files

private

Returns
void

Definition at line 488 of file folder.php.

References $path.

Referenced by tree().

Here is the caller graph for this function:

Member Data Documentation

XoopsFolderHandler::$directories
private

Definition at line 85 of file folder.php.

Referenced by tree().

XoopsFolderHandler::$errors = false
private

Definition at line 77 of file folder.php.

Referenced by errors().

XoopsFolderHandler::$files
private

Definition at line 93 of file folder.php.

Referenced by delete(), find(), findRecursiveHelper(), read(), and tree().

XoopsFolderHandler::$messages = array()
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::$sort = false

Definition at line 53 of file folder.php.

Referenced by find(), findRecursive(), findRecursiveHelper(), and read().


The documentation for this class was generated from the following file: