public function transform() { $filterChain = OutputFilterChain::getInstance(); // register filter that replaces the token with real live data if filter isn't already registered // (uses the same filter as htmlheader:gethead-Taglib) if (!$filterChain->isFilterRegistered('HtmlHeaderOutputFilter')) { $filter = new HtmlHeaderOutputFilter(); $filter->setContext($this->getContext()); $filter->setLanguage($this->getLanguage()); $filterChain->prependFilter($filter); } // place marker that will be replaced by the output filter return self::HTML_BODYJS_INDICATOR; }
/** * Executes the desired actions and creates the page output. * * @param string $namespace Namespace of the templates. * @param string $template Name of the templates. * * @return string The content of the transformed page. * * @author Christian Achatz * @version * Version 0.1, 20.01.2007<br /> * Version 0.2, 27.01.2007<br /> * Version 0.3, 31.01.2007<br /> * Version 0.4, 03.02.2007 (Added permanent actions)<br /> * Version 0.5, 08.06.2007 (Outsourced URL filtering to generic input filter)<br /> * Version 0.6, 01.07.2007 (Removed permanentpre and permanentpost actions)<br /> * Version 0.7, 29.09.2007 (Added further benchmark tags)<br /> * Version 0.8, 21.06.2008 (Introduced Registry to retrieve URLRewrite configuration)<br /> * Version 0.9, 13.10.2008 (Removed $URLRewriting parameter, because URL rewriting must be configured in the registry)<br /> * Version 1.0, 11.12.2008 (Switched to the new input filter concept)<br /> */ public function start($namespace, $template) { // check if the context is set. If not, use the current namespace $context = $this->getContext(); if (empty($context)) { $this->setContext($namespace); } // Create request and response implementations for OO abstraction $request = $this->getRequest(); $response = $this->getResponse(); $response->setContentType('text/html; charset=' . Registry::retrieve('APF\\core', 'Charset')); // apply input filter to process request $request = InputFilterChain::getInstance()->filter($request); // execute pre page create actions (see timing model) $this->runActions(Action::TYPE_PRE_PAGE_CREATE); // create new page $page = new Page(); // set context $page->setContext($this->getContext()); // set language $page->setLanguage($this->getLanguage()); // load desired design $page->loadDesign($namespace, $template); // execute actions before transformation (see timing model) $this->runActions(Action::TYPE_PRE_TRANSFORM); // transform page and apply to response $response->setBody(OutputFilterChain::getInstance()->filter($page->transform())); // execute actions after page transformation (see timing model) $this->runActions(Action::TYPE_POST_TRANSFORM); return $response; }