/** * 加载视图文件 */ protected function load_view_file($view_file) { if (!is_file($view_file)) { App::display_error(lang('app-8') . ': ' . $view_file); } $view_content = file_get_contents($view_file); return $this->handle_view_file($view_content); }
/** * 插件调用模板文件(文件为PHP文件) */ public function display($file) { $filename = PLUGIN_DIR . App::get_plugin_id() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $file . '.php'; if (!file_exists($filename)) { App::display_error(lang('app-12', array('1' => $file))); } //分析视图变量 $this->_options['viewpath'] = SITE_PATH . basename(PLUGIN_DIR) . '/' . APP_DIR . '/views/'; extract($this->_options, EXTR_PREFIX_SAME, 'data'); //清空不必要的内存占用 require $filename; }
/** * 静态加载项目设置目录(config目录)中的配置文件 */ public static function load_config($file_name) { if (!$file_name) { return false; } static $_config = array(); if (!isset($_config[$file_name]) || $_config[$file_name] == null) { $file_url = CONFIG_DIR . $file_name . '.ini.php'; if (!is_file($file_url)) { App::display_error(lang('app-11', array('1' => $file_name))); } $_config[$file_name] = (include $file_url); } return $_config[$file_name]; }