mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
small refactoring for the ClassRegistry
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7656 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5aade5b581
commit
3f8c959ab3
1 changed files with 3 additions and 4 deletions
|
@ -111,13 +111,13 @@ class ClassRegistry {
|
|||
$count = count($objects);
|
||||
foreach ($objects as $key => $settings) {
|
||||
if (is_array($settings)) {
|
||||
$plugin = null;
|
||||
$plugin = $pluginPath = null;
|
||||
$settings = array_merge($defaults, $settings);
|
||||
|
||||
$class = $settings['class'];
|
||||
if (strpos($class, '.') !== false) {
|
||||
list($plugin, $class) = explode('.', $class);
|
||||
$plugin = $plugin . '.';
|
||||
$pluginPath = $plugin . '.';
|
||||
}
|
||||
|
||||
if (empty($settings['alias'])) {
|
||||
|
@ -130,10 +130,9 @@ class ClassRegistry {
|
|||
return $model;
|
||||
}
|
||||
|
||||
if (class_exists($class) || App::import($type, $plugin . $class)) {
|
||||
if (class_exists($class) || App::import($type, $pluginPath . $class)) {
|
||||
${$class} =& new $class($settings);
|
||||
} elseif ($type === 'Model') {
|
||||
$plugin = substr($plugin, 0, -1);
|
||||
if ($plugin && class_exists($plugin . 'AppModel')) {
|
||||
$appModel = $plugin . 'AppModel';
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue