[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/net/ -> url.class.php (sommaire)

(pas de description)

Poids: 308 lignes (6 kb)
Inclus ou requis:0 fois
Référencé: 8 fois
Nécessite: 0 fichiers

Définit 1 class

Url:: (22 méthodes):
  Url()
  _calculateFields()
  getUrl()
  setUrl()
  getScheme()
  setScheme()
  getHost()
  setHost()
  getPort()
  setPort()
  getUser()
  setUser()
  getPass()
  setPass()
  getPath()
  setPath()
  getQuery()
  getQueryArray()
  setQuery()
  getFragment()
  setFragment()
  glueUrl()


Classe: Url  - X-Ref

\ingroup Net

Encapsulates a definition of an object representing a URL

Provides getters and setters for all the parts of the url:
<ul>
<li>url (the complete url)</li>
<li>scheme (http, file, ftp)</li>
<li>host</li>
<li>user</li>
<li>password</li>
<li>path</li>
<li>query (anything after the question mark "?")</li>
<li>fragment (anything after the hash mark "#")</li>
</ul>
Every time a change is made in one of the fields the
url string is recalculated so that any call to getUrl
will return the right one.
Url( $url )   X-Ref
given a string representing a valid URL, build the object. If the string is not a valid
URL, the constructor will not generate an error but the results of calling any of the getter
methods are undefined

param: url A string with a valid URL

_calculateFields()   X-Ref


getUrl()   X-Ref

return: returns the URL as it was given in the constructor

setUrl( $url )   X-Ref
sets a new URL string, which will overwrite the previous one.

param: the new URL string

getScheme()   X-Ref

return: returns the scheme of the given url (http, file, ftp, ...)

setScheme( $scheme )   X-Ref
sets a new scheme

param: Scheme The new scheme (http, file, ftp, ...)

getHost()   X-Ref

return: Returns the host specified in this URL

setHost( $host )   X-Ref
sets a new host

param: Host the new host

getPort()   X-Ref

return: Returns the port that was specified in the original URL, or 80 if there was nothing

setPort( $port )   X-Ref
sets a new port

param: port the new port

getUser()   X-Ref

return: Returns the user that was specified in the URL, if any.

setUser( $user )   X-Ref
sets a new user in the URL

param: user The new username

getPass()   X-Ref

return: Returns the password that was set in the URL

setPass( $pass )   X-Ref
sets a new password in the URL

param: pass the new password

getPath()   X-Ref

return: Returns the path

setPath( $path )   X-Ref
sets the new path

param: path The new path

getQuery()   X-Ref

return: Returns the query

getQueryArray()   X-Ref
Returns the query as an array of items

return: An associative array where the keys are the name

setQuery( $query )   X-Ref
sets a new query

param: query The new query

getFragment()   X-Ref

return: Returns the fragment

setFragment( $fragment )   X-Ref
Sets a new fragment

param: fragment The new fragment

glueUrl()   X-Ref
Puts all the pieces back in place, and returns the resulting
url. It is usually not necessary to call this method to obtain the new URL once we've called
any of the setter methods of this class, since it is done automatically. Doing

<pre>
$url->setScheme( "ftp" );
print("new url = ".$url->getUrl());
</pre>

is enough to obtain the updated URL string.

Extracted from http://www.php.net/manual/en/function.parse-url.php

return: a valid URL generated from the different parts of the object



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics