Uri

Extends Uri

Uri 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.

since

1.7.0

package

Joomla CMS

Methods

base

Returns the base URI for the request.

base( pathonly = false) : 
static
since

1.7.0

Arguments

pathonly

boolIf false, prepend the scheme, host and port information. Default is false.

Response

stringThe base URI string

buildQuery

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

buildQuery(mixed||string|int params) : 
static
see parse_str()
since

1.7.0

note

The parent method is protected, this exposes it as public for B/C

Arguments

params

array<string|int, mixed>The array of key => value pairs to return as a query string.

Response

stringThe resulting query string.

current

Returns the URL for the request, minus the query.

current() : 
static
since

1.7.0

Response

string

getInstance

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

getInstance( uri = 'SERVER') : \Joomla\CMS\Uri\Uri
static
since

1.7.0

Arguments

uri

stringThe URI to parse. [optional: if null uses script URI]

Response

UriThe URI object.

isInternal

Checks if the supplied URL is internal

isInternal( url) : 
static
since

1.7.0

Arguments

url

stringThe URL to check.

Response

boolTrue if Internal.

parse

Parse a given URI and populate the class fields.

parse( uri) : 
since

1.7.0

note

The parent method is protected, this exposes it as public for B/C

Arguments

uri

stringThe URI string to parse.

Response

boolTrue on success.

reset

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

reset() : 
static
since

1.7.0

Response

void

root

Returns the root URI for the request.

root( pathonly = false,  path = null) : 
static
since

1.7.0

Arguments

pathonly

boolIf false, prepend the scheme, host and port information. Default is false.

path

stringThe path

Response

stringThe root URI string.

Properties

instances

An array of Uri instances.

static
since

1.7.0

Type(s)

array<string|int, Uri>

base

The current calculated base url segments.

static
since

1.7.0

Type(s)

array<string|int, mixed>

root

The current calculated root url segments.

static
since

1.7.0

Type(s)

array<string|int, mixed>

current

The current url.

static
since

1.7.0

Type(s)

string