tribe_get_request_vars( bool $refresh = false )
Returns the sanitized version of the $_REQUEST super-global array.
Contents
Note: the return value is cached. It will be resolve the first time the function is called, per HTTP request, then the same return value will be returned. After the function has been called the first time, changes to the $_REQUEST super-global will NOT be reflected in the function return value. Call the function with $refresh set to true to refresh the function value.
Parameters
- $refresh
-
(bool) (Optional) Whether to parse the
$_REQUESTcache again and refresh the cache or not; defaults tofalse.Default value: false
Return
(array) The sanitized version of the $_REQUEST super-global.
Source
File: src/functions/utils.php
function tribe_get_request_vars( $refresh = false ) {
static $cache;
if ( ! isset( $_REQUEST ) ) {
return [];
}
if ( null !== $cache && ! $refresh ) {
return $cache;
}
$cache = array_combine(
array_keys( $_REQUEST ),
array_map( static function ( $v )
{
return filter_var( $v, FILTER_SANITIZE_STRING );
},
$_REQUEST )
);
return $cache;
}
Changelog
| Version | Description |
|---|---|
| 4.9.18 | Introduced. |