PHP Class WPDKFilesystem

Author: =undo= ([email protected])
Inheritance: extends WPDKObject
Show file Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$__version string Override version

Public Methods

Method Description
_rglob ( string $path, string $match = '', &$result = [] ) : array Return an array with all matched files from root folder.
append ( string $data, string $filename ) : boolean Append data to a file and return TRUE on successfully, FALSE otherwise.
ext ( string $filename ) : string Return the extension of a filename
fileSize ( string $filename, integer $precision = 2 ) : string | boolean Return the file size (B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB) well formatted. Return FALSE if file doesn't exists or filesize() failure.
filename ( string $filename ) : string Return the only filename part. if a filename is 'test.black.jpg' will return 'test.black'
recursiveScan ( string $path, string $match = '' ) : array Return an array with all matched files from root folder. This method release the follow filters:

Method Details

_rglob() public method

Return an array with all matched files from root folder.
public _rglob ( string $path, string $match = '', &$result = [] ) : array
$path string Folder root
$match string Optional. Regex to apply on file name. For example use '/^.*\.(php)$/i' to get only php file
return array

append() public static method

Append data to a file and return TRUE on successfully, FALSE otherwise.
Since: 1.7.0
public static append ( string $data, string $filename ) : boolean
$data string Data to append.
$filename string Complete path filename.
return boolean

ext() public static method

Return the extension of a filename
See also: filename()
public static ext ( string $filename ) : string
$filename string A comoplete filename
return string

fileSize() public static method

Return the file size (B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB) well formatted. Return FALSE if file doesn't exists or filesize() failure.
public static fileSize ( string $filename, integer $precision = 2 ) : string | boolean
$filename string File name or path to a file
$precision integer Digits to display after decimal
return string | boolean

filename() public static method

Return the only filename part. if a filename is 'test.black.jpg' will return 'test.black'
See also: ext()
Since: 1.4.15
public static filename ( string $filename ) : string
$filename string A comoplete filename
return string

recursiveScan() public static method

wpdk_rglob_find_dir( true, $file ) - when find a dir wpdk_rglob_find_file( true, $file ) - when find a a file wpdk_rglob_matched( $regexp_result, $file, $match ) - after preg_match() done
Since: 1.0.0.b4
public static recursiveScan ( string $path, string $match = '' ) : array
$path string Folder root
$match string Optional. Regex to apply on file name. For example use '/^.*\.(php)$/i' to get only php file. Default is empty
return array

Property Details

$__version public property

Override version
public string $__version
return string