Apache Zeta Components Manual :: Docs For Class ezcUrlTools

Url::ezcUrlTools

Class ezcUrlTools

Class providing methods for URL parsing.

Static methods contained in this class:

Source for this file: /Url/src/url_tools.php

Version:   //autogen//

Method Summary

public static string getCurrentUrl( [ $source = null] )
Returns the current URL as a string from the array $source (by default $_SERVER).
public static array(string=>mixed) parseQueryString( $str )
Parses the provided string and returns an associative array structure.

Methods

getCurrentUrl

static string getCurrentUrl( [ $source = null] )

Returns the current URL as a string from the array $source (by default $_SERVER).

The following fields are used in building the URL:

For example, if $_SERVER has these fields:
  1.  $_SERVER = array(
  2.      'HTTPS' => '1',
  3.      'SERVER_NAME' => 'www.example.com',
  4.      'SERVER_PORT' => 80,
  5.      'REQUEST_URI' => '/index.php'
  6.  );

Then by calling this function (with no parameters), this URL will be returned: 'http://www.example.com/index.php'.

The source of the URL parts can be changed to be other than $_SERVER by specifying an array parameter when calling this function.

Parameters:
Name Type Description
$source array(string=>mixed) The default array source, default $_SERVER

parseQueryString

static array(string=>mixed) parseQueryString( array(string=>mixed) $str )

Parses the provided string and returns an associative array structure.

It implements the functionality of the PHP function parse_str(), but without converting dots to underscores in parameter names.

Example:

  1.  $str = 'foo[]=bar&openid.nonce=123456';
  2.  
  3.  parse_str( $str, $params );
  4.  $params = ezcUrlTools::parseQueryString( $str );

In the first case (parse_str()), $params will be:

  1.  array( 'foo' => array( 'bar' ), 'openid_nonce' => '123456' );

In the second case (ezcUrlTools::parseQueryString()), $params will be:

  1.  array( 'foo' => array( 'bar' ), 'openid.nonce' => '123456' );

Parameters:
Name Type Description
$str array(string=>mixed) The string to parse
Documentation generated by phpDocumentor 1.4.3