API15

JRequest/get

From Joomla! Documentation

< API15:JRequest
Revision as of 17:19, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Fetches and returns a request array. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowik...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

[Edit Descripton]

Template:Description:JRequest/get

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

[Edit See Also] Template:SeeAlso:JRequest/get

Examples[edit]

<CodeExamplesForm />