Fat-Free Framework
3.2.1
|
Base structure. More...
Public Member Functions | |
sync ($key) | |
build ($url) | |
parse ($str) | |
compile ($str) | |
& | ref ($key, $add=TRUE) |
exists ($key, &$val=NULL) | |
devoid ($key) | |
set ($key, $val, $ttl=0) | |
get ($key, $args=NULL) | |
clear ($key) | |
mset (array $vars, $prefix='', $ttl=0) | |
hive () | |
copy ($src, $dst) | |
concat ($key, $val) | |
flip ($key) | |
push ($key, $val) | |
pop ($key) | |
unshift ($key, $val) | |
shift ($key) | |
merge ($key, $src) | |
fixslashes ($str) | |
split ($str) | |
stringify ($arg, array $stack=NULL) | |
csv (array $args) | |
camelcase ($str) | |
snakecase ($str) | |
sign ($num) | |
hash ($str) | |
base64 ($data, $mime) | |
encode ($str) | |
decode ($str) | |
dupe ($arg) | |
recursive ($arg, $func) | |
clean ($arg, $tags=NULL) | |
scrub (&$var, $tags=NULL) | |
format () | |
language ($code) | |
lexicon ($path) | |
serialize ($arg) | |
unserialize ($arg) | |
status ($code) | |
expire ($secs=0) | |
error ($code, $text='', array $trace=NULL) | |
mock ($pattern, array $args=NULL, array $headers=NULL, $body=NULL) | |
route ($pattern, $handler, $ttl=0, $kbps=0) | |
reroute ($url, $permanent=FALSE) | |
map ($url, $class, $ttl=0, $kbps=0) | |
blacklisted ($ip) | |
run () | |
call ($func, $args=NULL, $hooks='') | |
chain ($funcs, $args=NULL) | |
relay ($funcs, $args=NULL) | |
config ($file) | |
mutex ($id, $func, $args=NULL) | |
read ($file, $lf=FALSE) | |
write ($file, $data, $append=FALSE) | |
highlight ($text) | |
dump ($expr) | |
rel ($url) | |
unload ($cwd) | |
__construct () | |
Bootstrap. | |
Public Attributes | |
const | GLOBALS ='GET|POST|COOKIE|REQUEST|SESSION|FILES|SERVER|ENV' |
Mapped PHP globals. | |
const | VERBS ='GET|HEAD|POST|PUT|PATCH|DELETE|CONNECT' |
HTTP verbs. | |
const | MODE =0755 |
Default directory permissions. | |
const | CSS ='code.css' |
Syntax highlighting stylesheet. | |
$init | |
Initial settings. | |
$languages | |
Language lookup sequence. | |
$locales | |
Equivalent Locales. | |
$fallback ='en' | |
Default fallback language. | |
$null =NULL | |
NULL reference. | |
const | PACKAGE ='Fat-Free Framework' |
const | VERSION ='3.2.1-Release' |
const | HTTP_100 ='Continue' |
const | HTTP_101 ='Switching Protocols' |
const | HTTP_200 ='OK' |
const | HTTP_201 ='Created' |
const | HTTP_202 ='Accepted' |
const | HTTP_203 ='Non-Authorative Information' |
const | HTTP_204 ='No Content' |
const | HTTP_205 ='Reset Content' |
const | HTTP_206 ='Partial Content' |
const | HTTP_300 ='Multiple Choices' |
const | HTTP_301 ='Moved Permanently' |
const | HTTP_302 ='Found' |
const | HTTP_303 ='See Other' |
const | HTTP_304 ='Not Modified' |
const | HTTP_305 ='Use Proxy' |
const | HTTP_307 ='Temporary Redirect' |
const | HTTP_400 ='Bad Request' |
const | HTTP_401 ='Unauthorized' |
const | HTTP_402 ='Payment Required' |
const | HTTP_403 ='Forbidden' |
const | HTTP_404 ='Not Found' |
const | HTTP_405 ='Method Not Allowed' |
const | HTTP_406 ='Not Acceptable' |
const | HTTP_407 ='Proxy Authentication Required' |
const | HTTP_408 ='Request Timeout' |
const | HTTP_409 ='Conflict' |
const | HTTP_410 ='Gone' |
const | HTTP_411 ='Length Required' |
const | HTTP_412 ='Precondition Failed' |
const | HTTP_413 ='Request Entity Too Large' |
const | HTTP_414 ='Request-URI Too Long' |
const | HTTP_415 ='Unsupported Media Type' |
const | HTTP_416 ='Requested Range Not Satisfiable' |
const | HTTP_417 ='Expectation Failed' |
const | HTTP_500 ='Internal Server Error' |
const | HTTP_501 ='Not Implemented' |
const | HTTP_502 ='Bad Gateway' |
const | HTTP_503 ='Service Unavailable' |
const | HTTP_504 ='Gateway Timeout' |
const | HTTP_505 ='HTTP Version Not Supported' |
const | REQ_SYNC =1 |
const | REQ_AJAX =2 |
const | E_Pattern ='Invalid routing pattern: %s' |
const | E_Named ='Named route does not exist: %s' |
const | E_Fatal ='Fatal error: %s' |
const | E_Open ='Unable to open %s' |
const | E_Routes ='No routes specified' |
const | E_Class ='Invalid class %s' |
const | E_Method ='Invalid method %s' |
const | E_Hive ='Invalid hive key %s' |
Protected Member Functions | |
autoload ($class) | |
Additional Inherited Members | |
![]() | |
static | instance () |
Base structure.
|
protected |
Namespace-aware class autoloader
$class | string |
Base::base64 | ( | $data, | |
$mime | |||
) |
Return Base64-encoded equivalent
$data | string |
$mime | string |
Base::blacklisted | ( | $ip | ) |
Return TRUE if IPv4 address exists in DNSBL
$ip | string |
Base::build | ( | $url | ) |
Replace tokenized URL with current route's token values
$url | array|string |
Base::call | ( | $func, | |
$args = NULL , |
|||
$hooks = '' |
|||
) |
Execute callback/hooks (supports 'class->method' format)
$func | callback |
$args | mixed |
$hooks | string |
Base::camelcase | ( | $str | ) |
Convert snakecase string to camelcase
$str | string |
Base::chain | ( | $funcs, | |
$args = NULL |
|||
) |
Execute specified callbacks in succession; Apply same arguments to all callbacks
$funcs | array|string |
$args | mixed |
Base::clean | ( | $arg, | |
$tags = NULL |
|||
) |
Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks
$arg | mixed |
$tags | string |
Base::clear | ( | $key | ) |
Unset hive key
$key | string |
Base::compile | ( | $str | ) |
Convert JS-style token to PHP expression
$str | string |
Base::concat | ( | $key, | |
$val | |||
) |
Concatenate string to hive string variable
$key | string |
$val | string |
Base::config | ( | $file | ) |
Configure framework according to .ini-style file settings
$file | string |
Base::copy | ( | $src, | |
$dst | |||
) |
Copy contents of hive variable to another
$src | string |
$dst | string |
Base::csv | ( | array | $args | ) |
Flatten array values and return as CSV string
$args | array |
Base::decode | ( | $str | ) |
Convert HTML entities back to characters
$str | string |
Base::devoid | ( | $key | ) |
Return TRUE if hive key is empty and not cached
$key | string |
Base::dump | ( | $expr | ) |
Dump expression with syntax highlighting
$expr | mixed |
Base::dupe | ( | $arg | ) |
Attempt to clone object
Base::encode | ( | $str | ) |
Convert special characters to HTML entities
$str | string |
Base::error | ( | $code, | |
$text = '' , |
|||
array | $trace = NULL |
||
) |
Log error; Execute ONERROR handler if defined, else display default error page (HTML for synchronous requests, JSON string for AJAX requests)
$code | int |
$text | string |
$trace | array |
Base::exists | ( | $key, | |
& | $val = NULL |
||
) |
Return TRUE if hive key is not set (or return timestamp and TTL if cached)
$key | string |
$val | mixed |
Base::expire | ( | $secs = 0 | ) |
Send cache metadata to HTTP client
$secs | int |
Base::fixslashes | ( | $str | ) |
Convert backslashes to slashes
$str | string |
Base::flip | ( | $key | ) |
Swap keys and values of hive array variable
$key | string |
Base::format | ( | ) |
Return locale-aware formatted string
Base::get | ( | $key, | |
$args = NULL |
|||
) |
Retrieve contents of hive key
$key | string |
$args | string|array |
Base::hash | ( | $str | ) |
Generate 64bit/base36 hash
$str |
Base::highlight | ( | $text | ) |
Apply syntax highlighting
$text | string |
Base::hive | ( | ) |
Publish hive contents
Base::language | ( | $code | ) |
Assign/auto-detect language
$code | string |
Base::lexicon | ( | $path | ) |
Transfer lexicon entries to hive
$path | string |
Base::map | ( | $url, | |
$class, | |||
$ttl = 0 , |
|||
$kbps = 0 |
|||
) |
Provide ReST interface by mapping HTTP verb to class method
$url | string |
$class | string |
$ttl | int |
$kbps | int |
Base::merge | ( | $key, | |
$src | |||
) |
Merge array with hive array variable
$key | string |
$src | array |
Base::mock | ( | $pattern, | |
array | $args = NULL , |
||
array | $headers = NULL , |
||
$body = NULL |
|||
) |
Mock HTTP request
$pattern | string |
$args | array |
$headers | array |
$body | string |
Base::mset | ( | array | $vars, |
$prefix = '' , |
|||
$ttl = 0 |
|||
) |
Multi-variable assignment using associative array
$vars | array |
$prefix | string |
$ttl | int |
Base::mutex | ( | $id, | |
$func, | |||
$args = NULL |
|||
) |
Create mutex, invoke callback then drop ownership when done
$id | string |
$func | callback |
$args | mixed |
Base::parse | ( | $str | ) |
Parse string containing key-value pairs and use as routing tokens
$str | string |
Base::pop | ( | $key | ) |
Remove last element of hive array variable
$key | string |
Base::push | ( | $key, | |
$val | |||
) |
Add element to the end of hive array variable
$key | string |
$val | mixed |
Base::read | ( | $file, | |
$lf = FALSE |
|||
) |
Read file (with option to apply Unix LF as standard line ending)
$file | string |
$lf | bool |
Base::recursive | ( | $arg, | |
$func | |||
) |
Invoke callback recursively for all data types
$arg | mixed |
$func | callback |
& Base::ref | ( | $key, | |
$add = TRUE |
|||
) |
Get hive key reference/contents; Add non-existent hive keys, array elements, and object properties by default
$key | string |
$add | bool |
Base::rel | ( | $url | ) |
Return path relative to the base directory
$url | string |
Base::relay | ( | $funcs, | |
$args = NULL |
|||
) |
Execute specified callbacks in succession; Relay result of previous callback as argument to the next callback
$funcs | array|string |
$args | mixed |
Base::reroute | ( | $url, | |
$permanent = FALSE |
|||
) |
Reroute to specified URI
$url | string |
$permanent | bool |
Base::route | ( | $pattern, | |
$handler, | |||
$ttl = 0 , |
|||
$kbps = 0 |
|||
) |
Bind handler to route pattern
$pattern | string|array |
$handler | callback |
$ttl | int |
$kbps | int |
Base::run | ( | ) |
Match routes against incoming URI
Base::scrub | ( | & | $var, |
$tags = NULL |
|||
) |
Similar to clean(), except that variable is passed by reference
$var | mixed |
$tags | string |
Base::serialize | ( | $arg | ) |
Return string representation of PHP value
$arg | mixed |
Base::set | ( | $key, | |
$val, | |||
$ttl = 0 |
|||
) |
Bind value to hive key
$key | string |
$val | mixed |
$ttl | int |
Base::shift | ( | $key | ) |
Remove first element of hive array variable
$key | string |
Base::sign | ( | $num | ) |
Return -1 if specified number is negative, 0 if zero, or 1 if the number is positive
$num | mixed |
Base::snakecase | ( | $str | ) |
Convert camelcase string to snakecase
$str | string |
Base::split | ( | $str | ) |
Split comma-, semi-colon, or pipe-separated string
$str | string |
Base::status | ( | $code | ) |
Send HTTP/1.1 status header; Return text equivalent of status code
$code | int |
Base::stringify | ( | $arg, | |
array | $stack = NULL |
||
) |
Convert PHP expression/value to compressed exportable string
$arg | mixed |
$stack | array |
Base::sync | ( | $key | ) |
Sync PHP global with corresponding hive key
$key | string |
Base::unload | ( | $cwd | ) |
Execute framework/application shutdown sequence
$cwd | string |
Base::unserialize | ( | $arg | ) |
Return PHP value derived from string
$arg | mixed |
Base::unshift | ( | $key, | |
$val | |||
) |
Add element to the beginning of hive array variable
$key | string |
$val | mixed |
Base::write | ( | $file, | |
$data, | |||
$append = FALSE |
|||
) |
Exclusive file write
$file | string |
$data | mixed |
$append | bool |