Source for file Uri.php
Documentation is available at Uri.php
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Uri.php 18950 2009-11-12 15:37:56Z alexander $
* @see Microsoft_AutoLoader
require_once dirname(__FILE__ ) . '/AutoLoader.php';
* Abstract class for all Microsoft_Uri handlers
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* Scheme of this URI (http, ftp, etc.)
* Global configuration array
* Return a string representation of this URI.
* Convenience function, checks that a $uri string is well-formed
* by validating it but not returning an object. Returns TRUE if
* $uri is a well-formed URI, or FALSE otherwise.
* @param string $uri The URI to check
public static function check($uri)
$uri = self::factory($uri);
* Create a new Microsoft_Uri object for a URI. If building a new URI, then $uri should contain
* only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
* @param string $uri The URI form which a Microsoft_Uri instance is created
* @throws Microsoft_Uri_Exception When an empty string was supplied for the scheme
* @throws Microsoft_Uri_Exception When an illegal scheme is supplied
* @throws Microsoft_Uri_Exception When the scheme is not supported
* @link http://www.faqs.org/rfcs/rfc2396.html
public static function factory($uri = 'http')
// Separate the scheme from the scheme-specific parts
$schemeSpecific = isset ($uri[1]) === true ? $uri[1] : '';
require_once 'Microsoft/Uri/Exception.php';
// Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
require_once 'Microsoft/Uri/Exception.php';
* Create a new Microsoft_Uri object for the $uri. If a subclass of Microsoft_Uri exists for the
* scheme, return an instance of that class. Otherwise, a Microsoft_Uri_Exception is thrown.
// Break intentionally omitted
$className = 'Microsoft_Uri_Http';
require_once 'Microsoft/Uri/Exception.php';
require_once str_replace('_', '/', $className) . '.php';
$schemeHandler = new $className($scheme, $schemeSpecific);
* @return string|falseScheme or false if no scheme is set.
if (empty($this->_scheme) === false) {
* Set global configuration options
* @param Microsoft_Config|array$config
if ($config instanceof Microsoft_Config) {
$config = $config->toArray();
foreach ($config as $k => $v) {
* Microsoft_Uri and its subclasses cannot be instantiated directly.
* Use Microsoft_Uri::factory() to return a new Microsoft_Uri object.
* @param string $scheme The scheme of the URI
* @param string $schemeSpecific The scheme-specific part of the URI
abstract protected function __construct($scheme, $schemeSpecific = '');
* Return a string representation of this URI.
abstract public function getUri();
* Returns TRUE if this URI is valid, or FALSE otherwise.
abstract public function valid();
|