예제 #1
0
 static function load($module_name)
 {
     if (!($path = Find::dir_in("modules", $module_name))) {
         throw new \Exception("Module '{$module_name}' not found");
     }
     if (file_exists($path . "init.php")) {
         include $path . "init.php";
     }
     // add to autoloader
     Autoload::add_path($path . "classes");
     // add module instance to stack
     $class_name = "\\Fw\\Module\\" . ucfirst($module_name);
     if (class_exists($class_name)) {
         self::register(new $class_name());
     } else {
         throw new \Exception("Module Class '{$class_name}' not found");
     }
 }