From 6b75e8ffcb805c9b7827ed4ecd70fbccf012a27b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Aug 2007 21:10:21 +0000 Subject: [PATCH] ok, we are not able to cover all possibilities (IF A eq (B & C)) for example... or IF A == B... this would require a lot more code we do not see the need for. git-svn-id: file:///svn/phpbb/trunk@8043 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_template.php | 55 +-------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 5becb2458b..ba3b1ab106 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -526,60 +526,7 @@ class template_compile } } - // Try to combine some tokens... - $new_tokens = array(); - $j = 0; - - for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) - { - $token = &$tokens[$i]; - - if ($token != '&&' && $token != '||') - { - $new_tokens[$j][] = $token; - continue; - } - - $this->_merge_tokens(' ', $new_tokens[$j]); - $new_tokens[$j++] .= $token; - } - - if (!sizeof($new_tokens)) - { - $new_tokens[$j] = &$tokens; - } - - if (isset($new_tokens[$j]) && is_array($new_tokens[$j])) - { - $this->_merge_tokens('', $new_tokens[$j]); - } - - return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $new_tokens) . ') { '); - } - - /** - * Merge tokens from IF expression, correctly adding isset() calls. - * @access private - */ - function _merge_tokens($suffix, &$tokens) - { - for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) - { - $token = &$tokens[$i]; - - if (strpos($token, '$this') === 0) - { - $token = '(isset(' . $token . ') && ' . $token; - $suffix = ')' . $suffix; - } - else if (strpos($token, 'sizeof(') === 0) - { - $token = '(isset(' . substr($token, 7, -1) . ') && ' . $token; - $suffix = ')' . $suffix; - } - } - - $tokens = implode(' ', $tokens) . $suffix; + return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { '); } /**