mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
backed out comment patch
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,4 +1,3 @@
|
||||
- corrected output with smarty comments (Monte)
|
||||
- corrected output with {strip} and PHP tag newlines (Monte)
|
||||
- added possibility to register function-callbacks as "array(&$obj, 'method)"
|
||||
this affects register_function(), -block, -compiler_function, -modifier,
|
||||
|
@@ -238,18 +238,8 @@ class Smarty_Compiler extends Smarty {
|
||||
}
|
||||
|
||||
/* Annihilate the comments. */
|
||||
|
||||
$_comment_search = array(
|
||||
"!{$ldq}\*.*?\*{$rdq}!s", // get all onto one line
|
||||
"!(\r|\r\n|\n)%%%SMARTY_COMMENT%%%(\r|\r\n|\n)!", // remove CR if on one line
|
||||
'!%%%SMARTY_COMMENT%%%!'); // remove remaining comments
|
||||
$_comment_replace = array(
|
||||
'%%%SMARTY_COMMENT%%%',
|
||||
'\\1',
|
||||
'');
|
||||
|
||||
$template_source = preg_replace($_comment_search,
|
||||
$_comment_replace,
|
||||
$template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se",
|
||||
"'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'",
|
||||
$template_source);
|
||||
|
||||
/* Pull out the literal blocks. */
|
||||
@@ -390,6 +380,10 @@ class Smarty_Compiler extends Smarty {
|
||||
function _compile_tag($template_tag)
|
||||
{
|
||||
|
||||
/* Matched comment. */
|
||||
if ($template_tag{0} == '*' && $template_tag{strlen($template_tag) - 1} == '*')
|
||||
return '';
|
||||
|
||||
/* Split tag into two three parts: command, command modifiers and the arguments. */
|
||||
if(! preg_match('/^(?:(' . $this->_obj_call_regexp . '|' . $this->_var_regexp
|
||||
. '|' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
|
||||
|
Reference in New Issue
Block a user