/** * KYPageクラスのシングルトンです。 * * @return object KYPageのインスタンス * * @example private/library/example/instance.php */ public static function instance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
/** * Process URI * * @access private */ private function process_uri() { // Process URI $uri = explode("/", $_SERVER['REQUEST_URI']); $this_url = WWW . "/page"; while (true) { $page_name = $uri[count($uri) - 1]; $page_name = preg_split("/\\?/", $page_name); $page_name = $page_name[0]; KYPage::instance()->name($page_name); $this->_common_html_path = PATH_PUBLIC . "/html/common.html"; $this->_common_php_path = PATH_PRIVATE . "/php/common.php"; $this->_page_html_path = PATH_PUBLIC . "/html/{$page_name}.html"; $page_html_mobile_path = PATH_PUBLIC . "/html/{$page_name}_mobile.html"; $this->_page_php_path = PATH_PRIVATE . "/php/{$page_name}.php"; // Is common html if ($page_name === "common") { header("Location: " . WWW); exit; } // Find html (mobile) if (KYWeb::page()->is_mobile() == true && file_exists($page_html_mobile_path) == true) { $this->_page_html_path = $page_html_mobile_path; } // Find html or php if (file_exists($this->_page_html_path) == true || file_exists($this->_page_php_path) == true) { if (file_exists($this->_page_html_path) == false) { $this->_page_html_path = ""; } if (file_exists($this->_page_php_path) == false) { $this->_page_php_path = ""; } return $this; } // Not find html and php if (implode("/", $uri) != $this_url) { array_pop($uri); if (count($uri) <= 0) { header("Location: " . WWW); exit; } } else { // Is root page header("Location: " . WWW); exit; } } }