API15

JURI/isInternal: Difference between revisions

From Joomla! Documentation

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>]</...
 
m removing red link to edit, no existant pages
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JURI/isInternal|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JURI/isInternal}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 44: Line 44:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JURI/isInternal|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JURI/isInternal}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
Line 59: Line 59:
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Revision as of 18:56, 12 May 2013

Description

Checks if the supplied URL is internal

[<! removed edit link to red link >]

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

Syntax

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

Returns

boolean True if Internal

Defined in

libraries/joomla/environment/uri.php

Importing

jimport( 'joomla.environment.uri' );

Source Body

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

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

Examples

<CodeExamplesForm />