PHP 클래스 Base

파일 보기 프로젝트 열기: bcosca/fatfree 1 사용 예제들

공개 메소드들

메소드 설명
__call ( $key, $args ) : mixed Call function identified by hive key
__construct ( ) ! Bootstrap
__get ( $key ) : mixed Alias for offsetget()
__isset ( $key ) : mixed Alias for offsetexists()
__set ( $key, $val ) : mixed Alias for offsetset()
__unset ( $key ) : mixed Alias for offsetunset()
abort ( ) Disconnect HTTP client
agent ( ) : string Return HTTP user agent
ajax ( ) : boolean Return TRUE if XMLHttpRequest detected
alias ( $name, $params = [], $query = NULL ) : string Assemble url from alias name
base64 ( $data, $mime ) : string Return Base64-encoded equivalent
blacklisted ( $ip ) : boolean Return TRUE if IPv4 address exists in DNSBL
build ( $url, $args = [] ) : string Replace tokenized URL with available token values
call ( $func, $args = NULL, $hooks = '' ) : mixed | FALSE Execute callback/hooks (supports 'class->method' format)
camelcase ( $str ) : string Convert snakecase string to camelcase
chain ( $funcs, $args = NULL ) : array Execute specified callbacks in succession; Apply same arguments to all callbacks
checked ( $key ) : boolean Return TRUE if hive variable is 'on'
clean ( $arg, $tags = NULL ) : mixed Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks
clear ( $key ) : null Unset hive key
compile ( $str ) : string Convert JS-style token to PHP expression
concat ( $key, $val ) : string Concatenate string to hive string variable
config ( $file, $allow = FALSE ) : object Configure framework according to .ini-style file settings; If optional 2nd arg is provided, template strings are interpreted
constants ( $class, $prefix = '' ) : array Convert class constants to array
copy ( $src, $dst ) : mixed Copy contents of hive variable to another
csv ( array $args ) : string Flatten array values and return as CSV string
decode ( $str ) : string Convert HTML entities back to characters
devoid ( $key, &$val = NULL ) : boolean Return TRUE if hive key is empty and not cached
dump ( $expr ) : null Dump expression with syntax highlighting
encode ( $str ) : string Convert special characters to HTML entities
error ( $code, $text = '', array $trace = NULL, $level ) : null Log error; Execute ONERROR handler if defined, else display default error page (HTML for synchronous requests, JSON string for AJAX requests)
exists ( $key, &$val = NULL ) : boolean Return TRUE if hive key is set (or return timestamp and TTL if cached)
expire ( $secs ) : null Send cache metadata to HTTP client
extend ( $key, $src, $keep = FALSE ) : array Extend hive array variable with default values from $src
extract ( $arr, $prefix ) : array Extract values of array whose keys start with the given prefix
fixslashes ( $str ) : string Convert backslashes to slashes
flip ( $key ) : array Swap keys and values of hive array variable
format ( ) : string Return locale-aware formatted string
get ( $key, $args = NULL ) : mixed Retrieve contents of hive key
grab ( $func, $args = NULL ) : string | array Grab the real route handler behind the string expression
hash ( $str ) : string Generate 64bit/base36 hash
highlight ( $text ) : string Apply syntax highlighting
hive ( ) : array Publish hive contents
ip ( ) : string Sniff IP address
language ( $code ) : string Assign/auto-detect language
lexicon ( $path, $ttl ) : array Return lexicon entries
map ( $url, $class, $ttl, $kbps ) : null Provide ReST interface by mapping HTTP verb to class method
mask ( $pattern, $url = NULL ) Applies the specified URL mask and returns parameterized matches
merge ( $key, $src, $keep = FALSE ) : array Merge array with hive array variable
mock ( $pattern, array $args = NULL, array $headers = NULL, $body = NULL ) : mixed Mock HTTP request
mset ( array $vars, $prefix = '', $ttl ) : null Multi-variable assignment using associative array
mutex ( $id, $func, $args = NULL ) : mixed Create mutex, invoke callback then drop ownership when done
offsetexists ( $key ) : mixed Convenience method for checking hive key
offsetget ( $key ) : mixed Convenience method for retrieving hive value
offsetset ( $key, $val ) : mixed Convenience method for assigning hive value
offsetunset ( $key ) : null Convenience method for removing hive key
parse ( $str ) : array Parse string containing key-value pairs
pop ( $key ) : mixed Remove last element of hive array variable
push ( $key, $val ) : mixed Add element to the end of hive array variable
read ( $file, $lf = FALSE ) : string Read file (with option to apply Unix LF as standard line ending)
recursive ( $arg, $func, $stack = [] ) : mixed Invoke callback recursively for all data types
redirect ( $pattern, $url, $permanent = TRUE ) : null Redirect a route to another URL
ref ( $key, $add = TRUE, &$var = NULL ) : mixed Get hive key reference/contents; Add non-existent hive keys, array elements, and object properties by default
rel ( $url ) : string Return path (and query parameters) relative to the base directory
relay ( $funcs, $args = NULL ) : array Execute specified callbacks in succession; Relay result of previous callback as argument to the next callback
reroute ( $url = NULL, $permanent = FALSE ) : null Reroute to specified URI
route ( $pattern, $handler, $ttl, $kbps ) : null Bind handler to route pattern
run ( ) : mixed Match routes against incoming URI
scrub ( &$var, $tags = NULL ) : mixed Similar to clean(), except that variable is passed by reference
serialize ( $arg ) : string Return string representation of PHP value
set ( $key, $val, $ttl ) : mixed Bind value to hive key
shift ( $key ) : mixed Remove first element of hive array variable
sign ( $num ) : integer Return -1 if specified number is negative, 0 if zero, or 1 if the number is positive
snakecase ( $str ) : string Convert camelcase string to snakecase
split ( $str, $noempty = TRUE ) : array Split comma-, semi-colon, or pipe-separated string
status ( $code ) : string Send HTTP status header; Return text equivalent of status code
stringify ( $arg, array $stack = NULL ) : string Convert PHP expression/value to compressed exportable string
sync ( $key ) : array Sync PHP global with corresponding hive key
trace ( array $trace = NULL, $format = TRUE ) : string | array Return filtered stack trace as a formatted string (or array)
unload ( $cwd ) Execute framework/application shutdown sequence
unserialize ( $arg ) : string Return PHP value derived from string
unshift ( $key, $val ) : mixed Add element to the beginning of hive array variable
until ( $func, $args = NULL, $timeout = 60 ) : mixed Loop until callback returns TRUE (for long polling)
visible ( $obj, $key ) : boolean Return TRUE if property has public visibility
write ( $file, $data, $append = FALSE ) : integer | FALSE Exclusive file write

보호된 메소드들

메소드 설명
autoload ( $class ) : mixed Namespace-aware class autoloader

비공개 메소드들

메소드 설명
__clone ( ) ! Prohibit cloning
cut ( $key ) : array Return the parts of specified hive key

메소드 상세

__call() 공개 메소드

Call function identified by hive key
public __call ( $key, $args ) : mixed
$key string
$args array
리턴 mixed

__construct() 공개 메소드

! Bootstrap
public __construct ( )

__get() 공개 메소드

Alias for offsetget()
public __get ( $key ) : mixed
$key string
리턴 mixed

__isset() 공개 메소드

Alias for offsetexists()
public __isset ( $key ) : mixed
$key string
리턴 mixed

__set() 공개 메소드

Alias for offsetset()
public __set ( $key, $val ) : mixed
$key string
$val mixed
리턴 mixed

__unset() 공개 메소드

Alias for offsetunset()
public __unset ( $key ) : mixed
$key string
리턴 mixed

abort() 공개 메소드

Disconnect HTTP client
public abort ( )

agent() 공개 메소드

Return HTTP user agent
public agent ( ) : string
리턴 string

ajax() 공개 메소드

Return TRUE if XMLHttpRequest detected
public ajax ( ) : boolean
리턴 boolean

alias() 공개 메소드

