mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Added Recursive class loading in FolderPluginLoader
This commit is contained in:
parent
a7269c7900
commit
b59926bece
@ -96,17 +96,6 @@ namespace PocketMine {
|
|||||||
if(file_exists($fPath)){
|
if(file_exists($fPath)){
|
||||||
require_once($fPath);
|
require_once($fPath);
|
||||||
}
|
}
|
||||||
}else{ //Try plugin
|
|
||||||
$className = array_pop($path);
|
|
||||||
if(count($path) > 0){
|
|
||||||
$path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR;
|
|
||||||
}else{
|
|
||||||
$path = "";
|
|
||||||
}
|
|
||||||
$fPath = \PocketMine\PATH . "plugins" . DIRECTORY_SEPARATOR . $parent . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php";
|
|
||||||
if(file_exists($fPath)){
|
|
||||||
require_once($fPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,6 +59,12 @@ class FolderPluginLoader implements PluginLoader{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($file . "/src/")) as $fName){
|
||||||
|
if(strtolower(substr($fName, -4)) === ".php"){
|
||||||
|
include_once($fName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$className = $description->getMain();
|
$className = $description->getMain();
|
||||||
if(class_exists($className, true)){ //call autoloader, TODO: replace this with a specific Plugin autoload
|
if(class_exists($className, true)){ //call autoloader, TODO: replace this with a specific Plugin autoload
|
||||||
$plugin = new $className();
|
$plugin = new $className();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user