From 28af29248b955d9c29fbd4d4a81e6e8a38b35e1e Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 18 Jul 2011 21:03:24 -0400 Subject: [PATCH] w --- framework/YiiBase.php | 688 ++++++++++++---------------------- framework/base/Behavior.php | 1 - framework/base/Component.php | 1 - framework/base/Dictionary.php | 1 - framework/base/DictionaryIterator.php | 1 - framework/base/Event.php | 1 - framework/base/Exception.php | 1 - framework/base/Vector.php | 1 - framework/base/VectorIterator.php | 1 - framework/yii.php | 4 +- 10 files changed, 240 insertions(+), 460 deletions(-) diff --git a/framework/YiiBase.php b/framework/YiiBase.php index e903f24..f13ccf4 100644 --- a/framework/YiiBase.php +++ b/framework/YiiBase.php @@ -1,15 +1,20 @@ - * @version $Id: YiiBase.php 2895 2011-01-20 10:33:02Z mdomba $ - * @package system - * @since 1.0 + * @since 2.0 */ class YiiBase { /** * @var array class map used by the Yii autoloading mechanism. - * The array keys are the class names and the array values are the corresponding class file paths. - * @since 1.1.5 + * The array keys are the class names, and the array values are the corresponding class file paths. + * This property mainly affects how [[autoload]] works. + */ + public static $classMap = array(); + /** + * @var array list of directories where Yii will search for new classes to be included. + * The first directory in the array will be searched first, and so on. + * This property mainly affects how [[autoload]] works. + */ + public static $classPath = array(); + /** + * @var yii\base\Application the application instance */ - public static $classMap=array(); + public static $app; - private static $_aliases=array('system'=>YII_PATH,'zii'=>YII_ZII_PATH); // alias => path - private static $_imports=array(); // alias => class name or directory - private static $_includePaths; // list of include paths + private static $_aliases = array( + '@yii' => YII_PATH, + ); + private static $_imports = array(); // alias => class name or directory private static $_app; private static $_logger; + /** * @return string the version of Yii framework */ public static function getVersion() { - return '1.1.7-dev'; + return '2.0-dev'; } /** * Creates a Web application instance. - * @param mixed $config application configuration. - * If a string, it is treated as the path of the file that contains the configuration; - * If an array, it is the actual configuration information. - * Please make sure you specify the {@link CApplication::basePath basePath} property in the configuration, - * which should point to the directory containing all application logic, template and data. - * If not, the directory will be defaulted to 'protected'. + * @param mixed $config application configuration. This can be either an array representing + * the configuration to be applied to the newly created application instance, or a string + * referring to a PHP file returning the configuration array. + * @return yii\web\Application the newly created application instance. */ - public static function createWebApplication($config=null) + public static function createWebApplication($config = null) { - return self::createApplication('CWebApplication',$config); + return new yii\web\Application($config); } /** * Creates a console application instance. - * @param mixed $config application configuration. - * If a string, it is treated as the path of the file that contains the configuration; - * If an array, it is the actual configuration information. - * Please make sure you specify the {@link CApplication::basePath basePath} property in the configuration, - * which should point to the directory containing all application logic, template and data. - * If not, the directory will be defaulted to 'protected'. - */ - public static function createConsoleApplication($config=null) - { - return self::createApplication('CConsoleApplication',$config); - } - - /** - * Creates an application of the specified class. - * @param string $class the application class name - * @param mixed $config application configuration. This parameter will be passed as the parameter - * to the constructor of the application class. - * @return mixed the application instance - * @since 1.0.10 + * @param mixed $config application configuration. This can be either an array representing + * the configuration to be applied to the newly created application instance, or a string + * referring to a PHP file returning the configuration array. + * @return yii\console\Application the newly created application instance. */ - public static function createApplication($class,$config=null) + public static function createConsoleApplication($config = null) { - return new $class($config); - } - - /** - * Returns the application singleton, null if the singleton has not been created yet. - * @return CApplication the application singleton, null if the singleton has not been created yet. - */ - public static function app() - { - return self::$_app; - } - - /** - * Stores the application instance in the class static member. - * This method helps implement a singleton pattern for CApplication. - * Repeated invocation of this method or the CApplication constructor - * will cause the throw of an exception. - * To retrieve the application instance, use {@link app()}. - * @param CApplication $app the application instance. If this is null, the existing - * application singleton will be removed. - * @throws CException if multiple application instances are registered. - */ - public static function setApplication($app) - { - if(self::$_app===null || $app===null) - self::$_app=$app; - else - throw new CException(Yii::t('yii','Yii application can only be created once.')); + return new yii\console\Application($config); } /** + * Returns the installation directory of the Yii framework. * @return string the path of the framework */ public static function getFrameworkPath() @@ -161,45 +134,45 @@ class YiiBase */ public static function createComponent($config) { - if(is_string($config)) + if (is_string($config)) { - $type=$config; - $config=array(); + $type = $config; + $config = array(); } - else if(isset($config['class'])) + elseif (isset($config['class'])) { - $type=$config['class']; + $type = $config['class']; unset($config['class']); } else - throw new CException(Yii::t('yii','Object configuration must be an array containing a "class" element.')); + throw new CException(Yii::t('yii', 'Object configuration must be an array containing a "class" element.')); - if(!class_exists($type,false)) - $type=Yii::import($type,true); + if (!class_exists($type, false)) + $type = Yii::import($type, true); - if(($n=func_num_args())>1) + if (($n = func_num_args()) > 1) { - $args=func_get_args(); - if($n===2) - $object=new $type($args[1]); - else if($n===3) - $object=new $type($args[1],$args[2]); - else if($n===4) - $object=new $type($args[1],$args[2],$args[3]); + $args = func_get_args(); + if ($n === 2) + $object = new $type($args[1]); + elseif ($n === 3) + $object = new $type($args[1], $args[2]); + elseif ($n === 4) + $object = new $type($args[1], $args[2], $args[3]); else { unset($args[0]); - $class=new ReflectionClass($type); + $class = new ReflectionClass($type); // Note: ReflectionClass::newInstanceArgs() is available for PHP 5.1.3+ // $object=$class->newInstanceArgs($args); - $object=call_user_func_array(array($class,'newInstance'),$args); + $object = call_user_func_array(array($class, 'newInstance'), $args); } } else - $object=new $type; + $object = new $type; - foreach($config as $key=>$value) - $object->$key=$value; + foreach ($config as $key => $value) + $object->$key = $value; return $object; } @@ -242,156 +215,189 @@ class YiiBase * @return string the class name or the directory that this alias refers to * @throws CException if the alias is invalid */ - public static function import($alias,$forceInclude=false) + public static function import($alias, $forceInclude = false) { - if(isset(self::$_imports[$alias])) // previously imported + if (isset(self::$_imports[$alias])) // previously imported return self::$_imports[$alias]; - if(class_exists($alias,false) || interface_exists($alias,false)) - return self::$_imports[$alias]=$alias; + if (class_exists($alias, false) || interface_exists($alias, false)) + return self::$_imports[$alias] = $alias; - if(($pos=strrpos($alias,'\\'))!==false) // a class name in PHP 5.3 namespace format + if (($pos = strrpos($alias, '\\')) !== false) // a class name in PHP 5.3 namespace format { - $namespace=str_replace('\\','.',ltrim(substr($alias,0,$pos),'\\')); - if(($path=self::getPathOfAlias($namespace))!==false) + $namespace = str_replace('\\', '.', ltrim(substr($alias, 0, $pos), '\\')); + if (($path = self::getPathOfAlias($namespace)) !== false) { - $classFile=$path.DIRECTORY_SEPARATOR.substr($alias,$pos+1).'.php'; - if($forceInclude) + $classFile = $path . DIRECTORY_SEPARATOR . substr($alias, $pos + 1) . '.php'; + if ($forceInclude) { - if(is_file($classFile)) + if (is_file($classFile)) require($classFile); else - throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file.',array('{alias}'=>$alias))); - self::$_imports[$alias]=$alias; + throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing PHP file.', array('{alias}' => $alias))); + self::$_imports[$alias] = $alias; } else - self::$classMap[$alias]=$classFile; + self::$classMap[$alias] = $classFile; return $alias; } else - throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing directory.', - array('{alias}'=>$namespace))); + throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing directory.', + array('{alias}' => $namespace))); } - if(($pos=strrpos($alias,'.'))===false) // a simple class name + if (($pos = strrpos($alias, '.')) === false) // a simple class name { - if($forceInclude && self::autoload($alias)) - self::$_imports[$alias]=$alias; + if ($forceInclude && self::autoload($alias)) + self::$_imports[$alias] = $alias; return $alias; } - $className=(string)substr($alias,$pos+1); - $isClass=$className!=='*'; + $className = (string)substr($alias, $pos + 1); + $isClass = $className !== '*'; - if($isClass && (class_exists($className,false) || interface_exists($className,false))) - return self::$_imports[$alias]=$className; + if ($isClass && (class_exists($className, false) || interface_exists($className, false))) + return self::$_imports[$alias] = $className; - if(($path=self::getPathOfAlias($alias))!==false) + if (($path = self::getPathOfAlias($alias)) !== false) { - if($isClass) + if ($isClass) { - if($forceInclude) + if ($forceInclude) { - if(is_file($path.'.php')) - require($path.'.php'); + if (is_file($path . '.php')) + require($path . '.php'); else - throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file.',array('{alias}'=>$alias))); - self::$_imports[$alias]=$className; + throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing PHP file.', array('{alias}' => $alias))); + self::$_imports[$alias] = $className; } else - self::$classMap[$className]=$path.'.php'; + self::$classMap[$className] = $path . '.php'; return $className; } else // a directory { - if(self::$_includePaths===null) + if (self::$classPath === null) { - self::$_includePaths=array_unique(explode(PATH_SEPARATOR,get_include_path())); - if(($pos=array_search('.',self::$_includePaths,true))!==false) - unset(self::$_includePaths[$pos]); + self::$classPath = array_unique(explode(PATH_SEPARATOR, get_include_path())); + if (($pos = array_search('.', self::$classPath, true)) !== false) + unset(self::$classPath[$pos]); } - array_unshift(self::$_includePaths,$path); + array_unshift(self::$classPath, $path); - if(set_include_path('.'.PATH_SEPARATOR.implode(PATH_SEPARATOR,self::$_includePaths))===false) - throw new CException(Yii::t('yii','Unable to import "{alias}". Please check your server configuration to make sure you are allowed to change PHP include_path.',array('{alias}'=>$alias))); + if (self::$useIncludePath && set_include_path('.' . PATH_SEPARATOR . implode(PATH_SEPARATOR, self::$classPath)) === false) + self::$useIncludePath = false; - return self::$_imports[$alias]=$path; + return self::$_imports[$alias] = $path; } } else - throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing directory or file.', - array('{alias}'=>$alias))); + throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing directory or file.', + array('{alias}' => $alias))); } /** - * Translates an alias into a file path. - * Note, this method does not ensure the existence of the resulting file path. - * It only checks if the root alias is valid or not. - * @param string $alias alias (e.g. system.web.CController) - * @return mixed file path corresponding to the alias, false if the alias is invalid. + * Translates a path alias into an actual path. + * The path alias can be either a root alias registered via [[setPathOfAlias]] or an + * alias starting with a root alias (e.g. `@yii/base/Component.php`). + * In the latter case, the root alias will be replaced by the corresponding registered path + * and the remaining part will be appended to it. + * Note, this method does not ensure the existence of the resulting path. + * @param string $alias alias + * @return mixed path corresponding to the alias, false if the root alias is not previously registered. + * @see setPathOfAlias */ public static function getPathOfAlias($alias) { - if(isset(self::$_aliases[$alias])) + if (isset(self::$_aliases[$alias])) { return self::$_aliases[$alias]; - else if(($pos=strpos($alias,'.'))!==false) - { - $rootAlias=substr($alias,0,$pos); - if(isset(self::$_aliases[$rootAlias])) - return self::$_aliases[$alias]=rtrim(self::$_aliases[$rootAlias].DIRECTORY_SEPARATOR.str_replace('.',DIRECTORY_SEPARATOR,substr($alias,$pos+1)),'*'.DIRECTORY_SEPARATOR); - else if(self::$_app instanceof CWebApplication) - { - if(self::$_app->findModule($rootAlias)!==null) - return self::getPathOfAlias($alias); + } + elseif (($pos = strpos($alias, '/')) !== false) { + $rootAlias = substr($alias, 0, $pos); + if (isset(self::$_aliases[$rootAlias])) { + return self::$_aliases[$alias] = self::$_aliases[$rootAlias] . substr($alias, $pos); } } return false; } /** - * Create a path alias. - * Note, this method neither checks the existence of the path nor normalizes the path. - * @param string $alias alias to the path + * Registers a path alias. + * A path alias is a short name representing a path (a file path, a URL, etc.) + * A path alias must start with '@' (e.g. '@yii'). + * Note that this method neither checks the existence of the path nor normalizes the path. + * @param string $alias alias to the path. The alias must start with '@'. * @param string $path the path corresponding to the alias. If this is null, the corresponding - * path alias will be removed. + * path alias will be removed. The path can be a file path (e.g. `/tmp`) or a URL (e.g. `http://www.yiiframework.com`). + * @see getPathOfAlias */ - public static function setPathOfAlias($alias,$path) + public static function setPathOfAlias($alias, $path) { - if(empty($path)) + if ($path === null) { unset(self::$_aliases[$alias]); - else - self::$_aliases[$alias]=rtrim($path,'\\/'); + } + else { + self::$_aliases[$alias] = rtrim($path, '\\/'); + } } /** * Class autoload loader. - * This method is provided to be invoked within an __autoload() magic method. + * This method is invoked automatically when the execution encounters an unknown class. + * The method will attempt to include the class file as follows: + * + * 1. Search in [[classMap]]; + * 2. If the class is namespaced (e.g. `yii\base\Component`), it will attempt + * to include the file associated with the corresponding path alias + * (e.g. `@yii/base/Component.php`); + * 3. If the class is named in PEAR style (e.g. `PHPUnit_Framework_TestCase`), + * it will attempt to include the file associated with the corresponding path alias + * (e.g. `@PHPUnit/Framework/TestCase.php`); + * 4. Search in [[classPath]]; + * 5. Return false so that other autoloaders have chance to include the class file. + * * @param string $className class name * @return boolean whether the class has been loaded successfully */ public static function autoload($className) { - // use include so that the error PHP file may appear - if(isset(self::$_coreClasses[$className])) - include(YII_PATH.self::$_coreClasses[$className]); - else if(isset(self::$classMap[$className])) + if (isset(self::$classMap[$className])) { include(self::$classMap[$className]); - else - { - if(strpos($className,'\\')===false) - include($className.'.php'); - else // class name with namespace in PHP 5.3 - { - $namespace=str_replace('\\','.',ltrim($className,'\\')); - if(($path=self::getPathOfAlias($namespace))!==false) - include($path.'.php'); - else - return false; + return true; + } + + // namespaced class, e.g. yii\base\Component + if (strpos($className, '\\') !== false) { + // convert namespace to path alias, e.g. yii\base\Component to @yii/base/Component + $alias = '@' . str_replace('\\', '/', $className); + if (($path = self::getPathOfAlias($alias)) !== false) { + include($path . '.php'); + return true; } - return class_exists($className,false) || interface_exists($className,false); + return false; } - return true; + + // PEAR-styled class, e.g. PHPUnit_Framework_TestCase + if (($pos = strpos($className, '_')) !== false) { + // convert class name to path alias, e.g. PHPUnit_Framework_TestCase to @PHPUnit/Framework/TestCase + $alias = '@' . str_replace('_', '/', $className); + if (($path = self::getPathOfAlias($alias)) !== false) { + include($path . '.php'); + return true; + } + } + + // search in include paths + foreach (self::$classPath as $path) { + $classFile = $path . DIRECTORY_SEPARATOR . $className . '.php'; + if (is_file($classFile)) { + include($classFile); + return true; + } + } + + return false; } /** @@ -401,10 +407,11 @@ class YiiBase * @param string $category category of the message * @see log */ - public static function trace($msg,$category='application') + public static function trace($msg, $category = 'application') { - if(YII_DEBUG) - self::log($msg,CLogger::LEVEL_TRACE,$category); + if (YII_DEBUG) { + self::log($msg, CLogger::LEVEL_TRACE, $category); + } } /** @@ -416,25 +423,26 @@ class YiiBase * @param string $level level of the message (e.g. 'trace', 'warning', 'error'). It is case-insensitive. * @param string $category category of the message (e.g. 'system.web'). It is case-insensitive. */ - public static function log($msg,$level=CLogger::LEVEL_INFO,$category='application') + public static function log($msg, $level = CLogger::LEVEL_INFO, $category = 'application') { - if(self::$_logger===null) - self::$_logger=new CLogger; - if(YII_DEBUG && YII_TRACE_LEVEL>0 && $level!==CLogger::LEVEL_PROFILE) + if (self::$_logger === null) { + self::$_logger = new CLogger; + } + if (YII_DEBUG && YII_TRACE_LEVEL > 0 && $level !== CLogger::LEVEL_PROFILE) { - $traces=debug_backtrace(); - $count=0; - foreach($traces as $trace) + $traces = debug_backtrace(); + $count = 0; + foreach ($traces as $trace) { - if(isset($trace['file'],$trace['line']) && strpos($trace['file'],YII_PATH)!==0) + if (isset($trace['file'], $trace['line']) && strpos($trace['file'], YII_PATH) !== 0) { - $msg.="\nin ".$trace['file'].' ('.$trace['line'].')'; - if(++$count>=YII_TRACE_LEVEL) + $msg .= "\nin " . $trace['file'] . ' (' . $trace['line'] . ')'; + if (++$count >= YII_TRACE_LEVEL) break; } } } - self::$_logger->log($msg,$level,$category); + self::$_logger->log($msg, $level, $category); } /** @@ -458,9 +466,9 @@ class YiiBase * @param string $category the category of this log message * @see endProfile */ - public static function beginProfile($token,$category='application') + public static function beginProfile($token, $category = 'application') { - self::log('begin:'.$token,CLogger::LEVEL_PROFILE,$category); + self::log('begin:' . $token, CLogger::LEVEL_PROFILE, $category); } /** @@ -470,9 +478,9 @@ class YiiBase * @param string $category the category of this log message * @see beginProfile */ - public static function endProfile($token,$category='application') + public static function endProfile($token, $category = 'application') { - self::log('end:'.$token,CLogger::LEVEL_PROFILE,$category); + self::log('end:' . $token, CLogger::LEVEL_PROFILE, $category); } /** @@ -480,10 +488,20 @@ class YiiBase */ public static function getLogger() { - if(self::$_logger!==null) + if (self::$_logger !== null) return self::$_logger; else - return self::$_logger=new CLogger; + return self::$_logger = new CLogger; + } + + /** + * Sets the logger object. + * @param CLogger $logger the logger object. + * @since 1.1.8 + */ + public static function setLogger($logger) + { + self::$_logger = $logger; } /** @@ -519,273 +537,41 @@ class YiiBase * @return string the translated message * @see CMessageSource */ - public static function t($category,$message,$params=array(),$source=null,$language=null) + public static function t($category, $message, $params = array(), $source = null, $language = null) { - if(self::$_app!==null) + if (self::$_app !== null) { - if($source===null) - $source=($category==='yii'||$category==='zii')?'coreMessages':'messages'; - if(($source=self::$_app->getComponent($source))!==null) - $message=$source->translate($category,$message,$language); + if ($source === null) + $source = ($category === 'yii' || $category === 'zii') ? 'coreMessages' : 'messages'; + if (($source = self::$_app->getComponent($source)) !== null) + $message = $source->translate($category, $message, $language); } - if($params===array()) + if ($params === array()) return $message; - if(!is_array($params)) - $params=array($params); - if(isset($params[0])) // number choice + if (!is_array($params)) + $params = array($params); + if (isset($params[0])) // number choice { - if(strpos($message,'|')!==false) + if (strpos($message, '|') !== false) { - if(strpos($message,'#')===false) + if (strpos($message, '#') === false) { - $chunks=explode('|',$message); - $expressions=self::$_app->getLocale($language)->getPluralRules(); - if($n=min(count($chunks),count($expressions))) + $chunks = explode('|', $message); + $expressions = self::$_app->getLocale($language)->getPluralRules(); + if ($n = min(count($chunks), count($expressions))) { - for($i=0;$i<$n;$i++) - $chunks[$i]=$expressions[$i].'#'.$chunks[$i]; + for ($i = 0;$i < $n;$i++) + $chunks[$i] = $expressions[$i] . '#' . $chunks[$i]; - $message=implode('|',$chunks); + $message = implode('|', $chunks); } } - $message=CChoiceFormat::format($message,$params[0]); + $message = CChoiceFormat::format($message, $params[0]); } - if(!isset($params['{n}'])) - $params['{n}']=$params[0]; + if (!isset($params['{n}'])) + $params['{n}'] = $params[0]; unset($params[0]); } - return $params!==array() ? strtr($message,$params) : $message; - } - - /** - * Registers a new class autoloader. - * The new autoloader will be placed before {@link autoload} and after - * any other existing autoloaders. - * @param callback $callback a valid PHP callback (function name or array($className,$methodName)). - * @since 1.0.10 - */ - public static function registerAutoloader($callback) - { - spl_autoload_unregister(array('YiiBase','autoload')); - spl_autoload_register($callback); - spl_autoload_register(array('YiiBase','autoload')); + return $params !== array() ? strtr($message, $params) : $message; } - - /** - * @var array class map for core Yii classes. - * NOTE, DO NOT MODIFY THIS ARRAY MANUALLY. IF YOU CHANGE OR ADD SOME CORE CLASSES, - * PLEASE RUN 'build autoload' COMMAND TO UPDATE THIS ARRAY. - */ - private static $_coreClasses=array( - 'CApplication' => '/base/CApplication.php', - 'CApplicationComponent' => '/base/CApplicationComponent.php', - 'CBehavior' => '/base/CBehavior.php', - 'CComponent' => '/base/CComponent.php', - 'CErrorEvent' => '/base/CErrorEvent.php', - 'CErrorHandler' => '/base/CErrorHandler.php', - 'CException' => '/base/CException.php', - 'CExceptionEvent' => '/base/CExceptionEvent.php', - 'CHttpException' => '/base/CHttpException.php', - 'CModel' => '/base/CModel.php', - 'CModelBehavior' => '/base/CModelBehavior.php', - 'CModelEvent' => '/base/CModelEvent.php', - 'CModule' => '/base/CModule.php', - 'CSecurityManager' => '/base/CSecurityManager.php', - 'CStatePersister' => '/base/CStatePersister.php', - 'CApcCache' => '/caching/CApcCache.php', - 'CCache' => '/caching/CCache.php', - 'CDbCache' => '/caching/CDbCache.php', - 'CDummyCache' => '/caching/CDummyCache.php', - 'CEAcceleratorCache' => '/caching/CEAcceleratorCache.php', - 'CFileCache' => '/caching/CFileCache.php', - 'CMemCache' => '/caching/CMemCache.php', - 'CWinCache' => '/caching/CWinCache.php', - 'CXCache' => '/caching/CXCache.php', - 'CZendDataCache' => '/caching/CZendDataCache.php', - 'CCacheDependency' => '/caching/dependencies/CCacheDependency.php', - 'CChainedCacheDependency' => '/caching/dependencies/CChainedCacheDependency.php', - 'CDbCacheDependency' => '/caching/dependencies/CDbCacheDependency.php', - 'CDirectoryCacheDependency' => '/caching/dependencies/CDirectoryCacheDependency.php', - 'CExpressionDependency' => '/caching/dependencies/CExpressionDependency.php', - 'CFileCacheDependency' => '/caching/dependencies/CFileCacheDependency.php', - 'CGlobalStateCacheDependency' => '/caching/dependencies/CGlobalStateCacheDependency.php', - 'CAttributeCollection' => '/collections/CAttributeCollection.php', - 'CConfiguration' => '/collections/CConfiguration.php', - 'CList' => '/collections/CList.php', - 'CListIterator' => '/collections/CListIterator.php', - 'CMap' => '/collections/CMap.php', - 'CMapIterator' => '/collections/CMapIterator.php', - 'CQueue' => '/collections/CQueue.php', - 'CQueueIterator' => '/collections/CQueueIterator.php', - 'CStack' => '/collections/CStack.php', - 'CStackIterator' => '/collections/CStackIterator.php', - 'CTypedList' => '/collections/CTypedList.php', - 'CTypedMap' => '/collections/CTypedMap.php', - 'CConsoleApplication' => '/console/CConsoleApplication.php', - 'CConsoleCommand' => '/console/CConsoleCommand.php', - 'CConsoleCommandRunner' => '/console/CConsoleCommandRunner.php', - 'CHelpCommand' => '/console/CHelpCommand.php', - 'CDbCommand' => '/db/CDbCommand.php', - 'CDbConnection' => '/db/CDbConnection.php', - 'CDbDataReader' => '/db/CDbDataReader.php', - 'CDbException' => '/db/CDbException.php', - 'CDbMigration' => '/db/CDbMigration.php', - 'CDbTransaction' => '/db/CDbTransaction.php', - 'CActiveFinder' => '/db/ar/CActiveFinder.php', - 'CActiveRecord' => '/db/ar/CActiveRecord.php', - 'CActiveRecordBehavior' => '/db/ar/CActiveRecordBehavior.php', - 'CDbColumnSchema' => '/db/schema/CDbColumnSchema.php', - 'CDbCommandBuilder' => '/db/schema/CDbCommandBuilder.php', - 'CDbCriteria' => '/db/schema/CDbCriteria.php', - 'CDbExpression' => '/db/schema/CDbExpression.php', - 'CDbSchema' => '/db/schema/CDbSchema.php', - 'CDbTableSchema' => '/db/schema/CDbTableSchema.php', - 'CMssqlColumnSchema' => '/db/schema/mssql/CMssqlColumnSchema.php', - 'CMssqlCommandBuilder' => '/db/schema/mssql/CMssqlCommandBuilder.php', - 'CMssqlPdoAdapter' => '/db/schema/mssql/CMssqlPdoAdapter.php', - 'CMssqlSchema' => '/db/schema/mssql/CMssqlSchema.php', - 'CMssqlTableSchema' => '/db/schema/mssql/CMssqlTableSchema.php', - 'CMysqlColumnSchema' => '/db/schema/mysql/CMysqlColumnSchema.php', - 'CMysqlSchema' => '/db/schema/mysql/CMysqlSchema.php', - 'CMysqlTableSchema' => '/db/schema/mysql/CMysqlTableSchema.php', - 'COciColumnSchema' => '/db/schema/oci/COciColumnSchema.php', - 'COciCommandBuilder' => '/db/schema/oci/COciCommandBuilder.php', - 'COciSchema' => '/db/schema/oci/COciSchema.php', - 'COciTableSchema' => '/db/schema/oci/COciTableSchema.php', - 'CPgsqlColumnSchema' => '/db/schema/pgsql/CPgsqlColumnSchema.php', - 'CPgsqlSchema' => '/db/schema/pgsql/CPgsqlSchema.php', - 'CPgsqlTableSchema' => '/db/schema/pgsql/CPgsqlTableSchema.php', - 'CSqliteColumnSchema' => '/db/schema/sqlite/CSqliteColumnSchema.php', - 'CSqliteCommandBuilder' => '/db/schema/sqlite/CSqliteCommandBuilder.php', - 'CSqliteSchema' => '/db/schema/sqlite/CSqliteSchema.php', - 'CChoiceFormat' => '/i18n/CChoiceFormat.php', - 'CDateFormatter' => '/i18n/CDateFormatter.php', - 'CDbMessageSource' => '/i18n/CDbMessageSource.php', - 'CGettextMessageSource' => '/i18n/CGettextMessageSource.php', - 'CLocale' => '/i18n/CLocale.php', - 'CMessageSource' => '/i18n/CMessageSource.php', - 'CNumberFormatter' => '/i18n/CNumberFormatter.php', - 'CPhpMessageSource' => '/i18n/CPhpMessageSource.php', - 'CGettextFile' => '/i18n/gettext/CGettextFile.php', - 'CGettextMoFile' => '/i18n/gettext/CGettextMoFile.php', - 'CGettextPoFile' => '/i18n/gettext/CGettextPoFile.php', - 'CDbLogRoute' => '/logging/CDbLogRoute.php', - 'CEmailLogRoute' => '/logging/CEmailLogRoute.php', - 'CFileLogRoute' => '/logging/CFileLogRoute.php', - 'CLogFilter' => '/logging/CLogFilter.php', - 'CLogRoute' => '/logging/CLogRoute.php', - 'CLogRouter' => '/logging/CLogRouter.php', - 'CLogger' => '/logging/CLogger.php', - 'CProfileLogRoute' => '/logging/CProfileLogRoute.php', - 'CWebLogRoute' => '/logging/CWebLogRoute.php', - 'CDateTimeParser' => '/utils/CDateTimeParser.php', - 'CFileHelper' => '/utils/CFileHelper.php', - 'CFormatter' => '/utils/CFormatter.php', - 'CMarkdownParser' => '/utils/CMarkdownParser.php', - 'CPropertyValue' => '/utils/CPropertyValue.php', - 'CTimestamp' => '/utils/CTimestamp.php', - 'CVarDumper' => '/utils/CVarDumper.php', - 'CBooleanValidator' => '/validators/CBooleanValidator.php', - 'CCaptchaValidator' => '/validators/CCaptchaValidator.php', - 'CCompareValidator' => '/validators/CCompareValidator.php', - 'CDefaultValueValidator' => '/validators/CDefaultValueValidator.php', - 'CEmailValidator' => '/validators/CEmailValidator.php', - 'CExistValidator' => '/validators/CExistValidator.php', - 'CFileValidator' => '/validators/CFileValidator.php', - 'CFilterValidator' => '/validators/CFilterValidator.php', - 'CInlineValidator' => '/validators/CInlineValidator.php', - 'CNumberValidator' => '/validators/CNumberValidator.php', - 'CRangeValidator' => '/validators/CRangeValidator.php', - 'CRegularExpressionValidator' => '/validators/CRegularExpressionValidator.php', - 'CRequiredValidator' => '/validators/CRequiredValidator.php', - 'CSafeValidator' => '/validators/CSafeValidator.php', - 'CStringValidator' => '/validators/CStringValidator.php', - 'CTypeValidator' => '/validators/CTypeValidator.php', - 'CUniqueValidator' => '/validators/CUniqueValidator.php', - 'CUnsafeValidator' => '/validators/CUnsafeValidator.php', - 'CUrlValidator' => '/validators/CUrlValidator.php', - 'CValidator' => '/validators/CValidator.php', - 'CActiveDataProvider' => '/web/CActiveDataProvider.php', - 'CArrayDataProvider' => '/web/CArrayDataProvider.php', - 'CAssetManager' => '/web/CAssetManager.php', - 'CBaseController' => '/web/CBaseController.php', - 'CCacheHttpSession' => '/web/CCacheHttpSession.php', - 'CClientScript' => '/web/CClientScript.php', - 'CController' => '/web/CController.php', - 'CDataProvider' => '/web/CDataProvider.php', - 'CDbHttpSession' => '/web/CDbHttpSession.php', - 'CExtController' => '/web/CExtController.php', - 'CFormModel' => '/web/CFormModel.php', - 'CHttpCookie' => '/web/CHttpCookie.php', - 'CHttpRequest' => '/web/CHttpRequest.php', - 'CHttpSession' => '/web/CHttpSession.php', - 'CHttpSessionIterator' => '/web/CHttpSessionIterator.php', - 'COutputEvent' => '/web/COutputEvent.php', - 'CPagination' => '/web/CPagination.php', - 'CSort' => '/web/CSort.php', - 'CSqlDataProvider' => '/web/CSqlDataProvider.php', - 'CTheme' => '/web/CTheme.php', - 'CThemeManager' => '/web/CThemeManager.php', - 'CUploadedFile' => '/web/CUploadedFile.php', - 'CUrlManager' => '/web/CUrlManager.php', - 'CWebApplication' => '/web/CWebApplication.php', - 'CWebModule' => '/web/CWebModule.php', - 'CWidgetFactory' => '/web/CWidgetFactory.php', - 'CAction' => '/web/actions/CAction.php', - 'CInlineAction' => '/web/actions/CInlineAction.php', - 'CViewAction' => '/web/actions/CViewAction.php', - 'CAccessControlFilter' => '/web/auth/CAccessControlFilter.php', - 'CAuthAssignment' => '/web/auth/CAuthAssignment.php', - 'CAuthItem' => '/web/auth/CAuthItem.php', - 'CAuthManager' => '/web/auth/CAuthManager.php', - 'CBaseUserIdentity' => '/web/auth/CBaseUserIdentity.php', - 'CDbAuthManager' => '/web/auth/CDbAuthManager.php', - 'CPhpAuthManager' => '/web/auth/CPhpAuthManager.php', - 'CUserIdentity' => '/web/auth/CUserIdentity.php', - 'CWebUser' => '/web/auth/CWebUser.php', - 'CFilter' => '/web/filters/CFilter.php', - 'CFilterChain' => '/web/filters/CFilterChain.php', - 'CInlineFilter' => '/web/filters/CInlineFilter.php', - 'CForm' => '/web/form/CForm.php', - 'CFormButtonElement' => '/web/form/CFormButtonElement.php', - 'CFormElement' => '/web/form/CFormElement.php', - 'CFormElementCollection' => '/web/form/CFormElementCollection.php', - 'CFormInputElement' => '/web/form/CFormInputElement.php', - 'CFormStringElement' => '/web/form/CFormStringElement.php', - 'CGoogleApi' => '/web/helpers/CGoogleApi.php', - 'CHtml' => '/web/helpers/CHtml.php', - 'CJSON' => '/web/helpers/CJSON.php', - 'CJavaScript' => '/web/helpers/CJavaScript.php', - 'CPradoViewRenderer' => '/web/renderers/CPradoViewRenderer.php', - 'CViewRenderer' => '/web/renderers/CViewRenderer.php', - 'CWebService' => '/web/services/CWebService.php', - 'CWebServiceAction' => '/web/services/CWebServiceAction.php', - 'CWsdlGenerator' => '/web/services/CWsdlGenerator.php', - 'CActiveForm' => '/web/widgets/CActiveForm.php', - 'CAutoComplete' => '/web/widgets/CAutoComplete.php', - 'CClipWidget' => '/web/widgets/CClipWidget.php', - 'CContentDecorator' => '/web/widgets/CContentDecorator.php', - 'CFilterWidget' => '/web/widgets/CFilterWidget.php', - 'CFlexWidget' => '/web/widgets/CFlexWidget.php', - 'CHtmlPurifier' => '/web/widgets/CHtmlPurifier.php', - 'CInputWidget' => '/web/widgets/CInputWidget.php', - 'CMarkdown' => '/web/widgets/CMarkdown.php', - 'CMaskedTextField' => '/web/widgets/CMaskedTextField.php', - 'CMultiFileUpload' => '/web/widgets/CMultiFileUpload.php', - 'COutputCache' => '/web/widgets/COutputCache.php', - 'COutputProcessor' => '/web/widgets/COutputProcessor.php', - 'CStarRating' => '/web/widgets/CStarRating.php', - 'CTabView' => '/web/widgets/CTabView.php', - 'CTextHighlighter' => '/web/widgets/CTextHighlighter.php', - 'CTreeView' => '/web/widgets/CTreeView.php', - 'CWidget' => '/web/widgets/CWidget.php', - 'CCaptcha' => '/web/widgets/captcha/CCaptcha.php', - 'CCaptchaAction' => '/web/widgets/captcha/CCaptchaAction.php', - 'CBasePager' => '/web/widgets/pagers/CBasePager.php', - 'CLinkPager' => '/web/widgets/pagers/CLinkPager.php', - 'CListPager' => '/web/widgets/pagers/CListPager.php', - ); } - -spl_autoload_register(array('YiiBase','autoload')); -require(YII_PATH.'/base/interfaces.php'); diff --git a/framework/base/Behavior.php b/framework/base/Behavior.php index 288b132..24164dc 100644 --- a/framework/base/Behavior.php +++ b/framework/base/Behavior.php @@ -2,7 +2,6 @@ /** * Behavior class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/Component.php b/framework/base/Component.php index 58bd247..d9b1ae5 100644 --- a/framework/base/Component.php +++ b/framework/base/Component.php @@ -2,7 +2,6 @@ /** * Component class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/Dictionary.php b/framework/base/Dictionary.php index 860df39..02c58e3 100644 --- a/framework/base/Dictionary.php +++ b/framework/base/Dictionary.php @@ -2,7 +2,6 @@ /** * Dictionary class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/DictionaryIterator.php b/framework/base/DictionaryIterator.php index fb06ebc..e4b9ba8 100644 --- a/framework/base/DictionaryIterator.php +++ b/framework/base/DictionaryIterator.php @@ -2,7 +2,6 @@ /** * DictionaryIterator class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/Event.php b/framework/base/Event.php index 2e9837d..33b2c86 100644 --- a/framework/base/Event.php +++ b/framework/base/Event.php @@ -2,7 +2,6 @@ /** * Event class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/Exception.php b/framework/base/Exception.php index ef6161b..583099e 100644 --- a/framework/base/Exception.php +++ b/framework/base/Exception.php @@ -2,7 +2,6 @@ /** * Exception class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/Vector.php b/framework/base/Vector.php index 9c38898..3686f02 100644 --- a/framework/base/Vector.php +++ b/framework/base/Vector.php @@ -2,7 +2,6 @@ /** * Vector class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/base/VectorIterator.php b/framework/base/VectorIterator.php index 6abf674..a8b229e 100644 --- a/framework/base/VectorIterator.php +++ b/framework/base/VectorIterator.php @@ -2,7 +2,6 @@ /** * VectorIterator class file. * - * @author Qiang Xue * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2012 Yii Software LLC * @license http://www.yiiframework.com/license/ diff --git a/framework/yii.php b/framework/yii.php index 987de1e..bbbc422 100644 --- a/framework/yii.php +++ b/framework/yii.php @@ -24,6 +24,8 @@ require(__DIR__ . '/base/YiiBase.php'); * @package system * @since 2.0 */ -class Yii extends \yii\YiiBase +class Yii extends YiiBase { } + +spl_autoload_register(array('Yii', 'autoload'));