\JUri
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.
Synopsis
class JUri
{
- // members
- protected $uri;
- protected $scheme;
- protected $host;
- protected $port;
- protected $user;
- protected $pass;
- protected $path;
- protected $query;
- protected $fragment;
- protected $vars;
- protected $instances;
- protected $base;
- protected $root;
- protected $current;
- // methods
- public void __construct()
- public string __toString()
- public static JUri getInstance()
- public static string base()
- public static string root()
- public static string current()
- public static void reset()
- public boolean parse()
- public string toString()
- public string setVar()
- public boolean hasVar()
- public array getVar()
- public void delVar()
- public void setQuery()
- public string getQuery()
- public static string buildQuery()
- public string getScheme()
- public void setScheme()
- public string getUser()
- public void setUser()
- public string getPass()
- public void setPass()
- public string getHost()
- public void setHost()
- public integer getPort()
- public void setPort()
- public string getPath()
- public void setPath()
- public string getFragment()
- public void setFragment()
- public boolean isSSL()
- public static boolean isInternal()
- protected string _cleanPath()
Members
protected
- $base — array
- $current — string
- $fragment — string
- $host — string
- $instances — array
- $pass — string
- $path — string
- $port — integer
- $query — string
- $root — array
- $scheme — string
- $uri — string
- $user — string
- $vars — array
Methods
protected
- _cleanPath() — Resolves //, ../ and ./ from a path and returns the result. Eg:
public
- __construct() — Constructor.
- __toString() — Magic method to get the string representation of the URI object.
- base() — Returns the base URI for the request.
- buildQuery() — Build a query from a array (reverse of the PHP parse_str()).
- current() — Returns the URL for the request, minus the query.
- delVar() — Removes an item from the query string variables if it exists.
- getFragment() — Get the URI archor string Everything after the "#".
- getHost() — Get URI host Returns the hostname/ip or null if no hostname/ip was specified.
- getInstance() — Returns the global JUri object, only creating it if it doesn't already exist.
- getPass() — Get URI password Returns the password, or null if no password was specified.
- getPath() — Gets the URI path string.
- getPort() — Get URI port Returns the port number, or null if no port was specified.
- getQuery() — Returns flat query string.
- getScheme() — Get URI scheme (protocol) ie. http, https, ftp, etc...
- getUser() — Get URI username Returns the username, or null if no username was specified.
- getVar() — Returns a query variable by name.
- hasVar() — Checks if variable exists.
- isInternal() — Checks if the supplied URL is internal
- isSSL() — Checks whether the current URI is using HTTPS.
- parse() — Parse a given URI and populate the class fields.
- reset() — Method to reset class static members for testing and other various issues.
- root() — Returns the root URI for the request.
- setFragment() — Set the URI anchor string everything after the "#".
- setHost() — Set URI host.
- setPass() — Set URI password.
- setPath() — Set the URI path string.
- setPort() — Set URI port.
- setQuery() — Sets the query to a supplied string in format: foo=bar&x=y
- setScheme() — Set URI scheme (protocol) ie. http, https, ftp, etc...
- setUser() — Set URI username.
- setVar() — Adds a query variable and value, replacing the value if it already exists and returning the old value.
- toString() — Returns full uri string.