issue 831 : Fixed a bug that an error occured if conditional statements include line feeds.

issue 843 : Fixed a bug that spaces at the back of template statements are removed.


git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9795 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-11-03 03:56:16 +00:00
parent d74051e15a
commit 8a55d17cef
2 changed files with 9 additions and 4 deletions

View file

@ -187,7 +187,7 @@ class TemplateHandler {
$buff = $this->_parseInline($buff);
// include, unload/load, import
$buff = preg_replace_callback('/{(@[\s\S]+?|(?=\$\w+|_{1,2}[A-Z]+|[!\(+-]|\w+(?:\(|::)|\d+|[\'"].*?[\'"]).+?)}|<(!--[#%])?(include|import|(un)?load(?(4)|(?:_js_plugin)?))(?(2)\("([^"]+)")(.*?)(?(2)\)--|\/)>|<!--(@[a-z@]+)(.*?)-->(\s*)/', array($this, '_parseResource'), $buff);
$buff = preg_replace_callback('/{(@[\s\S]+?|(?=\$\w+|_{1,2}[A-Z]+|[!\(+-]|\w+(?:\(|::)|\d+|[\'"].*?[\'"]).+?)}|<(!--[#%])?(include|import|(un)?load(?(4)|(?:_js_plugin)?))(?(2)\("([^"]+)")(.*?)(?(2)\)--|\/)>|<!--(@[a-z@]+)([\s\S]*?)-->(\s*)/', array($this, '_parseResource'), $buff);
// remove block which is a virtual tag and remove comments
$buff = preg_replace('@</?block\s*>|\s?<!--//(.*?)-->@is','',$buff);
@ -508,7 +508,7 @@ class TemplateHandler {
$m[7] = substr($m[7],1);
if(!preg_match('/^(?:((?:end)?(?:if|switch|for(?:each)?|while)|end)|(else(?:if)?)|(break@)?(case|default)|(break))$/', $m[7], $mm)) return '';
if($mm[1]) {
if($mm[1]{0} == 'e') return '<?php } ?>';
if($mm[1]{0} == 'e') return '<?php } ?>'.$m[9];
$precheck = '';
if($mm[1] == 'switch') {