mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||||
|
10.02.2016
|
||||||
|
- bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177
|
||||||
|
|
||||||
09.02.2016
|
09.02.2016
|
||||||
- move some code from parser into compiler
|
- move some code from parser into compiler
|
||||||
- reformat all code for unique style
|
- reformat all code for unique style
|
||||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.30-dev/31';
|
const SMARTY_VERSION = '3.1.30-dev/32';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -54,6 +54,9 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
|||||||
{
|
{
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
|
//Does tag create output
|
||||||
|
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
|
||||||
|
|
||||||
$nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache);
|
$nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache);
|
||||||
if (!$nocacheParam) {
|
if (!$nocacheParam) {
|
||||||
// do not compile as nocache code
|
// do not compile as nocache code
|
||||||
@@ -140,7 +143,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
|||||||
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
|
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$compiler->has_output = true;
|
|
||||||
if ($_smarty_tpl->caching && !$nocacheParam) {
|
if ($_smarty_tpl->caching && !$nocacheParam) {
|
||||||
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
|
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
|
||||||
} else {
|
} else {
|
||||||
|
@@ -77,8 +77,8 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
|||||||
}
|
}
|
||||||
// closing tag of block plugin, restore nocache
|
// closing tag of block plugin, restore nocache
|
||||||
list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, - 5));
|
list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, - 5));
|
||||||
// This tag does create output
|
//Does tag create output
|
||||||
$compiler->has_output = true;
|
$compiler->has_output = isset($_params[ 'assign' ]) ? false : true;
|
||||||
// compile code
|
// compile code
|
||||||
if (!isset($parameter[ 'modifier_list' ])) {
|
if (!isset($parameter[ 'modifier_list' ])) {
|
||||||
$mod_pre = $mod_post = $mod_content = '';
|
$mod_pre = $mod_post = $mod_content = '';
|
||||||
|
@@ -45,11 +45,11 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
|
|||||||
*/
|
*/
|
||||||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function)
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function)
|
||||||
{
|
{
|
||||||
// This tag does create output
|
|
||||||
$compiler->has_output = true;
|
|
||||||
|
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
|
//Does tag create output
|
||||||
|
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
|
||||||
|
|
||||||
if ($_attr[ 'nocache' ] === true) {
|
if ($_attr[ 'nocache' ] === true) {
|
||||||
$compiler->tag_nocache = true;
|
$compiler->tag_nocache = true;
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,9 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
|||||||
{
|
{
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
|
//Does tag create output
|
||||||
|
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
|
||||||
|
|
||||||
if ($_attr[ 'nocache' ] === true) {
|
if ($_attr[ 'nocache' ] === true) {
|
||||||
$compiler->tag_nocache = true;
|
$compiler->tag_nocache = true;
|
||||||
}
|
}
|
||||||
@@ -72,8 +75,6 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_assign)) {
|
if (empty($_assign)) {
|
||||||
// This tag does create output
|
|
||||||
$compiler->has_output = true;
|
|
||||||
$output = "<?php echo {$return};?>\n";
|
$output = "<?php echo {$return};?>\n";
|
||||||
} else {
|
} else {
|
||||||
$output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n";
|
$output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n";
|
||||||
|
@@ -36,10 +36,11 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
|||||||
*/
|
*/
|
||||||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag)
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag)
|
||||||
{
|
{
|
||||||
// This tag does create output
|
|
||||||
$compiler->has_output = true;
|
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
|
//Does tag create output
|
||||||
|
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
|
||||||
|
|
||||||
if ($_attr[ 'nocache' ]) {
|
if ($_attr[ 'nocache' ]) {
|
||||||
$compiler->tag_nocache = true;
|
$compiler->tag_nocache = true;
|
||||||
}
|
}
|
||||||
|
@@ -794,8 +794,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if ((string) $text != '') {
|
if ((string) $text != '') {
|
||||||
$store = array();
|
$store = array();
|
||||||
$_store = 0;
|
$_store = 0;
|
||||||
$_offset = 0;
|
$space = '';
|
||||||
if ($this->parser->strip) {
|
if ($this->parser->strip) {
|
||||||
|
$space = $this->has_output && preg_match('/^\040|\011/', $text) ? ' ' : '';
|
||||||
|
$this->has_output = false;
|
||||||
|
|
||||||
if (strpos($text, '<') !== false) {
|
if (strpos($text, '<') !== false) {
|
||||||
// capture html elements not to be messed with
|
// capture html elements not to be messed with
|
||||||
$_offset = 0;
|
$_offset = 0;
|
||||||
@@ -836,7 +839,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$text = preg_replace($this->stripRegEx, '', $text);
|
$text = preg_replace($this->stripRegEx, '', $text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Smarty_Internal_ParseTree_Text($text);
|
return new Smarty_Internal_ParseTree_Text($space . $text);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user