Assemble url from alias name
public alias ( $name, $params = [], $query = NULL ) : string
$name string
$params array|string
$query string|array
리턴 string

autoload() 보호된 메소드

Namespace-aware class autoloader
protected autoload ( $class ) : mixed
$class string
리턴 mixed

base64() 공개 메소드

Return Base64-encoded equivalent
public base64 ( $data, $mime ) : string
$data string
$mime string
리턴 string

blacklisted() 공개 메소드

Return TRUE if IPv4 address exists in DNSBL
public blacklisted ( $ip ) : boolean
$ip string
리턴 boolean

build() 공개 메소드

Replace tokenized URL with available token values
public build ( $url, $args = [] ) : string
$url array|string
$args array
리턴 string

call() 공개 메소드

Execute callback/hooks (supports 'class->method' format)
public call ( $func, $args = NULL, $hooks = '' ) : mixed | FALSE
$func callback
$args mixed
$hooks string
리턴 mixed | FALSE

camelcase() 공개 메소드

Convert snakecase string to camelcase
public camelcase ( $str ) : string
$str string
리턴 string

chain() 공개 메소드

Execute specified callbacks in succession; Apply same arguments to all callbacks
public chain ( $funcs, $args = NULL ) : array
$funcs array|string
$args mixed
리턴 array

checked() 공개 메소드

Return TRUE if hive variable is 'on'
public checked ( $key ) : boolean
$key string
리턴 boolean

clean() 공개 메소드

Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks
public clean ( $arg, $tags = NULL ) : mixed
$arg mixed
$tags string
리턴 mixed

clear() 공개 메소드

Unset hive key
public clear ( $key ) : null
$key string
리턴 null

compile() 공개 메소드

Convert JS-style token to PHP expression
public compile ( $str ) : string
$str string
리턴 string

concat() 공개 메소드

Concatenate string to hive string variable
public concat ( $key, $val ) : string
$key string
$val string
리턴 string

config() 공개 메소드

Configure framework according to .ini-style file settings; If optional 2nd arg is provided, template strings are interpreted
public config ( $file, $allow = FALSE ) : object
$file string
$allow bool
리턴 object

constants() 공개 메소드

Convert class constants to array
public constants ( $class, $prefix = '' ) : array
$class object|string
$prefix string
리턴 array

copy() 공개 메소드

Copy contents of hive variable to another
public copy ( $src, $dst ) : mixed
$src string
$dst string
리턴 mixed

csv() 공개 메소드

Flatten array values and return as CSV string
public csv ( array $args ) : string
$args array array
리턴 string

decode() 공개 메소드

Convert HTML entities back to characters
public decode ( $str ) : string
$str string
리턴 string

devoid() 공개 메소드

Return TRUE if hive key is empty and not cached
public devoid ( $key, &$val = NULL ) : boolean
$key string
$val mixed
리턴 boolean

dump() 공개 메소드

Dump expression with syntax highlighting
public dump ( $expr ) : null
$expr mixed
리턴 null

encode() 공개 메소드

Convert special characters to HTML entities
public encode ( $str ) : string
$str string
리턴 string

error() 공개 메소드

Log error; Execute ONERROR handler if defined, else display default error page (HTML for synchronous requests, JSON string for AJAX requests)
public error ( $code, $text = '', array $trace = NULL, $level ) : null
$code int
$text string
$trace array array
$level int
리턴 null

exists() 공개 메소드

Return TRUE if hive key is set (or return timestamp and TTL if cached)
public exists ( $key, &$val = NULL ) : boolean
$key string
$val mixed
리턴 boolean

expire() 공개 메소드

Send cache metadata to HTTP client
public expire ( $secs ) : null
$secs int
리턴 null

extend() 공개 메소드

