mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
bugfix rework of newline spacing between tag code and template text.
now again identical with Smarty2 (forum topic 26878)
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
===== 3.1.32 - dev ===
|
===== 3.1.32 - dev ===
|
||||||
|
20.11.2017
|
||||||
|
- bugfix rework of newline spacing between tag code and template text.
|
||||||
|
now again identical with Smarty2 (forum topic 26878)
|
||||||
|
|
||||||
05.11.2017
|
05.11.2017
|
||||||
- lexer/parser optimization
|
- lexer/parser optimization
|
||||||
- code cleanup and optimizations
|
- code cleanup and optimizations
|
||||||
|
@@ -340,7 +340,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||||
}
|
}
|
||||||
comment {
|
comment {
|
||||||
preg_match("/[*]{$this->compiler->getRdelPreg()}/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||||
if (isset($match[0][1])) {
|
if (isset($match[0][1])) {
|
||||||
$to = $match[0][1] + strlen($match[0][0]);
|
$to = $match[0][1] + strlen($match[0][0]);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.32-dev-35';
|
const SMARTY_VERSION = '3.1.32-dev-36';
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
*/
|
*/
|
||||||
@@ -921,7 +921,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param object $parent next higher level of Smarty variables
|
* @param object $parent next higher level of Smarty variables
|
||||||
* @param boolean $do_clone flag is Smarty object shall be cloned
|
* @param boolean $do_clone flag is Smarty object shall be cloned
|
||||||
*
|
*
|
||||||
* @return object template object
|
* @return \Smarty_Internal_Template template object
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
|
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
|
||||||
|
@@ -5,15 +5,15 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsFilter
|
* @subpackage PluginsFilter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty htmlspecialchars variablefilter plugin
|
* Smarty htmlspecialchars variablefilter plugin
|
||||||
*
|
*
|
||||||
* @param string $source input string
|
* @param string $source input string
|
||||||
|
* @param \Smarty_Internal_Template $template
|
||||||
*
|
*
|
||||||
* @return string filtered output
|
* @return string filtered output
|
||||||
*/
|
*/
|
||||||
function smarty_variablefilter_htmlspecialchars($source)
|
function smarty_variablefilter_htmlspecialchars($source, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
|
return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
|
||||||
}
|
}
|
||||||
|
@@ -85,9 +85,9 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
|
|||||||
$output .= "settype(\$_tmp_array, 'array');\n";
|
$output .= "settype(\$_tmp_array, 'array');\n";
|
||||||
$output .= "}\n";
|
$output .= "}\n";
|
||||||
$output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
|
$output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
|
||||||
$output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});\n?>";
|
$output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});?>";
|
||||||
} else {
|
} else {
|
||||||
$output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});\n?>";
|
$output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});?>";
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@@ -123,7 +123,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
|
|||||||
$compiler->trigger_template_error(" '\$smarty.block.{$name}' used outside {block} tags ",
|
$compiler->trigger_template_error(" '\$smarty.block.{$name}' used outside {block} tags ",
|
||||||
$compiler->parser->lex->taglineno);
|
$compiler->parser->lex->taglineno);
|
||||||
}
|
}
|
||||||
$compiler->has_code = true;
|
|
||||||
$compiler->suppressNocacheProcessing = true;
|
$compiler->suppressNocacheProcessing = true;
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'child':
|
case 'child':
|
||||||
@@ -235,7 +234,6 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
|
|||||||
if ($compiler->_cache['blockNesting'] === 0) {
|
if ($compiler->_cache['blockNesting'] === 0) {
|
||||||
unset($compiler->_cache['blockNesting']);
|
unset($compiler->_cache['blockNesting']);
|
||||||
}
|
}
|
||||||
$compiler->has_code = true;
|
|
||||||
$compiler->suppressNocacheProcessing = true;
|
$compiler->suppressNocacheProcessing = true;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
|
|||||||
'<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' .
|
'<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' .
|
||||||
(isset($template) ?
|
(isset($template) ?
|
||||||
", {$template}{$inlineUids}" :
|
", {$template}{$inlineUids}" :
|
||||||
'') . ");\n?>\n");
|
'') . ");\n?>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -164,7 +164,7 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
|
|||||||
if ($openTag !== 'forelse') {
|
if ($openTag !== 'forelse') {
|
||||||
$output .= "}\n";
|
$output .= "}\n";
|
||||||
}
|
}
|
||||||
$output .= "?>\n";
|
$output .= "?>";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -262,7 +262,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
|||||||
*/
|
*/
|
||||||
public function compileRestore($levels)
|
public function compileRestore($levels)
|
||||||
{
|
{
|
||||||
return "\$_smarty_tpl->smarty->ext->_foreach->restore(\$_smarty_tpl, {$levels});\n";
|
return "\$_smarty_tpl->smarty->ext->_foreach->restore(\$_smarty_tpl, {$levels});";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
|
|||||||
if ($restore === 2) {
|
if ($restore === 2) {
|
||||||
$output .= "{$itemVar} = {$local}saved;\n";
|
$output .= "{$itemVar} = {$local}saved;\n";
|
||||||
}
|
}
|
||||||
$output .= "}\n} else {\n?>\n";
|
$output .= "}\n} else {\n?>";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
|
|||||||
/* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
|
/* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
|
||||||
$foreachCompiler = $compiler->getTagCompiler('foreach');
|
$foreachCompiler = $compiler->getTagCompiler('foreach');
|
||||||
$output .= $foreachCompiler->compileRestore(1);
|
$output .= $foreachCompiler->compileRestore(1);
|
||||||
$output .= "?>\n";
|
$output .= "?>";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -132,7 +132,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
$output = "<?php\n";
|
$output = "<?php\n";
|
||||||
$output .= "/* {$_funcNameCaching} */\n";
|
$output .= "/* {$_funcNameCaching} */\n";
|
||||||
$output .= "if (!function_exists('{$_funcNameCaching}')) {\n";
|
$output .= "if (!function_exists('{$_funcNameCaching}')) {\n";
|
||||||
$output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n";
|
$output .= "function {$_funcNameCaching} (Smarty_Internal_Template \$_smarty_tpl,\$params) {\n";
|
||||||
$output .= "ob_start();\n";
|
$output .= "ob_start();\n";
|
||||||
$output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n";
|
$output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n";
|
||||||
$output .= $_paramsCode;
|
$output .= $_paramsCode;
|
||||||
@@ -164,7 +164,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
$output = "<?php\n";
|
$output = "<?php\n";
|
||||||
$output .= "/* {$_funcName} */\n";
|
$output .= "/* {$_funcName} */\n";
|
||||||
$output .= "if (!function_exists('{$_funcName}')) {\n";
|
$output .= "if (!function_exists('{$_funcName}')) {\n";
|
||||||
$output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n";
|
$output .= "function {$_funcName}(Smarty_Internal_Template \$_smarty_tpl,\$params) {\n";
|
||||||
$output .= $_paramsCode;
|
$output .= $_paramsCode;
|
||||||
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>";
|
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||||
|
@@ -239,7 +239,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
if ($update_compile_id) {
|
if ($update_compile_id) {
|
||||||
$_output .= $compiler->makeNocacheCode("\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n");
|
$_output .= $compiler->makeNocacheCode("\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n");
|
||||||
}
|
}
|
||||||
$_output .= "?>\n";
|
$_output .= "?>";
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
if ($call_nocache) {
|
if ($call_nocache) {
|
||||||
@@ -260,7 +260,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
if ($update_compile_id) {
|
if ($update_compile_id) {
|
||||||
$_output .= "\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n";
|
$_output .= "\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n";
|
||||||
}
|
}
|
||||||
$_output .= "?>\n";
|
$_output .= "?>";
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
// get compiled code
|
// get compiled code
|
||||||
$compiled_code = "<?php\n\n";
|
$compiled_code = "<?php\n\n";
|
||||||
$compiled_code .= "/* Start inline template \"{$sourceInfo}\" =============================*/\n";
|
$compiled_code .= "/* Start inline template \"{$sourceInfo}\" =============================*/\n";
|
||||||
$compiled_code .= "function {$tpl->compiled->unifunc} (\$_smarty_tpl) {\n";
|
$compiled_code .= "function {$tpl->compiled->unifunc} (Smarty_Internal_Template \$_smarty_tpl) {\n";
|
||||||
$compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler);
|
$compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler);
|
||||||
$compiled_code .= "<?php\n";
|
$compiled_code .= "<?php\n";
|
||||||
$compiled_code .= "}\n?>\n";
|
$compiled_code .= "}\n?>\n";
|
||||||
|
@@ -52,8 +52,6 @@ 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
|
||||||
|
@@ -32,9 +32,6 @@ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase
|
|||||||
if ($_attr[ 'nocache' ] === true) {
|
if ($_attr[ 'nocache' ] === true) {
|
||||||
$compiler->trigger_template_error('nocache option not allowed', null, true);
|
$compiler->trigger_template_error('nocache option not allowed', null, true);
|
||||||
}
|
}
|
||||||
// this tag does not return compiled code
|
|
||||||
$compiler->has_code = true;
|
|
||||||
|
|
||||||
return $compiler->smarty->left_delimiter;
|
return $compiler->smarty->left_delimiter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,6 @@ class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase
|
|||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
if ($compiler->template->caching) {
|
if ($compiler->template->caching) {
|
||||||
$output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
|
$output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
|
||||||
$compiler->has_code = true;
|
|
||||||
$compiler->template->compiled->has_nocache_code = true;
|
$compiler->template->compiled->has_nocache_code = true;
|
||||||
$compiler->suppressNocacheProcessing = true;
|
$compiler->suppressNocacheProcessing = true;
|
||||||
return $output;
|
return $output;
|
||||||
|
@@ -65,7 +65,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
|||||||
$output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n";
|
$output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n";
|
||||||
}
|
}
|
||||||
$output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n";
|
$output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n";
|
||||||
$output .= "\$_block_repeat=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat);\nwhile (\$_block_repeat) {\nob_start();\n?>";
|
$output .= "\$_block_repeat=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat);\nwhile (\$_block_repeat) {\nob_start();?>";
|
||||||
$this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback));
|
$this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback));
|
||||||
// maybe nocache because of nocache variables or nocache plugin
|
// maybe nocache because of nocache variables or nocache plugin
|
||||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||||
@@ -76,8 +76,6 @@ 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));
|
||||||
//Does tag create output
|
|
||||||
$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 = '';
|
||||||
@@ -93,7 +91,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
|||||||
$output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n";
|
$output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n";
|
||||||
$output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>';
|
$output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>';
|
||||||
}
|
}
|
||||||
return $output . "\n";
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -68,8 +68,6 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
|
|||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
'value' => $output));
|
'value' => $output));
|
||||||
}
|
}
|
||||||
//Does tag create output
|
|
||||||
$compiler->has_output = true;
|
|
||||||
$output = "<?php echo {$output};?>\n";
|
$output = "<?php echo {$output};?>\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@@ -41,9 +41,6 @@ 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;
|
|
||||||
|
|
||||||
unset($_attr[ 'nocache' ]);
|
unset($_attr[ 'nocache' ]);
|
||||||
$_assign = null;
|
$_assign = null;
|
||||||
if (isset($_attr[ 'assign' ])) {
|
if (isset($_attr[ 'assign' ])) {
|
||||||
@@ -76,9 +73,6 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
|||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag('private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output));
|
array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output));
|
||||||
}
|
}
|
||||||
//Does tag create output
|
|
||||||
$compiler->has_output = isset($_attr[ 'assign' ]) ? false : true;
|
|
||||||
|
|
||||||
if (empty($_assign)) {
|
if (empty($_assign)) {
|
||||||
return "<?php echo {$output};?>\n";
|
return "<?php echo {$output};?>\n";
|
||||||
} else {
|
} else {
|
||||||
|
@@ -120,9 +120,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$output = "<?php echo {$output};?>\n";
|
||||||
$compiler->has_output = true;
|
|
||||||
$output = "<?php echo {$output};?>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
@@ -80,8 +80,6 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
|||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
'value' => $output));
|
'value' => $output));
|
||||||
}
|
}
|
||||||
//Does tag create output
|
|
||||||
$compiler->has_output = true;
|
|
||||||
$output = "<?php echo {$output};?>\n";
|
$output = "<?php echo {$output};?>\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase
|
class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Compiles code for the {rdelim} tag
|
* Compiles code for the {rdelim} tag
|
||||||
@@ -28,13 +28,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase
|
|||||||
*/
|
*/
|
||||||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
|
||||||
{
|
{
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
parent::compile($args,$compiler);
|
||||||
if ($_attr[ 'nocache' ] === true) {
|
|
||||||
$compiler->trigger_template_error('nocache option not allowed', null, true);
|
|
||||||
}
|
|
||||||
// this tag does not return compiled code
|
|
||||||
$compiler->has_code = true;
|
|
||||||
|
|
||||||
return $compiler->smarty->right_delimiter;
|
return $compiler->smarty->right_delimiter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
* @property Smarty_Internal_Method_RegisterFilter $registerFilter
|
* @property Smarty_Internal_Method_RegisterFilter $registerFilter
|
||||||
* @property Smarty_Internal_Method_RegisterObject $registerObject
|
* @property Smarty_Internal_Method_RegisterObject $registerObject
|
||||||
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
|
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
|
||||||
|
* @property mixed|\Smarty_Template_Cached configLoad
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Extension_Handler
|
class Smarty_Internal_Extension_Handler
|
||||||
{
|
{
|
||||||
|
@@ -88,7 +88,7 @@ class Smarty_Internal_Runtime_CodeFrame
|
|||||||
$output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
|
$output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$output .= "?>\n";
|
$output .= "?>";
|
||||||
$output .= $content;
|
$output .= $content;
|
||||||
$output .= "<?php }\n?>";
|
$output .= "<?php }\n?>";
|
||||||
$output .= $functions;
|
$output .= $functions;
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
* @property Smarty_Template_Compiled $compiled
|
* @property Smarty_Template_Compiled $compiled
|
||||||
* @property Smarty_Template_Cached $cached
|
* @property Smarty_Template_Cached $cached
|
||||||
* @property Smarty_Internal_TemplateCompilerBase $compiler
|
* @property Smarty_Internal_TemplateCompilerBase $compiler
|
||||||
|
* @property mixed|\Smarty_Template_Cached registered_plugins
|
||||||
*
|
*
|
||||||
* The following methods will be dynamically loaded by the extension handler when they are called.
|
* The following methods will be dynamically loaded by the extension handler when they are called.
|
||||||
* They are located in a corresponding Smarty_Internal_Method_xxxx class
|
* They are located in a corresponding Smarty_Internal_Method_xxxx class
|
||||||
|
@@ -225,12 +225,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $has_variable_string = false;
|
public $has_variable_string = false;
|
||||||
/**
|
|
||||||
* Tag creates output
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $has_output = false;
|
|
||||||
/**
|
/**
|
||||||
* Stack for {setfilter} {/setfilter}
|
* Stack for {setfilter} {/setfilter}
|
||||||
*
|
*
|
||||||
@@ -833,9 +828,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
*/
|
*/
|
||||||
public function appendCode($left, $right)
|
public function appendCode($left, $right)
|
||||||
{
|
{
|
||||||
if (preg_match('/\s*\?>\s*$/', $left) && preg_match('/^\s*<\?php\s+/', $right)) {
|
if (preg_match('/\s*\?>\s?$/D', $left) && preg_match('/^<\?php\s+/', $right)) {
|
||||||
$left = preg_replace('/\s*\?>\s*$/', "\n", $left);
|
$left = preg_replace('/\s*\?>\s?$/D', "\n", $left);
|
||||||
$left .= preg_replace('/^\s*<\?php\s+/', '', $right);
|
$left .= preg_replace('/^<\?php\s+/', '', $right);
|
||||||
} else {
|
} else {
|
||||||
$left .= $right;
|
$left .= $right;
|
||||||
}
|
}
|
||||||
@@ -1298,7 +1293,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
// $args contains the attributes parsed and compiled by the lexer/parser
|
// $args contains the attributes parsed and compiled by the lexer/parser
|
||||||
// assume that tag does compile into code, but creates no HTML output
|
// assume that tag does compile into code, but creates no HTML output
|
||||||
$this->has_code = true;
|
$this->has_code = true;
|
||||||
$this->has_output = false;
|
|
||||||
// log tag/attributes
|
// log tag/attributes
|
||||||
if (isset($this->smarty->_cache[ 'get_used_tags' ])) {
|
if (isset($this->smarty->_cache[ 'get_used_tags' ])) {
|
||||||
$this->template->_cache[ 'used_tags' ][] = array($tag,
|
$this->template->_cache[ 'used_tags' ][] = array($tag,
|
||||||
@@ -1333,10 +1327,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if ($_output !== true) {
|
if ($_output !== true) {
|
||||||
// did we get compiled code
|
// did we get compiled code
|
||||||
if ($this->has_code) {
|
if ($this->has_code) {
|
||||||
// Does it create output?
|
|
||||||
if ($this->has_output) {
|
|
||||||
$_output .= "\n";
|
|
||||||
}
|
|
||||||
// return compiled code
|
// return compiled code
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
|
@@ -368,7 +368,11 @@ class Smarty_Internal_Templatelexer
|
|||||||
|
|
||||||
function yy_r1_2()
|
function yy_r1_2()
|
||||||
{
|
{
|
||||||
preg_match("/[*]{$this->compiler->getRdelPreg()}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",
|
||||||
|
$this->data,
|
||||||
|
$match,
|
||||||
|
PREG_OFFSET_CAPTURE,
|
||||||
|
$this->counter);
|
||||||
if (isset($match[ 0 ][ 1 ])) {
|
if (isset($match[ 0 ][ 1 ])) {
|
||||||
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -9,9 +9,6 @@ class TP_yyStackEntry
|
|||||||
** is the value of the token */
|
** is the value of the token */
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
#line 11 "../smarty/lexer/smarty_internal_templateparser.y"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Template Parser Class
|
* Smarty Template Parser Class
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user