diff --git a/.gitignore b/.gitignore index d8b54c0..832a890 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ nbproject Thumbs.db # composer vendor dir -/framework/vendor \ No newline at end of file +/yii/vendor \ No newline at end of file diff --git a/apps/bootstrap/index.php b/apps/bootstrap/index.php index d9aca6f..c046b69 100644 --- a/apps/bootstrap/index.php +++ b/apps/bootstrap/index.php @@ -1,14 +1,13 @@ run(); diff --git a/build/build b/build/build index 691eba9..95b51e4 100755 --- a/build/build +++ b/build/build @@ -11,7 +11,7 @@ // fcgi doesn't have STDIN defined by default defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); -require(__DIR__ . '/../framework/yii.php'); +require(__DIR__ . '/../framework/Yii.php'); $id = 'yiic-build'; $basePath = __DIR__; diff --git a/composer.json b/composer.json index c6b616a..e9c3927 100644 --- a/composer.json +++ b/composer.json @@ -64,10 +64,10 @@ "source": "https://github.com/yiisoft/yii2" }, "config": { - "vendor-dir": "framework/vendor" + "vendor-dir": "yii/vendor" }, "bin": [ - "framework/yiic" + "yii/yiic" ], "require": { "php": ">=5.3.0", diff --git a/tests/unit/bootstrap.php b/tests/unit/bootstrap.php index 8290bbe..285b55b 100644 --- a/tests/unit/bootstrap.php +++ b/tests/unit/bootstrap.php @@ -5,7 +5,7 @@ define('YII_DEBUG', true); $_SERVER['SCRIPT_NAME'] = '/' . __DIR__; $_SERVER['SCRIPT_FILENAME'] = __FILE__; -require_once(__DIR__ . '/../../framework/yii.php'); +require_once(__DIR__ . '/../../yii/Yii.php'); Yii::setAlias('@yiiunit', __DIR__); diff --git a/tests/unit/framework/YiiBaseTest.php b/tests/unit/framework/YiiBaseTest.php index 47474f2..4ebf45c 100644 --- a/tests/unit/framework/YiiBaseTest.php +++ b/tests/unit/framework/YiiBaseTest.php @@ -47,7 +47,6 @@ class YiiBaseTest extends TestCase public function testGetVersion() { - echo Yii::getVersion(); $this->assertTrue((boolean)preg_match('~\d+\.\d+(?:\.\d+)?(?:-\w+)?~', \Yii::getVersion())); } diff --git a/tests/unit/framework/helpers/StringHelperTest.php b/tests/unit/framework/helpers/StringHelperTest.php index c37aafd..64811d1 100644 --- a/tests/unit/framework/helpers/StringHelperTest.php +++ b/tests/unit/framework/helpers/StringHelperTest.php @@ -70,4 +70,48 @@ class StringHelperTest extends \yii\test\TestCase $this->assertEquals('PostTag', StringHelper::id2camel('post-tag')); $this->assertEquals('PostTag', StringHelper::id2camel('post_tag', '_')); } + + public function testBasename() + { + $this->assertEquals('', StringHelper::basename('')); + + $this->assertEquals('file', StringHelper::basename('file')); + $this->assertEquals('file.test', StringHelper::basename('file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('file.test', '.test')); + + $this->assertEquals('file', StringHelper::basename('/file')); + $this->assertEquals('file.test', StringHelper::basename('/file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('/file.test', '.test')); + + $this->assertEquals('file', StringHelper::basename('/path/to/file')); + $this->assertEquals('file.test', StringHelper::basename('/path/to/file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('/path/to/file.test', '.test')); + + $this->assertEquals('file', StringHelper::basename('\file')); + $this->assertEquals('file.test', StringHelper::basename('\file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('\file.test', '.test')); + + $this->assertEquals('file', StringHelper::basename('C:\file')); + $this->assertEquals('file.test', StringHelper::basename('C:\file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('C:\file.test', '.test')); + + $this->assertEquals('file', StringHelper::basename('C:\path\to\file')); + $this->assertEquals('file.test', StringHelper::basename('C:\path\to\file.test', '.test2')); + $this->assertEquals('file', StringHelper::basename('C:\path\to\file.test', '.test')); + + // mixed paths + $this->assertEquals('file.test', StringHelper::basename('/path\to/file.test')); + $this->assertEquals('file.test', StringHelper::basename('/path/to\file.test')); + $this->assertEquals('file.test', StringHelper::basename('\path/to\file.test')); + + // \ and / in suffix + $this->assertEquals('file', StringHelper::basename('/path/to/filete/st', 'te/st')); + $this->assertEquals('st', StringHelper::basename('/path/to/filete/st', 'te\st')); + $this->assertEquals('file', StringHelper::basename('/path/to/filete\st', 'te\st')); + $this->assertEquals('st', StringHelper::basename('/path/to/filete\st', 'te/st')); + + // http://www.php.net/manual/en/function.basename.php#72254 + $this->assertEquals('foo', StringHelper::basename('/bar/foo/')); + $this->assertEquals('foo', StringHelper::basename('\\bar\\foo\\')); + } } diff --git a/tests/web/app/index.php b/tests/web/app/index.php index 4cfa1ab..7096665 100644 --- a/tests/web/app/index.php +++ b/tests/web/app/index.php @@ -1,6 +1,6 @@ run(); diff --git a/framework/.htaccess b/yii/.htaccess similarity index 100% rename from framework/.htaccess rename to yii/.htaccess diff --git a/framework/yii.php b/yii/Yii.php similarity index 100% rename from framework/yii.php rename to yii/Yii.php diff --git a/framework/YiiBase.php b/yii/YiiBase.php similarity index 98% rename from framework/YiiBase.php rename to yii/YiiBase.php index aeed6f5..1a3f50c 100644 --- a/framework/YiiBase.php +++ b/yii/YiiBase.php @@ -158,8 +158,8 @@ class YiiBase { foreach ($namespaces as $name => $path) { if ($name !== '') { - $name = '@' . str_replace('\\', '/', $name); - static::setAlias($name, $path); + $name = trim(strtr($name, array('\\' => '/', '_' => '/')), '/'); + static::setAlias('@' . $name, rtrim($path, '/\\') . '/' . $name); } } } @@ -370,7 +370,8 @@ class YiiBase include($classFile); - if (class_exists($className, false) || interface_exists($className, false)) { + if (class_exists($className, false) || interface_exists($className, false) || + function_exists('trait_exists') && trait_exists($className, false)) { return true; } else { throw new UnknownClassException("Unable to find '$className' in file: $classFile"); diff --git a/framework/assets.php b/yii/assets.php similarity index 100% rename from framework/assets.php rename to yii/assets.php diff --git a/framework/assets/jquery.min.js b/yii/assets/jquery.min.js similarity index 100% rename from framework/assets/jquery.min.js rename to yii/assets/jquery.min.js diff --git a/framework/assets/yii.activeForm.js b/yii/assets/yii.activeForm.js similarity index 100% rename from framework/assets/yii.activeForm.js rename to yii/assets/yii.activeForm.js diff --git a/framework/assets/yii.captcha.js b/yii/assets/yii.captcha.js similarity index 100% rename from framework/assets/yii.captcha.js rename to yii/assets/yii.captcha.js diff --git a/framework/assets/yii.debug.js b/yii/assets/yii.debug.js similarity index 100% rename from framework/assets/yii.debug.js rename to yii/assets/yii.debug.js diff --git a/framework/assets/yii.js b/yii/assets/yii.js similarity index 100% rename from framework/assets/yii.js rename to yii/assets/yii.js diff --git a/framework/assets/yii.validation.js b/yii/assets/yii.validation.js similarity index 100% rename from framework/assets/yii.validation.js rename to yii/assets/yii.validation.js diff --git a/framework/base/Action.php b/yii/base/Action.php similarity index 100% rename from framework/base/Action.php rename to yii/base/Action.php diff --git a/framework/base/ActionEvent.php b/yii/base/ActionEvent.php similarity index 100% rename from framework/base/ActionEvent.php rename to yii/base/ActionEvent.php diff --git a/framework/base/ActionFilter.php b/yii/base/ActionFilter.php similarity index 100% rename from framework/base/ActionFilter.php rename to yii/base/ActionFilter.php diff --git a/framework/base/Application.php b/yii/base/Application.php similarity index 100% rename from framework/base/Application.php rename to yii/base/Application.php diff --git a/framework/base/Behavior.php b/yii/base/Behavior.php similarity index 100% rename from framework/base/Behavior.php rename to yii/base/Behavior.php diff --git a/framework/base/Component.php b/yii/base/Component.php similarity index 100% rename from framework/base/Component.php rename to yii/base/Component.php diff --git a/framework/base/Controller.php b/yii/base/Controller.php similarity index 100% rename from framework/base/Controller.php rename to yii/base/Controller.php diff --git a/framework/base/Dictionary.php b/yii/base/Dictionary.php similarity index 100% rename from framework/base/Dictionary.php rename to yii/base/Dictionary.php diff --git a/framework/base/DictionaryIterator.php b/yii/base/DictionaryIterator.php similarity index 100% rename from framework/base/DictionaryIterator.php rename to yii/base/DictionaryIterator.php diff --git a/framework/base/ErrorException.php b/yii/base/ErrorException.php similarity index 100% rename from framework/base/ErrorException.php rename to yii/base/ErrorException.php diff --git a/framework/base/ErrorHandler.php b/yii/base/ErrorHandler.php similarity index 100% rename from framework/base/ErrorHandler.php rename to yii/base/ErrorHandler.php diff --git a/framework/base/Event.php b/yii/base/Event.php similarity index 100% rename from framework/base/Event.php rename to yii/base/Event.php diff --git a/framework/base/Exception.php b/yii/base/Exception.php similarity index 100% rename from framework/base/Exception.php rename to yii/base/Exception.php diff --git a/framework/base/HttpException.php b/yii/base/HttpException.php similarity index 100% rename from framework/base/HttpException.php rename to yii/base/HttpException.php diff --git a/framework/base/InlineAction.php b/yii/base/InlineAction.php similarity index 100% rename from framework/base/InlineAction.php rename to yii/base/InlineAction.php diff --git a/framework/base/InvalidCallException.php b/yii/base/InvalidCallException.php similarity index 100% rename from framework/base/InvalidCallException.php rename to yii/base/InvalidCallException.php diff --git a/framework/base/InvalidConfigException.php b/yii/base/InvalidConfigException.php similarity index 100% rename from framework/base/InvalidConfigException.php rename to yii/base/InvalidConfigException.php diff --git a/framework/base/InvalidParamException.php b/yii/base/InvalidParamException.php similarity index 100% rename from framework/base/InvalidParamException.php rename to yii/base/InvalidParamException.php diff --git a/framework/base/InvalidRequestException.php b/yii/base/InvalidRequestException.php similarity index 100% rename from framework/base/InvalidRequestException.php rename to yii/base/InvalidRequestException.php diff --git a/framework/base/InvalidRouteException.php b/yii/base/InvalidRouteException.php similarity index 100% rename from framework/base/InvalidRouteException.php rename to yii/base/InvalidRouteException.php diff --git a/framework/base/Model.php b/yii/base/Model.php similarity index 100% rename from framework/base/Model.php rename to yii/base/Model.php diff --git a/framework/base/ModelEvent.php b/yii/base/ModelEvent.php similarity index 100% rename from framework/base/ModelEvent.php rename to yii/base/ModelEvent.php diff --git a/framework/base/Module.php b/yii/base/Module.php similarity index 100% rename from framework/base/Module.php rename to yii/base/Module.php diff --git a/framework/base/NotSupportedException.php b/yii/base/NotSupportedException.php similarity index 100% rename from framework/base/NotSupportedException.php rename to yii/base/NotSupportedException.php diff --git a/framework/base/Object.php b/yii/base/Object.php similarity index 100% rename from framework/base/Object.php rename to yii/base/Object.php diff --git a/framework/base/Request.php b/yii/base/Request.php similarity index 100% rename from framework/base/Request.php rename to yii/base/Request.php diff --git a/framework/base/Response.php b/yii/base/Response.php similarity index 100% rename from framework/base/Response.php rename to yii/base/Response.php diff --git a/framework/base/Theme.php b/yii/base/Theme.php similarity index 100% rename from framework/base/Theme.php rename to yii/base/Theme.php diff --git a/framework/base/UnknownClassException.php b/yii/base/UnknownClassException.php similarity index 100% rename from framework/base/UnknownClassException.php rename to yii/base/UnknownClassException.php diff --git a/framework/base/UnknownMethodException.php b/yii/base/UnknownMethodException.php similarity index 100% rename from framework/base/UnknownMethodException.php rename to yii/base/UnknownMethodException.php diff --git a/framework/base/UnknownPropertyException.php b/yii/base/UnknownPropertyException.php similarity index 100% rename from framework/base/UnknownPropertyException.php rename to yii/base/UnknownPropertyException.php diff --git a/framework/base/UserException.php b/yii/base/UserException.php similarity index 100% rename from framework/base/UserException.php rename to yii/base/UserException.php diff --git a/framework/base/Vector.php b/yii/base/Vector.php similarity index 100% rename from framework/base/Vector.php rename to yii/base/Vector.php diff --git a/framework/base/VectorIterator.php b/yii/base/VectorIterator.php similarity index 100% rename from framework/base/VectorIterator.php rename to yii/base/VectorIterator.php diff --git a/framework/base/View.php b/yii/base/View.php similarity index 100% rename from framework/base/View.php rename to yii/base/View.php diff --git a/framework/base/ViewEvent.php b/yii/base/ViewEvent.php similarity index 100% rename from framework/base/ViewEvent.php rename to yii/base/ViewEvent.php diff --git a/framework/base/ViewRenderer.php b/yii/base/ViewRenderer.php similarity index 100% rename from framework/base/ViewRenderer.php rename to yii/base/ViewRenderer.php diff --git a/framework/base/Widget.php b/yii/base/Widget.php similarity index 100% rename from framework/base/Widget.php rename to yii/base/Widget.php diff --git a/framework/caching/ApcCache.php b/yii/caching/ApcCache.php similarity index 100% rename from framework/caching/ApcCache.php rename to yii/caching/ApcCache.php diff --git a/framework/caching/Cache.php b/yii/caching/Cache.php similarity index 100% rename from framework/caching/Cache.php rename to yii/caching/Cache.php diff --git a/framework/caching/ChainedDependency.php b/yii/caching/ChainedDependency.php similarity index 100% rename from framework/caching/ChainedDependency.php rename to yii/caching/ChainedDependency.php diff --git a/framework/caching/DbCache.php b/yii/caching/DbCache.php similarity index 100% rename from framework/caching/DbCache.php rename to yii/caching/DbCache.php diff --git a/framework/caching/DbDependency.php b/yii/caching/DbDependency.php similarity index 100% rename from framework/caching/DbDependency.php rename to yii/caching/DbDependency.php diff --git a/framework/caching/Dependency.php b/yii/caching/Dependency.php similarity index 100% rename from framework/caching/Dependency.php rename to yii/caching/Dependency.php diff --git a/framework/caching/DummyCache.php b/yii/caching/DummyCache.php similarity index 100% rename from framework/caching/DummyCache.php rename to yii/caching/DummyCache.php diff --git a/framework/caching/ExpressionDependency.php b/yii/caching/ExpressionDependency.php similarity index 100% rename from framework/caching/ExpressionDependency.php rename to yii/caching/ExpressionDependency.php diff --git a/framework/caching/FileCache.php b/yii/caching/FileCache.php similarity index 100% rename from framework/caching/FileCache.php rename to yii/caching/FileCache.php diff --git a/framework/caching/FileDependency.php b/yii/caching/FileDependency.php similarity index 100% rename from framework/caching/FileDependency.php rename to yii/caching/FileDependency.php diff --git a/framework/caching/MemCache.php b/yii/caching/MemCache.php similarity index 100% rename from framework/caching/MemCache.php rename to yii/caching/MemCache.php diff --git a/framework/caching/MemCacheServer.php b/yii/caching/MemCacheServer.php similarity index 100% rename from framework/caching/MemCacheServer.php rename to yii/caching/MemCacheServer.php diff --git a/framework/caching/WinCache.php b/yii/caching/WinCache.php similarity index 100% rename from framework/caching/WinCache.php rename to yii/caching/WinCache.php diff --git a/framework/caching/XCache.php b/yii/caching/XCache.php similarity index 100% rename from framework/caching/XCache.php rename to yii/caching/XCache.php diff --git a/framework/caching/ZendDataCache.php b/yii/caching/ZendDataCache.php similarity index 100% rename from framework/caching/ZendDataCache.php rename to yii/caching/ZendDataCache.php diff --git a/framework/console/Application.php b/yii/console/Application.php similarity index 100% rename from framework/console/Application.php rename to yii/console/Application.php diff --git a/framework/console/Controller.php b/yii/console/Controller.php similarity index 100% rename from framework/console/Controller.php rename to yii/console/Controller.php diff --git a/framework/console/Exception.php b/yii/console/Exception.php similarity index 100% rename from framework/console/Exception.php rename to yii/console/Exception.php diff --git a/framework/console/Request.php b/yii/console/Request.php similarity index 100% rename from framework/console/Request.php rename to yii/console/Request.php diff --git a/framework/console/controllers/AppController.php b/yii/console/controllers/AppController.php similarity index 100% rename from framework/console/controllers/AppController.php rename to yii/console/controllers/AppController.php diff --git a/framework/console/controllers/AssetController.php b/yii/console/controllers/AssetController.php similarity index 100% rename from framework/console/controllers/AssetController.php rename to yii/console/controllers/AssetController.php diff --git a/framework/console/controllers/CacheController.php b/yii/console/controllers/CacheController.php similarity index 100% rename from framework/console/controllers/CacheController.php rename to yii/console/controllers/CacheController.php diff --git a/framework/console/controllers/HelpController.php b/yii/console/controllers/HelpController.php similarity index 100% rename from framework/console/controllers/HelpController.php rename to yii/console/controllers/HelpController.php diff --git a/framework/console/controllers/MessageController.php b/yii/console/controllers/MessageController.php similarity index 100% rename from framework/console/controllers/MessageController.php rename to yii/console/controllers/MessageController.php diff --git a/framework/console/controllers/MigrateController.php b/yii/console/controllers/MigrateController.php similarity index 100% rename from framework/console/controllers/MigrateController.php rename to yii/console/controllers/MigrateController.php diff --git a/framework/console/runtime/.gitignore b/yii/console/runtime/.gitignore similarity index 100% rename from framework/console/runtime/.gitignore rename to yii/console/runtime/.gitignore diff --git a/framework/db/ActiveQuery.php b/yii/db/ActiveQuery.php similarity index 100% rename from framework/db/ActiveQuery.php rename to yii/db/ActiveQuery.php diff --git a/framework/db/ActiveRecord.php b/yii/db/ActiveRecord.php similarity index 99% rename from framework/db/ActiveRecord.php rename to yii/db/ActiveRecord.php index 500029d..356819d 100644 --- a/framework/db/ActiveRecord.php +++ b/yii/db/ActiveRecord.php @@ -252,7 +252,7 @@ class ActiveRecord extends Model */ public static function tableName() { - return 'tbl_' . StringHelper::camel2id(basename(get_called_class()), '_'); + return 'tbl_' . StringHelper::camel2id(StringHelper::basename(get_called_class()), '_'); } /** diff --git a/framework/db/ActiveRelation.php b/yii/db/ActiveRelation.php similarity index 100% rename from framework/db/ActiveRelation.php rename to yii/db/ActiveRelation.php diff --git a/framework/db/ColumnSchema.php b/yii/db/ColumnSchema.php similarity index 100% rename from framework/db/ColumnSchema.php rename to yii/db/ColumnSchema.php diff --git a/framework/db/Command.php b/yii/db/Command.php similarity index 100% rename from framework/db/Command.php rename to yii/db/Command.php diff --git a/framework/db/Connection.php b/yii/db/Connection.php similarity index 100% rename from framework/db/Connection.php rename to yii/db/Connection.php diff --git a/framework/db/DataReader.php b/yii/db/DataReader.php similarity index 100% rename from framework/db/DataReader.php rename to yii/db/DataReader.php diff --git a/framework/db/Exception.php b/yii/db/Exception.php similarity index 100% rename from framework/db/Exception.php rename to yii/db/Exception.php diff --git a/framework/db/Expression.php b/yii/db/Expression.php similarity index 100% rename from framework/db/Expression.php rename to yii/db/Expression.php diff --git a/framework/db/Migration.php b/yii/db/Migration.php similarity index 100% rename from framework/db/Migration.php rename to yii/db/Migration.php diff --git a/framework/db/Query.php b/yii/db/Query.php similarity index 100% rename from framework/db/Query.php rename to yii/db/Query.php diff --git a/framework/db/QueryBuilder.php b/yii/db/QueryBuilder.php similarity index 100% rename from framework/db/QueryBuilder.php rename to yii/db/QueryBuilder.php diff --git a/framework/db/Schema.php b/yii/db/Schema.php similarity index 100% rename from framework/db/Schema.php rename to yii/db/Schema.php diff --git a/framework/db/StaleObjectException.php b/yii/db/StaleObjectException.php similarity index 100% rename from framework/db/StaleObjectException.php rename to yii/db/StaleObjectException.php diff --git a/framework/db/TableSchema.php b/yii/db/TableSchema.php similarity index 100% rename from framework/db/TableSchema.php rename to yii/db/TableSchema.php diff --git a/framework/db/Transaction.php b/yii/db/Transaction.php similarity index 100% rename from framework/db/Transaction.php rename to yii/db/Transaction.php diff --git a/framework/db/mysql/QueryBuilder.php b/yii/db/mysql/QueryBuilder.php similarity index 100% rename from framework/db/mysql/QueryBuilder.php rename to yii/db/mysql/QueryBuilder.php diff --git a/framework/db/mysql/Schema.php b/yii/db/mysql/Schema.php similarity index 100% rename from framework/db/mysql/Schema.php rename to yii/db/mysql/Schema.php diff --git a/framework/db/sqlite/QueryBuilder.php b/yii/db/sqlite/QueryBuilder.php similarity index 100% rename from framework/db/sqlite/QueryBuilder.php rename to yii/db/sqlite/QueryBuilder.php diff --git a/framework/db/sqlite/Schema.php b/yii/db/sqlite/Schema.php similarity index 100% rename from framework/db/sqlite/Schema.php rename to yii/db/sqlite/Schema.php diff --git a/framework/debug/Module.php b/yii/debug/Module.php similarity index 100% rename from framework/debug/Module.php rename to yii/debug/Module.php diff --git a/framework/debug/Toolbar.php b/yii/debug/Toolbar.php similarity index 100% rename from framework/debug/Toolbar.php rename to yii/debug/Toolbar.php diff --git a/framework/debug/controllers/DefaultController.php b/yii/debug/controllers/DefaultController.php similarity index 100% rename from framework/debug/controllers/DefaultController.php rename to yii/debug/controllers/DefaultController.php diff --git a/framework/helpers/ArrayHelper.php b/yii/helpers/ArrayHelper.php similarity index 100% rename from framework/helpers/ArrayHelper.php rename to yii/helpers/ArrayHelper.php diff --git a/framework/helpers/Console.php b/yii/helpers/Console.php similarity index 100% rename from framework/helpers/Console.php rename to yii/helpers/Console.php diff --git a/framework/helpers/FileHelper.php b/yii/helpers/FileHelper.php similarity index 100% rename from framework/helpers/FileHelper.php rename to yii/helpers/FileHelper.php diff --git a/framework/helpers/Html.php b/yii/helpers/Html.php similarity index 100% rename from framework/helpers/Html.php rename to yii/helpers/Html.php diff --git a/framework/helpers/Json.php b/yii/helpers/Json.php similarity index 100% rename from framework/helpers/Json.php rename to yii/helpers/Json.php diff --git a/framework/helpers/Markdown.php b/yii/helpers/Markdown.php similarity index 100% rename from framework/helpers/Markdown.php rename to yii/helpers/Markdown.php diff --git a/framework/helpers/Purifier.php b/yii/helpers/Purifier.php similarity index 100% rename from framework/helpers/Purifier.php rename to yii/helpers/Purifier.php diff --git a/framework/helpers/SecurityHelper.php b/yii/helpers/SecurityHelper.php similarity index 100% rename from framework/helpers/SecurityHelper.php rename to yii/helpers/SecurityHelper.php diff --git a/framework/helpers/StringHelper.php b/yii/helpers/StringHelper.php similarity index 100% rename from framework/helpers/StringHelper.php rename to yii/helpers/StringHelper.php diff --git a/framework/helpers/VarDumper.php b/yii/helpers/VarDumper.php similarity index 100% rename from framework/helpers/VarDumper.php rename to yii/helpers/VarDumper.php diff --git a/framework/helpers/base/ArrayHelper.php b/yii/helpers/base/ArrayHelper.php similarity index 100% rename from framework/helpers/base/ArrayHelper.php rename to yii/helpers/base/ArrayHelper.php diff --git a/framework/helpers/base/Console.php b/yii/helpers/base/Console.php similarity index 100% rename from framework/helpers/base/Console.php rename to yii/helpers/base/Console.php diff --git a/framework/helpers/base/FileHelper.php b/yii/helpers/base/FileHelper.php similarity index 100% rename from framework/helpers/base/FileHelper.php rename to yii/helpers/base/FileHelper.php diff --git a/framework/helpers/base/Html.php b/yii/helpers/base/Html.php similarity index 100% rename from framework/helpers/base/Html.php rename to yii/helpers/base/Html.php diff --git a/framework/helpers/base/Json.php b/yii/helpers/base/Json.php similarity index 100% rename from framework/helpers/base/Json.php rename to yii/helpers/base/Json.php diff --git a/framework/helpers/base/Markdown.php b/yii/helpers/base/Markdown.php similarity index 100% rename from framework/helpers/base/Markdown.php rename to yii/helpers/base/Markdown.php diff --git a/framework/helpers/base/Purifier.php b/yii/helpers/base/Purifier.php similarity index 100% rename from framework/helpers/base/Purifier.php rename to yii/helpers/base/Purifier.php diff --git a/framework/helpers/base/SecurityHelper.php b/yii/helpers/base/SecurityHelper.php similarity index 100% rename from framework/helpers/base/SecurityHelper.php rename to yii/helpers/base/SecurityHelper.php diff --git a/framework/helpers/base/StringHelper.php b/yii/helpers/base/StringHelper.php similarity index 81% rename from framework/helpers/base/StringHelper.php rename to yii/helpers/base/StringHelper.php index cb4b09b..646bcbb 100644 --- a/framework/helpers/base/StringHelper.php +++ b/yii/helpers/base/StringHelper.php @@ -44,6 +44,29 @@ class StringHelper } /** + * Returns the trailing name component of a path. + * This method does the same as the php function basename() except that it will + * always use \ and / as directory separators, independent of the operating system. + * Note: basename() operates naively on the input string, and is not aware of the + * actual filesystem, or path components such as "..". + * @param string $path A path string. + * @param string $suffix If the name component ends in suffix this will also be cut off. + * @return string the trailing name component of the given path. + * @see http://www.php.net/manual/en/function.basename.php + */ + public static function basename($path, $suffix = '') + { + if (($len = mb_strlen($suffix)) > 0 && mb_substr($path, -$len) == $suffix) { + $path = mb_substr($path, 0, -$len); + } + $path = rtrim(str_replace('\\', '/', $path), '/\\'); + if (($pos = mb_strrpos($path, '/')) !== false) { + return mb_substr($path, $pos + 1); + } + return $path; + } + + /** * Converts a word to its plural form. * Note that this is for English only! * For example, 'apple' will become 'apples', and 'child' will become 'children'. diff --git a/framework/helpers/base/VarDumper.php b/yii/helpers/base/VarDumper.php similarity index 100% rename from framework/helpers/base/VarDumper.php rename to yii/helpers/base/VarDumper.php diff --git a/framework/helpers/base/mimeTypes.php b/yii/helpers/base/mimeTypes.php similarity index 100% rename from framework/helpers/base/mimeTypes.php rename to yii/helpers/base/mimeTypes.php diff --git a/framework/i18n/I18N.php b/yii/i18n/I18N.php similarity index 100% rename from framework/i18n/I18N.php rename to yii/i18n/I18N.php diff --git a/framework/i18n/MessageSource.php b/yii/i18n/MessageSource.php similarity index 100% rename from framework/i18n/MessageSource.php rename to yii/i18n/MessageSource.php diff --git a/framework/i18n/MissingTranslationEvent.php b/yii/i18n/MissingTranslationEvent.php similarity index 100% rename from framework/i18n/MissingTranslationEvent.php rename to yii/i18n/MissingTranslationEvent.php diff --git a/framework/i18n/PhpMessageSource.php b/yii/i18n/PhpMessageSource.php similarity index 100% rename from framework/i18n/PhpMessageSource.php rename to yii/i18n/PhpMessageSource.php diff --git a/framework/i18n/data/plurals.php b/yii/i18n/data/plurals.php similarity index 100% rename from framework/i18n/data/plurals.php rename to yii/i18n/data/plurals.php diff --git a/framework/i18n/data/plurals.xml b/yii/i18n/data/plurals.xml similarity index 100% rename from framework/i18n/data/plurals.xml rename to yii/i18n/data/plurals.xml diff --git a/framework/logging/DbTarget.php b/yii/logging/DbTarget.php similarity index 100% rename from framework/logging/DbTarget.php rename to yii/logging/DbTarget.php diff --git a/framework/logging/EmailTarget.php b/yii/logging/EmailTarget.php similarity index 100% rename from framework/logging/EmailTarget.php rename to yii/logging/EmailTarget.php diff --git a/framework/logging/FileTarget.php b/yii/logging/FileTarget.php similarity index 100% rename from framework/logging/FileTarget.php rename to yii/logging/FileTarget.php diff --git a/framework/logging/Logger.php b/yii/logging/Logger.php similarity index 100% rename from framework/logging/Logger.php rename to yii/logging/Logger.php diff --git a/framework/logging/ProfileTarget.php b/yii/logging/ProfileTarget.php similarity index 100% rename from framework/logging/ProfileTarget.php rename to yii/logging/ProfileTarget.php diff --git a/framework/logging/Router.php b/yii/logging/Router.php similarity index 100% rename from framework/logging/Router.php rename to yii/logging/Router.php diff --git a/framework/logging/Target.php b/yii/logging/Target.php similarity index 100% rename from framework/logging/Target.php rename to yii/logging/Target.php diff --git a/framework/logging/WebTarget.php b/yii/logging/WebTarget.php similarity index 100% rename from framework/logging/WebTarget.php rename to yii/logging/WebTarget.php diff --git a/framework/renderers/SmartyViewRenderer.php b/yii/renderers/SmartyViewRenderer.php similarity index 100% rename from framework/renderers/SmartyViewRenderer.php rename to yii/renderers/SmartyViewRenderer.php diff --git a/framework/renderers/TwigViewRenderer.php b/yii/renderers/TwigViewRenderer.php similarity index 100% rename from framework/renderers/TwigViewRenderer.php rename to yii/renderers/TwigViewRenderer.php diff --git a/framework/test/TestCase.php b/yii/test/TestCase.php similarity index 100% rename from framework/test/TestCase.php rename to yii/test/TestCase.php diff --git a/framework/test/WebTestCase.php b/yii/test/WebTestCase.php similarity index 100% rename from framework/test/WebTestCase.php rename to yii/test/WebTestCase.php diff --git a/framework/validators/BooleanValidator.php b/yii/validators/BooleanValidator.php similarity index 100% rename from framework/validators/BooleanValidator.php rename to yii/validators/BooleanValidator.php diff --git a/framework/validators/CaptchaValidator.php b/yii/validators/CaptchaValidator.php similarity index 100% rename from framework/validators/CaptchaValidator.php rename to yii/validators/CaptchaValidator.php diff --git a/framework/validators/CompareValidator.php b/yii/validators/CompareValidator.php similarity index 100% rename from framework/validators/CompareValidator.php rename to yii/validators/CompareValidator.php diff --git a/framework/validators/DateValidator.php b/yii/validators/DateValidator.php similarity index 100% rename from framework/validators/DateValidator.php rename to yii/validators/DateValidator.php diff --git a/framework/validators/DefaultValueValidator.php b/yii/validators/DefaultValueValidator.php similarity index 100% rename from framework/validators/DefaultValueValidator.php rename to yii/validators/DefaultValueValidator.php diff --git a/framework/validators/EmailValidator.php b/yii/validators/EmailValidator.php similarity index 100% rename from framework/validators/EmailValidator.php rename to yii/validators/EmailValidator.php diff --git a/framework/validators/ExistValidator.php b/yii/validators/ExistValidator.php similarity index 100% rename from framework/validators/ExistValidator.php rename to yii/validators/ExistValidator.php diff --git a/framework/validators/FileValidator.php b/yii/validators/FileValidator.php similarity index 100% rename from framework/validators/FileValidator.php rename to yii/validators/FileValidator.php diff --git a/framework/validators/FilterValidator.php b/yii/validators/FilterValidator.php similarity index 100% rename from framework/validators/FilterValidator.php rename to yii/validators/FilterValidator.php diff --git a/framework/validators/InlineValidator.php b/yii/validators/InlineValidator.php similarity index 100% rename from framework/validators/InlineValidator.php rename to yii/validators/InlineValidator.php diff --git a/framework/validators/NumberValidator.php b/yii/validators/NumberValidator.php similarity index 100% rename from framework/validators/NumberValidator.php rename to yii/validators/NumberValidator.php diff --git a/framework/validators/RangeValidator.php b/yii/validators/RangeValidator.php similarity index 100% rename from framework/validators/RangeValidator.php rename to yii/validators/RangeValidator.php diff --git a/framework/validators/RegularExpressionValidator.php b/yii/validators/RegularExpressionValidator.php similarity index 100% rename from framework/validators/RegularExpressionValidator.php rename to yii/validators/RegularExpressionValidator.php diff --git a/framework/validators/RequiredValidator.php b/yii/validators/RequiredValidator.php similarity index 100% rename from framework/validators/RequiredValidator.php rename to yii/validators/RequiredValidator.php diff --git a/framework/validators/StringValidator.php b/yii/validators/StringValidator.php similarity index 100% rename from framework/validators/StringValidator.php rename to yii/validators/StringValidator.php diff --git a/framework/validators/UniqueValidator.php b/yii/validators/UniqueValidator.php similarity index 100% rename from framework/validators/UniqueValidator.php rename to yii/validators/UniqueValidator.php diff --git a/framework/validators/UrlValidator.php b/yii/validators/UrlValidator.php similarity index 100% rename from framework/validators/UrlValidator.php rename to yii/validators/UrlValidator.php diff --git a/framework/validators/Validator.php b/yii/validators/Validator.php similarity index 100% rename from framework/validators/Validator.php rename to yii/validators/Validator.php diff --git a/framework/views/error.php b/yii/views/error.php similarity index 100% rename from framework/views/error.php rename to yii/views/error.php diff --git a/framework/views/exception.php b/yii/views/exception.php similarity index 100% rename from framework/views/exception.php rename to yii/views/exception.php diff --git a/framework/views/migration.php b/yii/views/migration.php similarity index 100% rename from framework/views/migration.php rename to yii/views/migration.php diff --git a/framework/web/AccessControl.php b/yii/web/AccessControl.php similarity index 100% rename from framework/web/AccessControl.php rename to yii/web/AccessControl.php diff --git a/framework/web/AccessRule.php b/yii/web/AccessRule.php similarity index 100% rename from framework/web/AccessRule.php rename to yii/web/AccessRule.php diff --git a/framework/web/Application.php b/yii/web/Application.php similarity index 100% rename from framework/web/Application.php rename to yii/web/Application.php diff --git a/framework/web/AssetBundle.php b/yii/web/AssetBundle.php similarity index 100% rename from framework/web/AssetBundle.php rename to yii/web/AssetBundle.php diff --git a/framework/web/AssetConverter.php b/yii/web/AssetConverter.php similarity index 100% rename from framework/web/AssetConverter.php rename to yii/web/AssetConverter.php diff --git a/framework/web/AssetManager.php b/yii/web/AssetManager.php similarity index 100% rename from framework/web/AssetManager.php rename to yii/web/AssetManager.php diff --git a/framework/web/CacheSession.php b/yii/web/CacheSession.php similarity index 100% rename from framework/web/CacheSession.php rename to yii/web/CacheSession.php diff --git a/framework/web/CaptchaAction.php b/yii/web/CaptchaAction.php similarity index 100% rename from framework/web/CaptchaAction.php rename to yii/web/CaptchaAction.php diff --git a/framework/web/Controller.php b/yii/web/Controller.php similarity index 100% rename from framework/web/Controller.php rename to yii/web/Controller.php diff --git a/framework/web/Cookie.php b/yii/web/Cookie.php similarity index 100% rename from framework/web/Cookie.php rename to yii/web/Cookie.php diff --git a/framework/web/CookieCollection.php b/yii/web/CookieCollection.php similarity index 100% rename from framework/web/CookieCollection.php rename to yii/web/CookieCollection.php diff --git a/framework/web/DbSession.php b/yii/web/DbSession.php similarity index 100% rename from framework/web/DbSession.php rename to yii/web/DbSession.php diff --git a/framework/web/HttpCache.php b/yii/web/HttpCache.php similarity index 100% rename from framework/web/HttpCache.php rename to yii/web/HttpCache.php diff --git a/framework/web/IAssetConverter.php b/yii/web/IAssetConverter.php similarity index 100% rename from framework/web/IAssetConverter.php rename to yii/web/IAssetConverter.php diff --git a/framework/web/Identity.php b/yii/web/Identity.php similarity index 100% rename from framework/web/Identity.php rename to yii/web/Identity.php diff --git a/framework/web/JsExpression.php b/yii/web/JsExpression.php similarity index 100% rename from framework/web/JsExpression.php rename to yii/web/JsExpression.php diff --git a/framework/web/PageCache.php b/yii/web/PageCache.php similarity index 100% rename from framework/web/PageCache.php rename to yii/web/PageCache.php diff --git a/framework/web/Pagination.php b/yii/web/Pagination.php similarity index 100% rename from framework/web/Pagination.php rename to yii/web/Pagination.php diff --git a/framework/web/Request.php b/yii/web/Request.php similarity index 99% rename from framework/web/Request.php rename to yii/web/Request.php index 5e2f064..d3f419b 100644 --- a/framework/web/Request.php +++ b/yii/web/Request.php @@ -69,8 +69,8 @@ class Request extends \yii\base\Request $result = Yii::$app->getUrlManager()->parseRequest($this); if ($result !== false) { list ($route, $params) = $result; - $params = array_merge($_GET, $params); - return array($route, $params); + $_GET = array_merge($_GET, $params); + return array($route, $_GET); } else { throw new HttpException(404, Yii::t('yii|Page not found.')); } diff --git a/framework/web/Response.php b/yii/web/Response.php similarity index 100% rename from framework/web/Response.php rename to yii/web/Response.php diff --git a/framework/web/Session.php b/yii/web/Session.php similarity index 100% rename from framework/web/Session.php rename to yii/web/Session.php diff --git a/framework/web/SessionIterator.php b/yii/web/SessionIterator.php similarity index 100% rename from framework/web/SessionIterator.php rename to yii/web/SessionIterator.php diff --git a/framework/web/Sort.php b/yii/web/Sort.php similarity index 100% rename from framework/web/Sort.php rename to yii/web/Sort.php diff --git a/framework/web/SpicyRice.md b/yii/web/SpicyRice.md similarity index 100% rename from framework/web/SpicyRice.md rename to yii/web/SpicyRice.md diff --git a/framework/web/SpicyRice.ttf b/yii/web/SpicyRice.ttf similarity index 100% rename from framework/web/SpicyRice.ttf rename to yii/web/SpicyRice.ttf diff --git a/framework/web/UploadedFile.php b/yii/web/UploadedFile.php similarity index 100% rename from framework/web/UploadedFile.php rename to yii/web/UploadedFile.php diff --git a/framework/web/UrlManager.php b/yii/web/UrlManager.php similarity index 100% rename from framework/web/UrlManager.php rename to yii/web/UrlManager.php diff --git a/framework/web/UrlRule.php b/yii/web/UrlRule.php similarity index 100% rename from framework/web/UrlRule.php rename to yii/web/UrlRule.php diff --git a/framework/web/User.php b/yii/web/User.php similarity index 100% rename from framework/web/User.php rename to yii/web/User.php diff --git a/framework/web/UserEvent.php b/yii/web/UserEvent.php similarity index 100% rename from framework/web/UserEvent.php rename to yii/web/UserEvent.php diff --git a/framework/widgets/ActiveField.php b/yii/widgets/ActiveField.php similarity index 100% rename from framework/widgets/ActiveField.php rename to yii/widgets/ActiveField.php diff --git a/framework/widgets/ActiveForm.php b/yii/widgets/ActiveForm.php similarity index 100% rename from framework/widgets/ActiveForm.php rename to yii/widgets/ActiveForm.php diff --git a/framework/widgets/Block.php b/yii/widgets/Block.php similarity index 100% rename from framework/widgets/Block.php rename to yii/widgets/Block.php diff --git a/framework/widgets/Breadcrumbs.php b/yii/widgets/Breadcrumbs.php similarity index 100% rename from framework/widgets/Breadcrumbs.php rename to yii/widgets/Breadcrumbs.php diff --git a/framework/widgets/Captcha.php b/yii/widgets/Captcha.php similarity index 100% rename from framework/widgets/Captcha.php rename to yii/widgets/Captcha.php diff --git a/framework/widgets/ContentDecorator.php b/yii/widgets/ContentDecorator.php similarity index 100% rename from framework/widgets/ContentDecorator.php rename to yii/widgets/ContentDecorator.php diff --git a/framework/widgets/FragmentCache.php b/yii/widgets/FragmentCache.php similarity index 100% rename from framework/widgets/FragmentCache.php rename to yii/widgets/FragmentCache.php diff --git a/framework/widgets/Menu.php b/yii/widgets/Menu.php similarity index 100% rename from framework/widgets/Menu.php rename to yii/widgets/Menu.php diff --git a/framework/yiic b/yii/yiic similarity index 100% rename from framework/yiic rename to yii/yiic diff --git a/framework/yiic.bat b/yii/yiic.bat similarity index 100% rename from framework/yiic.bat rename to yii/yiic.bat diff --git a/framework/yiic.php b/yii/yiic.php similarity index 94% rename from framework/yiic.php rename to yii/yiic.php index 3872e2f..7cd0c40 100644 --- a/framework/yiic.php +++ b/yii/yiic.php @@ -12,7 +12,7 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); // fcgi doesn't have STDIN defined by default defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); -require(__DIR__ . '/yii.php'); +require(__DIR__ . '/Yii.php'); $application = new yii\console\Application(array( 'id' => 'yiic',