API15

JRequest/get

From Joomla! Documentation

< API15:JRequest
Revision as of 13:44, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Fetches and returns a request array.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

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[edit]

mixed Request hash

Defined in[edit]

libraries/joomla/environment/request.php

Importing[edit]

jimport( 'joomla.environment.request' );

Source Body[edit]

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />