API - XOOPS 2.5.11 Beta 2
By monxoops.fr
XoopsFolderHandler Class Reference

Public Member Functions

 __construct ($path=false, $create=true, $mode=false)
 
 pwd ()
 
 cd ($path)
 
 read ($sort=true, $exceptions=false)
 
 find ($regexp_pattern='.*', $sort=false)
 
 findRecursive ($pattern='.*', $sort=false)
 
 _findRecursive ($pattern, $sort=false)
 
 inXoopsPath ($path='')
 
 inPath ($path='', $reverse=false)
 
 chmod ($path, $mode=false, $recursive=true, $exceptions=array())
 
 tree ($path, $hidden=true, $type=null)
 
 _tree ($path, $hidden)
 
 create ($pathname, $mode=false)
 
 dirsize ()
 
 delete ($path)
 
 copy ($options=array())
 
 move ($options)
 
 messages ()
 
 errors ()
 
 realpath ($path)
 

Static Public Member Functions

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

Data Fields

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
bool | string$pathPath to folder
boolean$createCreate folder if not found
mixed$modeMode (CHMOD) to apply to created folder, false to ignore
Here is the call graph for this function:

Member Function Documentation

◆ _findRecursive()

_findRecursive (   $pattern,
  $sort = false 
)

Private helper function for findRecursive.

Parameters
string$patternPattern to match against
bool$sort
Returns
array Files matching pattern @access private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _tree()

_tree (   $path,
  $hidden 
)

Private method to list directories and files in each directory

Parameters
string$path
$hidden
Here is the caller graph for this function:

◆ addPathElement()

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 @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cd()

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 @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ chmod()

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

Change the mode on a directory structure recursively.

Parameters
string$pathThe path to chmod
bool | int$modeoctal value 0755
boolean$recursivechmod recursively
array$exceptionsarray of files, directories to skip
Returns
boolean Returns TRUE on success, FALSE on failure @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy()

copy (   $options = array())

Recursive directory copy.

Parameters
array | string$options(to, from, chmod, skip)
Returns
bool @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ correctSlashFor()

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 "/") @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

create (   $pathname,
  $mode = false 
)

Create a directory structure recursively.

Parameters
string$pathnameThe directory structure to create
bool | int$modeoctal value 0755
Returns
boolean Returns TRUE on success, FALSE on failure @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete()

delete (   $path)

Recursively Remove directories if system allow.

Parameters
string$pathPath of directory to delete
Returns
boolean Success @access public
Here is the call graph for this function:

◆ dirsize()

dirsize ( )

Returns the size in bytes of this Folder.

Returns
int $size @access public
Here is the call graph for this function:

◆ errors()

errors ( )

get error from latest method

Returns
array @access public
Here is the caller graph for this function:

◆ find()

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

Returns an array of all matching files in current directory.

Parameters
string$regexp_patternPreg_match pattern (Defaults to: .*)
bool$sort
Returns
array Files that match given pattern @access public

◆ findRecursive()

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

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

Parameters
string$patternPreg_match pattern (Defaults to: .*)
bool$sort
Returns
array Files matching $pattern @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inPath()

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

Returns true if the File is in given path.

Parameters
string$path
bool$reverse
Returns
bool @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inXoopsPath()

inXoopsPath (   $path = '')

Returns true if the File is in a given XoopsPath.

Parameters
string$path
Returns
bool @access public
Here is the call graph for this function:

◆ isAbsolute()

isAbsolute (   $path)
static

Returns true if given $path is an absolute path.

Parameters
string$pathPath to check
Returns
bool @access public
Here is the caller graph for this function:

◆ isSlashTerm()

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 @access public
Here is the caller graph for this function:

◆ isWindowsPath()

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 @access public
Here is the caller graph for this function:

◆ messages()

messages ( )

get messages from latest method

Returns
array @access public
Here is the caller graph for this function:

◆ move()

move (   $options)

Recursive directory move.

Parameters
array | string$options(to, from, chmod, skip)
Returns
string|boolean Success @access public
Here is the call graph for this function:

◆ normalizePath()

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 "/") @access public
Here is the call graph for this function:

◆ pwd()

pwd ( )

Return current path.

Returns
string Current path @access public
Here is the caller graph for this function:

◆ read()

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 @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ realpath()

realpath (   $path)

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

Parameters
string$pathPath to resolve
Returns
string|false The resolved path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slashTerm()

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 @access public
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tree()

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 @access public
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ $directories

$directories

◆ $errors

$errors = false

◆ $files

$files

◆ $messages

$messages = array()

◆ $mode

$mode = '0755'

◆ $path

$path

◆ $sort

$sort = false

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