API16

JRequest: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 59: Line 59:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=JRequest
  category=JRequest
  category=CodeExample
  namespace=CodeExample
  category=ClassExample
  category=ClassExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>

Latest revision as of 02:00, 25 March 2017

JRequest provides a common interface to access request variables. This includes $_POST, $_GET, and naturally $_REQUEST. Variables can be passed through an input filter to avoid injection or returned raw.

Defined in

libraries/joomla/environment/request.php

Methods

Method name Description
getURI Gets the full request path.
getMethod Gets the request method.
getVar Fetches and returns a given variable.
getInt Fetches and returns a given filtered variable. The integer filter will allow only digits to be returned. This is currently only a proxy function for getVar().
getFloat Fetches and returns a given filtered variable. The float filter only allows digits and periods. This is currently only a proxy function for getVar().
getBool Fetches and returns a given filtered variable. The bool filter will only return true/false bool values. This is currently only a proxy function for getVar().
getWord Fetches and returns a given filtered variable. The word filter only allows the characters [A-Za-z_]. This is currently only a proxy function for getVar().
getCmd Fetches and returns a given filtered variable. The cmd filter only allows the characters [A-Za-z0-9.-_]. This is currently only a proxy function for getVar().
getString 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().
setVar Set a variabe in on of the request variables.
get Fetches and returns a request array.
set Sets a request variable.
checkToken Checks for a form token in the request.
clean Cleans the request from script injection.

Importing

jimport( 'joomla.environment.request' );


Examples

Code Examples