/** * Loads required view and treat the parameters. * * Receives name of View. * Parameters must to be setted on {setVars} method. * {vars} will be broken in indepentent variables * that will be named with the key concatenated with string "view_". Therefore * an array like array("name"=>"foo","id"=>0) can be accessed into view page * as $view_name and $_viewid. * This method will include the required phtml file. * * @param String $viewName * @return void */ protected function view($viewName) { if (count($this->vars) > 0) { extract($this->vars, EXTR_PREFIX_ALL, 'view'); } $controller = SYSTEM::getPureController(); $controllerIdentification = $controller; if ($controller == 'odin') { $controller = 'Home'; } else { if ($controller == 'error404') { $controller = 'Page not found'; } else { $controller = strtoupper(substr($controller, 0, 1) . substr($controller, 1, -1)); } } $action = SYSTEM::getPureAction(); $actionIdentification = $action; if ($action == 'ini') { $action = ''; } else { $action = strtoupper(substr($action, 0, 1) . substr($action, 1, -1)); } return require_once 'app/views/' . $viewName . '.phtml'; }
public static function setting() { $rsnum = CRUD::dataFetch('system', array('id' => '1')); if (!empty($rsnum)) { self::$setting = CRUD::$data[0]; foreach (self::$setting as $field => $var) { switch ($field) { case "address": if (!empty($var)) { $output['SYSTEM_MAP'] = 'https://maps.google.com.tw/maps?f=q&hl=zh-TW&geocode&q=' . $var; } break; case "ga": $var = self::gaLoad($var); break; case "email": if (empty($var)) { # 如果未設定系統 E-mail,設定初始 E-mail $var = '*****@*****.**'; self::$setting[$field] = $var; } break; case "facebook": case "gplus": case "twitter": case "instagram": case "linkedin": $output['SYSTEM_' . strtoupper($field) . '_TARGET'] = !empty($var) ? '_blank' : '_self'; $var = empty($var) ? '#' : $var; break; } $output['SYSTEM_' . strtoupper($field)] = $var; } VIEW::assignGlobal($output); } }
private static function permanent() { $router_array = array_keys(self::$cfg["lang"]); self::$root = self::$cfg["router"] == $router_array[0] ? self::$cfg["root"] : self::$cfg["root"] . self::$cfg["router"] . '/'; self::$manage = self::$root . self::$cfg["manage"]; self::$prefix = self::$cfg["prefix"]; self::$langtag = self::$cfg["langtag"]; self::$temp = self::$path . self::$cfg["temp_path"] . '_' . self::$cfg["router"] . '/' . self::$mobileDir; self::$admin_temp = self::$path . self::$cfg["admin_temp"]; self::$lang = (include self::$path . 'lang/lang-' . self::$cfg["langfix"] . '.php'); self::$temp_main = self::$cfg["temp"]['main']; self::$temp_option = self::$cfg["temp"]['option']; self::$temp_admin = self::$cfg["temp"]['admin']; SYSTEM::setting(); # 取得系統設定 new SEO(); # 啟動 SEO 功能檢測 new MAIL(); # 啟動 phpmailer new CRUMBS(); # 啟動 麵包屑功能 #### 各語系資源分開增加路徑 #### $lang_keys = array_keys(self::$cfg["lang"]); list($main_lang) = $lang_keys; if (self::$langtag != self::$cfg["lang"][$main_lang][0]) { $path_plus = self::$langtag . '/'; } ################################ VIEW::assignGlobal(array("TAG_ROOT_PATH" => self::$root, "TAG_MANAGE_PATH" => self::$manage, "TAG_THEME_PATH" => self::$cfg["images"], "TAG_CSS_PATH" => self::$cfg["css"] . self::$mobileDir, "TAG_JS_PATH" => self::$cfg["js"], "TAG_FILE_PATH" => self::$cfg["file"], "TAG_URL_PATH" => 'http://' . self::$cfg["url"] . '/', "TAG_REAL_PATH" => self::$cfg["root"], "TAG_NO_IMG" => self::$cfg["noimg"])); new LOAD(); }