Uri
Extends UriJUri 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
_cleanPath
Resolves //, ../ and ./ from a path and returns the result. Eg:
_cleanPath(string path) : string
/foo/bar/../boo.php => /foo/boo.php /foo/bar/../../boo.php => /boo.php /foo/bar/.././/boo.php => /foo/boo.php
| since |
1.7.0 |
|---|---|
| deprecated |
4.0 Use {@link \Joomla\Uri\Uri::cleanPath()} instead |
Arguments
- path
stringThe URI path to clean.
Response
stringCleaned and resolved URI path.
base
Returns the base URI for the request.
base(bool pathonly = false) : string
| 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(array params) : string
| see | parse_str() |
|---|---|
| since |
1.7.0 |
| note |
The parent method is protected, this exposes it as public for B/C |
Arguments
- params
arrayThe 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() : string
| since |
1.7.0 |
|---|
Response
string
getInstance
Returns the global JUri object, only creating it if it doesn't already exist.
getInstance(string uri = 'SERVER') : \Joomla\CMS\Uri\Uri
| since |
1.7.0 |
|---|
Arguments
- uri
stringThe URI to parse. [optional: if null uses script URI]
Response
\Joomla\CMS\Uri\UriThe URI object.
isInternal
Checks if the supplied URL is internal
isInternal(string url) : bool
| 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(string uri) : bool
| 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() : void
| since |
1.7.0 |
|---|
root
Returns the root URI for the request.
root(bool pathonly = false, string path = null) : string
| 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.
setPath
Set the URI path string. Note we keep this method here so it uses the old _cleanPath function
setPath(string path) : void
| since |
1.7.0 |
|---|---|
| deprecated |
4.0 Use {@link \Joomla\Uri\Uri::setPath()} |
| note |
Present to proxy calls to the deprecated {@link JUri::_cleanPath()} method. |
Arguments
- path
stringThe URI path string.
Properties
instances
An array of JUri instances.
| since |
1.7.0 |
|---|
Type(s)
\Joomla\CMS\Uri\Uri[]
base
The current calculated base url segments.
| since |
1.7.0 |
|---|
Type(s)
array
root
The current calculated root url segments.
| since |
1.7.0 |
|---|
Type(s)
array
current
The current url.
| since |
1.7.0 |
|---|
Type(s)
string