mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 09:32:43 +00:00
refactor Dispatcher::__getController to pass all tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5697 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
34a88741bf
commit
18ab04b32b
3 changed files with 50 additions and 47 deletions
|
@ -340,6 +340,7 @@
|
|||
if ($name === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$parent = 'AppController';
|
||||
if (strpos($name, '.') !== false) {
|
||||
list($plugin, $name) = explode('.', $name);
|
||||
|
@ -357,7 +358,7 @@
|
|||
}
|
||||
|
||||
if (empty($name)) {
|
||||
if (!class_exists(Inflector::camelize($plugin . 'controller'))) {
|
||||
if (!class_exists(Inflector::camelize($plugin . 'Controller'))) {
|
||||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
|
@ -366,10 +367,8 @@
|
|||
}
|
||||
|
||||
if (!class_exists($name . 'Controller')) {
|
||||
|
||||
$name = Inflector::underscore($name);
|
||||
$file = APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $name . '_controller.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require($file);
|
||||
return true;
|
||||
|
@ -377,17 +376,15 @@
|
|||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$className = $name . 'Controller';
|
||||
|
||||
if (class_exists($className)) {
|
||||
if (class_exists($className) && low(get_parent_class($className)) !== low($name . 'AppController')) {
|
||||
return true;
|
||||
} else {
|
||||
$name = Inflector::underscore($className);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue