Commit 10f2b925 by Qiang Xue

Merge branch 'master' of github.com:yiisoft/yii2

parents 3852e0b7 2c509886
......@@ -49,17 +49,19 @@ class ClassmapController extends Controller
'/debug/',
'/console/',
'/test/',
'/gii/',
),
);
$files = FileHelper::findFiles($root, $options);
$map = array();
foreach ($files as $file) {
if (($pos = strpos($file, $root)) !== 0) {
die("Something wrong: $file");
die("Something wrong: $file\n");
}
$path = str_replace('\\', '/', substr($file, strlen($root)));
$map[] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',";
$map[$path] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',";
}
ksort($map);
$map = implode("\n", $map);
$output = <<<EOD
<?php
......@@ -80,10 +82,10 @@ $map
EOD;
if (is_file($mapFile) && file_get_contents($mapFile) === $output) {
echo "Nothing changed.";
echo "Nothing changed.\n";
} else {
file_put_contents($mapFile, $output);
echo "Class map saved in $mapFile";
echo "Class map saved in $mapFile\n";
}
}
}
......@@ -9,6 +9,7 @@ namespace yii;
use yii\base\Exception;
use yii\base\InvalidConfigException;
use yii\base\InvalidParamException;
use yii\base\UnknownClassException;
use yii\log\Logger;
/**
......@@ -333,7 +334,11 @@ class YiiBase
* it will attempt to include the file associated with the corresponding path alias
* (e.g. `@PHPUnit/Framework/TestCase.php`);
*
* This autoloader allows loading classes that follow the [PSR-0 standard](http://www.php-fig.org/psr/0/).
* Therefor a path alias has to be defined for each top-level namespace.
*
* @param string $className the fully qualified class name without a leading backslash "\"
* @throws UnknownClassException if the class does not exist in the class file
*/
public static function autoload($className)
{
......@@ -342,7 +347,6 @@ class YiiBase
if ($classFile[0] === '@') {
$classFile = static::getAlias($classFile);
}
include($classFile);
} else {
// follow PSR-0 to determine the class file
if (($pos = strrpos($className, '\\')) !== false) {
......@@ -354,13 +358,22 @@ class YiiBase
}
// try loading via path alias
if (strpos($path, '/') !== false) {
if (strpos($path, '/') === false) {
return;
} else {
$classFile = static::getAlias('@' . $path, false);
if ($classFile !== false && is_file($classFile)) {
include($classFile);
if ($classFile === false || !is_file($classFile)) {
return;
}
}
}
include($classFile);
if (!class_exists($className, false) && !interface_exists($className, false) &&
(!function_exists('trait_exists') || !trait_exists($className, false))) {
throw new UnknownClassException("Unable to find '$className' in file: $classFile");
}
}
/**
......
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\base;
/**
* UnknownClassException represents an exception caused by using an unknown class.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class UnknownClassException extends Exception
{
/**
* @return string the user-friendly name of this exception
*/
public function getName()
{
return \Yii::t('yii', 'Unknown Class');
}
}
......@@ -37,6 +37,7 @@ return array(
'yii\base\Request' => YII_PATH . '/base/Request.php',
'yii\base\Response' => YII_PATH . '/base/Response.php',
'yii\base\Theme' => YII_PATH . '/base/Theme.php',
'yii\base\UnknownClassException' => YII_PATH . '/base/UnknownClassException.php',
'yii\base\UnknownMethodException' => YII_PATH . '/base/UnknownMethodException.php',
'yii\base\UnknownPropertyException' => YII_PATH . '/base/UnknownPropertyException.php',
'yii\base\UserException' => YII_PATH . '/base/UserException.php',
......@@ -45,34 +46,21 @@ return array(
'yii\base\ViewRenderer' => YII_PATH . '/base/ViewRenderer.php',
'yii\base\Widget' => YII_PATH . '/base/Widget.php',
'yii\behaviors\AutoTimestamp' => YII_PATH . '/behaviors/AutoTimestamp.php',
'yii\bootstrap\AffixAsset' => YII_PATH . '/bootstrap/AffixAsset.php',
'yii\bootstrap\Alert' => YII_PATH . '/bootstrap/Alert.php',
'yii\bootstrap\AlertAsset' => YII_PATH . '/bootstrap/AlertAsset.php',
'yii\bootstrap\BootstrapAsset' => YII_PATH . '/bootstrap/BootstrapAsset.php',
'yii\bootstrap\BootstrapPluginAsset' => YII_PATH . '/bootstrap/BootstrapPluginAsset.php',
'yii\bootstrap\Button' => YII_PATH . '/bootstrap/Button.php',
'yii\bootstrap\ButtonAsset' => YII_PATH . '/bootstrap/ButtonAsset.php',
'yii\bootstrap\ButtonDropdown' => YII_PATH . '/bootstrap/ButtonDropdown.php',
'yii\bootstrap\ButtonGroup' => YII_PATH . '/bootstrap/ButtonGroup.php',
'yii\bootstrap\Carousel' => YII_PATH . '/bootstrap/Carousel.php',
'yii\bootstrap\CarouselAsset' => YII_PATH . '/bootstrap/CarouselAsset.php',
'yii\bootstrap\Collapse' => YII_PATH . '/bootstrap/Collapse.php',
'yii\bootstrap\CollapseAsset' => YII_PATH . '/bootstrap/CollapseAsset.php',
'yii\bootstrap\Dropdown' => YII_PATH . '/bootstrap/Dropdown.php',
'yii\bootstrap\DropdownAsset' => YII_PATH . '/bootstrap/DropdownAsset.php',
'yii\bootstrap\Modal' => YII_PATH . '/bootstrap/Modal.php',
'yii\bootstrap\ModalAsset' => YII_PATH . '/bootstrap/ModalAsset.php',
'yii\bootstrap\Nav' => YII_PATH . '/bootstrap/Nav.php',
'yii\bootstrap\NavBar' => YII_PATH . '/bootstrap/NavBar.php',
'yii\bootstrap\PopoverAsset' => YII_PATH . '/bootstrap/PopoverAsset.php',
'yii\bootstrap\Progress' => YII_PATH . '/bootstrap/Progress.php',
'yii\bootstrap\ResponsiveAsset' => YII_PATH . '/bootstrap/ResponsiveAsset.php',
'yii\bootstrap\ScrollspyAsset' => YII_PATH . '/bootstrap/ScrollspyAsset.php',
'yii\bootstrap\TabAsset' => YII_PATH . '/bootstrap/TabAsset.php',
'yii\bootstrap\Tabs' => YII_PATH . '/bootstrap/Tabs.php',
'yii\bootstrap\TooltipAsset' => YII_PATH . '/bootstrap/TooltipAsset.php',
'yii\bootstrap\TransitionAsset' => YII_PATH . '/bootstrap/TransitionAsset.php',
'yii\bootstrap\Typeahead' => YII_PATH . '/bootstrap/Typeahead.php',
'yii\bootstrap\TypeaheadAsset' => YII_PATH . '/bootstrap/TypeaheadAsset.php',
'yii\bootstrap\Widget' => YII_PATH . '/bootstrap/Widget.php',
'yii\caching\ApcCache' => YII_PATH . '/caching/ApcCache.php',
'yii\caching\Cache' => YII_PATH . '/caching/Cache.php',
......@@ -110,6 +98,12 @@ return array(
'yii\db\Exception' => YII_PATH . '/db/Exception.php',
'yii\db\Expression' => YII_PATH . '/db/Expression.php',
'yii\db\Migration' => YII_PATH . '/db/Migration.php',
'yii\db\Query' => YII_PATH . '/db/Query.php',
'yii\db\QueryBuilder' => YII_PATH . '/db/QueryBuilder.php',
'yii\db\Schema' => YII_PATH . '/db/Schema.php',
'yii\db\StaleObjectException' => YII_PATH . '/db/StaleObjectException.php',
'yii\db\TableSchema' => YII_PATH . '/db/TableSchema.php',
'yii\db\Transaction' => YII_PATH . '/db/Transaction.php',
'yii\db\mssql\PDO' => YII_PATH . '/db/mssql/PDO.php',
'yii\db\mssql\QueryBuilder' => YII_PATH . '/db/mssql/QueryBuilder.php',
'yii\db\mssql\Schema' => YII_PATH . '/db/mssql/Schema.php',
......@@ -118,14 +112,14 @@ return array(
'yii\db\mysql\Schema' => YII_PATH . '/db/mysql/Schema.php',
'yii\db\pgsql\QueryBuilder' => YII_PATH . '/db/pgsql/QueryBuilder.php',
'yii\db\pgsql\Schema' => YII_PATH . '/db/pgsql/Schema.php',
'yii\db\Query' => YII_PATH . '/db/Query.php',
'yii\db\QueryBuilder' => YII_PATH . '/db/QueryBuilder.php',
'yii\db\Schema' => YII_PATH . '/db/Schema.php',
'yii\db\sqlite\QueryBuilder' => YII_PATH . '/db/sqlite/QueryBuilder.php',
'yii\db\sqlite\Schema' => YII_PATH . '/db/sqlite/Schema.php',
'yii\db\StaleObjectException' => YII_PATH . '/db/StaleObjectException.php',
'yii\db\TableSchema' => YII_PATH . '/db/TableSchema.php',
'yii\db\Transaction' => YII_PATH . '/db/Transaction.php',
'yii\grid\CheckboxColumn' => YII_PATH . '/grid/CheckboxColumn.php',
'yii\grid\Column' => YII_PATH . '/grid/Column.php',
'yii\grid\DataColumn' => YII_PATH . '/grid/DataColumn.php',
'yii\grid\GridView' => YII_PATH . '/grid/GridView.php',
'yii\grid\GridViewAsset' => YII_PATH . '/grid/GridViewAsset.php',
'yii\grid\SerialColumn' => YII_PATH . '/grid/SerialColumn.php',
'yii\helpers\ArrayHelper' => YII_PATH . '/helpers/ArrayHelper.php',
'yii\helpers\ArrayHelperBase' => YII_PATH . '/helpers/ArrayHelperBase.php',
'yii\helpers\Console' => YII_PATH . '/helpers/Console.php',
......@@ -199,6 +193,7 @@ return array(
'yii\web\Cookie' => YII_PATH . '/web/Cookie.php',
'yii\web\CookieCollection' => YII_PATH . '/web/CookieCollection.php',
'yii\web\DbSession' => YII_PATH . '/web/DbSession.php',
'yii\web\ErrorAction' => YII_PATH . '/web/ErrorAction.php',
'yii\web\HeaderCollection' => YII_PATH . '/web/HeaderCollection.php',
'yii\web\HttpCache' => YII_PATH . '/web/HttpCache.php',
'yii\web\HttpException' => YII_PATH . '/web/HttpException.php',
......@@ -229,10 +224,6 @@ return array(
'yii\widgets\ContentDecorator' => YII_PATH . '/widgets/ContentDecorator.php',
'yii\widgets\DetailView' => YII_PATH . '/widgets/DetailView.php',
'yii\widgets\FragmentCache' => YII_PATH . '/widgets/FragmentCache.php',
'yii\grid\CheckboxColumn' => YII_PATH . '/grid/CheckboxColumn.php',
'yii\grid\Column' => YII_PATH . '/grid/Column.php',
'yii\grid\DataColumn' => YII_PATH . '/grid/DataColumn.php',
'yii\grid\GridView' => YII_PATH . '/grid/GridView.php',
'yii\widgets\InputWidget' => YII_PATH . '/widgets/InputWidget.php',
'yii\widgets\LinkPager' => YII_PATH . '/widgets/LinkPager.php',
'yii\widgets\LinkSorter' => YII_PATH . '/widgets/LinkSorter.php',
......
......@@ -28,7 +28,7 @@ use yii\widgets\ActiveForm;
<?php endforeach; ?>
<div class="form-group">
<?php echo '<?php'; ?> echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
<?php echo '<?php'; ?> echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?>
</div>
<?php echo '<?php'; ?> ActiveForm::end(); ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment