Moodle  2.2.1
http://www.collinsharper.com
SimpleUrl Class Reference

Public Member Functions

 SimpleUrl ($url= '')
 _chompCoordinates (&$url)
 _chompScheme (&$url)
 _chompLogin (&$url)
 _chompHost (&$url)
 _chompPath (&$url)
 _chompRequest (&$url)
 _parseRequest ($raw)
 getScheme ($default=false)
 getUsername ()
 getPassword ()
 getHost ($default=false)
 getTld ()
 getPort ()
 getPath ()
 getPage ()
 getBasePath ()
 getFragment ()
 setCoordinates ($x=false, $y=false)
 getX ()
 getY ()
 getEncodedRequest ()
 addRequestParameter ($key, $value)
 addRequestParameters ($parameters)
 clearRequest ()
 getTarget ()
 setTarget ($frame)
 asString ()
 makeAbsolute ($base)
 _extractAbsolutePath ($base)
 _isRelativePath ($path)
 getIdentity ()
 normalisePath ($path)

Static Public Member Functions

 getAllTopLevelDomains ()

Data Fields

 $_scheme
 $_username
 $_password
 $_host
 $_port
 $_path
 $_request
 $_fragment
 $_x
 $_y
 $_target
 $_raw = false

Detailed Description

Definition at line 25 of file url.php.


Member Function Documentation

_chompCoordinates ( &$  url)

Extracts the X, Y coordinate pair from an image map.

Parameters:
string$urlURL so far. The coordinates will be removed.
Returns:
array X, Y as a pair of integers. private

Definition at line 68 of file url.php.

Here is the caller graph for this function:

_chompHost ( &$  url)

Extracts the host part of an incoming URL. Includes the port number part. Will extract the host if it starts with // or it has a top level domain or it has at least two dots.

Parameters:
string$urlURL so far. The host will be removed.
Returns:
string Host part guess or false. private

Definition at line 129 of file url.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_chompLogin ( &$  url)

Extracts the username and password from the incoming URL. The // prefix will be reattached to the URL after the doublet is extracted.

Parameters:
string$urlURL so far. The username and password are removed.
Returns:
array Two item list of username and password. Will urldecode() them. private

Definition at line 101 of file url.php.

Here is the caller graph for this function:

_chompPath ( &$  url)

Extracts the path information from the incoming URL. Strips this path from the URL.

Parameters:
string$urlURL so far. The host will be removed.
Returns:
string Path part or '/'. private

Definition at line 155 of file url.php.

Here is the caller graph for this function:

_chompRequest ( &$  url)

Strips off the request data.

Parameters:
string$urlURL so far. The request will be removed.
Returns:
string Raw request part. private

Definition at line 170 of file url.php.

Here is the caller graph for this function:

_chompScheme ( &$  url)

Extracts the scheme part of an incoming URL.

Parameters:
string$urlURL so far. The scheme will be removed.
Returns:
string Scheme part or false. private

Definition at line 83 of file url.php.

Here is the caller graph for this function:

_extractAbsolutePath ( base)

Replaces unknown sections of the path with base parts to return a complete absolute one.

Parameters:
string/SimpleUrl$base Base URL.
stringAbsolute path. private

Definition at line 470 of file url.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_isRelativePath ( path)

Simple test to see if a path part is relative.

Parameters:
string$pathPath to test.
Returns:
boolean True if starts with a "/". private

Definition at line 489 of file url.php.

Here is the caller graph for this function:

_parseRequest ( raw)

Breaks the request down into an object.

Parameters:
string$rawRaw request.
Returns:
SimpleFormEncoding Parsed data. private

Definition at line 184 of file url.php.

Here is the caller graph for this function:

addRequestParameter ( key,
value 
)

Adds an additional parameter to the request.

Parameters:
string$keyName of parameter.
string$valueValue as string. public

Definition at line 360 of file url.php.

addRequestParameters ( parameters)

Adds additional parameters to the request.

Parameters:
hash/SimpleFormEncoding$parameters Additional parameters. public

Definition at line 371 of file url.php.

asString ( )

Renders the URL back into a string.

Returns:
string URL in canonical form. public

Definition at line 411 of file url.php.

Here is the call graph for this function:

Clears down all parameters. public

Definition at line 380 of file url.php.

