• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Uri.php

00001 <?php
00030 abstract class Zend_Uri
00031 {
00037     protected $_scheme = '';
00038 
00044     static protected $_config = array(
00045         'allow_unwise' => false
00046     );
00047 
00054     public function __toString()
00055     {
00056         return $this->getUri();
00057     }
00058 
00067     public static function check($uri)
00068     {
00069         try {
00070             $uri = self::factory($uri);
00071         } catch (Exception $e) {
00072             return false;
00073         }
00074 
00075         return $uri->valid();
00076     }
00077 
00089     public static function factory($uri = 'http')
00090     {
00091         // Separate the scheme from the scheme-specific parts
00092         $uri            = explode(':', $uri, 2);
00093         $scheme         = strtolower($uri[0]);
00094         $schemeSpecific = isset($uri[1]) === true ? $uri[1] : '';
00095 
00096         if (strlen($scheme) === 0) {
00097             require_once 'Zend/Uri/Exception.php';
00098             throw new Zend_Uri_Exception('An empty string was supplied for the scheme');
00099         }
00100 
00101         // Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
00102         if (ctype_alnum($scheme) === false) {
00103             require_once 'Zend/Uri/Exception.php';
00104             throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
00105         }
00106 
00111         switch ($scheme) {
00112             case 'http':
00113                 // Break intentionally omitted
00114             case 'https':
00115                 $className = 'Zend_Uri_Http';
00116                 break;
00117 
00118             case 'mailto':
00119                 // TODO
00120             default:
00121                 require_once 'Zend/Uri/Exception.php';
00122                 throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
00123                 break;
00124         }
00125 
00126         if (!class_exists($className)) {
00127             require_once 'Zend/Loader.php';
00128             Zend_Loader::loadClass($className);
00129         }
00130         $schemeHandler = new $className($scheme, $schemeSpecific);
00131 
00132         return $schemeHandler;
00133     }
00134 
00140     public function getScheme()
00141     {
00142         if (empty($this->_scheme) === false) {
00143             return $this->_scheme;
00144         } else {
00145             return false;
00146         }
00147     }
00148 
00154     static public function setConfig(array $config)
00155     {
00156         foreach ($config as $k => $v) {
00157             self::$_config[$k] = $v;
00158         }
00159     }
00160 
00168     abstract protected function __construct($scheme, $schemeSpecific = '');
00169 
00175     abstract public function getUri();
00176 
00182     abstract public function valid();
00183 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2