- revert handling of newline on no output tags like {if...}

This commit is contained in:
Uwe.Tews
2010-01-14 20:57:27 +00:00
parent 13444e9781
commit 383e4bb4ae
6 changed files with 13 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
- bugfix on backslash within single quoted strings
- bugfix allow absolute filepath for config files
- bugfix on special Smarty variable $smarty.cookies
- revert handling of newline on no output tags like {if...}
01/13/2010
- bugfix on {if} tags

View File

@@ -64,7 +64,7 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
if (isset($append)) {
$_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;
}
}

View File

@@ -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']."){?>";
return $_output;
} 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'));
$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)) {
$this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
return "<?php }elseif({$args['if condition']}){?>\n";
return "<?php }elseif({$args['if condition']}){?>";
} else {
$tmp = '';
foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
$this->compiler->prefix_code = array();
$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'));
$tmp = '';
for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
return "<?php {$tmp}?>\n";
return "<?php {$tmp}?>";
}
}

View File

@@ -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 .= "\$_tpl_stack[] = \$_smarty_tpl; \$_smarty_tpl = \$_template;?>\n";
$_output .= $compiled_tpl;
$_output .= "<?php \$_smarty_tpl->updateParentVariables($_parent_scope);?>";
$_output .= "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>";
$_output .= "<?php \$_smarty_tpl->updateParentVariables($_parent_scope);?>\n";
$_output .= "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>\n";
$_output .= "<?php \$_smarty_tpl = array_pop(\$_tpl_stack);?>";
} else {
$_output .= " echo \$_template->getRenderedTemplate();?>";
$_output .= "<?php \$_template->updateParentVariables($_parent_scope);?>";
}
}
$_output .= "<?php unset(\$_template);?>";
$_output .= "<?php unset(\$_template);?>\n";
return $_output;
}
}

View File

@@ -57,13 +57,11 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
}
}
$_output = '<?php ';
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 {
$_output .= 'include' . $_once . ' (\'' . $_file . '\');?>';
return "<?php include{$_once} ('{$_file}');?>\n";
}
return $_output;
}
}

View File

@@ -340,7 +340,7 @@ class Smarty_Internal_TemplateCompilerBase {
$this->tag_nocache = false;
$this->template->has_nocache_code = true;
$_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
if (isset($this->template->saved_modifer)) {
foreach ($this->template->saved_modifer as $plugin_name => $dummy) {