[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/environment/ -> uri.php (summary)

(no description)

Copyright: Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 809 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JURI:: (33 methods):
  __construct()
  __toString()
  getInstance()
  base()
  root()
  current()
  reset()
  parse()
  toString()
  setVar()
  hasVar()
  getVar()
  delVar()
  setQuery()
  getQuery()
  buildQuery()
  getScheme()
  setScheme()
  getUser()
  setUser()
  getPass()
  setPass()
  getHost()
  setHost()
  getPort()
  setPort()
  getPath()
  setPath()
  getFragment()
  setFragment()
  isSSL()
  isInternal()
  _cleanPath()


Class: JURI  - X-Ref

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.

__construct($uri = null)   X-Ref
Constructor.
You can pass a URI string to the constructor to initialise a specific URI.

param: string  $uri  The optional URI string

__toString()   X-Ref
Magic method to get the string representation of the URI object.

return: string

getInstance($uri = 'SERVER')   X-Ref
Returns the global JURI object, only creating it
if it doesn't already exist.

param: string  $uri  The URI to parse.  [optional: if null uses script URI]
return: JURI  The URI object.

base($pathonly = false)   X-Ref
Returns the base URI for the request.

param: boolean  $pathonly  If false, prepend the scheme, host and port information. Default is false.
return: string  The base URI string

root($pathonly = false, $path = null)   X-Ref
Returns the root URI for the request.

param: boolean  $pathonly  If false, prepend the scheme, host and port information. Default is false.
param: string   $path      The path
return: string  The root URI string.

current()   X-Ref
Returns the URL for the request, minus the query.

return: string

reset()   X-Ref
Method to reset class static members for testing and other various issues.

return: void

parse($uri)   X-Ref
Parse a given URI and populate the class fields.

param: string  $uri  The URI string to parse.
return: boolean  True on success.

toString($parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')   X-Ref
Returns full uri string.

param: array  $parts  An array specifying the parts to render.
return: string  The rendered URI string.

setVar($name, $value)   X-Ref
Adds a query variable and value, replacing the value if it
already exists and returning the old value.

param: string  $name   Name of the query variable to set.
param: string  $value  Value of the query variable.
return: string  Previous value for the query variable.

hasVar($name)   X-Ref
Checks if variable exists.

param: string  $name  Name of the query variable to check.
return: boolean  True if the variable exists.

getVar($name, $default = null)   X-Ref
Returns a query variable by name.

param: string  $name     Name of the query variable to get.
param: string  $default  Default value to return if the variable is not set.
return: array   Query variables.

delVar($name)   X-Ref
Removes an item from the query string variables if it exists.

param: string  $name  Name of variable to remove.
return: void

setQuery($query)   X-Ref
Sets the query to a supplied string in format:
foo=bar&x=y

param: mixed  $query  The query string or array.
return: void

getQuery($toArray = false)   X-Ref
Returns flat query string.

param: boolean  $toArray  True to return the query as a key => value pair array.
return: string   Query string.

buildQuery($params)   X-Ref
Build a query from a array (reverse of the PHP parse_str()).

param: array  $params  The array of key => value pairs to return as a query string.
return: string  The resulting query string.

getScheme()   X-Ref
Get URI scheme (protocol)
ie. http, https, ftp, etc...

return: string  The URI scheme.

setScheme($scheme)   X-Ref
Set URI scheme (protocol)
ie. http, https, ftp, etc...

param: string  $scheme  The URI scheme.
return: void

getUser()   X-Ref
Get URI username
Returns the username, or null if no username was specified.

return: string  The URI username.

setUser($user)   X-Ref
Set URI username.

param: string  $user  The URI username.
return: void

getPass()   X-Ref
Get URI password
Returns the password, or null if no password was specified.

return: string  The URI password.

setPass($pass)   X-Ref
Set URI password.

param: string  $pass  The URI password.
return: void

getHost()   X-Ref
Get URI host
Returns the hostname/ip or null if no hostname/ip was specified.

return: string  The URI host.

setHost($host)   X-Ref
Set URI host.

param: string  $host  The URI host.
return: void

getPort()   X-Ref
Get URI port
Returns the port number, or null if no port was specified.

return: integer  The URI port number.

setPort($port)   X-Ref
Set URI port.

param: integer  $port  The URI port number.
return: void

getPath()   X-Ref
Gets the URI path string.

return: string  The URI path string.

setPath($path)   X-Ref
Set the URI path string.

param: string  $path  The URI path string.
return: void

getFragment()   X-Ref
Get the URI archor string
Everything after the "#".

return: string  The URI anchor string.

setFragment($anchor)   X-Ref
Set the URI anchor string
everything after the "#".

param: string  $anchor  The URI anchor string.
return: void

isSSL()   X-Ref
Checks whether the current URI is using HTTPS.

return: boolean  True if using SSL via HTTPS.

isInternal($url)   X-Ref
Checks if the supplied URL is internal

param: string  $url  The URL to check.
return: boolean  True if Internal.

_cleanPath($path)   X-Ref
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

param: string  $path  The URI path to clean.
return: string  Cleaned and resolved URI path.



Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1