Returns the base URI for the request.
static string
base
([boolean $pathonly = false])
-
boolean
$pathonly: If false, prepend the scheme, host and port information. Default is false.
Build a query from a array (reverse of the PHP parse_str()).
static string
buildQuery
(array $params)
-
array
$params: The array of key => value pairs to return as a query string.
Returns the URL for the request, minus the query.
static string
current
()
Returns the global JUri object, only creating it if it doesn't already exist.
static
JUri
getInstance
([
string $uri =
'SERVER'])
-
string
$uri: The URI to parse. [optional: if null uses script URI]
Checks if the supplied URL is internal
static boolean
isInternal
(string $url)
-
string
$url: The URL to check.
Method to reset class static members for testing and other various issues.
static void
reset
()
Returns the root URI for the request.
static string
root
([boolean $pathonly = false], [string $path = null])
-
boolean
$pathonly: If false, prepend the scheme, host and port information. Default is false.
-
string
$path: The path
Constructor.
You can pass a URI string to the constructor to initialise a specific URI.
JUri
__construct
([string $uri = null])
-
string
$uri: The optional URI string
Removes an item from the query string variables if it exists.
void
delVar
(string $name)
-
string
$name: Name of variable to remove.
Get the URI archor string Everything after the "#".
string
getFragment
()
Get URI host Returns the hostname/ip or null if no hostname/ip was specified.
string
getHost
()
Get URI password Returns the password, or null if no password was specified.
string
getPass
()
Gets the URI path string.
string
getPath
()
Get URI port Returns the port number, or null if no port was specified.
integer
getPort
()
Returns flat query string.
string
getQuery
([boolean $toArray = false])
-
boolean
$toArray: True to return the query as a key => value pair array.
Get URI scheme (protocol) ie. http, https, ftp, etc...
string
getScheme
()
Get URI username Returns the username, or null if no username was specified.
string
getUser
()
Returns a query variable by name.
array
getVar
(string $name, [string $default = null])
-
string
$name: Name of the query variable to get.
-
string
$default: Default value to return if the variable is not set.
Checks if variable exists.
boolean
hasVar
(string $name)
-
string
$name: Name of the query variable to check.
Checks whether the current URI is using HTTPS.
boolean
isSSL
()
Parse a given URI and populate the class fields.
boolean
parse
(string $uri)
-
string
$uri: The URI string to parse.
Set the URI anchor string everything after the "#".
void
setFragment
(string $anchor)
-
string
$anchor: The URI anchor string.
Set URI host.
void
setHost
(string $host)
-
string
$host: The URI host.
Set URI password.
void
setPass
(string $pass)
-
string
$pass: The URI password.
Set the URI path string.
void
setPath
(string $path)
-
string
$path: The URI path string.
Set URI port.
void
setPort
(integer $port)
-
integer
$port: The URI port number.
Sets the query to a supplied string in format: foo=bar&x=y
void
setQuery
(mixed $query)
-
mixed
$query: The query string or array.
Set URI scheme (protocol) ie. http, https, ftp, etc...
void
setScheme
(string $scheme)
-
string
$scheme: The URI scheme.
Set URI username.
void
setUser
(string $user)
-
string
$user: The URI username.
Adds a query variable and value, replacing the value if it already exists and returning the old value.
string
setVar
(string $name, string $value)
-
string
$name: Name of the query variable to set.
-
string
$value: Value of the query variable.
Returns full uri string.
string
toString
([array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')])
-
array
$parts: An array specifying the parts to render.
Resolves //, ../ and ./ from a path and returns the result. Eg:
/foo/bar/../boo.php => /foo/boo.php /foo/bar/../../boo.php => /boo.php /foo/bar/.././/boo.php => /foo/boo.php
string
_cleanPath
(string $path)
-
string
$path: The URI path to clean.
Magic method to get the string representation of the URI object.
string
__toString
()