compile() защищенный Метод

Compile the template
protected compile ( )
Пример #1
0
 /**
  * Compile the template
  *
  * @param bool $blnCheckRequest If true, check for unsued $_GET parameters
  *
  * @throws \UnusedArgumentsException If there are unused $_GET parameters
  *
  * @internal Do not call this method in your code. It will be made private in Contao 5.0.
  */
 protected function compile($blnCheckRequest = false)
 {
     $this->keywords = '';
     $arrKeywords = array_map('trim', explode(',', $GLOBALS['TL_KEYWORDS']));
     // Add the meta keywords
     if (strlen($arrKeywords[0])) {
         $this->keywords = str_replace(array("\n", "\r", '"'), array(' ', '', ''), implode(', ', array_unique($arrKeywords)));
     }
     // Parse the template
     $this->strBuffer = $this->parse();
     // HOOK: add custom output filters
     if (isset($GLOBALS['TL_HOOKS']['outputFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputFrontendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputFrontendTemplate'] as $callback) {
             $this->import($callback[0]);
             $this->strBuffer = $this->{$callback[0]}->{$callback[1]}($this->strBuffer, $this->strTemplate);
         }
     }
     // Add the output to the cache
     $this->addToCache();
     // Unset only after the output has been cached (see #7824)
     unset($_SESSION['LOGIN_ERROR']);
     // Replace insert tags and then re-replace the request_token tag in case a form element has been loaded via insert tag
     $this->strBuffer = $this->replaceInsertTags($this->strBuffer, false);
     $this->strBuffer = str_replace(array('{{request_token}}', '[{]', '[}]'), array(REQUEST_TOKEN, '{{', '}}'), $this->strBuffer);
     $this->strBuffer = $this->replaceDynamicScriptTags($this->strBuffer);
     // see #4203
     // HOOK: allow to modify the compiled markup (see #4291)
     if (isset($GLOBALS['TL_HOOKS']['modifyFrontendPage']) && is_array($GLOBALS['TL_HOOKS']['modifyFrontendPage'])) {
         foreach ($GLOBALS['TL_HOOKS']['modifyFrontendPage'] as $callback) {
             $this->import($callback[0]);
             $this->strBuffer = $this->{$callback[0]}->{$callback[1]}($this->strBuffer, $this->strTemplate);
         }
     }
     // Check whether all $_GET parameters have been used (see #4277)
     if ($blnCheckRequest && \Input::hasUnusedGet()) {
         throw new \UnusedArgumentsException();
     }
     parent::compile();
 }
Пример #2
0
 /**
  * Compile the template
  *
  * @throws \UnusedArgumentsException If there are unused $_GET parameters
  *
  * @internal Do not call this method in your code. It will be made private in Contao 5.0.
  */
 protected function compile()
 {
     $this->keywords = '';
     $arrKeywords = \StringUtil::trimsplit(',', $GLOBALS['TL_KEYWORDS']);
     // Add the meta keywords
     if (strlen($arrKeywords[0])) {
         $this->keywords = str_replace(array("\n", "\r", '"'), array(' ', '', ''), implode(', ', array_unique($arrKeywords)));
     }
     // Parse the template
     $this->strBuffer = $this->parse();
     // HOOK: add custom output filters
     if (isset($GLOBALS['TL_HOOKS']['outputFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputFrontendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['outputFrontendTemplate'] as $callback) {
             $this->import($callback[0]);
             $this->strBuffer = $this->{$callback[0]}->{$callback[1]}($this->strBuffer, $this->strTemplate);
         }
     }
     // Replace insert tags
     $this->strBuffer = $this->replaceInsertTags($this->strBuffer);
     $this->strBuffer = $this->replaceDynamicScriptTags($this->strBuffer);
     // see #4203
     // HOOK: allow to modify the compiled markup (see #4291)
     if (isset($GLOBALS['TL_HOOKS']['modifyFrontendPage']) && is_array($GLOBALS['TL_HOOKS']['modifyFrontendPage'])) {
         foreach ($GLOBALS['TL_HOOKS']['modifyFrontendPage'] as $callback) {
             $this->import($callback[0]);
             $this->strBuffer = $this->{$callback[0]}->{$callback[1]}($this->strBuffer, $this->strTemplate);
         }
     }
     // Check whether all $_GET parameters have been used (see #4277)
     if ($this->blnCheckRequest && \Input::hasUnusedGet()) {
         throw new \UnusedArgumentsException();
     }
     parent::compile();
 }