/** * Page variable * * Checks wether a page variable is set in the sitemap and returns it * @param string $request The variable key to return * @param mixed $uri Optional segment # or URI * @return mixed */ public static function page($request, $uri = NULL) { // Use current page if no second argument if (is_null($uri)) { // Check for a cached page if (is_null(Xysti::$page)) { Xysti::$page = Xysti::sitemap_page_walk(Xysti::uri_array()); } // Take the page from the cache $page = Xysti::$page; // Segment number specified } elseif (is_int($uri)) { $page = Xysti::sitemap_page_walk(Xysti::uri_array(), $uri); // Segment string specified } elseif (is_string($uri)) { $page = Xysti::sitemap_page_walk(Xysti::uri_array($uri), Xysti::uri_count($uri)); // Segment array specified } elseif (is_string($uri)) { $page = Xysti::sitemap_page_walk(Xysti::uri_array($uri), Xysti::uri_count($uri)); } else { //Log::write('error', 'Unexpected Xysti::page(' . $request . ',' . $uri . ') call at ' . URI::current() . '.'); return Xysti::error(500, 'Unexpected Xysti::page(' . $request . ',' . $uri . ') call at ' . URI::current() . '.'); } // Fetch the meta regardless of whether a sitemap entry has been found return Xysti::meta($request, $page); // Page was found // @todo Remove this if statement on confirmation of working if ($page) { return Xysti::meta($request, $page); } else { //Log::write('error', 'Xysti::page(' . $request . ',' . $uri . ') could not be found at ' . URI::current() . '.'); return FALSE; } }