diff options
author | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-12-11 20:15:27 +0000 |
---|---|---|
committer | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-12-11 20:15:27 +0000 |
commit | 967ab871b836f618107fe144978bd1453c3c6634 (patch) | |
tree | 1bcb1b4bb1b25c904a2bc06f5c6d526d29909eaa /library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php | |
parent | 960c35bad3a0dbaa7a1f2191aef60ad014d926ca (diff) | |
download | volse-hubzilla-967ab871b836f618107fe144978bd1453c3c6634.tar.gz volse-hubzilla-967ab871b836f618107fe144978bd1453c3c6634.tar.bz2 volse-hubzilla-967ab871b836f618107fe144978bd1453c3c6634.zip |
Update Smarty
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php b/library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php index 1ec1aa430..50bd16ef2 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php @@ -1,27 +1,26 @@ <?php /** * Smarty Internal Plugin Smarty Template Compiler Base + * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser * - * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser - * - * @package Smarty + * @package Smarty * @subpackage Compiler - * @author Uwe Tews + * @author Uwe Tews */ /** * @ignore */ -include ("smarty_internal_parsetree.php"); +include 'smarty_internal_parsetree.php'; /** * Class SmartyTemplateCompiler * - * @package Smarty + * @package Smarty * @subpackage Compiler */ -class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase { - +class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase +{ /** * Lexer class name * @@ -81,10 +80,11 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom } /** - * Methode to compile a Smarty template + * method to compile a Smarty template * * @param mixed $_content template source - * @return bool true if compiling succeeded, false if it failed + * + * @return bool true if compiling succeeded, false if it failed */ protected function doCompile($_content) { @@ -94,8 +94,21 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom // init the lexer/parser to compile the template $this->lex = new $this->lexer_class($_content, $this); $this->parser = new $this->parser_class($this->lex, $this); - if ($this->smarty->_parserdebug) + if ($this->inheritance_child) { + // start state on child templates + $this->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY); + } + if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); + } else { + $mbEncoding = null; + } + + if ($this->smarty->_parserdebug) { $this->parser->PrintTrace(); + $this->lex->PrintTrace(); + } // get tokens from lexer and parse them while ($this->lex->yylex() && !$this->abort_and_recompile) { if ($this->smarty->_parserdebug) { @@ -111,17 +124,17 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom } // finish parsing process $this->parser->doParse(0, 0); + if ($mbEncoding) { + mb_internal_encoding($mbEncoding); + } // check for unclosed tags if (count($this->_tag_stack) > 0) { // get stacked info list($openTag, $_data) = array_pop($this->_tag_stack); - $this->trigger_template_error("unclosed {" . $openTag . "} tag"); + $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag . "{$this->smarty->right_delimiter} tag"); } // return compiled code // return str_replace(array("? >\n<?php","? ><?php"), array('',''), $this->parser->retvalue); return $this->parser->retvalue; } - } - -?>
\ No newline at end of file |