|
Fat-Free Framework
3.4.0
|
Base structure. More...
Inheritance diagram for Base:Public Member Functions | |
| sync ($key) | |
| build ($url, $params=array()) | |
| alias ($name, $params=null) | |
| 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) | |
| checked ($key) | |
| visible ($obj, $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) | |
| recursive ($arg, $func, $stack=NULL) | |
| clean ($arg, $tags=NULL) | |
| scrub (&$var, $tags=NULL) | |
| format () | |
| language ($code) | |
| lexicon ($path) | |
| serialize ($arg) | |
| unserialize ($arg) | |
| status ($code) | |
| expire ($secs=0) | |
| agent () | |
| ajax () | |
| ip () | |
| 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) | |
| redirect ($pattern, $url) | |
| 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) | |
| offsetexists ($key) | |
| offsetset ($key, $val) | |
| & | offsetget ($key) |
| offsetunset ($key) | |
| __isset ($key) | |
| __set ($key, $val) | |
| & | __get ($key) |
| __unset ($key) | |
| __call ($key, $args) | |
| __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. | |
| $fallback ='en' | |
| Default fallback language. | |
| const | PACKAGE ='Fat-Free Framework' |
| const | VERSION ='3.4.0-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 Public Member Functions inherited from Prefab | |
| static | instance () |
Base structure.
| Base::__call | ( | $key, | |
| $args | |||
| ) |
Call function identified by hive key
| $key | string |
| $args | array |
| & Base::__get | ( | $key | ) |
Alias for offsetget()
| $key | string |
| Base::__isset | ( | $key | ) |
Alias for offsetexists()
| $key | string |
| Base::__set | ( | $key, | |
| $val | |||
| ) |
Alias for offsetset()
| $key | string |
| $val | mixed |
| Base::__unset | ( | $key | ) |
Alias for offsetunset()
| $key | string |
| Base::agent | ( | ) |
Return HTTP user agent
| Base::ajax | ( | ) |
Return TRUE if XMLHttpRequest detected
| Base::alias | ( | $name, | |
$params = null |
|||
| ) |
assemble url from alias name
| $name | string |
| $params | string |
|
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, | |
$params = array() |
|||
| ) |
Replace tokenized URL with available token values
| $url | array|string |
| $params | array |
| 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::checked | ( | $key | ) |
Return TRUE if hive variable is 'on'
| $key | string |
| 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::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 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::ip | ( | ) |
Sniff IP address
| Base::language | ( | $code | ) |
Assign/auto-detect language
| $code | string |
| Base::lexicon | ( | $path | ) |
Return lexicon entries
| $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 | string|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::offsetexists | ( | $key | ) |
Convenience method for checking hive key
| $key | string |
| & Base::offsetget | ( | $key | ) |
Convenience method for retrieving hive value
| $key | string |
| Base::offsetset | ( | $key, | |
| $val | |||
| ) |
Convenience method for assigning hive value
| $key | string |
| $val | scalar |
| Base::offsetunset | ( | $key | ) |
Convenience method for removing hive key
| $key | string |
| Base::parse | ( | $str | ) |
Parse string containing key-value pairs
| $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, | |||
$stack = NULL |
|||
| ) |
Invoke callback recursively for all data types
| $arg | mixed |
| $func | callback |
| $stack | array |
| Base::redirect | ( | $pattern, | |
| $url | |||
| ) |
Redirect a route to another URL
| $pattern | string|array |
| $url | string |
| & 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::visible | ( | $obj, | |
| $key | |||
| ) |
Return TRUE if property has public visibility
| $obj | object |
| $key | string |
| Base::write | ( | $file, | |
| $data, | |||
$append = FALSE |
|||
| ) |
Exclusive file write
| $file | string |
| $data | mixed |
| $append | bool |