Extend hive array variable with default values from $src
public extend ( $key, $src, $keep = FALSE ) : array
$key string
$src string|array
$keep bool
리턴 array

extract() 공개 메소드

Extract values of array whose keys start with the given prefix
public extract ( $arr, $prefix ) : array
$arr array
$prefix string
리턴 array

fixslashes() 공개 메소드

Convert backslashes to slashes
public fixslashes ( $str ) : string
$str string
리턴 string

flip() 공개 메소드

Swap keys and values of hive array variable
public flip ( $key ) : array
$key string
리턴 array

format() 공개 메소드

Return locale-aware formatted string
public format ( ) : string
리턴 string

get() 공개 메소드

Retrieve contents of hive key
public get ( $key, $args = NULL ) : mixed
$key string
$args string|array
리턴 mixed

grab() 공개 메소드

Grab the real route handler behind the string expression
public grab ( $func, $args = NULL ) : string | array
$func string
$args array
리턴 string | array

hash() 공개 메소드

Generate 64bit/base36 hash
public hash ( $str ) : string
$str
리턴 string

highlight() 공개 메소드

Apply syntax highlighting
public highlight ( $text ) : string
$text string
리턴 string

hive() 공개 메소드

Publish hive contents
public hive ( ) : array
리턴 array

ip() 공개 메소드

Sniff IP address
public ip ( ) : string
리턴 string

language() 공개 메소드

Assign/auto-detect language
public language ( $code ) : string
$code string
리턴 string

lexicon() 공개 메소드

Return lexicon entries
public lexicon ( $path, $ttl ) : array
$path string
$ttl int
리턴 array

map() 공개 메소드

Provide ReST interface by mapping HTTP verb to class method
public map ( $url, $class, $ttl, $kbps ) : null
$url string
$class string|object
$ttl int
$kbps int
리턴 null

mask() 공개 메소드

Applies the specified URL mask and returns parameterized matches
public mask ( $pattern, $url = NULL )
$pattern string
$url string|NULL

merge() 공개 메소드

Merge array with hive array variable
public merge ( $key, $src, $keep = FALSE ) : array
$key string
$src string|array
$keep bool
리턴 array

mock() 공개 메소드

Mock HTTP request
public mock ( $pattern, array $args = NULL, array $headers = NULL, $body = NULL ) : mixed
$pattern string
$args array array
$headers array array
$body string
리턴 mixed

mset() 공개 메소드

Multi-variable assignment using associative array
public mset ( array $vars, $prefix = '', $ttl ) : null
$vars array array
$prefix string
$ttl int
리턴 null

mutex() 공개 메소드

Create mutex, invoke callback then drop ownership when done
public mutex ( $id, $func, $args = NULL ) : mixed
$id string
$func callback
$args mixed
리턴 mixed

offsetexists() 공개 메소드

Convenience method for checking hive key
public offsetexists ( $key ) : mixed
$key string
리턴 mixed

offsetget() 공개 메소드

Convenience method for retrieving hive value
public offsetget ( $key ) : mixed
$key string
리턴 mixed

offsetset() 공개 메소드

Convenience method for assigning hive value
public offsetset ( $key, $val ) : mixed
$key string
$val scalar
리턴 mixed

offsetunset() 공개 메소드

Convenience method for removing hive key
public offsetunset ( $key ) : null
$key string
리턴 null

parse() 공개 메소드

Parse string containing key-value pairs
public parse ( $str ) : array
$str string
리턴 array

pop() 공개 메소드

Remove last element of hive array variable
public pop ( $key ) : mixed
$key string
리턴 mixed

push() 공개 메소드

Add element to the end of hive array variable
public push ( $key, $val ) : mixed
$key string
$val mixed
리턴 mixed

read() 공개 메소드

Read file (with option to apply Unix LF as standard line ending)
public read ( $file, $lf = FALSE ) : string
$file string
$lf bool
리턴 string

recursive() 공개 메소드

Invoke callback recursively for all data types
public recursive ( $arg, $func, $stack = [] ) : mixed
$arg mixed
$func callback
$stack array
리턴 mixed

