Fat-Free Framework: Base Class Reference

Fat-Free-Framework

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

Base::autoload (   $class)
protected

Namespace-aware class autoloader

Returns
mixed
Parameters
$classstring
Base::base64 (   $data,
  $mime 
)

Return Base64-encoded equivalent

Returns
string
Parameters
$datastring
$mimestring
Base::blacklisted (   $ip)

Return TRUE if IPv4 address exists in DNSBL

Returns
bool
Parameters
$ipstring
Base::call (   $func,
  $args = NULL,
  $hooks = '' 
)

Execute callback/hooks (supports 'class->method' format)

Returns
mixed|FALSE
Parameters
$funccallback
$argsmixed
$hooksstring
Base::camelcase (   $str)

Convert snakecase string to camelcase

Returns
string
Parameters
$strstring
Base::chain (   $funcs,
  $args = NULL 
)

Execute specified callbacks in succession; Apply same arguments to all callbacks

Returns
array
Parameters
$funcsarray|string
$argsmixed
Base::clear (   $key)

Unset hive key

Returns
NULL
Parameters
$keystring
Base::concat (   $key,
  $val 
)

Concatenate string to hive string variable

Returns
string
Parameters
$keystring
$valstring
Base::config (   $file)

Configure framework according to .ini-style file settings

Returns
NULL
Parameters
$filestring
Base::copy (   $src,
  $dst 
)

Copy contents of hive variable to another

Returns
mixed
Parameters
$srcstring
$dststring
Base::csv ( array  $args)

Flatten array values and return as CSV string

Returns
string
Parameters
$argsarray
Base::decode (   $str)

Convert HTML entities back to characters

Returns
string
Parameters
$strstring
Base::dump (   $expr)

Dump expression with syntax highlighting

Returns
NULL
Parameters
$exprmixed
Base::encode (   $str)

Convert special characters to HTML entities

Returns
string
Parameters
$strstring
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
$codeint
$textstring
$tracearray
Base::esc (   $arg)

Encode characters to equivalent HTML entities

Returns
string
Parameters
$argmixed
Base::exists (   $key)

Return TRUE if hive key is not empty (or timestamp and TTL if cached)

Returns
bool
Parameters
$keystring
Base::expire (   $secs = 0)

Send cache metadata to HTTP client

Returns
NULL
Parameters
$secsint
Base::fixslashes (   $str)

Convert backslashes to slashes

Returns
string
Parameters
$strstring
Base::flip (   $key)

Swap keys and values of hive array variable

Returns
array
Parameters
$keystring
Base::format ( )

Return locale-aware formatted string

Returns
string
Base::get (   $key,
  $args = NULL 
)

Retrieve contents of hive key

Returns
mixed
Parameters
$keystring
$argsstring|array
Base::hash (   $str)

Generate 64bit/base36 hash

Returns
string
Parameters
$str
Base::highlight (   $text)

Apply syntax highlighting

Returns
string
Parameters
$textstring
Base::hive ( )

Publish hive contents

Returns
array
static Base::instance ( )
static

Return class instance

Returns
object
Base::language (   $code)

Assign/auto-detect language

Returns
string
Parameters
$codestring
Base::lexicon (   $path)

Transfer lexicon entries to hive

Returns
NULL
Parameters
$pathstring
Base::map (   $url,
  $class,
  $ttl = 0,
  $kbps = 0 
)

Provide ReST interface by mapping HTTP verb to class method

Returns
NULL
Parameters
$urlstring
$classstring
$ttlint
$kbpsint
Base::mock (   $pattern,
array  $args = NULL,
array  $headers = NULL,
  $body = NULL 
)

Mock HTTP request

Returns
NULL
Parameters
$patternstring
$argsarray
$headersarray
$bodystring
Base::mset ( array  $vars,
  $prefix = '',
  $ttl = 0 
)

Multi-variable assignment using associative array

Returns
NULL
Parameters
$varsarray
$prefixstring
$ttlint
Base::mutex (   $id,
  $func,
  $args = NULL 
)

Create mutex, invoke callback then drop ownership when done

Returns
mixed
Parameters
$idstring
$funccallback
$argsmixed
Base::pop (   $key)

Remove last element of hive array variable

Returns
mixed
Parameters
$keystring
Base::push (   $key,
  $val 
)

Add element to the end of hive array variable

Returns
mixed
Parameters
$keystring
$valmixed
Base::raw (   $arg)

Decode HTML entities to equivalent characters

Returns
string
Parameters
$argmixed
Base::read (   $file,
  $lf = FALSE 
)

Read file (with option to apply Unix LF as standard line ending)

Returns
string
Parameters
$filestring
$lfbool
& 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
$keystring
$addbool
Base::relay (   $funcs,
  $args = NULL 
)

Execute specified callbacks in succession; Relay result of previous callback as argument to the next callback

Returns
array
Parameters
$funcsarray|string
$argsmixed
Base::reroute (   $uri,
  $permanent = FALSE 
)

Reroute to specified URI

Returns
NULL
Parameters
$uristring
$permanentbool
Base::route (   $pattern,
  $handler,
  $ttl = 0,
  $kbps = 0 
)

Bind handler to route pattern

Returns
NULL
Parameters
$patternstring|array
$handlercallback
$ttlint
$kbpsint
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
$varmixed
$tagsstring
Base::serialize (   $arg)

Return string representation of PHP value

Returns
string
Parameters
$argmixed
Base::set (   $key,
  $val,
  $ttl = 0 
)

Bind value to hive key

Returns
mixed
Parameters
$keystring
$valmixed
$ttlint
Base::shift (   $key)

Remove first element of hive array variable

Returns
mixed
Parameters
$keystring
Base::sign (   $num)

Return -1 if specified number is negative, 0 if zero, or 1 if the number is positive

Returns
int
Parameters
$nummixed
Base::snakecase (   $str)

Convert camelcase string to snakecase

Returns
string
Parameters
$strstring
Base::split (   $str)

Split comma-, semi-colon, or pipe-separated string

Returns
array
Parameters
$strstring
Base::status (   $code)

Send HTTP/1.1 status header; Return text equivalent of status code

Returns
string
Parameters
$codeint
Base::stringify (   $arg)

Convert PHP expression/value to compressed exportable string

Returns
string
Parameters
$argmixed
Base::sync (   $key)

Sync PHP global with corresponding hive key

Returns
array
Parameters
$keystring
Base::unload ( )

Execute framework/application shutdown sequence

Returns
NULL
Base::unserialize (   $arg)

Return PHP value derived from string

Returns
string
Parameters
$argmixed
Base::unshift (   $key,
  $val 
)

Add element to the beginning of hive array variable

Returns
mixed
Parameters
$keystring
$valmixed
Base::write (   $file,
  $data,
  $append = FALSE 
)

Exclusive file write

Returns
int|FALSE
Parameters
$filestring
$datamixed
$appendbool

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   doxygen 1.8.4