XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
XoopsFolderHandler Class Reference

Public Member Functions

 __construct ($path=false, $create=true, $mode=false)
 
 _findRecursive ($pattern, $sort=false)
 
 _tree ($path, $hidden)
 
 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)
 
 XoopsFolderHandler ($path, $create=false, $mode=false)
 

Static Public Member Functions

 addPathElement ($path, $element)
 
 correctSlashFor ($path)
 
 isAbsolute ($path)
 
 isSlashTerm ($path)
 
 isWindowsPath ($path)
 
 normalizePath ($path)
 
 slashTerm ($path)
 

Public Attributes

 $directories
 
 $errors = false
 
 $files
 
 $messages = array()
 
 $mode = '0755'
 
 $path = null
 
 $sort = false
 

Detailed Description

Definition at line 54 of file folder.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$pathPath to folder
boolean$createCreate folder if not found
mixed$modeMode (CHMOD) to apply to created folder, false to ignore

Definition at line 119 of file folder.php.

References $mode, $path, cd(), create(), isAbsolute(), and realpath().

Referenced by XoopsFolderHandler().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

XoopsFolderHandler::_findRecursive (   $pattern,
  $sort = false 
)

Private helper function for findRecursive.

Parameters
string$patternPattern to match against
Returns
array Files matching pattern private

Definition at line 255 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::_tree (   $path,
  $hidden 
)

Private method to list directories and files in each directory

Parameters
string$path
$= boolean $hidden private

Definition at line 485 of file folder.php.

References $path.

Referenced by tree().

Here is the caller graph for this function:

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 359 of file folder.php.

References $path, and slashTerm().

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

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsFolderHandler::cd (   $path)

Change directory to $desired_path.

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

Definition at line 159 of file folder.php.

References $path, and realpath().

Referenced by __construct(), _findRecursive(), copy(), findRecursive(), 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
integer$modeoctal value 0755
boolean$recursivechmod recursively
array$exceptionsarray of files, directories to skip
Returns
boolean Returns TRUE on success, FALSE on failure public

Definition at line 409 of file folder.php.

References $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 628 of file folder.php.

References $handle, $mode, $options, addPathElement(), cd(), chmod(), errors(), and messages().

Referenced by move().

Here is the call graph for this function:

Here is the caller graph for this function:

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 326 of file folder.php.

References $path, and isWindowsPath().

Referenced by slashTerm().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Create a directory structure recursively.

Parameters
string$pathnameThe directory structure to create
integer$modeoctal value 0755
Returns
boolean Returns TRUE on success, FALSE on failure public

Definition at line 514 of file folder.php.

References $mode, errors(), 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 584 of file folder.php.

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

Here is the call graph for this function:

XoopsFolderHandler::dirsize ( )

Returns the size in bytes of this Folder.

Parameters
string$directoryPath to directory public

Definition at line 547 of file folder.php.

References $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 742 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$patternPreg_match pattern (Defaults to: .*)
Returns
array Files that match given pattern public

Definition at line 217 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: .*)
Returns
array Files matching $pattern public

Definition at line 240 of file folder.php.

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

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.

Returns
bool public

Definition at line 383 of file folder.php.

References $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.

Returns
bool public

Definition at line 370 of file folder.php.

References $dir, $path, inPath(), and slashTerm().

Here is the call graph for this function:

XoopsFolderHandler::isAbsolute (   $path)
static

Returns true if given $path is an absolute path.

Parameters
string$pathPath to check
Returns
bool public

Definition at line 296 of file folder.php.

References $path.

Referenced by __construct(), and realpath().

Here is the caller graph for this function:

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 794 of file folder.php.

References $path.

Referenced by slashTerm().

Here is the caller graph for this function:

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 280 of file folder.php.

References $path.

Referenced by correctSlashFor(), and normalizePath().

Here is the caller graph for this function:

XoopsFolderHandler::messages ( )

get messages from latest method

Returns
array public

Definition at line 731 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
boolean Success public

Definition at line 705 of file folder.php.

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

Here is the call graph for this function:

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 310 of file folder.php.

References $path, and isWindowsPath().

Here is the call graph for this function:

XoopsFolderHandler::pwd ( )

Return current path.

Returns
string Current path public

Definition at line 147 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$sort
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 177 of file folder.php.

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

Referenced by _findRecursive(), and find().

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 753 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:

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 342 of file folder.php.

References $path, correctSlashFor(), and isSlashTerm().

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

Here is the call graph for this function:

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 455 of file folder.php.

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

Referenced by chmod().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 136 of file folder.php.

References $mode, $path, and __construct().

Here is the call graph for this function:

Member Data Documentation

XoopsFolderHandler::$directories

Definition at line 102 of file folder.php.

Referenced by tree().

XoopsFolderHandler::$errors = false

Definition at line 94 of file folder.php.

Referenced by errors().

XoopsFolderHandler::$files

Definition at line 110 of file folder.php.

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

XoopsFolderHandler::$messages = array()

Definition at line 86 of file folder.php.

Referenced by messages().

XoopsFolderHandler::$mode = '0755'

Definition at line 78 of file folder.php.

Referenced by __construct(), chmod(), copy(), create(), and XoopsFolderHandler().

XoopsFolderHandler::$sort = false

Definition at line 70 of file folder.php.

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


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