getAllTopLevelDomains ( ) [static]

A pipe seperated list of all TLDs that result in two part domain names.

Returns:
string Pipe separated list. public

Definition at line 524 of file url.php.

Here is the caller graph for this function:

Gets the path to the page.

Returns:
string Path less the page. public

Definition at line 284 of file url.php.

Here is the call graph for this function:

Accessor for current request parameters in URL string form. Will return teh original request if at all possible even if it doesn't make much sense.

Returns:
string Form is string "?a=1&b=2", etc. public

Definition at line 342 of file url.php.

Here is the caller graph for this function:

Accessor for fragment at end of URL after the "#".

Returns:
string Part after "#". public

Definition at line 296 of file url.php.

Here is the caller graph for this function:

getHost ( default = false)

Accessor for hostname and port.

Parameters:
string$defaultValue to use if not present.
Returns:
string Hostname only. public

Definition at line 231 of file url.php.

Here is the caller graph for this function:

Extracts the username and password for use in rendering a URL.

Returns:
string/boolean Form of username:password or false. public

Definition at line 499 of file url.php.

Here is the caller graph for this function:

getPage ( )

Accessor for page if any. This may be a directory name if ambiguious.

Returns:
Page name. public

Definition at line 272 of file url.php.

Here is the call graph for this function:

Accessor for password.

Returns:
string Password preceding host. public

Definition at line 221 of file url.php.

getPath ( )

Accessor for path.

Returns:
string Full path including leading slash if implied. public

Definition at line 259 of file url.php.

Here is the caller graph for this function:

getPort ( )

Accessor for port number.

Returns:
integer TCP/IP port number. public

Definition at line 250 of file url.php.

Here is the caller graph for this function:

getScheme ( default = false)

Accessor for protocol part.

Parameters:
string$defaultValue to use if not present.
Returns:
string Scheme name, e.g "http". public

Definition at line 203 of file url.php.

Here is the caller graph for this function:

getTarget ( )

Gets the frame target if present. Although not strictly part of the URL specification it acts as similarily to the browser.

Returns:
boolean/string Frame name or false if none. public

Definition at line 392 of file url.php.

getTld ( )

Accessor for top level domain.

Returns:
string Last part of host. public

Definition at line 240 of file url.php.

Here is the call graph for this function:

Accessor for user name.

Returns:
string Username preceding host. public

Definition at line 212 of file url.php.

getX ( )

Accessor for horizontal image coordinate.

Returns:
integer X value. public

Definition at line 321 of file url.php.

Here is the caller graph for this function:

getY ( )

Accessor for vertical image coordinate.

Returns:
integer Y value. public

Definition at line 330 of file url.php.

Here is the caller graph for this function:

makeAbsolute ( base)

Replaces unknown sections to turn a relative URL into an absolute one. The base URL can be either a string or a SimpleUrl object.

Parameters:
string/SimpleUrl$base Base URL. public

Definition at line 438 of file url.php.

Here is the call graph for this function:

normalisePath ( path)

Replaces . and .. sections of the path.

Parameters:
string$pathUnoptimised path.
Returns:
string Path with dots removed if possible. public

Definition at line 512 of file url.php.

Here is the caller graph for this function:

setCoordinates ( x = false,
y = false 
)

Sets image coordinates. Set to false to clear them.

Parameters:
integer$xHorizontal position.
integer$yVertical position. public

Definition at line 307 of file url.php.

Here is the caller graph for this function:

setTarget ( frame)

Attaches a frame target.

Parameters:
string$frameName of frame. public

Definition at line 401 of file url.php.

SimpleUrl ( url = '')

Constructor. Parses URL into sections.

Parameters:
string$urlIncoming URL. public

Definition at line 44 of file url.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$_fragment

Definition at line 33 of file url.php.

$_host

Definition at line 29 of file url.php.

$_password

Definition at line 28 of file url.php.

$_path

Definition at line 31 of file url.php.

$_port

Definition at line 30 of file url.php.

$_raw = false

Definition at line 37 of file url.php.

$_request

Definition at line 32 of file url.php.

$_scheme

Definition at line 26 of file url.php.

$_target

Definition at line 36 of file url.php.

$_username

Definition at line 27 of file url.php.

$_x

Definition at line 34 of file url.php.

$_y

Definition at line 35 of file url.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations