/** * 加载所有的模块,设置其配置 */ 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"); } }
private function __construct() { if ($this->conn) { return $this->conn; } $app_module = new App_Module(); if (!$app_module->db_name) { return; } $this->conn = new PDO('mysql:dbname=' . $app_module->get_module_config('db_name') . ';port=' . $app_module->get_module_config('db_port') . ';host=' . $app_module->get_module_config('db_host'), $app_module->get_module_config('db_user'), $app_module->get_module_config('db_psw')); $this->conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); $this->conn->query('SET NAMES ' . $app_module->get_module_config('db_charset')); }
$module = @$_GET["m"]; //load module bundle if (!$bundle && !$module) { return; } date_default_timezone_set('Asia/Chongqing'); $bundle_files = array(); if ($module) { $temp = $type == "js" ? YZE_Request::jsBundle($module) : YZE_Request::cssBundle($module); if ($temp) { foreach ($temp as $file) { $bundle_files[] = "/module-assets/{$module}/" . ltrim($file, "/"); } } } else { $app = new App_Module(); foreach (explode(",", $bundle) as $bundle) { if (empty($bundle)) { continue; } $temp = $type == "js" ? $app->js_bundle($bundle) : $app->css_bundle($bundle); if (!$temp) { continue; } $bundle_files = array_merge($bundle_files, $temp); } } $current_dir = dirname(__FILE__); $last_modified_time = 0; //找出当前文件最后一次更新时间 $files = array();