class Uri extends Uri

JUri Class

This class serves two purposes. First it parses a URI and provides a common interface for the Joomla Platform to access and manipulate a URI. Second it obtains the URI of the current executing script from the server regardless of server.

Methods

static  Uri
getInstance( string $uri = 'SERVER')

Returns the global JUri object, only creating it if it doesn't already exist.

static  string
base( boolean $pathonly = false)

Returns the base URI for the request.

static  string
root( boolean $pathonly = false, string $path = null)

Returns the root URI for the request.

static  string
current()

Returns the URL for the request, minus the query.

static  void
reset()

Method to reset class static members for testing and other various issues.

void
setPath( string $path)

Set the URI path string. Note we keep this method here so it uses the old _cleanPath function

static  boolean
isInternal( string $url)

Checks if the supplied URL is internal

static  string
buildQuery( array $params)

Build a query from an array (reverse of the PHP parse_str()).

boolean
parse( string $uri)

Parse a given URI and populate the class fields.

Details

static Uri getInstance( string $uri = 'SERVER')

Returns the global JUri object, only creating it if it doesn't already exist.

Parameters

string $uri The URI to parse. [optional: if null uses script URI]

Return Value

Uri The URI object.

static string base( boolean $pathonly = false)

Returns the base URI for the request.

Parameters

boolean $pathonly If false, prepend the scheme, host and port information. Default is false.

Return Value

string The base URI string

static string root( boolean $pathonly = false, string $path = null)

Returns the root URI for the request.

Parameters

boolean $pathonly If false, prepend the scheme, host and port information. Default is false.
string $path The path

Return Value

string The root URI string.

static string current()

Returns the URL for the request, minus the query.

Return Value

string

static void reset()

Method to reset class static members for testing and other various issues.

Return Value

void

void setPath( string $path)

Set the URI path string. Note we keep this method here so it uses the old _cleanPath function

Parameters

string $path The URI path string.

Return Value

void

static boolean isInternal( string $url)

Checks if the supplied URL is internal

Parameters

string $url The URL to check.

Return Value

boolean True if Internal.

static string buildQuery( array $params)

Build a query from an array (reverse of the PHP parse_str()).

Parameters

array $params The array of key => value pairs to return as a query string.

Return Value

string The resulting query string.

See also

parse_str()

boolean parse( string $uri)

Parse a given URI and populate the class fields.

Parameters

string $uri The URI string to parse.

Return Value

boolean True on success.