mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-03 18:12:40 +00:00
Refactoring loading of plugins.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5464 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b29366ddc0
commit
ea15f09288
3 changed files with 48 additions and 52 deletions
|
@ -320,15 +320,15 @@
|
|||
if ($name === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$parent = 'AppController';
|
||||
if (strpos($name, '.') !== false) {
|
||||
list($plugin, $name) = explode('.', $name);
|
||||
|
||||
$pluginAppController = Inflector::camelize($plugin . '_app_controller');
|
||||
$parent = Inflector::camelize($plugin . '_app_controller');
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
$pluginAppControllerFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_controller.php';
|
||||
|
||||
if (!class_exists($pluginAppController)) {
|
||||
if (!class_exists($parent)) {
|
||||
if (file_exists($pluginAppControllerFile)) {
|
||||
require($pluginAppControllerFile);
|
||||
} else {
|
||||
|
@ -346,6 +346,7 @@
|
|||
}
|
||||
|
||||
if (!class_exists($name . 'Controller')) {
|
||||
|
||||
$name = Inflector::underscore($name);
|
||||
$file = APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $name . '_controller.php';
|
||||
|
||||
|
@ -365,7 +366,8 @@
|
|||
}
|
||||
|
||||
$className = $name . 'Controller';
|
||||
if (class_exists($className)) {
|
||||
|
||||
if (class_exists($className) && get_parent_class($className) == $parent) {
|
||||
return true;
|
||||
} else {
|
||||
$name = Inflector::underscore($className);
|
||||
|
@ -1629,4 +1631,4 @@
|
|||
}
|
||||
return $val2;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue