Smart.Framework Logo

final class \SmartFrameworkRegistry
{ } ::

Class Smart.Framework Registry
It may be used anywhere inside Smart.Framework or by Plugins and Application Modules.


class Methods

public static function issetServerVar ( string $key ) {} :: BOOL
@return: {BOOL} TRUE if the variable exists, FALSE otherwise
Check if a Server Variable is set into Registry
public static function getServerVar ( string $key ) {} :: STRING/NULL
@return: {STRING/NULL} the safe filtered value of $_SERVER[$key]
Get a Server Variable from the Registry for a key
This will get a value from $_SERVER but but filtered with SmartFrameworkSecurity::FilterUnsafeString to be UTF-8 compliant and avoid dangerous characters ; $_SERVER is not filtered, is raw !
public static function getServerVars ( ) {} :: ARRAY
@return: {ARRAY} an associative array with all the server vars from $_SERVER but filtered with SmartFrameworkSecurity::FilterUnsafeString to be UTF-8 compliant and avoid dangerous characters ; $_SERVER is not filtered, is raw !
Get all the Server Variables from the Registry
public static function issetRequestVar ( string $key ) {} :: BOOL
@return: {BOOL} TRUE if the variable exists, FALSE otherwise
Check if a Request Variable is set into Registry
public static function getRequestVar ( string $key, MIXED $defval = null, ENUM $type = "" ) {} :: MIXED
@return: {MIXED} The value of the choosen Request (GET/POST) variable
@param: {STRING} $key: The name (key) of the GET or POST variable (if the variable is set in both GET and POST, the GPC as set in PHP.INI sequence will overwrite the GET with POST, thus the POST value will be get).
@param: {MIXED} $defval: The default value (if a type is set must be the same type) of that variable in the case was not set in the Request (GET/POST). By default it is set to null.
@param: {ENUM} $type: The type of the variable ; Default is '' (no enforcing). This can be used to enforce a type for the variable as: ['enum', 'list', 'of', 'allowed', 'values'], 'array', 'string', 'boolean', 'integer', 'integer+', 'integer-', 'decimal1', 'decimal2', 'decimal3', 'decimal4', 'numeric'.
Get a Request Variable that come from GET or POST
See the method description for SmartFrameworkRegistry::getRequestVars() to sse how the GET / POST variables are registered, in which order, which have precedence for more details
Shortly, this is a union between $_GET and $_POST ; $_GET are registered first ; $_POST after ; $_POST will ot rewrite $_GET (security !!)
Difference between this method and working directly with $_GET or $_POST is that this method returns safe filtered values of $_GET or $_POST variables ...
If need to work directly with $_GET or $_POST or $_REQUEST don't forget to use the value of them filtered with SmartFrameworkSecurity::FilterRequestVar($_GET['something']); // or SmartFrameworkSecurity::FilterRequestVar($_POST['something_else']); // or SmartFrameworkSecurity::FilterRequestVar($_REQUEST['something_else']);
public static function getRequestVars ( ) {} :: ARRAY
@return: {ARRAY} an associative array with all the ($_GET + $_POST) request variables, except cookies ; this may differ from $_GET / $_POST or $_REQUEST or as this is filtered to be UTF-8 compliant and avoid dangerous characters ; $_GET / $_POST or $_REQUEST are not filtered, they are raw
Get all the request Request Variables from the Registry
It contains the filtered union between $_GET and $_POST variables registered into this order: $_GET first and $_POST after
If $_POST contain a variable with the same name as in $_GET it will not rewrite the first one, will be dropped for security reasons
Unifying GET + POST is an easy way to work with REQUEST input variables as is not important if the variables come from GET or POST (sometimes even with POST method some variables can come from GET others from POST)
From the security point of view make no difference ... POST variables are not more secure than GET variables !
But if you wish to work with specific $_GET or $_POST or $_REQUEST see the notes from method getRequestVar()

class Properties


class Constants



documentation generated on: 2023-10-19 23:15:48 +0000


Smart.Framework © 2009-2023 unix-world.org