@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Dwoo_Plugin_smartyinterface extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block |
| 18 | 18 | { |
| 19 | - public function init($__funcname, $__functype, array $rest=array()) {} |
|
| 19 | + public function init($__funcname, $__functype, array $rest = array()) {} |
|
| 20 | 20 | |
| 21 | 21 | public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type) |
| 22 | 22 | { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $paramsOut .= var_export($i, true).' => '.$p.','; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $curBlock =& $compiler->getCurrentBlock(); |
|
| 49 | + $curBlock = & $compiler->getCurrentBlock(); |
|
| 50 | 50 | $curBlock['params']['postOut'] = Dwoo_Compiler::PHP_OPEN.' $_block_content = ob_get_clean(); $_block_repeat=false; echo '.$callback.'$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);'.Dwoo_Compiler::PHP_CLOSE; |
| 51 | 51 | |
| 52 | 52 | return Dwoo_Compiler::PHP_OPEN.$prepend.' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array('.$paramsOut.'); $_block_repeat=true; '.$callback.'$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();'.Dwoo_Compiler::PHP_CLOSE; |
@@ -54,6 +54,6 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
| 56 | 56 | { |
| 57 | - return $content . $params['postOut']; |
|
| 57 | + return $content.$params['postOut']; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class Dwoo_Plugin_a extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block |
| 36 | 36 | { |
| 37 | - public function init($href, array $rest=array()) |
|
| 37 | + public function init($href, array $rest = array()) |
|
| 38 | 38 | { |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $p = $compiler->getCompiledParams($params); |
| 44 | 44 | |
| 45 | - $out = Dwoo_Compiler::PHP_OPEN . 'echo \'<a '.self::paramsToAttributes($p, "'", $compiler); |
|
| 45 | + $out = Dwoo_Compiler::PHP_OPEN.'echo \'<a '.self::paramsToAttributes($p, "'", $compiler); |
|
| 46 | 46 | |
| 47 | - return $out.'>\';' . Dwoo_Compiler::PHP_CLOSE; |
|
| 47 | + return $out.'>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | if ($content == "") { |
| 56 | 56 | // merge </a> into the href if href is a string |
| 57 | 57 | if (substr($p['href'], -1) === '"' || substr($p['href'], -1) === '\'') { |
| 58 | - return Dwoo_Compiler::PHP_OPEN . 'echo '.substr($p['href'], 0, -1).'</a>'.substr($p['href'], -1).';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 58 | + return Dwoo_Compiler::PHP_OPEN.'echo '.substr($p['href'], 0, -1).'</a>'.substr($p['href'], -1).';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 59 | 59 | } |
| 60 | 60 | // otherwise append |
| 61 | - return Dwoo_Compiler::PHP_OPEN . 'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 61 | + return Dwoo_Compiler::PHP_OPEN.'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // return content |
| 65 | - return $content . '</a>'; |
|
| 65 | + return $content.'</a>'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | |
| 36 | 36 | $mode = trim($params['mode'], '"\''); |
| 37 | 37 | switch ($mode) { |
| 38 | - case 'js': |
|
| 39 | - case 'javascript': |
|
| 40 | - $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s','', $content); |
|
| 38 | + case 'js': |
|
| 39 | + case 'javascript': |
|
| 40 | + $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s','', $content); |
|
| 41 | 41 | |
| 42 | - case 'default': |
|
| 43 | - default: |
|
| 42 | + case 'default': |
|
| 43 | + default: |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $content = preg_replace(array("/\n/","/\r/",'/(<\?(?:php)?|<%)\s*/'), array('','','$1 '), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content)); |
@@ -37,13 +37,13 @@ |
||
| 37 | 37 | switch ($mode) { |
| 38 | 38 | case 'js': |
| 39 | 39 | case 'javascript': |
| 40 | - $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s','', $content); |
|
| 40 | + $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s', '', $content); |
|
| 41 | 41 | |
| 42 | 42 | case 'default': |
| 43 | 43 | default: |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $content = preg_replace(array("/\n/","/\r/",'/(<\?(?:php)?|<%)\s*/'), array('','','$1 '), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content)); |
|
| 46 | + $content = preg_replace(array("/\n/", "/\r/", '/(<\?(?:php)?|<%)\s*/'), array('', '', '$1 '), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content)); |
|
| 47 | 47 | |
| 48 | 48 | return $content; |
| 49 | 49 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Dwoo_Plugin_section extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block, Dwoo_IElseable |
| 18 | 18 | { |
| 19 | - public static $cnt=0; |
|
| 19 | + public static $cnt = 0; |
|
| 20 | 20 | |
| 21 | 21 | public function init($name, $loop, $start = null, $step = null, $max = null, $show = true) |
| 22 | 22 | { |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | $output .= "\t\t".'$_section'.$cnt.'[\'first\'] = ($_section'.$cnt.'[\'iteration\'] == 1);'."\n"; |
| 119 | 119 | $output .= "\t\t".'$_section'.$cnt.'[\'last\'] = ($_section'.$cnt.'[\'iteration\'] == $_section'.$cnt.'[\'total\']);'."\n"; |
| 120 | 120 | |
| 121 | - $output .= Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN; |
|
| 121 | + $output .= Dwoo_Compiler::PHP_CLOSE.$content.Dwoo_Compiler::PHP_OPEN; |
|
| 122 | 122 | |
| 123 | - $output .= "\n\t}\n} " . Dwoo_Compiler::PHP_CLOSE; |
|
| 123 | + $output .= "\n\t}\n} ".Dwoo_Compiler::PHP_CLOSE; |
|
| 124 | 124 | |
| 125 | 125 | if (isset($params['hasElse'])) { |
| 126 | 126 | $output .= $params['hasElse']; |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | |
| 28 | 28 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
| 29 | 29 | { |
| 30 | - return $content . Dwoo_Compiler::PHP_OPEN.' /* end template body */'."\n".'return $this->buffer . ob_get_clean();'; |
|
| 30 | + return $content.Dwoo_Compiler::PHP_OPEN.' /* end template body */'."\n".'return $this->buffer . ob_get_clean();'; |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $preContent = ''; |
| 27 | 27 | while (true) { |
| 28 | 28 | $preContent .= $compiler->removeTopBlock(); |
| 29 | - $block =& $compiler->getCurrentBlock(); |
|
| 29 | + $block = & $compiler->getCurrentBlock(); |
|
| 30 | 30 | $interfaces = class_implements($block['class'], false); |
| 31 | 31 | if (in_array('Dwoo_IElseable', $interfaces) !== false) { |
| 32 | 32 | break; |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | $tokens = $compiler->getParamTokens($params); |
| 48 | 48 | $params = $compiler->getCompiledParams($params); |
| 49 | 49 | |
| 50 | - $pre = Dwoo_Compiler::PHP_OPEN."elseif (".implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)).") {\n" . Dwoo_Compiler::PHP_CLOSE; |
|
| 50 | + $pre = Dwoo_Compiler::PHP_OPEN."elseif (".implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)).") {\n".Dwoo_Compiler::PHP_CLOSE; |
|
| 51 | 51 | $post = Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE; |
| 52 | 52 | |
| 53 | 53 | if (isset($params['hasElse'])) { |
| 54 | 54 | $post .= $params['hasElse']; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $block =& $compiler->getCurrentBlock(); |
|
| 58 | - $block['params']['hasElse'] = $pre . $content . $post; |
|
| 57 | + $block = & $compiler->getCurrentBlock(); |
|
| 58 | + $block['params']['hasElse'] = $pre.$content.$post; |
|
| 59 | 59 | return ''; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | $p = array(); |
| 40 | 40 | |
| 41 | 41 | reset($params); |
| 42 | - while (list($k,$v) = each($params)) { |
|
| 42 | + while (list($k, $v) = each($params)) { |
|
| 43 | 43 | $v = (string) $v; |
| 44 | - if(substr($v, 0, 1) === '"' || substr($v, 0, 1) === '\'') { |
|
| 44 | + if (substr($v, 0, 1) === '"' || substr($v, 0, 1) === '\'') { |
|
| 45 | 45 | $vmod = strtolower(substr($v, 1, -1)); |
| 46 | 46 | } else { |
| 47 | 47 | $vmod = strtolower($v); |
| 48 | 48 | } |
| 49 | - switch($vmod) { |
|
| 49 | + switch ($vmod) { |
|
| 50 | 50 | |
| 51 | 51 | case 'and': |
| 52 | 52 | if ($tokens[$k] === Dwoo_Compiler::T_UNQUOTED_STRING) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } else { |
| 156 | 156 | $negate = false; |
| 157 | 157 | } |
| 158 | - $ptr = 1+(int)$negate; |
|
| 158 | + $ptr = 1+(int) $negate; |
|
| 159 | 159 | if ($tokens[$k+$ptr] !== Dwoo_Compiler::T_UNQUOTED_STRING) { |
| 160 | 160 | break; |
| 161 | 161 | } |
@@ -164,27 +164,27 @@ discard block |
||
| 164 | 164 | } else { |
| 165 | 165 | $params[$k+$ptr] = trim($params[$k+$ptr], '"\''); |
| 166 | 166 | } |
| 167 | - switch($params[$k+$ptr]) { |
|
| 167 | + switch ($params[$k+$ptr]) { |
|
| 168 | 168 | |
| 169 | 169 | case 'div': |
| 170 | 170 | if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') { |
| 171 | - $p[] = ' % '.$params[$k+$ptr+2].' '.($negate?'!':'=').'== 0'; |
|
| 171 | + $p[] = ' % '.$params[$k+$ptr+2].' '.($negate ? '!' : '=').'== 0'; |
|
| 172 | 172 | next($params); |
| 173 | 173 | next($params); |
| 174 | 174 | next($params); |
| 175 | 175 | } else { |
| 176 | - throw new Dwoo_Compilation_Exception($compiler, 'If : Syntax error : syntax should be "if $a is [not] div by $b", found '.$params[$k-1].' is '.($negate?'not ':'').'div '.$params[$k+$ptr+1].' '.$params[$k+$ptr+2]); |
|
| 176 | + throw new Dwoo_Compilation_Exception($compiler, 'If : Syntax error : syntax should be "if $a is [not] div by $b", found '.$params[$k-1].' is '.($negate ? 'not ' : '').'div '.$params[$k+$ptr+1].' '.$params[$k+$ptr+2]); |
|
| 177 | 177 | } |
| 178 | 178 | break; |
| 179 | 179 | case 'even': |
| 180 | 180 | $a = array_pop($p); |
| 181 | 181 | if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') { |
| 182 | 182 | $b = $params[$k+$ptr+2]; |
| 183 | - $p[] = '('.$a .' / '.$b.') % 2 '.($negate?'!':'=').'== 0'; |
|
| 183 | + $p[] = '('.$a.' / '.$b.') % 2 '.($negate ? '!' : '=').'== 0'; |
|
| 184 | 184 | next($params); |
| 185 | 185 | next($params); |
| 186 | 186 | } else { |
| 187 | - $p[] = $a.' % 2 '.($negate?'!':'=').'== 0'; |
|
| 187 | + $p[] = $a.' % 2 '.($negate ? '!' : '=').'== 0'; |
|
| 188 | 188 | } |
| 189 | 189 | next($params); |
| 190 | 190 | break; |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | $a = array_pop($p); |
| 193 | 193 | if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') { |
| 194 | 194 | $b = $params[$k+$ptr+2]; |
| 195 | - $p[] = '('.$a .' / '.$b.') % 2 '.($negate?'=':'!').'== 0'; |
|
| 195 | + $p[] = '('.$a.' / '.$b.') % 2 '.($negate ? '=' : '!').'== 0'; |
|
| 196 | 196 | next($params); |
| 197 | 197 | next($params); |
| 198 | 198 | } else { |
| 199 | - $p[] = $a.' % 2 '.($negate?'=':'!').'== 0'; |
|
| 199 | + $p[] = $a.' % 2 '.($negate ? '=' : '!').'== 0'; |
|
| 200 | 200 | } |
| 201 | 201 | next($params); |
| 202 | 202 | break; |
@@ -231,6 +231,6 @@ discard block |
||
| 231 | 231 | $post .= $params['hasElse']; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - return $pre . $content . $post; |
|
| 234 | + return $pre.$content.$post; |
|
| 235 | 235 | } |
| 236 | 236 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $params = $compiler->getCompiledParams($params); |
| 48 | 48 | |
| 49 | - $out = $content . Dwoo_Compiler::PHP_OPEN.$prepend."\n".'$tmp = ob_get_clean();'; |
|
| 49 | + $out = $content.Dwoo_Compiler::PHP_OPEN.$prepend."\n".'$tmp = ob_get_clean();'; |
|
| 50 | 50 | if ($params['trim'] !== 'false' && $params['trim'] !== 0) { |
| 51 | 51 | $out .= "\n".'$tmp = trim($tmp);'; |
| 52 | 52 | } |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | if ($params['assign'] !== 'null') { |
| 57 | 57 | $out .= "\n".'$this->scope['.$params['assign'].'] = $tmp;'; |
| 58 | 58 | } |
| 59 | - return $out . "\n".'$this->globals[\'capture\']['.$params['name'].'] = $tmp;'.$append.Dwoo_Compiler::PHP_CLOSE; |
|
| 59 | + return $out."\n".'$this->globals[\'capture\']['.$params['name'].'] = $tmp;'.$append.Dwoo_Compiler::PHP_CLOSE; |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | class Dwoo_Plugin_foreach extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block, Dwoo_IElseable |
| 33 | 33 | { |
| 34 | - public static $cnt=0; |
|
| 34 | + public static $cnt = 0; |
|
| 35 | 35 | |
| 36 | - public function init($from, $key=null, $item=null, $name='default', $implode=null) |
|
| 36 | + public function init($from, $key = null, $item = null, $name = 'default', $implode = null) |
|
| 37 | 37 | { |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type) |
| 41 | 41 | { |
| 42 | 42 | // get block params and save the current template pointer to use it in the postProcessing method |
| 43 | - $currentBlock =& $compiler->getCurrentBlock(); |
|
| 43 | + $currentBlock = & $compiler->getCurrentBlock(); |
|
| 44 | 44 | $currentBlock['params']['tplPointer'] = $compiler->getPointer(); |
| 45 | 45 | |
| 46 | 46 | return ''; |
@@ -101,22 +101,22 @@ discard block |
||
| 101 | 101 | $cnt = self::$cnt++; |
| 102 | 102 | |
| 103 | 103 | // build pre content output |
| 104 | - $pre = Dwoo_Compiler::PHP_OPEN . "\n".'$_fh'.$cnt.'_data = '.$src.';'; |
|
| 104 | + $pre = Dwoo_Compiler::PHP_OPEN."\n".'$_fh'.$cnt.'_data = '.$src.';'; |
|
| 105 | 105 | // adds foreach properties |
| 106 | 106 | if ($usesAny) { |
| 107 | 107 | $pre .= "\n".'$this->globals["foreach"]['.$name.'] = array'."\n("; |
| 108 | - if ($usesIndex) $pre .="\n\t".'"index" => 0,'; |
|
| 109 | - if ($usesIteration) $pre .="\n\t".'"iteration" => 1,'; |
|
| 110 | - if ($usesFirst) $pre .="\n\t".'"first" => null,'; |
|
| 111 | - if ($usesLast) $pre .="\n\t".'"last" => null,'; |
|
| 112 | - if ($usesShow) $pre .="\n\t".'"show" => $this->isArray($_fh'.$cnt.'_data, true),'; |
|
| 113 | - if ($usesTotal) $pre .="\n\t".'"total" => $this->count($_fh'.$cnt.'_data),'; |
|
| 114 | - $pre.="\n);\n".'$_fh'.$cnt.'_glob =& $this->globals["foreach"]['.$name.'];'; |
|
| 108 | + if ($usesIndex) $pre .= "\n\t".'"index" => 0,'; |
|
| 109 | + if ($usesIteration) $pre .= "\n\t".'"iteration" => 1,'; |
|
| 110 | + if ($usesFirst) $pre .= "\n\t".'"first" => null,'; |
|
| 111 | + if ($usesLast) $pre .= "\n\t".'"last" => null,'; |
|
| 112 | + if ($usesShow) $pre .= "\n\t".'"show" => $this->isArray($_fh'.$cnt.'_data, true),'; |
|
| 113 | + if ($usesTotal) $pre .= "\n\t".'"total" => $this->count($_fh'.$cnt.'_data),'; |
|
| 114 | + $pre .= "\n);\n".'$_fh'.$cnt.'_glob =& $this->globals["foreach"]['.$name.'];'; |
|
| 115 | 115 | } |
| 116 | 116 | // checks if foreach must be looped |
| 117 | 117 | $pre .= "\n".'if ($this->isTraversable($_fh'.$cnt.'_data'.(isset($params['hasElse']) ? ', true' : '').') == true)'."\n{"; |
| 118 | 118 | // iterates over keys |
| 119 | - $pre .= "\n\t".'foreach ($_fh'.$cnt.'_data as '.(isset($key)?'$this->scope['.$key.']=>':'').'$this->scope['.$val.'])'."\n\t{"; |
|
| 119 | + $pre .= "\n\t".'foreach ($_fh'.$cnt.'_data as '.(isset($key) ? '$this->scope['.$key.']=>' : '').'$this->scope['.$val.'])'."\n\t{"; |
|
| 120 | 120 | // updates properties |
| 121 | 121 | if ($usesFirst) { |
| 122 | 122 | $pre .= "\n\t\t".'$_fh'.$cnt.'_glob["first"] = (string) ($_fh'.$cnt.'_glob["index"] === 0);'; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $pre .= "\n/* -- foreach start output */\n".Dwoo_Compiler::PHP_CLOSE; |
| 128 | 128 | |
| 129 | 129 | // build post content output |
| 130 | - $post = Dwoo_Compiler::PHP_OPEN . "\n"; |
|
| 130 | + $post = Dwoo_Compiler::PHP_OPEN."\n"; |
|
| 131 | 131 | |
| 132 | 132 | if (isset($implode)) { |
| 133 | 133 | $post .= '/* -- implode */'."\n".'if (!$_fh'.$cnt.'_glob["last"]) {'. |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | $post .= '/* -- foreach end output */'; |
| 137 | 137 | // update properties |
| 138 | 138 | if ($usesIndex) { |
| 139 | - $post.="\n\t\t".'$_fh'.$cnt.'_glob["index"]+=1;'; |
|
| 139 | + $post .= "\n\t\t".'$_fh'.$cnt.'_glob["index"]+=1;'; |
|
| 140 | 140 | } |
| 141 | 141 | if ($usesIteration) { |
| 142 | - $post.="\n\t\t".'$_fh'.$cnt.'_glob["iteration"]+=1;'; |
|
| 142 | + $post .= "\n\t\t".'$_fh'.$cnt.'_glob["iteration"]+=1;'; |
|
| 143 | 143 | } |
| 144 | 144 | // end loop |
| 145 | 145 | $post .= "\n\t}\n}".Dwoo_Compiler::PHP_CLOSE; |
@@ -147,6 +147,6 @@ discard block |
||
| 147 | 147 | $post .= $params['hasElse']; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - return $pre . $content . $post; |
|
| 150 | + return $pre.$content.$post; |
|
| 151 | 151 | } |
| 152 | 152 | } |
@@ -105,12 +105,24 @@ |
||
| 105 | 105 | // adds foreach properties |
| 106 | 106 | if ($usesAny) { |
| 107 | 107 | $pre .= "\n".'$this->globals["foreach"]['.$name.'] = array'."\n("; |
| 108 | - if ($usesIndex) $pre .="\n\t".'"index" => 0,'; |
|
| 109 | - if ($usesIteration) $pre .="\n\t".'"iteration" => 1,'; |
|
| 110 | - if ($usesFirst) $pre .="\n\t".'"first" => null,'; |
|
| 111 | - if ($usesLast) $pre .="\n\t".'"last" => null,'; |
|
| 112 | - if ($usesShow) $pre .="\n\t".'"show" => $this->isArray($_fh'.$cnt.'_data, true),'; |
|
| 113 | - if ($usesTotal) $pre .="\n\t".'"total" => $this->count($_fh'.$cnt.'_data),'; |
|
| 108 | + if ($usesIndex) { |
|
| 109 | + $pre .="\n\t".'"index" => 0,'; |
|
| 110 | + } |
|
| 111 | + if ($usesIteration) { |
|
| 112 | + $pre .="\n\t".'"iteration" => 1,'; |
|
| 113 | + } |
|
| 114 | + if ($usesFirst) { |
|
| 115 | + $pre .="\n\t".'"first" => null,'; |
|
| 116 | + } |
|
| 117 | + if ($usesLast) { |
|
| 118 | + $pre .="\n\t".'"last" => null,'; |
|
| 119 | + } |
|
| 120 | + if ($usesShow) { |
|
| 121 | + $pre .="\n\t".'"show" => $this->isArray($_fh'.$cnt.'_data, true),'; |
|
| 122 | + } |
|
| 123 | + if ($usesTotal) { |
|
| 124 | + $pre .="\n\t".'"total" => $this->count($_fh'.$cnt.'_data),'; |
|
| 125 | + } |
|
| 114 | 126 | $pre.="\n);\n".'$_fh'.$cnt.'_glob =& $this->globals["foreach"]['.$name.'];'; |
| 115 | 127 | } |
| 116 | 128 | // checks if foreach must be looped |