API15

JURI/isInternal

From Joomla! Documentation

< API15:JURI
Revision as of 17:20, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Checks if the supplied URL is internal <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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]

Checks if the supplied URL is internal

[Edit Descripton]

Template:Description:JURI/isInternal

Syntax[edit]

isInternal($url)
Parameter Name Default Value Description
$url $url The URL to check

Returns[edit]

boolean True if Internal

Defined in[edit]

libraries/joomla/environment/uri.php

Importing[edit]

jimport( 'joomla.environment.uri' );

Source Body[edit]

function isInternal($url) {
        $uri =& JURI::getInstance($url);
        $base = $uri->toString(array('scheme', 'host', 'port', 'path'));
        $host = $uri->toString(array('scheme', 'host', 'port'));
        if(stripos($base, JURI::base()) !== 0 && !empty($host)) {
                return false;
        }
        return true;
}

[Edit See Also] Template:SeeAlso:JURI/isInternal

Examples[edit]

<CodeExamplesForm />