Contao\FrontendTemplate::compile PHP Method

compile() protected method

Compile the template
protected compile ( )
    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();
    }