redirect() 공개 메소드

Redirect a route to another URL
public redirect ( $pattern, $url, $permanent = TRUE ) : null
$pattern string|array
$url string
$permanent bool
리턴 null

ref() 공개 메소드

Get hive key reference/contents; Add non-existent hive keys, array elements, and object properties by default
public ref ( $key, $add = TRUE, &$var = NULL ) : mixed
$key string
$add bool
$var mixed
리턴 mixed

rel() 공개 메소드

Return path (and query parameters) relative to the base directory
public rel ( $url ) : string
$url string
리턴 string

relay() 공개 메소드

Execute specified callbacks in succession; Relay result of previous callback as argument to the next callback
public relay ( $funcs, $args = NULL ) : array
$funcs array|string
$args mixed
리턴 array

reroute() 공개 메소드

Reroute to specified URI
public reroute ( $url = NULL, $permanent = FALSE ) : null
$url array|string
$permanent bool
리턴 null

route() 공개 메소드

Bind handler to route pattern
public route ( $pattern, $handler, $ttl, $kbps ) : null
$pattern string|array
$handler callback
$ttl int
$kbps int
리턴 null

run() 공개 메소드

Match routes against incoming URI
public run ( ) : mixed
리턴 mixed

scrub() 공개 메소드

Similar to clean(), except that variable is passed by reference
public scrub ( &$var, $tags = NULL ) : mixed
$var mixed
$tags string
리턴 mixed

serialize() 공개 메소드

Return string representation of PHP value
public serialize ( $arg ) : string
$arg mixed
리턴 string

set() 공개 메소드

Bind value to hive key
public set ( $key, $val, $ttl ) : mixed
$key string
$val mixed
$ttl int
리턴 mixed

shift() 공개 메소드

Remove first element of hive array variable
public shift ( $key ) : mixed
$key string
리턴 mixed

sign() 공개 메소드

Return -1 if specified number is negative, 0 if zero, or 1 if the number is positive
public sign ( $num ) : integer
$num mixed
리턴 integer

snakecase() 공개 메소드

Convert camelcase string to snakecase
public snakecase ( $str ) : string
$str string
리턴 string

split() 공개 메소드

Split comma-, semi-colon, or pipe-separated string
public split ( $str, $noempty = TRUE ) : array
$str string
$noempty bool
리턴 array

status() 공개 메소드

Send HTTP status header; Return text equivalent of status code
public status ( $code ) : string
$code int
리턴 string

stringify() 공개 메소드

Convert PHP expression/value to compressed exportable string
public stringify ( $arg, array $stack = NULL ) : string
$arg mixed
$stack array array
리턴 string

sync() 공개 메소드

Sync PHP global with corresponding hive key
public sync ( $key ) : array
$key string
리턴 array

trace() 공개 메소드

Return filtered stack trace as a formatted string (or array)
public trace ( array $trace = NULL, $format = TRUE ) : string | array
$trace array array|NULL
$format bool
리턴 string | array

unload() 공개 메소드

Execute framework/application shutdown sequence
public unload ( $cwd )
$cwd string

unserialize() 공개 메소드

Return PHP value derived from string
public unserialize ( $arg ) : string
$arg mixed
리턴 string

unshift() 공개 메소드

Add element to the beginning of hive array variable
public unshift ( $key, $val ) : mixed
$key string
$val mixed
리턴 mixed

until() 공개 메소드

Loop until callback returns TRUE (for long polling)
public until ( $func, $args = NULL, $timeout = 60 ) : mixed
$func callback
$args array
$timeout int
리턴 mixed

visible() 공개 메소드

Return TRUE if property has public visibility
public visible ( $obj, $key ) : boolean
$obj object
$key string
리턴 boolean

write() 공개 메소드

Exclusive file write
public write ( $file, $data, $append = FALSE ) : integer | FALSE
$file string
$data mixed
$append bool
리턴 integer | FALSE