PHP Класс f, kirby

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

append() статический публичный Метод

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.
Результат boolean

convert() статический публичный Метод

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
Результат string

dirname() статический публичный Метод

Just an alternative for dirname() to stay consistent
static public dirname ( string $file = __FILE__ ) : string
$file string The path
Результат string

extension() статический публичный Метод

Gets the extension of a file
static public extension ( $filename ) : string
Результат string

filename() статический публичный Метод

Extracts the filename from a file path
static public filename ( $name ) : string
Результат string

move() статический публичный Метод

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
Результат boolean

name() статический публичный Метод

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
Результат string

nice_size() статический публичный Метод

Converts an integer size into a human readable format
static public nice_size ( integer $size ) : string
$size integer The file size
Результат string

read() статический публичный Метод

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.
Результат mixed

remove() статический публичный Метод

Deletes a file
static public remove ( string $file ) : boolean
$file string The path for the file
Результат boolean

safe_name() статический публичный Метод

Sanitize a filename to strip unwanted special characters
static public safe_name ( string $string ) : string
$string string The file name
Результат string

size() статический публичный Метод

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
Результат mixed

write() статический публичный Метод

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.
Результат boolean