Actions

API15

JRequest/get

From Joomla! Documentation

< API15:JRequest
Revision as of 17:19, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Fetches and returns a request array.

[Edit Descripton]

Description:JRequest/get

Syntax

get($hash= 'default', $mask=0)
Parameter Name Default Value Description
$hash 'default' $hash to get (POST, GET, FILES, METHOD)
$mask 0 $mask Filter mask for the variable

Returns

mixed Request hash

Defined in

libraries/joomla/environment/request.php

Importing

jimport( 'joomla.environment.request' );

Source Body

function get($hash = 'default', $mask = 0)
{
        $hash = strtoupper($hash);
 
        if ($hash === 'METHOD') {
                $hash = strtoupper( $_SERVER['REQUEST_METHOD'] );
        }
 
        switch ($hash)
        {
                case 'GET' :
                        $input = $_GET;
                        break;
 
                case 'POST' :
                        $input = $_POST;
                        break;
 
                case 'FILES' :
                        $input = $_FILES;
                        break;
 
                case 'COOKIE' :
                        $input = $_COOKIE;
                        break;
 
                case 'ENV'    :
                        $input = &$_ENV;
                        break;
 
                case 'SERVER'    :
                        $input = &$_SERVER;
                        break;
 
                default:
                        $input = $_REQUEST;
                        break;
        }
 
        $result = JRequest::_cleanVar($input, $mask);
 
        // Handle magic quotes compatability
        if (get_magic_quotes_gpc() && ($hash != 'FILES')) {
                $result = JRequest::_stripSlashesRecursive( $result );
        }
 
        return $result;
}

[Edit See Also] SeeAlso:JRequest/get

Examples

<CodeExamplesForm />