PHP Class f, kirby

Afficher le fichier Open project: bastianallgeier/kirby Class Usage Examples

Méthodes publiques

Méthode Description
append ( string $file, mixed $content ) : boolean Appends new content to an existing file
convert ( string $name, string $type = 'jpg' ) : string Convert the filename to a new extension
dirname ( string $file = __FILE__ ) : string Just an alternative for dirname() to stay consistent
extension ( $filename ) : string Gets the extension of a file
filename ( $name ) : string Extracts the filename from a file path
move ( string $old, string $new ) : boolean Moves a file to a new location
name ( $name, boolean $remove_path = false ) : string Extracts the name from a file path or filename without extension
nice_size ( integer $size ) : string Converts an integer size into a human readable format
read ( string $file, mixed $parse = false ) : mixed Reads the content of a file
remove ( string $file ) : boolean Deletes a file
safe_name ( string $string ) : string Sanitize a filename to strip unwanted special characters
size ( string $file, boolean $nice = false ) : mixed Returns the size of a file.
write ( string $file, mixed $content, boolean $append = false ) : boolean Creates a new file

Method Details

append() static public méthode

Appends new content to an existing file
static public append ( string $file, mixed $content ) : boolean
$file string The path for the file
$content mixed Either a string or an array. Arrays will be converted to JSON.
Résultat boolean

convert() static public méthode

Convert the filename to a new extension
static public convert ( string $name, string $type = 'jpg' ) : string
$name string The file name
$type string The new extension
Résultat string

dirname() static public méthode

Just an alternative for dirname() to stay consistent
static public dirname ( string $file = __FILE__ ) : string
$file string The path
Résultat string

extension() static public méthode

Gets the extension of a file
static public extension ( $filename ) : string
Résultat string

filename() static public méthode

Extracts the filename from a file path
static public filename ( $name ) : string
Résultat string

move() static public méthode

Moves a file to a new location
static public move ( string $old, string $new ) : boolean
$old string The current path for the file
$new string The path to the new location
Résultat boolean

name() static public méthode

Extracts the name from a file path or filename without extension
static public name ( $name, boolean $remove_path = false ) : string
$remove_path boolean remove the path from the name
Résultat string

nice_size() static public méthode

Converts an integer size into a human readable format
static public nice_size ( integer $size ) : string
$size integer The file size
Résultat string

read() static public méthode

Reads the content of a file
static public read ( string $file, mixed $parse = false ) : mixed
$file string The path for the file
$parse mixed if set to true, parse the result with the passed method. See: "str::parse()" for more info about available methods.
Résultat mixed

remove() static public méthode

Deletes a file
static public remove ( string $file ) : boolean
$file string The path for the file
Résultat boolean

safe_name() static public méthode

Sanitize a filename to strip unwanted special characters
static public safe_name ( string $string ) : string
$string string The file name
Résultat string

size() static public méthode

Returns the size of a file.
static public size ( string $file, boolean $nice = false ) : mixed
$file string The path
$nice boolean True: return the size in a human readable format
Résultat mixed

write() static public méthode

Creates a new file
static public write ( string $file, mixed $content, boolean $append = false ) : boolean
$file string The path for the new file
$content mixed Either a string or an array. Arrays will be converted to JSON.
$append boolean true: append the content to an exisiting file if available. false: overwrite.
Résultat boolean