Joomla! 1.5 API

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2011 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 Class JURI

Description

JURI Class

This class serves two purposes. First to parse a URI and provide a common interface for the Joomla Framework to access and manipulate a URI. Second to attain the URI of the current executing script from the server regardless of server.

  • since: 1.5

Located in /joomla/environment/uri.php (line 29)

Class JObject   (Subpackage Base)

Class JURI   (Subpackage Environment)
Variable Summary
Variable string $_fragment
Variable string $_host
Variable string $_pass
Variable string $_path
Variable integer $_port
Variable string $_query
Variable string $_scheme
Variable string $_uri
Variable string $_user
Variable array $_vars
Method Summary
Static method static string base ([boolean $pathonly = false])
Static method static JURI &getInstance ([string $uri = 'SERVER'])
Static method static string root ([boolean $pathonly = false], [ $path = null])
Constructor JURI __construct ([string $uri = null])
Method string buildQuery ( $params, [ $akey = null])
Method string current ()
Method void delVar (string $name)
Method string getFragment ()
Method string getHost ()
Method string getPass ()
Method string getPath ()
Method int getPort ()
Method string getQuery ([ $toArray = false])
Method string getScheme ()
Method string getUser ()
Method array getVar ([string $name = null], [ $default = null])
Method boolean isInternal (string $url)
Method boolean isSSL ()
Method boolean parse (string $uri)
Method void setFragment (string $anchor)
Method void setHost (string $host)
Method void setPass (string $pass)
Method void setPath (string $path)
Method void setPort (int $port)
Method void setQuery (mixed $query)
Method void setScheme (string $scheme)
Method void setUser (string $user)
Method string setVar (string $name, string $value)
Method string toString ([array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')])
Variables
string $_fragment = null (line 92)

Anchor

string $_host = null (line 50)

Host

string $_pass = null (line 71)

Password

string $_path = null (line 78)

Path

integer $_port = null (line 57)

Port

string $_query = null (line 85)

Query

string $_scheme = null (line 43)

Protocol

string $_uri = null (line 36)

Original URI

string $_user = null (line 64)

Username

array $_vars = array () (line 99)

Query variable hash

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 107)

Constructor.

You can pass a URI string to the constructor to initialize a specific URI.

JURI __construct ([string $uri = null])
  • string $uri: The optional URI string

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
base (line 223)

Returns the base URI for the request.

  • return: The base URI string
  • since: 1.5
  • access: public
string base ([boolean $pathonly = false])
  • boolean $pathonly: If false, prepend the scheme, host and port information. Default is false.
buildQuery (line 489)

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

  • return: The resulting query string
  • see: parse_str()
  • since: 1.5
  • access: public
string buildQuery ( $params, [ $akey = null])
  • $params
  • $akey
current (line 296)

Returns the URL for the request, minus the query

  • since: 1.5
  • access: public
string current ()
delVar (line 423)

Removes an item from the query string variables if it exists

  • since: 1.5
  • access: public
void delVar (string $name)
  • string $name: Name of variable to remove
getFragment (line 662)

Get the URI archor string everything after the "#"

  • return: The URI anchor string
  • since: 1.5
  • access: public
string getFragment ()
getHost (line 595)

Get URI host returns the hostname/ip, or null if no hostname/ip was specified

  • return: The URI host
  • since: 1.5
  • access: public
string getHost ()
getInstance (line 126)

Returns a reference to a global JURI object, only creating it if it doesn't already exist.

This method must be invoked as:

  $uri =& JURI::getInstance([$uri]);

  • return: The URI object.
  • since: 1.5
JURI &getInstance ([string $uri = 'SERVER'])
  • string $uri: The URI to parse. [optional: if null uses script URI]
getPass (line 572)

Get URI password returns the password, or null if no password was specified

  • return: The URI password
  • since: 1.5
  • access: public
string getPass ()
getPath (line 639)

Gets the URI path string

  • return: The URI path string
  • since: 1.5
  • access: public
string getPath ()
getPort (line 617)

Get URI port returns the port number, or null if no port was specified

  • return: The URI port number
  • access: public
int getPort ()
getQuery (line 467)

Returns flat query string

  • return: Query string
  • since: 1.5
  • access: public
string getQuery ([ $toArray = false])
  • $toArray
getScheme (line 525)

Get URI scheme (protocol) ie. http, https, ftp, etc...

  • return: The URI scheme
  • since: 1.5
  • access: public
string getScheme ()
getUser (line 549)

Get URI username returns the username, or null if no username was specified

  • return: The URI username
  • since: 1.5
  • access: public
string getUser ()
getVar (line 408)

Returns a query variable by name

  • return: Query variables
  • since: 1.5
  • access: public
array getVar ([string $name = null], [ $default = null])
  • string $name: Name of the query variable to get
  • $default
isInternal (line 697)

Checks if the supplied URL is internal

  • return: True if Internal
  • since: 1.5
  • access: public
boolean isInternal (string $url)
  • string $url: The URL to check
isSSL (line 685)

Checks whether the current URI is using HTTPS

  • return: True if using SSL via HTTPS
  • since: 1.5
  • access: public
boolean isSSL ()
parse (line 318)

Parse a given URI and populate the class fields

  • return: True on success
  • since: 1.5
  • access: public
boolean parse (string $uri)
  • string $uri: The URI string to parse
root (line 269)

Returns the root URI for the request.

  • return: The root URI string
  • since: 1.5
  • access: public
string root ([boolean $pathonly = false], [ $path = null])
  • boolean $pathonly: If false, prepend the scheme, host and port information. Default is false.
  • $path
setFragment (line 674)

Set the URI anchor string everything after the "#"

  • since: 1.5
  • access: public
void setFragment (string $anchor)
  • string $anchor: The URI anchor string
setHost (line 606)

Set URI host

  • since: 1.5
  • access: public
void setHost (string $host)
  • string $host: The URI host
setPass (line 583)

Set URI password

  • since: 1.5
  • access: public
void setPass (string $pass)
  • string $pass: The URI password
setPath (line 650)

Set the URI path string

  • since: 1.5
  • access: public
void setPath (string $path)
  • string $path: The URI path string
setPort (line 628)

Set URI port

  • since: 1.5
  • access: public
void setPort (int $port)
  • int $port: The URI port number
setQuery (line 442)

Sets the query to a supplied string in format: foo=bar&x=y

  • since: 1.5
  • access: public
void setQuery (mixed $query)
  • mixed $query: (array|string) $query The query string
setScheme (line 537)

Set URI scheme (protocol) ie. http, https, ftp, etc...

  • since: 1.5
  • access: public
void setScheme (string $scheme)
  • string $scheme: The URI scheme
setUser (line 560)

Set URI username

  • since: 1.5
  • access: public
void setUser (string $user)
  • string $user: The URI username
setVar (line 389)

Adds a query variable and value, replacing the value if it already exists and returning the old value.

  • return: Previous value for the query variable
  • since: 1.5
  • access: public
string setVar (string $name, string $value)
  • string $name: Name of the query variable to set
  • string $value: Value of the query variable
toString (line 362)

Returns full uri string

  • return: The rendered URI string
  • since: 1.5
  • access: public
string toString ([array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')])
  • array $parts: An array specifying the parts to render

Redefinition of:
JObject::toString()
Object-to-string conversion.

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::getPublicProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::toString()
Support Joomla!