mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- revert handling of newline on no output tags like {if...}
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
- bugfix on backslash within single quoted strings
|
- bugfix on backslash within single quoted strings
|
||||||
- bugfix allow absolute filepath for config files
|
- bugfix allow absolute filepath for config files
|
||||||
- bugfix on special Smarty variable $smarty.cookies
|
- bugfix on special Smarty variable $smarty.cookies
|
||||||
|
- revert handling of newline on no output tags like {if...}
|
||||||
|
|
||||||
01/13/2010
|
01/13/2010
|
||||||
- bugfix on {if} tags
|
- bugfix on {if} tags
|
||||||
|
@@ -64,7 +64,7 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
|||||||
if (isset($append)) {
|
if (isset($append)) {
|
||||||
$_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
|
$_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
|
||||||
}
|
}
|
||||||
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>";
|
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean();?>";
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
|||||||
$_output .= "if (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value']."){?>";
|
$_output .= "if (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value']."){?>";
|
||||||
return $_output;
|
return $_output;
|
||||||
} else {
|
} else {
|
||||||
return "<?php if ({$args['if condition']}){?>\n";
|
return "<?php if ({$args['if condition']}){?>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
|||||||
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
|
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
|
||||||
$this->_open_tag('else',array($nesting,$compiler->tag_nocache));
|
$this->_open_tag('else',array($nesting,$compiler->tag_nocache));
|
||||||
|
|
||||||
return "<?php }else{ ?>\n";
|
return "<?php }else{ ?>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,13 +79,13 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
|||||||
|
|
||||||
if (empty($this->compiler->prefix_code)) {
|
if (empty($this->compiler->prefix_code)) {
|
||||||
$this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
|
$this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
|
||||||
return "<?php }elseif({$args['if condition']}){?>\n";
|
return "<?php }elseif({$args['if condition']}){?>";
|
||||||
} else {
|
} else {
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
|
foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
|
||||||
$this->compiler->prefix_code = array();
|
$this->compiler->prefix_code = array();
|
||||||
$this->_open_tag('elseif', array($nesting + 1, $compiler->tag_nocache));
|
$this->_open_tag('elseif', array($nesting + 1, $compiler->tag_nocache));
|
||||||
return "<?php }else{?>{$tmp}<?php if ({$args['if condition']}){?>\n";
|
return "<?php }else{?>{$tmp}<?php if ({$args['if condition']}){?>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
|
|||||||
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'else', 'elseif'));
|
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'else', 'elseif'));
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
|
for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
|
||||||
return "<?php {$tmp}?>\n";
|
return "<?php {$tmp}?>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -129,15 +129,15 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
$_output .= "\$_template->properties['nocache_hash'] = '{$compiler->template->properties['nocache_hash']}';\n";
|
$_output .= "\$_template->properties['nocache_hash'] = '{$compiler->template->properties['nocache_hash']}';\n";
|
||||||
$_output .= "\$_tpl_stack[] = \$_smarty_tpl; \$_smarty_tpl = \$_template;?>\n";
|
$_output .= "\$_tpl_stack[] = \$_smarty_tpl; \$_smarty_tpl = \$_template;?>\n";
|
||||||
$_output .= $compiled_tpl;
|
$_output .= $compiled_tpl;
|
||||||
$_output .= "<?php \$_smarty_tpl->updateParentVariables($_parent_scope);?>";
|
$_output .= "<?php \$_smarty_tpl->updateParentVariables($_parent_scope);?>\n";
|
||||||
$_output .= "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>";
|
$_output .= "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>\n";
|
||||||
$_output .= "<?php \$_smarty_tpl = array_pop(\$_tpl_stack);?>";
|
$_output .= "<?php \$_smarty_tpl = array_pop(\$_tpl_stack);?>";
|
||||||
} else {
|
} else {
|
||||||
$_output .= " echo \$_template->getRenderedTemplate();?>";
|
$_output .= " echo \$_template->getRenderedTemplate();?>";
|
||||||
$_output .= "<?php \$_template->updateParentVariables($_parent_scope);?>";
|
$_output .= "<?php \$_template->updateParentVariables($_parent_scope);?>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_output .= "<?php unset(\$_template);?>";
|
$_output .= "<?php unset(\$_template);?>\n";
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,13 +57,11 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_output = '<?php ';
|
|
||||||
if (isset($_assign)) {
|
if (isset($_assign)) {
|
||||||
$_output .= 'ob_start(); include' . $_once . ' (\'' . $_file . '\'); $_smarty_tpl->assign(' . $_assign . ',ob_get_contents()); ob_end_clean();?>';
|
return "<?php ob_start(); include{$_once} ('{$_file}'); \$_smarty_tpl->assign({$_assign},ob_get_contents()); ob_end_clean();?>";
|
||||||
} else {
|
} else {
|
||||||
$_output .= 'include' . $_once . ' (\'' . $_file . '\');?>';
|
return "<?php include{$_once} ('{$_file}');?>\n";
|
||||||
}
|
}
|
||||||
return $_output;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -340,7 +340,7 @@ class Smarty_Internal_TemplateCompilerBase {
|
|||||||
$this->tag_nocache = false;
|
$this->tag_nocache = false;
|
||||||
$this->template->has_nocache_code = true;
|
$this->template->has_nocache_code = true;
|
||||||
$_output = str_replace("'", "\'", $content);
|
$_output = str_replace("'", "\'", $content);
|
||||||
$_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";
|
$_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>";
|
||||||
// make sure we include modifer plugins for nocache code
|
// make sure we include modifer plugins for nocache code
|
||||||
if (isset($this->template->saved_modifer)) {
|
if (isset($this->template->saved_modifer)) {
|
||||||
foreach ($this->template->saved_modifer as $plugin_name => $dummy) {
|
foreach ($this->template->saved_modifer as $plugin_name => $dummy) {
|
||||||
|
Reference in New Issue
Block a user