|
Fat-Free Framework
3.1.0 API Reference
|
Base structure. More...
Public Member Functions | |
| sync ($key) | |
| & | ref ($key, $add=TRUE) |
| exists ($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) | |
| fixslashes ($str) | |
| split ($str) | |
| stringify ($arg) | |
| csv (array $args) | |
| camelcase ($str) | |
| snakecase ($str) | |
| sign ($num) | |
| hash ($str) | |
| base64 ($data, $mime) | |
| encode ($str) | |
| decode ($str) | |
| scrub (&$var, $tags=NULL) | |
| esc ($arg) | |
| raw ($arg) | |
| 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 ($uri, $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) | |
| unload () | |
Static Public Member Functions | |
| static | instance () |
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.1.0-Dev' |
| 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_Fatal ='Fatal error: %s' |
| const | E_Open ='Unable to open %s' |
| const | E_Routes ='No routes specified' |
| const | E_Method ='Invalid method %s' |
| const | E_Hive ='Invalid hive key %s' |
Protected Member Functions | |
| autoload ($class) | |
Detailed Description
Base structure.
Member Function Documentation
|
protected |
Namespace-aware class autoloader
- Returns
- mixed
- Parameters
-
$class string
| Base::base64 | ( | $data, | |
| $mime | |||
| ) |
Return Base64-encoded equivalent
- Returns
- string
- Parameters
-
$data string $mime string
| Base::blacklisted | ( | $ip) |
Return TRUE if IPv4 address exists in DNSBL
- Returns
- bool
- Parameters
-
$ip string
| Base::call | ( | $func, | |
$args = NULL, |
|||
$hooks = '' |
|||
| ) |
Execute callback/hooks (supports 'class->method' format)
- Returns
- mixed|FALSE
- Parameters
-
$func callback $args mixed $hooks string
| Base::camelcase | ( | $str) |
Convert snakecase string to camelcase
- Returns
- string
- Parameters
-
$str string
| Base::chain | ( | $funcs, | |
$args = NULL |
|||
| ) |
Execute specified callbacks in succession; Apply same arguments to all callbacks
- Returns
- array
- Parameters
-
$funcs array|string $args mixed
| Base::clear | ( | $key) |
Unset hive key
- Returns
- NULL
- Parameters
-
$key string
| Base::concat | ( | $key, | |
| $val | |||
| ) |
Concatenate string to hive string variable
- Returns
- string
- Parameters
-
$key string $val string
| Base::config | ( | $file) |
Configure framework according to .ini-style file settings
- Returns
- NULL
- Parameters
-
$file string
| Base::copy | ( | $src, | |
| $dst | |||
| ) |
Copy contents of hive variable to another
- Returns
- mixed
- Parameters
-
$src string $dst string
| Base::csv | ( | array | $args) |
Flatten array values and return as CSV string
- Returns
- string
- Parameters
-
$args array
| Base::decode | ( | $str) |
Convert HTML entities back to characters
- Returns
- string
- Parameters
-
$str string
| Base::dump | ( | $expr) |
Dump expression with syntax highlighting
- Returns
- NULL
- Parameters
-
$expr mixed
| Base::encode | ( | $str) |
Convert special characters to HTML entities
- Returns
- string
- Parameters
-
$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)
- Returns
- NULL
- Parameters
-
$code int $text string $trace array
| Base::esc | ( | $arg) |
Encode characters to equivalent HTML entities
- Returns
- string
- Parameters
-
$arg mixed
| Base::exists | ( | $key) |
Return TRUE if hive key is not empty (or timestamp and TTL if cached)
- Returns
- bool
- Parameters
-
$key string
| Base::expire | ( | $secs = 0) |
Send cache metadata to HTTP client
- Returns
- NULL
- Parameters
-
$secs int
| Base::fixslashes | ( | $str) |
Convert backslashes to slashes
- Returns
- string
- Parameters
-
$str string
| Base::flip | ( | $key) |
Swap keys and values of hive array variable
- Returns
- array
- Parameters
-
$key string
| Base::format | ( | ) |
Return locale-aware formatted string
- Returns
- string
| Base::get | ( | $key, | |
$args = NULL |
|||
| ) |
Retrieve contents of hive key
- Returns
- mixed
- Parameters
-
$key string $args string|array
| Base::hash | ( | $str) |
Generate 64bit/base36 hash
- Returns
- string
- Parameters
-
$str
| Base::highlight | ( | $text) |
Apply syntax highlighting
- Returns
- string
- Parameters
-
$text string
| Base::hive | ( | ) |
Publish hive contents
- Returns
- array
|
static |
Return class instance
- Returns
- object
| Base::language | ( | $code) |
Assign/auto-detect language
- Returns
- string
- Parameters
-
$code string
| Base::lexicon | ( | $path) |
Transfer lexicon entries to hive
- Returns
- NULL
- Parameters
-
$path string
| Base::map | ( | $url, | |
| $class, | |||
$ttl = 0, |
|||
$kbps = 0 |
|||
| ) |
Provide ReST interface by mapping HTTP verb to class method
- Returns
- NULL
- Parameters
-
$url string $class string $ttl int $kbps int
| Base::mock | ( | $pattern, | |
| array | $args = NULL, |
||
| array | $headers = NULL, |
||
$body = NULL |
|||
| ) |
Mock HTTP request
- Returns
- NULL
- Parameters
-
$pattern string $args array $headers array $body string
| Base::mset | ( | array | $vars, |
$prefix = '', |
|||
$ttl = 0 |
|||
| ) |
Multi-variable assignment using associative array
- Returns
- NULL
- Parameters
-
$vars array $prefix string $ttl int
| Base::mutex | ( | $id, | |
| $func, | |||
$args = NULL |
|||
| ) |
Create mutex, invoke callback then drop ownership when done
- Returns
- mixed
- Parameters
-
$id string $func callback $args mixed
| Base::pop | ( | $key) |
Remove last element of hive array variable
- Returns
- mixed
- Parameters
-
$key string
| Base::push | ( | $key, | |
| $val | |||
| ) |
Add element to the end of hive array variable
- Returns
- mixed
- Parameters
-
$key string $val mixed
| Base::raw | ( | $arg) |
Decode HTML entities to equivalent characters
- Returns
- string
- Parameters
-
$arg mixed
| Base::read | ( | $file, | |
$lf = FALSE |
|||
| ) |
Read file (with option to apply Unix LF as standard line ending)
- Returns
- string
- Parameters
-
$file string $lf bool
| & Base::ref | ( | $key, | |
$add = TRUE |
|||
| ) |
Get hive key reference/contents; Add non-existent hive keys, array elements, and object properties by default
- Returns
- mixed
- Parameters
-
$key string $add bool
| Base::relay | ( | $funcs, | |
$args = NULL |
|||
| ) |
Execute specified callbacks in succession; Relay result of previous callback as argument to the next callback
- Returns
- array
- Parameters
-
$funcs array|string $args mixed
| Base::reroute | ( | $uri, | |
$permanent = FALSE |
|||
| ) |
Reroute to specified URI
- Returns
- NULL
- Parameters
-
$uri string $permanent bool
| Base::route | ( | $pattern, | |
| $handler, | |||
$ttl = 0, |
|||
$kbps = 0 |
|||
| ) |
Bind handler to route pattern
- Returns
- NULL
- Parameters
-
$pattern string|array $handler callback $ttl int $kbps int
| Base::run | ( | ) |
Match routes against incoming URI
- Returns
- NULL
| Base::scrub | ( | & | $var, |
$tags = NULL |
|||
| ) |
Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks
- Returns
- mixed
- Parameters
-
$var mixed $tags string
| Base::serialize | ( | $arg) |
Return string representation of PHP value
- Returns
- string
- Parameters
-
$arg mixed
| Base::set | ( | $key, | |
| $val, | |||
$ttl = 0 |
|||
| ) |
Bind value to hive key
- Returns
- mixed
- Parameters
-
$key string $val mixed $ttl int
| Base::shift | ( | $key) |
Remove first element of hive array variable
- Returns
- mixed
- Parameters
-
$key string
| Base::sign | ( | $num) |
Return -1 if specified number is negative, 0 if zero, or 1 if the number is positive
- Returns
- int
- Parameters
-
$num mixed
| Base::snakecase | ( | $str) |
Convert camelcase string to snakecase
- Returns
- string
- Parameters
-
$str string
| Base::split | ( | $str) |
Split comma-, semi-colon, or pipe-separated string
- Returns
- array
- Parameters
-
$str string
| Base::status | ( | $code) |
Send HTTP/1.1 status header; Return text equivalent of status code
- Returns
- string
- Parameters
-
$code int
| Base::stringify | ( | $arg) |
Convert PHP expression/value to compressed exportable string
- Returns
- string
- Parameters
-
$arg mixed
| Base::sync | ( | $key) |
Sync PHP global with corresponding hive key
- Returns
- array
- Parameters
-
$key string
| Base::unload | ( | ) |
Execute framework/application shutdown sequence
- Returns
- NULL
| Base::unserialize | ( | $arg) |
Return PHP value derived from string
- Returns
- string
- Parameters
-
$arg mixed
| Base::unshift | ( | $key, | |
| $val | |||
| ) |
Add element to the beginning of hive array variable
- Returns
- mixed
- Parameters
-
$key string $val mixed
| Base::write | ( | $file, | |
| $data, | |||
$append = FALSE |
|||
| ) |
Exclusive file write
- Returns
- int|FALSE
- Parameters
-
$file string $data mixed $append bool
The documentation for this class was generated from the following file:
- base.php
Generated on Mon Aug 19 2013 21:27:46 for Fat-Free Framework by
1.8.4