PHP Class dir, kirby

This class makes it easy to create/edit/delete directories on the filesystem
Mostrar archivo Open project: bastianallgeier/kirby Class Usage Examples

Public Methods

Method Description
clean ( string $dir ) : boolean Flushes a directory
inspect ( string $dir ) : mixed Reads a directory and returns a full set of info about it
make ( string $dir ) : boolean Creates a new directory
modified ( string $dir, integer $modified ) : integer Recursively check when the dir and all subfolders have been modified for the last time.
move ( string $old, string $new ) : boolean Moves a directory to a new location
read ( string $dir ) : mixed Reads all files from a directory and returns them as an array.
remove ( string $dir, boolean $keep = false ) : boolean Deletes a directory
size ( $path, boolean $recursive = true, boolean $nice = false ) : mixed Gets the size of the directory and all subfolders and files

Method Details

clean() static public method

Flushes a directory
static public clean ( string $dir ) : boolean
$dir string The path of the directory
return boolean True: the directory has been flushed, false: flushing failed

inspect() static public method

Reads a directory and returns a full set of info about it
static public inspect ( string $dir ) : mixed
$dir string The path of directory
return mixed An info array or false

make() static public method

Creates a new directory
static public make ( string $dir ) : boolean
$dir string The path for the new directory
return boolean True: the dir has been created, false: creating failed

modified() static public method

Recursively check when the dir and all subfolders have been modified for the last time.
static public modified ( string $dir, integer $modified ) : integer
$dir string The path of the directory
$modified integer internal modified store
return integer

move() static public method

Moves a directory to a new location
static public move ( string $old, string $new ) : boolean
$old string The current path of the directory
$new string The desired path where the dir should be moved to
return boolean True: the directory has been moved, false: moving failed

read() static public method

It skips unwanted invisible stuff.
static public read ( string $dir ) : mixed
$dir string The path of directory
return mixed An array of filenames or false

remove() static public method

Deletes a directory
static public remove ( string $dir, boolean $keep = false ) : boolean
$dir string The path of the directory
$keep boolean If set to true, the directory will flushed but not removed.
return boolean True: the directory has been removed, false: removing failed

size() static public method

Gets the size of the directory and all subfolders and files
static public size ( $path, boolean $recursive = true, boolean $nice = false ) : mixed
$recursive boolean
$nice boolean returns the size in a human readable size
return mixed