JRequest/getString: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask. This is currently only a proxy function for getV... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask. This is currently only a proxy function for getVar(). | Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask. This is currently only a proxy function for getVar(). | ||
===Syntax=== | ===Syntax=== | ||
| Line 51: | Line 49: | ||
</source> | </source> | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getString | category=getString | ||
category=JRequest | category=JRequest | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 02:01, 25 March 2017
Description
Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask. This is currently only a proxy function for getVar().
Syntax
static getString($name, $default= '', $hash= 'default', $mask=0)
| Parameter Name | Default Value | Description |
|---|---|---|
| $name | $name Variable name | |
| $default | $default Default value if the variable does not exist | |
| $hash | 'default' | $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) |
| $mask | 0 | $mask Filter mask for the variable |
Returns
string Requested variable
Defined in
libraries/joomla/environment/request.php
Importing
jimport( 'joomla.environment.request' );
Source Body
public static function getString($name, $default = '', $hash = 'default', $mask = 0)
{
// Cast to string, in case JREQUEST_ALLOWRAW was specified for mask
return (string) self::getVar($name, $default, $hash, 'string', $mask);
}
Examples
Code Examples