Class SimpleUrl

Description

URL parser to replace parse_url() PHP function which got broken in PHP 4.3.0. Adds some browser specific functionality such as expandomatics.

Guesses a bit trying to separate the host from the path and tries to keep a raw, possibly unparsable, request string as long as possible.

Located in /url.php (line 25)


	
			
Variable Summary
 mixed $_fragment
 mixed $_host
 mixed $_password
 mixed $_path
 mixed $_port
 mixed $_raw
 mixed $_request
 mixed $_scheme
 mixed $_target
 mixed $_username
 mixed $_x
 mixed $_y
Method Summary
 static string getAllTopLevelDomains ()
 SimpleUrl SimpleUrl ([string $url = ''])
 void addRequestParameter (string $key, string $value)
 void addRequestParameters (hash/SimpleFormEncoding $parameters)
 string asString ()
 void clearRequest ()
 string getBasePath ()
 string getEncodedRequest ()
 string getFragment ()
 string getHost ([string $default = false])
 string/boolean getIdentity ()
 Page getPage ()
 string getPassword ()
 string getPath ()
 integer getPort ()
 string getScheme ([string $default = false])
 boolean/string getTarget ()
 string getTld ()
 string getUsername ()
 integer getX ()
 integer getY ()
 void makeAbsolute (string/SimpleUrl $base)
 string normalisePath (string $path)
 void setCoordinates ([integer $x = false], [integer $y = false])
 void setTarget (string $frame)
Variables
mixed $_fragment (line 33)
mixed $_host (line 29)
mixed $_password (line 28)
mixed $_path (line 31)
mixed $_port (line 30)
mixed $_raw = false (line 37)
mixed $_request (line 32)
mixed $_scheme (line 26)
mixed $_target (line 36)
mixed $_username (line 27)
mixed $_x (line 34)
mixed $_y (line 35)
Methods
static getAllTopLevelDomains (line 524)

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

  • return: Pipe separated list.
  • access: public
static string getAllTopLevelDomains ()
Constructor SimpleUrl (line 44)

Constructor. Parses URL into sections.

  • access: public
SimpleUrl SimpleUrl ([string $url = ''])
  • string $url: Incoming URL.
addRequestParameter (line 360)

Adds an additional parameter to the request.

  • access: public
void addRequestParameter (string $key, string $value)
  • string $key: Name of parameter.
  • string $value: Value as string.
addRequestParameters (line 371)

Adds additional parameters to the request.

  • access: public
void addRequestParameters (hash/SimpleFormEncoding $parameters)
  • hash/SimpleFormEncoding $parameters: Additional parameters.
asString (line 411)

Renders the URL back into a string.

  • return: URL in canonical form.
  • access: public
string asString ()
clearRequest (line 380)

Clears down all parameters.

  • access: public
void clearRequest ()
getBasePath (line 284)

Gets the path to the page.

  • return: Path less the page.
  • access: public
string getBasePath ()
getEncodedRequest (line 342)

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.

  • return: Form is string "?a=1&b=2", etc.
  • access: public
string getEncodedRequest ()
getFragment (line 296)

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

  • return: Part after "#".
  • access: public
string getFragment ()
getHost (line 231)

Accessor for hostname and port.

  • return: Hostname only.
  • access: public
string getHost ([string $default = false])
  • string $default: Value to use if not present.
getIdentity (line 499)

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

  • return: Form of username:password or false.
  • access: public
string/boolean getIdentity ()
getPage (line 272)

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

  • return: name.
  • access: public
Page getPage ()
getPassword (line 221)

Accessor for password.

  • return: Password preceding host.
  • access: public
string getPassword ()
getPath (line 259)

Accessor for path.

  • return: Full path including leading slash if implied.
  • access: public
string getPath ()
getPort (line 250)

Accessor for port number.

  • return: TCP/IP port number.
  • access: public
integer getPort ()
getScheme (line 203)

Accessor for protocol part.

  • return: Scheme name, e.g "http".
  • access: public
string getScheme ([string $default = false])
  • string $default: Value to use if not present.
getTarget (line 392)

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

  • return: Frame name or false if none.
  • access: public
boolean/string getTarget ()
getTld (line 240)

Accessor for top level domain.

  • return: Last part of host.
  • access: public
string getTld ()
getUsername (line 212)

Accessor for user name.

  • return: Username preceding host.
  • access: public
string getUsername ()
getX (line 321)

Accessor for horizontal image coordinate.

  • return: X value.
  • access: public
integer getX ()
getY (line 330)

Accessor for vertical image coordinate.

  • return: Y value.
  • access: public
integer getY ()
makeAbsolute (line 438)

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

  • access: public
void makeAbsolute (string/SimpleUrl $base)
  • string/SimpleUrl $base: Base URL.
normalisePath (line 512)

Replaces . and .. sections of the path.

  • return: Path with dots removed if possible.
  • access: public
string normalisePath (string $path)
  • string $path: Unoptimised path.
setCoordinates (line 307)

Sets image coordinates. Set to false to clear them.

  • access: public
void setCoordinates ([integer $x = false], [integer $y = false])
  • integer $x: Horizontal position.
  • integer $y: Vertical position.
setTarget (line 401)

Attaches a frame target.

  • access: public
void setTarget (string $frame)
  • string $frame: Name of frame.

Documentation generated on Sun, 04 May 2008 09:22:23 -0500 by phpDocumentor 1.3.0