$here = str_replace('/page/' . $url_vars['page'], '', $url); $url = preg_replace('~/+~', '/', str_replace($to_replace, '', $here)); if (empty($url)) { $url = '/'; } if (empty($here)) { $here = '/'; } require 'Koken.php'; Koken::start(); Koken::$protocol = $protocol; Koken::$original_url = $original_url; Koken::$root_path = $root_path; Koken::$draft = $draft; Koken::$preview = $preview; Koken::$rewrite = $rewrite; Koken::$pjax = $pjax; Koken::$location = array('root' => $base_path, 'root_folder' => $base_folder, 'real_root_folder' => $real_base_folder, 'here' => $here, 'rewrite' => $rewrite, 'parameters' => $url_vars, 'host' => $protocol . '://' . $_SERVER['HTTP_HOST'], 'hostname' => $_SERVER['HTTP_HOST'], 'site_url' => $protocol . '://' . $_SERVER['HTTP_HOST'] . $base_folder, 'preview' => $preview, 'draft' => $draft); Koken::$rss_feeds = array('contents' => "{$base_path}/feed/content/recent.rss", 'essays' => "{$base_path}/feed/essays/recent.rss", 'timeline' => "{$base_path}/feed/timeline/recent.rss"); Shutter::hook('site.url', array($url)); // Enable caching in case .htaccess missed it or isn't available if ($_SERVER['REQUEST_METHOD'] === 'GET' && (!$draft || $preview) && !isset($_GET['default_link']) && !isset($_COOKIE['share_to_tumblr'])) { $cache_url = rtrim($cache_url, '/'); $css = $js = false; if (preg_match('/\\.css\\.lens$/', $cache_url)) { $css = true; $cache_url = $base_path . $cache_url; } else { if ($cache_url === '/koken.js') { $js = true; $cache_url = $base_path . $cache_url;