update loadlibs

This commit is contained in:
Amberstone 2024-09-28 13:16:29 +09:00
parent 9233b02ba9
commit 143eadf448
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
2 changed files with 4 additions and 3 deletions

View file

@ -55,7 +55,7 @@ for ($i = 0; $i < $ext_cnt; $i++) {
* @throws \Exception * @throws \Exception
* @return string[] * @return string[]
*/ */
function load_libs($base_dir) function load_libs($base_dir, $load_type = "class")
{ {
$base_path = realpath($base_dir); $base_path = realpath($base_dir);
if ($base_path === false) { if ($base_path === false) {
@ -73,7 +73,7 @@ function load_libs($base_dir)
if ($file->isDir()) { if ($file->isDir()) {
$parent_folder_name = $file->getFilename(); $parent_folder_name = $file->getFilename();
$class_file = $file->getPathname() . DIRECTORY_SEPARATOR . "{$parent_folder_name}.class.php"; $class_file = $file->getPathname() . DIRECTORY_SEPARATOR . "{$parent_folder_name}.{$load_type}.php";
if (file_exists($class_file)) { if (file_exists($class_file)) {
require_once $class_file; require_once $class_file;
@ -139,7 +139,8 @@ function get_embed_file($type, $path, ...$args)
include_once __DIR__ . "/classes/event/event_handler.php"; include_once __DIR__ . "/classes/event/event_handler.php";
$_system = new stdClass; $_system = new stdClass;
$_system->classes = load_libs(__DIR__ . "/classes"); $_system->classes = load_libs(__DIR__ . "/classes", "class");
$_system->addons = load_libs(__DIR__ . "/addons", "addon");
// $_system->modules = load_libs(__DIR__ . "/modules", "model"); // $_system->modules = load_libs(__DIR__ . "/modules", "model");
// $_system->modules = load_libs(__DIR__ . "/modules"); // $_system->modules = load_libs(__DIR__ . "/modules");