示例#1
0
 /**
  * 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;
 }
示例#2
0
    $logger = Singleton::getInstance(Logger::class);
    $logger->flushLogBuffer();
});
// Set up default link scheme configuration. In case url rewriting is required, please
// specify another link scheme within your application bootstrap file.
LinkGenerator::setLinkScheme(new DefaultLinkScheme());
// Add the front controller filter that is a wrapper on the front controller's input
// filters concerning thr url rewriting configuration. In case rewriting is required,
// please specify another input filter within your application bootstrap file according
// to your url mapping requirements (e.g. use the ChainedUrlRewritingInputFilter included
// within the APF).
// As shipped, the APF does not define an output filter since "normal" url handling
// does not require rewriting. In case rewriting is required, please specify another output
// filter according to your url mapping requirements (e.g. use the ChainedUrlRewritingOutputFilter
// included within the APF).
InputFilterChain::getInstance()->appendFilter(new ChainedStandardInputFilter());
// The 2.2/3.0 APF parser allows to globally register tags. This not only eases tag implementation and re-usage
// but also registration at a central place (bootstrap file). The following section registers all APF tags
// shipped with the release to have them available for custom tags. Tags are grouped per namespace and purpose.
// APF\core
Document::addTagLib(AddTaglibTag::class, 'core', 'addtaglib');
Document::addTagLib(AppendNodeTag::class, 'core', 'appendnode');
Document::addTagLib(ImportTemplateTag::class, 'core', 'importdesign');
Document::addTagLib(LanguageLabelTag::class, 'html', 'getstring');
Document::addTagLib(PlaceHolderTag::class, 'html', 'placeholder');
Document::addTagLib(TemplateTag::class, 'html', 'template');
Document::addTagLib(ConditionalPlaceHolderTag::class, 'cond', 'placeholder');
Document::addTagLib(ConditionalTemplateTag::class, 'cond', 'template');
// APF\tools
Document::addTagLib(HtmlFormTag::class, 'html', 'form');
Document::addTagLib(AddFormControlFilterTag::class, 'form', 'addfilter');