[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/test_tools/simpletest/ -> url.php (sommaire)

base include file for SimpleTest

Version: $Id: url.php 1526 2006-11-28 23:34:00Z wei $
Poids: 525 lignes (19 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

SimpleUrl:: (34 méthodes):
  SimpleUrl()
  _chompCoordinates()
  _chompScheme()
  _chompLogin()
  _chompHost()
  _chompPath()
  _chompRequest()
  _parseRequest()
  getScheme()
  getUsername()
  getPassword()
  getHost()
  getTld()
  getPort()
  getPath()
  getPage()
  getBasePath()
  getFragment()
  setCoordinates()
  getX()
  getY()
  getEncodedRequest()
  addRequestParameter()
  addRequestParameters()
  clearRequest()
  getTarget()
  setTarget()
  asString()
  makeAbsolute()
  _extractAbsolutePath()
  _isRelativePath()
  getIdentity()
  normalisePath()
  getAllTopLevelDomains()


Classe: SimpleUrl  - X-Ref

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.

SimpleUrl($url)   X-Ref
Constructor. Parses URL into sections.

param: string $url        Incoming URL.

_chompCoordinates($url)   X-Ref
Extracts the X, Y coordinate pair from an image map.

param: string $url   URL so far. The coordinates will be
return: array        X, Y as a pair of integers.

_chompScheme($url)   X-Ref
Extracts the scheme part of an incoming URL.

param: string $url   URL so far. The scheme will be
return: string       Scheme part or false.

_chompLogin($url)   X-Ref
Extracts the username and password from the
incoming URL. The // prefix will be reattached
to the URL after the doublet is extracted.

param: string $url    URL so far. The username and
return: array         Two item list of username and

_chompHost($url)   X-Ref
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.

param: string $url    URL so far. The host will be
return: string        Host part guess or false.

_chompPath($url)   X-Ref
Extracts the path information from the incoming
URL. Strips this path from the URL.

param: string $url     URL so far. The host will be
return: string         Path part or '/'.

_chompRequest($url)   X-Ref
Strips off the request data.

param: string $url  URL so far. The request will be
return: string      Raw request part.

_parseRequest($raw)   X-Ref
Breaks the request down into an object.

param: string $raw           Raw request.
return: SimpleFormEncoding    Parsed data.

getScheme($default = false)   X-Ref
Accessor for protocol part.

param: string $default    Value to use if not present.
return: string            Scheme name, e.g "http".

getUsername()   X-Ref
Accessor for user name.

return: string    Username preceding host.

getPassword()   X-Ref
Accessor for password.

return: string    Password preceding host.

getHost($default = false)   X-Ref
Accessor for hostname and port.

param: string $default    Value to use if not present.
return: string            Hostname only.

getTld()   X-Ref
Accessor for top level domain.

return: string       Last part of host.

getPort()   X-Ref
Accessor for port number.

return: integer    TCP/IP port number.

getPath()   X-Ref
Accessor for path.

return: string    Full path including leading slash if implied.

getPage()   X-Ref
Accessor for page if any. This may be a
directory name if ambiguious.

return: Page name.

getBasePath()   X-Ref
Gets the path to the page.

return: string       Path less the page.

getFragment()   X-Ref
Accessor for fragment at end of URL after the "#".

return: string    Part after "#".

setCoordinates($x = false, $y = false)   X-Ref
Sets image coordinates. Set to false to clear
them.

param: integer $x    Horizontal position.
param: integer $y    Vertical position.

getX()   X-Ref
Accessor for horizontal image coordinate.

return: integer        X value.

getY()   X-Ref
Accessor for vertical image coordinate.

return: integer        Y value.

getEncodedRequest()   X-Ref
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: string   Form is string "?a=1&b=2", etc.

addRequestParameter($key, $value)   X-Ref
Adds an additional parameter to the request.

param: string $key            Name of parameter.
param: string $value          Value as string.

addRequestParameters($parameters)   X-Ref
Adds additional parameters to the request.

param: hash/SimpleFormEncoding $parameters   Additional

clearRequest()   X-Ref
Clears down all parameters.


getTarget()   X-Ref
Gets the frame target if present. Although
not strictly part of the URL specification it
acts as similarily to the browser.

return: boolean/string    Frame name or false if none.

setTarget($frame)   X-Ref
Attaches a frame target.

param: string $frame        Name of frame.

asString()   X-Ref
Renders the URL back into a string.

return: string        URL in canonical form.

makeAbsolute($base)   X-Ref
Replaces unknown sections to turn a relative
URL into an absolute one. The base URL can
be either a string or a SimpleUrl object.

param: string/SimpleUrl $base       Base URL.

_extractAbsolutePath($base)   X-Ref
Replaces unknown sections of the path with base parts
to return a complete absolute one.

param: string/SimpleUrl $base       Base URL.
param: string                       Absolute path.

_isRelativePath($path)   X-Ref
Simple test to see if a path part is relative.

param: string $path        Path to test.
return: boolean            True if starts with a "/".

getIdentity()   X-Ref
Extracts the username and password for use in rendering
a URL.

return: string/boolean    Form of username:password or false.

normalisePath($path)   X-Ref
Replaces . and .. sections of the path.

param: string $path    Unoptimised path.
return: string         Path with dots removed if possible.

getAllTopLevelDomains()   X-Ref
A pipe seperated list of all TLDs that result in two part
domain names.

return: string        Pipe separated list.



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7