Uri
class Uri extends AbstractUri (View source)
Uri Class
This class parses a URI and provides a common interface for the Windwalker framework to access and manipulate a URI.
This class is a fork from Joomla Uri.
Constants
SCHEME_HTTP |
|
SCHEME_HTTPS |
|
Methods
Magic method to get the string representation of the URI object.
Returns full uri string.
Returns a query variable by name.
Get URI username Returns the username, or null if no username was specified.
Get URI password Returns the password, or null if no password was specified.
Get URI host Returns the hostname/ip or null if no hostname/ip was specified.
Get URI port Returns the port number, or null if no port was specified.
Adds a query variable and value, replacing the value if it already exists and returning the old value.
Removes an item from the query string variables if it exists.
Sets the query to a supplied string in format: foo=bar&x=y
Set URI scheme (protocol) ie. http, https, ftp, etc.
Set URI username.
Set URI password.
Set URI host.
Set URI port.
Set the URI path string.
Set the URI anchor string everything after the "#".
Details
in AbstractUri at line line 93
__construct(string $uri = null)
Constructor.
You can pass a URI string to the constructor to initialise a specific URI.
in AbstractUri at line line 108
string
__toString()
Magic method to get the string representation of the URI object.
in AbstractUri at line line 122
string
toString(array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'))
Returns full uri string.
in AbstractUri at line line 149
boolean
hasVar(string $name)
Checks if variable exists.
in AbstractUri at line line 164
array
getVar(string $name, string $default = null)
Returns a query variable by name.
in AbstractUri at line line 183
string
getQuery(boolean $toArray = false)
Returns flat query string.
in AbstractUri at line line 207
string
getScheme()
Get URI scheme (protocol) ie. http, https, ftp, etc.
..
in AbstractUri at line line 220
string
getUser()
Get URI username Returns the username, or null if no username was specified.
in AbstractUri at line line 233
string
getPass()
Get URI password Returns the password, or null if no password was specified.
in AbstractUri at line line 255
string
getUserInfo()
Retrieve the user information component of the URI.
If no user information is present, this method MUST return an empty string.
If a user is present in the URI, this will return that value; additionally, if the password is also present, it will be appended to the user value, with a colon (":") separating the values.
The trailing "@" character is not part of the user information and MUST NOT be added.
in AbstractUri at line line 275
string
getHost()
Get URI host Returns the hostname/ip or null if no hostname/ip was specified.
in AbstractUri at line line 288
integer
getPort()
Get URI port Returns the port number, or null if no port was specified.
in AbstractUri at line line 300
string
getPath()
Gets the URI path string.
in AbstractUri at line line 313
string
getFragment()
Get the URI archor string Everything after the "#".
in AbstractUri at line line 325
boolean
isSSL()
Checks whether the current URI is using HTTPS.
in AbstractUri at line line 384
string
getOriginal()
getUri
at line line 34
string
setVar(string $name, string $value)
Adds a query variable and value, replacing the value if it already exists and returning the old value.
at line line 55
void
delVar(string $name)
Removes an item from the query string variables if it exists.
at line line 76
void
setQuery(mixed $query)
Sets the query to a supplied string in format: foo=bar&x=y
at line line 106
void
setScheme(string $scheme)
Set URI scheme (protocol) ie. http, https, ftp, etc.
..
at line line 120
void
setUser(string $user)
Set URI username.
at line line 134
void
setPass(string $pass)
Set URI password.
at line line 148
void
setHost(string $host)
Set URI host.
at line line 162
void
setPort(integer $port)
Set URI port.
at line line 176
void
setPath(string $path)
Set the URI path string.
at line line 191
void
setFragment(string $anchor)
Set the URI anchor string everything after the "#".