/** * 加载所有的模块,设置其配置 */ function yze_load_app() { // 加载app配置 if (!file_exists(YZE_APP_PATH . "__config__.php")) { die(__("app/__config__.php not found")); } include_once YZE_APP_INC . '__config__.php'; @(include_once YZE_APP_INC . '__aros_acos__.php'); $app_module = new App_Module(); $app_module->check(); $module_include_files = $app_module->module_include_files(); foreach ((array) $module_include_files as $path) { include_once $path; } YZE_Hook::include_hooks("app", YZE_APP_INC . 'hooks'); foreach (glob(YZE_APP_MODULES_INC . "*") as $module) { $phar_wrap = ""; if (is_file($module)) { // phar $phar_wrap = "phar://"; } $module_name = strtolower(basename($module)); if ($phar_wrap) { $module_name = ucfirst(preg_replace('/\\.phar$/', "", $module_name)); } if (@file_exists("{$phar_wrap}{$module}/__module__.php")) { require_once "{$phar_wrap}{$module}/__module__.php"; $class = "\\app\\{$module_name}\\" . ucfirst($module_name) . "_Module"; $object = new $class(); $object->check(); $mappings = $object->get_module_config('routers'); if ($mappings) { YZE_Router::get_Instance()->set_Routers($module_name, $mappings); } \yangzie\YZE_Object::set_loaded_modules($module_name, array("is_phar" => $phar_wrap ? true : false)); } YZE_Hook::include_hooks($module_name, "{$phar_wrap}{$module}/hooks"); } }
/** * 返回当前请求的模块views目录,注意结尾无/ */ public function view_path() { $info = \yangzie\YZE_Object::loaded_module($this->module()); if ($info['is_phar']) { return "phar://" . YZE_APP_PATH . "modules/" . $this->module() . ".phar/views"; } else { return YZE_APP_PATH . "modules/" . $this->module() . "/views"; } }