mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Fixing App::objects() so it will accept again the plugin syntax fro retreiving plugin objects
This commit is contained in:
parent
599a110d6b
commit
be83288806
2 changed files with 7 additions and 23 deletions
|
@ -266,10 +266,9 @@ class App {
|
||||||
foreach (self::$__packageFormat[$type] as $f) {
|
foreach (self::$__packageFormat[$type] as $f) {
|
||||||
$path[] = sprintf($f, $pluginPath);
|
$path[] = sprintf($f, $pluginPath);
|
||||||
}
|
}
|
||||||
return $path;
|
|
||||||
}
|
}
|
||||||
|
$path[] = $pluginPath . 'libs' . DS . $type . DS;
|
||||||
return $pluginPath . 'libs' . DS . $type;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$__packages[$type])) {
|
if (!isset(self::$__packages[$type])) {
|
||||||
|
@ -439,23 +438,9 @@ class App {
|
||||||
if ($type == 'plugins') {
|
if ($type == 'plugins') {
|
||||||
$extension = '/.*/';
|
$extension = '/.*/';
|
||||||
$includeDirectories = true;
|
$includeDirectories = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* $extension = false;
|
|
||||||
list($plugin, $type) = pluginSplit($type);
|
list($plugin, $type) = pluginSplit($type);
|
||||||
$name = $type;
|
|
||||||
|
|
||||||
if ($plugin) {
|
|
||||||
$path = Inflector::pluralize($type);
|
|
||||||
if ($path == 'helpers') {
|
|
||||||
$path = 'views' . DS .$path;
|
|
||||||
} elseif ($path == 'behaviors') {
|
|
||||||
$path = 'models' . DS .$path;
|
|
||||||
} elseif ($path == 'components') {
|
|
||||||
$path = 'controllers' . DS .$path;
|
|
||||||
}
|
|
||||||
$path = self::pluginPath($plugin) . $path;
|
|
||||||
$cache = false; */
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type === 'file' && !$path) {
|
if ($type === 'file' && !$path) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -472,16 +457,16 @@ class App {
|
||||||
$objects = array();
|
$objects = array();
|
||||||
|
|
||||||
if (empty($path)) {
|
if (empty($path)) {
|
||||||
$path = self::path($type);
|
$path = self::path($type, $plugin);
|
||||||
}
|
}
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
foreach ((array)$path as $dir) {
|
foreach ((array)$path as $dir) {
|
||||||
if ($dir != APP) {
|
if ($dir != APP && is_dir($dir)) {
|
||||||
$files = new RegexIterator(new DirectoryIterator($dir), $extension);
|
$files = new RegexIterator(new DirectoryIterator($dir), $extension);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (!$file->isDot() && (!$file->isDir() || $includeDirectories)) {
|
if (!$file->isDot() && (!$file->isDir() || $includeDirectories)) {
|
||||||
$objects[] = basename($file);
|
$objects[] = substr(basename($file), 0, -4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -524,7 +509,6 @@ class App {
|
||||||
|
|
||||||
public static function load($className) {
|
public static function load($className) {
|
||||||
if (isset(self::$__classMap[$className])) {
|
if (isset(self::$__classMap[$className])) {
|
||||||
|
|
||||||
if ($file = self::__mapped($className)) {
|
if ($file = self::__mapped($className)) {
|
||||||
return include $file;
|
return include $file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue