pull origin

This commit is contained in:
RichWeber
2014-08-01 00:32:08 +03:00
parent 5a8bd4747d
commit 92cd13a913
411 changed files with 4872 additions and 1587 deletions

View File

@@ -30,7 +30,7 @@ use yii\di\ServiceLocator;
* @property string $layoutPath The root directory of layout files. Defaults to "[[viewPath]]/layouts".
* @property array $modules The modules (indexed by their IDs).
* @property string $uniqueId The unique ID of the module. This property is read-only.
* @property string $viewPath The root directory of view files. Defaults to "[[basePath]]/view".
* @property string $viewPath The root directory of view files. Defaults to "[[basePath]]/views".
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
@@ -106,6 +106,7 @@ class Module extends ServiceLocator
* [[Controller::defaultAction]].
*/
public $defaultRoute = 'default';
/**
* @var string the root directory of the module.
*/
@@ -127,6 +128,7 @@ class Module extends ServiceLocator
*/
private static $_instances = [];
/**
* Constructor.
* @param string $id the ID of this module
@@ -241,7 +243,7 @@ class Module extends ServiceLocator
/**
* Returns the directory that contains the view files for this module.
* @return string the root directory of view files. Defaults to "[[basePath]]/view".
* @return string the root directory of view files. Defaults to "[[basePath]]/views".
*/
public function getViewPath()
{
@@ -548,10 +550,6 @@ class Module extends ServiceLocator
*/
public function createControllerByID($id)
{
if (!preg_match('%^[a-z0-9\\-_/]+$%', $id)) {
return null;
}
$pos = strrpos($id, '/');
if ($pos === false) {
$prefix = '';
@@ -561,6 +559,13 @@ class Module extends ServiceLocator
$className = substr($id, $pos + 1);
}
if (!preg_match('%^[a-z][a-z0-9\\-_]*$%', $className)) {
return null;
}
if ($prefix !== '' && !preg_match('%^[a-z0-9_/]+$%i', $prefix)) {
return null;
}
$className = str_replace(' ', '', ucwords(str_replace('-', ' ', $className))) . 'Controller';
$className = ltrim($this->controllerNamespace . '\\' . str_replace('/', '\\', $prefix) . $className, '\\');
if (strpos($className, '-') !== false || !class_exists($className)) {