Actions

API15

JURI/parse

From Joomla! Documentation

< API15:JURI
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

Parse a given URI and populate the class fields

[Edit Descripton]

Description:JURI/parse

Syntax

parse($uri)
Parameter Name Default Value Description
$uri $uri The URI string to parse

Returns

boolean True on success

Defined in

libraries/joomla/environment/uri.php

Importing

jimport( 'joomla.environment.uri' );

Source Body

function parse($uri)
{
        //Initialize variables
        $retval = false;
 
        // Set the original URI to fall back on
        $this->_uri = $uri;
 
        /*
         * Parse the URI and populate the object fields.  If URI is parsed properly,
         * set method return value to true.
         */
        if ($_parts = $this->_parseURL($uri)) {
                $retval = true;
        }
 
        //We need to replace &amp; with & for parse_str to work right...
        if(isset ($_parts['query']) && strpos($_parts['query'], '&amp;')) {
                $_parts['query'] = str_replace('&amp;', '&', $_parts['query']);
        }
 
        $this->_scheme = isset ($_parts['scheme']) ? $_parts['scheme'] : null;
        $this->_user = isset ($_parts['user']) ? $_parts['user'] : null;
        $this->_pass = isset ($_parts['pass']) ? $_parts['pass'] : null;
        $this->_host = isset ($_parts['host']) ? $_parts['host'] : null;
        $this->_port = isset ($_parts['port']) ? $_parts['port'] : null;
        $this->_path = isset ($_parts['path']) ? $_parts['path'] : null;
        $this->_query = isset ($_parts['query'])? $_parts['query'] : null;
        $this->_fragment = isset ($_parts['fragment']) ? $_parts['fragment'] : null;
 
        //parse the query
 
        if(isset ($_parts['query'])) parse_str($_parts['query'], $this->_vars);
        return $retval;
}

[Edit See Also] SeeAlso:JURI/parse

Examples

<CodeExamplesForm />