Returns application root file path
string
app_file
()
call_if_exists (line
1641)
Calls a function if exists
mixed
call_if_exists
(string $func, mixed $arg,..)
-
string
$func: the function name
-
mixed
$arg,..: (optional)
Returns css output with proper http headers
string
css
(string $content_or_func, [string $layout = ''], [string $locals = array()])
-
string
$content_or_func
-
string
$layout
-
string
$locals
define_unless_exists (line
1656)
Define a constant unless it already exists
void
define_unless_exists
(string $name, string $value)
-
string
$name
-
string
$value
an alias of dispatch_get
void
dispatch
( $path_or_array, $function)
dispatch_delete (line
1084)
Add a DELETE route
void
dispatch_delete
(string $path_or_array, string $function)
-
string
$path_or_array
-
string
$function
Add a GET route. Also automatically defines a HEAD route.
void
dispatch_get
(string $path_or_array, string $function)
-
string
$path_or_array
-
string
$function
dispatch_post (line
1060)
Add a POST route
void
dispatch_post
(string $path_or_array, string $function)
-
string
$path_or_array
-
string
$function
Add a PUT route
void
dispatch_put
(string $path_or_array, string $function)
-
string
$path_or_array
-
string
$function
Returns limonade environment variables:
'SERVER', 'FILES', 'REQUEST', 'SESSION', 'ENV', 'COOKIE', 'GET', 'POST', 'PUT', 'DELETE'
If a null argument is passed, reset and rebuild environment
array
env
([null $reset = null])
-
null
$reset: @reset reset and rebuild environment
Associate a function with error code(s) and return all associations
array
error
([string $errno = null], [string $function = null])
-
string
$errno
-
string
$function
error_default_handler (line
640)
Default error handler
string
error_default_handler
(string $errno, string $errstr, string $errfile, string $errline)
-
string
$errno
-
string
$errstr
-
string
$errfile
-
string
$errline
error_http_status (line
831)
Returns http response status for a given error number
int
error_http_status
(string $errno)
Set and returns error output layout
string
error_layout
([string $layout = false])
error_notices_render (line
758)
Returns notices output rendering and reset notices
string
error_notices_render
()
return error code name for a given code num, or return all errors names
mixed
error_type
([string $num = null])
file_extension (line
2159)
Returns file extension or false if none
string,
file_extension
(string $filename)
file_is_binary (line
2184)
Checks if $filename is a binary file
void
file_is_binary
(string $filename)
Checks if $filename is a text file
bool
file_is_text
(string $filename)
file_list_dir (line
2210)
Returns an array of files contained in a directory
array
file_list_dir
(string $dir)
file_mime_content_type (line
2088)
Detect MIME Content-type for a file
string
file_mime_content_type
(string $filename)
-
string
$filename: Path to the tested file.
Create a file path by concatenation of given arguments
string
file_path
( $path, string $path,)
Return or output file content
string,
file_read
( $filename, [ $return = false])
file_read_chunked (line
2112)
Read and output file content and return filesize in bytes or status after closing file.
This function is very efficient for outputing large files without timeout nor too expensive memory use
bool,
file_read_chunked
(string $filename, [string $retbytes = true])
-
string
$filename
-
string
$retbytes
Set and returns flash messages that will be available in the next action via the flash_now() function or the view variable
.
If multiple values are provided, set
variable with an array of those values. If there is only one value, set
variable with the provided $values or if it's
is an array, merge it with current messages.
mixed
flash
([string, $name = null], [ $value = null], mixed $values,...)
-
mixed
$values,...
-
string,
$name: array $name
-
$value
Set and returns flash messages available for the current action, included those defined in the previous action with flash() Those messages will also be passed to the views and made available in the
variable.
If multiple values are provided, set
variable with an array of those values. If there is only one value, set
variable with the provided $values or if it's
is an array, merge it with current messages.
mixed
flash_now
([string, $name = null], [ $value = null], mixed $values,...)
-
mixed
$values,...
-
string,
$name: array $name
-
$value
An alias of http://www.php.net/htmlspecialchars.
If no $charset is provided, uses option('encoding') value
void
h
(string $str, [string $quote_style = ENT_NOQUOTES], [string $charset = null])
-
string
$str
-
string
$quote_style
-
string
$charset
Raise an error, passing a given error number and an optional message, then exit.
Error number should be a HTTP status code or a php user error (E_USER...) $errno and $msg arguments can be passsed in any order If no arguments are passed, default $errno is SERVER_ERROR (500)
void
halt
([int,string $errno = SERVER_ERROR], [string,string $msg = ''], [mixed $debug_args = null])
-
int,string
$errno: Error number or message string
-
string,string
$msg: Message string or error number
-
mixed
$debug_args: extra data provided for debugging
Returns html output with proper http headers
string
html
(string $content_or_func, [string $layout = ''], [string $locals = array()])
-
string
$content_or_func
-
string
$layout
-
string
$locals
http_response_status (line
1822)
Returns HTTP response status for a given code.
If no code provided, return an array of all status
string,array
http_response_status
([string $num = null])
http_response_status_code (line
1903)
Returns an HTTP response status string for a given code
string
http_response_status_code
(string $num)
http_response_status_is_valid (line
1891)
Checks if an HTTP response code is valid
bool
http_response_status_is_valid
(string $num)
Returns json representation of data with proper http headers
string
json
(string $data, [int $json_option = 0])
-
string
$data
-
int
$json_option
Set and return current layout
string
layout
([string $function_or_file = null])
Returns mime type for a given extension or if no extension is provided, all mime types in an associative array, with extensions as keys.
(extracted from Orbit source http://orbit.luaforge.net/)
string,
mime_type
([string $ext = null])
Set and returns options values
If multiple values are provided, set $name option with an array of those values. If there is only one value, set $name option with the provided $values
mixed
option
([string $name = null], [ $values = null], mixed $values,...)
-
string
$name
-
mixed
$values,...
-
$values
Set and returns params
Depending on provided arguments:
* Reset params if first argument is null
* If first argument is an array, merge it with current params
* If there is a second argument $value, set param $name (first argument) with $value
params('name', 'Doe') // set 'name' => 'Doe'
* If there is more than 2 arguments, set param $name (first argument) value with an array of next arguments
params('months', 'jan', 'feb', 'mar') // set 'month' => array('months', 'jan', 'feb', 'mar')
mixed
params
([mixed $name_or_array_or_null = null], [ $value = null], mixed $value,...)
-
mixed
$name_or_array_or_null: could be null || array of params || name of a param (optional)
-
mixed
$value,...: for the $name param (optional)
-
$value
Http redirection
void
redirect
( $uri, string $url)
Http redirection
void
redirect_to
( $params, string $params,...)
-
string
$params,...
-
$params
Returns a string to output
It might use a a template file or function, a formatted string (like http://www.php.net/sprintf). It could be embraced by a layout or not. Local vars can be passed in addition to variables made available with the set() function.
string
render
(string $content_or_func, [string $layout = ''], [string $locals = array()])
-
string
$content_or_func
-
string
$layout
-
string
$locals
undocumented function
mixed
render_file
(string $filename, [string $return = false])
-
string
$filename
-
string
$return
request_is_delete (line
920)
Checks if request method is DELETE
bool
request_is_delete
([string $env = null])
request_is_get (line
887)
Checks if request method is GET
bool
request_is_get
([string $env = null])
request_is_head (line
931)
Checks if request method is HEAD
bool
request_is_head
([string $env = null])
request_is_post (line
898)
Checks if request method is POST
bool
request_is_post
([string $env = null])
request_is_put (line
909)
Checks if request method is PUT
bool
request_is_put
([string $env = null])
request_method (line
855)
Returns current request method for a given environment or current one
string
request_method
([string $env = null])
request_methods (line
941)
Returns allowed request methods
array
request_methods
()
request_method_is_allowed (line
875)
Checks if a request method or current one is allowed
bool
request_method_is_allowed
([string $m = null])
Returns current request uri (the path that will be compared with routes)
(Inspired from codeigniter URI::_fetch_uri_string method)
string
request_uri
([ $env = null])
require_once_dir (line
1693)
Load php files with require_once in a given dir
array
require_once_dir
(string $path, [string $pattern = "*.php"])
-
string
$path: Path in which are the file to load
-
string
$pattern: a regexp pattern that filter files to load
Running application
void
run
([string $env = null])
Set and returns template variables
If multiple values are provided, set $name variable with an array of those values. If there is only one value, set $name variable with the provided $values
mixed
set
([string $name = null], [ $values = null], mixed $values,...)
-
string
$name
-
mixed
$values,...
-
$values
set_or_default (line
293)
Sets a template variable with a value or a default value if value is empty
mixed
set_or_default
(string $name, string $value, string $default)
-
string
$name
-
string
$value
-
string
$default
Output proper HTTP header for a given HTTP code
void
status
([string $code = 500])
Returns txt output with proper http headers
string
txt
(string $content_or_func, [string $layout = ''], [string $locals = array()])
-
string
$content_or_func
-
string
$layout
-
string
$locals
Returns an url composed of params joined with /
string
url_for
([ $params = null], string $params,...)
-
string
$params,...
-
$params
An alias of value_or_default()
mixed
v
(mixed $value, mixed $default)
-
mixed
$value
-
mixed
$default
value_or_default (line
1668)
Return a default value if provided value is empty
mixed
value_or_default
(mixed $value, mixed $default)
-
mixed
$value
-
mixed
$default: default value returned if $value is empty
Returns xml output with proper http headers
string
xml
( $data, string $content_or_func, string $layout, string $locals)
-
string
$content_or_func
-
string
$layout
-
string
$locals
-
$data