/** * Site url hook for newer koken versions */ public function siteUrlHook() { if ($this->isSitemapUrl()) { if ($cache = Shutter::get_cache($this->getCachePath())) { header('Content-type: text/xml; charset=utf-8'); echo $cache['data']; exit; } else { Koken::$cache_path = $this->getCachePath(); $xmlSitemap = $this->buildXmlSitemap(); $this->outputXmlSitemapAndExit($xmlSitemap); } } }
function kokenI18nOutput($html) { if ($_SERVER['SCRIPT_NAME'] !== "/preview.php") { Koken::$cache_path = str_replace('/cache.', '/cache.' . $this->kokenI18nCookie(true) . '.', Koken::$cache_path); } return $this->kokenI18nExpand($html); }
$format = 'F Y'; if (isset($date['day'])) { $str .= $date['day']; $format = 'F j, Y'; } else { $str .= '01'; } } else { $str .= '01-01'; } Koken::$location['parameters']['__overrides_display'][] = array('title' => 'Date', 'value' => date($format, strtotime($str))); } // Fallback path with default themes Koken::$fallback_path = $root_path . $ds . 'app' . $ds . 'site' . $ds . 'themes'; if (isset($cache_path)) { Koken::$cache_path = $cache_path; } list($site_api, $categories) = Koken::api(array('/site' . ($draft ? $preview ? '/preview:' . $preview : '/draft:true' : ''), '/categories')); # Do this separately to be sure KOKEN_ENCRYPTION_KEY has been created by the above API call $koken_key = Shutter::get_encryption_key(); $video = Koken::api('/content/types:video/limit:1/visibility:any/token:' . $koken_key); Koken::$has_video = count($video['content']) > 0; if (!is_array($site_api)) { die(file_get_contents(Koken::$fallback_path . $ds . 'error' . $ds . 'api.html')); } if (isset($site_api['error'])) { die(str_replace('<!-- ERROR -->', $site_api['error'], file_get_contents(Koken::$fallback_path . $ds . 'error' . $ds . 'json.html'))); } Koken::$site = $site_api; Koken::$profile = Koken::$site['profile']; Koken::$location['theme_path'] = $real_base_folder . '/storage/themes/' . $site_api['theme']['path'];
/** * Parses the HTML output prior to delivery to the browser and filters out languages other than that selected. * First, filters based on Babel's delimiter, then Babel's tag and finally on the user set separator. * @param string $html A string containing the HTML output. * @return string The filtered HTML. */ function parse_output($html) { Koken::$cache_path = $this->mb_str_replace('/cache.', '/cache.' . $this->langs[$this->lang]['code'] . '.', Koken::$cache_path); $html = $this->translate_navigation($html); $html = $this->translate_labels($html); $html = $this->translate_title($html); $html = $this->filter_on_delim($html); $html = $this->filter_on_tag($html); $html = $this->filter_on_sep($html); return $html; }