mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating dispatcher for automatic plugin
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5716 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a1fb0073a3
commit
45444faeb0
1 changed files with 11 additions and 7 deletions
|
@ -482,9 +482,15 @@ class Dispatcher extends Object {
|
|||
|
||||
$controller = false;
|
||||
if (!$ctrlClass = $this->__loadController($params)) {
|
||||
$params = $this->_restructureParams($params);
|
||||
if(!isset($params['plugin'])) {
|
||||
$params = $this->_restructureParams($params);
|
||||
}
|
||||
if (!$ctrlClass = $this->__loadController($params)) {
|
||||
$params = am($params, array('controller'=> $params['plugin'], 'action'=> $params['controller']));
|
||||
$params = am($params, array('controller'=> $params['plugin'],
|
||||
'action'=> $params['controller'],
|
||||
'pass' => am($params['pass'], Router::getArgs($params['action']))
|
||||
)
|
||||
);
|
||||
if (!$ctrlClass = $this->__loadController($params)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -512,19 +518,17 @@ class Dispatcher extends Object {
|
|||
$this->plugin = $params['plugin'];
|
||||
$pluginName = Inflector::camelize($params['plugin']);
|
||||
$pluginPath = $pluginName . '.';
|
||||
$this->params['controller'] = $this->plugin;
|
||||
$controller = $pluginName;
|
||||
}
|
||||
|
||||
if (!empty($params['controller'])) {
|
||||
$controller = Inflector::camelize($params['controller']);
|
||||
$ctrlClass = $controller . 'Controller';
|
||||
} elseif ($this->plugin) {
|
||||
$this->params['controller'] = $this->plugin;
|
||||
$controller = $pluginName;
|
||||
$ctrlClass = $controller . 'Controller';
|
||||
}
|
||||
|
||||
if ($pluginPath . $controller) {
|
||||
if (loadController($pluginPath . $controller)) {
|
||||
$ctrlClass = $controller . 'Controller';
|
||||
return $ctrlClass;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue