FRED™
3.0
FRED™: Framework for Rapid and Easy Development
|
Component comprising all information regarding an HTTP-request (to transport these along all stepts executed during a request). More...
Public Member Functions | |
mapArgs ($keys=null) | |
Map command line arguments to the $_GET. More... | |
file ($key) | |
Retrieve a file upload from the request. More... | |
complex ($key, $default=null) | |
Retrieve a complex parameter (simple type or array) from the request. More... | |
record ($key, $default=null) | |
Retrieve a record like parameter (single layer array) from the request. More... | |
simple ($key, $default=null, $mask=null) | |
Retrieve a simple parameter (not an array) from the request. More... | |
data ($key, $default=null) | |
cookie ($key, $value=null, $days=365, $options=null) | |
Set and/or get a cookie. More... | |
__invoke ($key, $default=null) | |
Public Member Functions inherited from Component | |
__construct ($fred, $config=null) | |
__destruct () | |
clientConfig () | |
Public configuration. More... | |
config ($key, $default=null) | |
Retrieve a config value. More... | |
ping () | |
Ping function. More... | |
filemtime ($filename) | |
Filemtime with session cache. More... | |
component ($name) | |
Get a component (local or default). More... | |
components (... $names) | |
Get multiple components in an array. More... | |
Public Member Functions inherited from Thing | |
propertyExists ($property) | |
Check if a property exists (public or published). More... | |
constants ($prefix=null) | |
Return all constants. More... | |
get ($key) | |
Get one or more properties. More... | |
set ($key, $value=null) | |
Set one or more properties. More... | |
__get ($key) | |
__set ($key, $value) | |
Data Fields | |
$encoding = 'UTF-8' | |
Check encoding. More... | |
$errors = [] | |
Errors detected during the processing of the request (key = item ID, value = error code). More... | |
$data = [] | |
Data to be presented by the view (key-value pairs). More... | |
$result = null | |
Result fo the request (mixed). More... | |
$redir = null | |
URL for redirection (empty = no redirection). More... | |
$viewControllerName = null | |
Name of the view controller (same as the request handler when empty). More... | |
$cookieOptions = [] | |
Default cookie options. More... | |
$jsonDecodingError = 'JSON decoding error: [error]' | |
$postExceededError = 'POST exceeded ([size] / [max])' | |
Data Fields inherited from Component | |
$filemtimeTtl = 0 | |
Data Fields inherited from Thing | |
const | HIDDEN = 0 |
Property is hidden. More... | |
const | READABLE = 1 |
Property is readable. More... | |
const | WRITEABLE = 2 |
Property is writeable. More... | |
const | READWRITE = 3 |
Property is readable and writeable. More... | |
Protected Member Functions | |
init () | |
checkPost () | |
Checks the post (by content type). More... | |
fixFileKey ($values, $prefix=null, $files=null) | |
Transform an array of uploaded files to a 'normal' structure. More... | |
getFiles () | |
getServer () | |
_get ($key) | |
_set ($key, $value) | |
Protected Member Functions inherited from Component | |
init () | |
done () | |
getSession () | |
Protected Member Functions inherited from Thing | |
publish ($property, $visibility=self::READABLE) | |
Publish a property (or hide it again). More... | |
configure ($config) | |
Configure the object. More... | |
_get ($key) | |
Default getter if no specific setter is defined, and the property is also not published (readable). More... | |
_set ($key, $value) | |
Default setter if no specific setter is defined, and the property is also not published (writeable). More... | |
Protected Attributes | |
$_files = null | |
$_server = null | |
Protected Attributes inherited from Component | |
$_fred = null | |
$_config = null | |
$_name = null | |
$_components = [] | |
Local components (key = component name, value = component). More... | |
$_session = null | |
Protected Attributes inherited from Thing | |
$_published = [] | |
Published properties (key = name of property, value = visibility). More... | |
Component comprising all information regarding an HTTP-request (to transport these along all stepts executed during a request).
Definition at line 9 of file Request.php.
__invoke | ( | $key, | |
$default = null |
|||
) |
Definition at line 180 of file Request.php.
|
protected |
Definition at line 172 of file Request.php.
|
protected |
Definition at line 176 of file Request.php.
|
protected |
Checks the post (by content type).
Definition at line 32 of file Request.php.
complex | ( | $key, | |
$default = null |
|||
) |
Retrieve a complex parameter (simple type or array) from the request.
Parameters are first sought-after in the $_POST, then in the $_FILES, and last in the $_GET. Only the latter will be done case insensitive.
string | $key | Name of the sought parameter. |
mixed | $default | Default value if the key does not exist. |
Definition at line 103 of file Request.php.
cookie | ( | $key, | |
$value = null , |
|||
$days = 365 , |
|||
$options = null |
|||
) |
Set and/or get a cookie.
string | $key | Cookie key. |
mixed | $value | Cookie value. |
int | $days | Cookie lifetime (in days). |
array | $options | Cookie options (see https://www.php.net/setcookie; when 'secure' is undefined, the value is automaticly set to true when the request was made using a secure connection). |
Definition at line 148 of file Request.php.
data | ( | $key, | |
$default = null |
|||
) |
Definition at line 136 of file Request.php.
file | ( | $key | ) |
Retrieve a file upload from the request.
string | $key | Name of the sought file. |
Definition at line 92 of file Request.php.
|
protected |
Transform an array of uploaded files to a 'normal' structure.
Single file uploads have an entry in the $_FILES array with properties 'tmp_name', 'size', and so on. With an array of files this is also the case, and each of these property has a multi dimensional array of values. For the processing of single files though it is more convinient if all files have the same single dimension array structure as the single file upload at the deepest level. Therefore the property names must move to the end of the structure.
array | $values | Array with properties (single or multi dimensional). |
array | $prefix | Array to prefix before the keys. |
array | $files | Already determined, correct structure. |
Definition at line 64 of file Request.php.
|
protected |
Definition at line 153 of file Request.php.
|
protected |
Definition at line 161 of file Request.php.
|
protected |
Definition at line 25 of file Request.php.
mapArgs | ( | $keys = null | ) |
Map command line arguments to the $_GET.
array | $keys | Array with key for every consecutive argument. If empty, the argument itself is parsed for keys ("key=value foo=bar" format). |
Definition at line 81 of file Request.php.
record | ( | $key, | |
$default = null |
|||
) |
Retrieve a record like parameter (single layer array) from the request.
string | $key | Name of the sought parameter. |
mixed | $default | Default value if the key does not exist. |
Definition at line 115 of file Request.php.
simple | ( | $key, | |
$default = null , |
|||
$mask = null |
|||
) |
Retrieve a simple parameter (not an array) from the request.
string | $key | Name of the sought parameter. |
mixed | $default | Default value if the key does not exist. |
string | $mask | Regex to check the value with (true = word chars only). |
Definition at line 128 of file Request.php.
|
protected |
Definition at line 22 of file Request.php.
|
protected |
Definition at line 23 of file Request.php.
$cookieOptions = [] |
Default cookie options.
Definition at line 18 of file Request.php.
$data = [] |
Data to be presented by the view (key-value pairs).
Definition at line 13 of file Request.php.
$encoding = 'UTF-8' |
Check encoding.
Definition at line 11 of file Request.php.
$errors = [] |
Errors detected during the processing of the request (key = item ID, value = error code).
Definition at line 12 of file Request.php.
$jsonDecodingError = 'JSON decoding error: [error]' |
Definition at line 19 of file Request.php.
$postExceededError = 'POST exceeded ([size] / [max])' |
Definition at line 20 of file Request.php.
$redir = null |
URL for redirection (empty = no redirection).
Definition at line 15 of file Request.php.
$result = null |
Result fo the request (mixed).
Definition at line 14 of file Request.php.
$viewControllerName = null |
Name of the view controller (same as the request handler when empty).
Definition at line 16 of file Request.php.