Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Uri_Http Class Reference

Public Member Functions

 getUri ()
 Returns a URI based on current values of the instance variables.
 
 valid ()
 Validate the current URI from the instance variables.
 
 getUsername ()
 Returns the username portion of the URL, or FALSE if none.
 
 validateUsername ($username=null)
 Returns true if and only if the username passes validation.
 
 setUsername ($username)
 Sets the username for the current URI, and returns the old username.
 
 getPassword ()
 Returns the password portion of the URL, or FALSE if none.
 
 validatePassword ($password=null)
 Returns true if and only if the password passes validation.
 
 setPassword ($password)
 Sets the password for the current URI, and returns the old password.
 
 getHost ()
 Returns the domain or host IP portion of the URL, or FALSE if none.
 
 validateHost ($host=null)
 Returns true if and only if the host string passes validation.
 
 setHost ($host)
 Sets the host for the current URI, and returns the old host.
 
 getPort ()
 Returns the TCP port, or FALSE if none.
 
 validatePort ($port=null)
 Returns true if and only if the TCP port string passes validation.
 
 setPort ($port)
 Sets the port for the current URI, and returns the old port.
 
 getPath ()
 Returns the path and filename portion of the URL.
 
 validatePath ($path=null)
 Returns true if and only if the path string passes validation.
 
 setPath ($path)
 Sets the path for the current URI, and returns the old path.
 
 getQuery ()
 Returns the query portion of the URL (after ?), or FALSE if none.
 
 getQueryAsArray ()
 Returns the query portion of the URL (after ?) as a key-value-array.
 
 validateQuery ($query=null)
 Returns true if and only if the query string passes validation.
 
 addReplaceQueryParameters (array $queryParams)
 Add or replace params in the query string for the current URI, and return the old query.
 
 removeQueryParameters (array $queryParamKeys)
 Remove params in the query string for the current URI, and return the old query.
 
 setQuery ($query)
 Set the query string for the current URI, and return the old query string This method accepts both strings and arrays.
 
 getFragment ()
 Returns the fragment portion of the URL (after #), or FALSE if none.
 
 validateFragment ($fragment=null)
 Returns true if and only if the fragment passes validation.
 
 setFragment ($fragment)
 Sets the fragment for the current URI, and returns the old fragment.
 
- Public Member Functions inherited from Zend_Uri
 __toString ()
 Return a string representation of this URI.
 
 getScheme ()
 Get the URI's scheme.
 
 getUri ()
 Return a string representation of this URI.
 
 valid ()
 Returns TRUE if this URI is valid, or FALSE otherwise.
 

Static Public Member Functions

static fromString ($uri)
 Creates a Zend_Uri_Http from the given string.
 
- Static Public Member Functions inherited from Zend_Uri
static check ($uri)
 Convenience function, checks that a $uri string is well-formed by validating it but not returning an object.
 
static factory ($uri= 'http', $className=null)
 Create a new Zend_Uri object for a URI.
 
static setConfig ($config)
 Set global configuration options.
 

Public Attributes

const CHAR_ALNUM = 'A-Za-z0-9'
 Character classes for validation regular expressions.
 
const CHAR_MARK = '-_.!~*\'()\[\]'
 
const CHAR_RESERVED = ';\/?:@&=+$,'
 
const CHAR_SEGMENT = ':@&=+$,;'
 
const CHAR_UNWISE = '{}|\\\\^`'
 

Protected Member Functions

 __construct ($scheme, $schemeSpecific= '')
 Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI (e.g., example.com/path/to/resource?query=param::fragment)
 
 _parseUri ($schemeSpecific)
 Parse the scheme-specific portion of the URI and place its parts into instance variables.
 
- Protected Member Functions inherited from Zend_Uri
 __construct ($scheme, $schemeSpecific= '')
 Zend_Uri and its subclasses cannot be instantiated directly.
 

Protected Attributes

 $_username = ''
 
 $_password = ''
 
 $_host = ''
 
 $_port = ''
 
 $_path = ''
 
 $_query = ''
 
 $_fragment = ''
 
 $_regex = array()
 
- Protected Attributes inherited from Zend_Uri
 $_scheme = ''
 

Additional Inherited Members

- Static Protected Attributes inherited from Zend_Uri
static $_config
 

Constructor & Destructor Documentation

__construct (   $scheme,
  $schemeSpecific = '' 
)
protected

Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI (e.g., example.com/path/to/resource?query=param::fragment)

Parameters
string$schemeThe scheme of the URI
string$schemeSpecificThe scheme-specific part of the URI
Exceptions
Zend_Uri_ExceptionWhen the URI is not valid

Member Function Documentation

_parseUri (   $schemeSpecific)
protected

Parse the scheme-specific portion of the URI and place its parts into instance variables.

Parameters
string$schemeSpecificThe scheme-specific portion to parse
Exceptions
Zend_Uri_ExceptionWhen scheme-specific decoposition fails
Zend_Uri_ExceptionWhen authority decomposition fails
Returns
void
addReplaceQueryParameters ( array  $queryParams)

Add or replace params in the query string for the current URI, and return the old query.

Parameters
array$queryParams
Returns
string Old query string
static fromString (   $uri)
static

Creates a Zend_Uri_Http from the given string.

Parameters
string$uriString to create URI from, must start with 'http://' or 'https://'
Exceptions
InvalidArgumentExceptionWhen the given $uri is not a string or does not start with http:// or https://
Zend_Uri_ExceptionWhen the given $uri is invalid
Returns
Zend_Uri_Http
getFragment ( )

Returns the fragment portion of the URL (after #), or FALSE if none.

Returns
string|false
getHost ( )

Returns the domain or host IP portion of the URL, or FALSE if none.

Returns
string
getPassword ( )

Returns the password portion of the URL, or FALSE if none.

Returns
string
getPath ( )

Returns the path and filename portion of the URL.

Returns
string
getPort ( )

Returns the TCP port, or FALSE if none.

Returns
string
getQuery ( )

Returns the query portion of the URL (after ?), or FALSE if none.

Returns
string
getQueryAsArray ( )

Returns the query portion of the URL (after ?) as a key-value-array.

If the query is empty an empty array is returned

Returns
array
getUri ( )

Returns a URI based on current values of the instance variables.

If any part of the URI does not pass validation, then an exception is thrown.

Exceptions
Zend_Uri_ExceptionWhen one or more parts of the URI are invalid
Returns
string
getUsername ( )

Returns the username portion of the URL, or FALSE if none.

Returns
string
removeQueryParameters ( array  $queryParamKeys)

Remove params in the query string for the current URI, and return the old query.

Parameters
array$queryParamKeys
Returns
string Old query string
setFragment (   $fragment)

Sets the fragment for the current URI, and returns the old fragment.

Parameters
string$fragmentFragment of the current URI
Exceptions
Zend_Uri_ExceptionWhen $fragment is not a valid HTTP fragment
Returns
string
setHost (   $host)

Sets the host for the current URI, and returns the old host.

Parameters
string$hostThe HTTP host
Exceptions
Zend_Uri_ExceptionWhen $host is nota valid HTTP host
Returns
string
setPassword (   $password)

Sets the password for the current URI, and returns the old password.

Parameters
string$passwordThe HTTP password
Exceptions
Zend_Uri_ExceptionWhen $password is not a valid HTTP password
Returns
string
setPath (   $path)

Sets the path for the current URI, and returns the old path.

Parameters
string$pathThe HTTP path
Exceptions
Zend_Uri_ExceptionWhen $path is not a valid HTTP path
Returns
string
setPort (   $port)

Sets the port for the current URI, and returns the old port.

Parameters
string$portThe HTTP port
Exceptions
Zend_Uri_ExceptionWhen $port is not a valid HTTP port
Returns
string
setQuery (   $query)

Set the query string for the current URI, and return the old query string This method accepts both strings and arrays.

Parameters
string | array$queryThe query string or array
Exceptions
Zend_Uri_ExceptionWhen $query is not a valid query string
Returns
string Old query string
setUsername (   $username)

Sets the username for the current URI, and returns the old username.

Parameters
string$usernameThe HTTP username
Exceptions
Zend_Uri_ExceptionWhen $username is not a valid HTTP username
Returns
string
valid ( )

Validate the current URI from the instance variables.

Returns true if and only if all parts pass validation.

Returns
boolean
validateFragment (   $fragment = null)

Returns true if and only if the fragment passes validation.

If no fragment is passed, then the fragment contained in the instance variable is used.

Parameters
string$fragmentFragment of an URI
Exceptions
Zend_Uri_ExceptionWhen fragment validation fails
Returns
boolean http://www.faqs.org/rfcs/rfc2396.html
validateHost (   $host = null)

Returns true if and only if the host string passes validation.

If no host is passed, then the host contained in the instance variable is used.

Parameters
string$hostThe HTTP host
Returns
boolean Zend_Filter
validatePassword (   $password = null)

Returns true if and only if the password passes validation.

If no password is passed, then the password contained in the instance variable is used.

Parameters
string$passwordThe HTTP password
Exceptions
Zend_Uri_ExceptionWhen password validation fails
Returns
boolean http://www.faqs.org/rfcs/rfc2396.html
validatePath (   $path = null)

Returns true if and only if the path string passes validation.

If no path is passed, then the path contained in the instance variable is used.

Parameters
string$pathThe HTTP path
Exceptions
Zend_Uri_ExceptionWhen path validation fails
Returns
boolean
validatePort (   $port = null)

Returns true if and only if the TCP port string passes validation.

If no port is passed, then the port contained in the instance variable is used.

Parameters
string$portThe HTTP port
Returns
boolean
validateQuery (   $query = null)

Returns true if and only if the query string passes validation.

If no query is passed, then the query string contained in the instance variable is used.

Parameters
string$queryThe query to validate
Exceptions
Zend_Uri_ExceptionWhen query validation fails
Returns
boolean http://www.faqs.org/rfcs/rfc2396.html
validateUsername (   $username = null)

Returns true if and only if the username passes validation.

If no username is passed, then the username contained in the instance variable is used.

Parameters
string$usernameThe HTTP username
Exceptions
Zend_Uri_ExceptionWhen username validation fails
Returns
boolean http://www.faqs.org/rfcs/rfc2396.html

Member Data Documentation

$_fragment = ''
protected
$_host = ''
protected
$_password = ''
protected
$_path = ''
protected
$_port = ''
protected
$_query = ''
protected
$_regex = array()
protected
$_username = ''
protected
const CHAR_ALNUM = 'A-Za-z0-9'

Character classes for validation regular expressions.

const CHAR_MARK = '-_.!~*\'()\[\]'
const CHAR_RESERVED = ';\/?:@&=+$,'
const CHAR_SEGMENT = ':@&=+$,;'
const CHAR_UNWISE = '{}|\\\\^`'