public static final function getSetting($class, $setting) { return Kwf_Component_Settings::getSetting($class, $setting); }
public static function dispatchKwc() { $requestPath = self::getRequestPath(); if ($requestPath === false) { return; } $fullRequestPath = $requestPath; $data = null; $baseUrl = Kwf_Setup::getBaseUrl(); if ($baseUrl) { if (substr($requestPath, 0, strlen($baseUrl)) != $baseUrl) { throw new Kwf_Exception_NotFound(); } $requestPath = substr($requestPath, strlen($baseUrl)); } $uri = substr($requestPath, 1); $i = strpos($uri, '/'); if ($i) { $uri = substr($uri, 0, $i); } if ($uri == 'robots.txt') { Kwf_Util_RobotsTxt::output(); } if ($uri == 'sitemap.xml') { $data = Kwf_Component_Data_Root::getInstance()->getPageByUrl('http://' . $_SERVER['HTTP_HOST'] . Kwf_Setup::getBaseUrl() . '/', null); Kwf_Component_Sitemap::output($data->getDomainComponent()); } if (!in_array($uri, array('media', 'kwf', 'admin', 'assets', 'vkwf', 'api'))) { if (!isset($_SERVER['HTTP_HOST'])) { $requestUrl = 'http://' . Kwf_Config::getValue('server.domain') . $fullRequestPath; } else { $requestUrl = 'http://' . $_SERVER['HTTP_HOST'] . $fullRequestPath; } Kwf_Trl::getInstance()->setUseUserLanguage(false); $root = Kwf_Component_Data_Root::getInstance(); foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_PreDispatch') as $p) { $p->preDispatch($requestUrl); } $acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null; $exactMatch = true; $data = $root->getPageByUrl($requestUrl, $acceptLanguage, $exactMatch); Kwf_Benchmark::checkpoint('getPageByUrl'); if (!$data) { throw new Kwf_Exception_NotFound(); } if (!$exactMatch) { if (rawurldecode($data->url) == $fullRequestPath) { throw new Kwf_Exception("getPageByUrl reported this isn't an exact match, but the urls are equal. wtf."); } $url = $data->url; if (!$url) { // e.g. firstChildPageData without child pages throw new Kwf_Exception_NotFound(); } foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_PostRender') as $p) { $url = $p->processUrl($url); } if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { $url .= '?' . $_SERVER['QUERY_STRING']; } header('Location: ' . $url, true, 301); exit; } $root->setCurrentPage($data); Kwf_User_Autologin::processCookies(); $contentSender = Kwf_Component_Settings::getSetting($data->componentClass, 'contentSender'); $contentSender = new $contentSender($data); $contentSender->sendContent(true); Kwf_Benchmark::shutDown(); //TODO: ein flag oder sowas ähnliches stattdessen verwenden if ($data instanceof Kwc_Abstract_Feed_Component || $data instanceof Kwc_Export_Xml_Component || $data instanceof Kwc_Export_Xml_Trl_Component) { echo "<!--"; } Kwf_Benchmark::output(); if ($data instanceof Kwc_Abstract_Feed_Component || $data instanceof Kwc_Export_Xml_Component || $data instanceof Kwc_Export_Xml_Trl_Component) { echo "-->"; } exit; } else { if ($requestPath == '/kwf/util/kwc/render') { Kwf_User_Autologin::processCookies(); Kwf_Util_Component::dispatchRender(); } } }