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:
gwoo 2007-10-04 05:09:26 +00:00
parent a1fb0073a3
commit 45444faeb0

View file

@ -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;
}
}