| @@ 144-165 (lines=22) @@ | ||
| 141 | // build pre content output |
|
| 142 | $pre = Compiler::PHP_OPEN . "\n" . '$_fh' . $cnt . '_data = ' . $src . ';'; |
|
| 143 | // adds foreach properties |
|
| 144 | if ($usesAny) { |
|
| 145 | $pre .= "\n" . '$this->globals["foreach"][' . $name . '] = array' . "\n("; |
|
| 146 | if ($usesIndex) { |
|
| 147 | $pre .= "\n\t" . '"index" => 0,'; |
|
| 148 | } |
|
| 149 | if ($usesIteration) { |
|
| 150 | $pre .= "\n\t" . '"iteration" => 1,'; |
|
| 151 | } |
|
| 152 | if ($usesFirst) { |
|
| 153 | $pre .= "\n\t" . '"first" => null,'; |
|
| 154 | } |
|
| 155 | if ($usesLast) { |
|
| 156 | $pre .= "\n\t" . '"last" => null,'; |
|
| 157 | } |
|
| 158 | if ($usesShow) { |
|
| 159 | $pre .= "\n\t" . '"show" => $this->isArray($_fh' . $cnt . '_data, true),'; |
|
| 160 | } |
|
| 161 | if ($usesTotal) { |
|
| 162 | $pre .= "\n\t" . '"total" => $this->count($_fh' . $cnt . '_data),'; |
|
| 163 | } |
|
| 164 | $pre .= "\n);\n" . '$_fh' . $cnt . '_glob =& $this->globals["foreach"][' . $name . '];'; |
|
| 165 | } |
|
| 166 | // checks if foreach must be looped |
|
| 167 | $pre .= "\n" . 'if ($this->isTraversable($_fh' . $cnt . '_data' . (isset($params['hasElse']) ? ', true' : '') . ') == true)' . "\n{"; |
|
| 168 | // iterates over keys |
|
| @@ 118-139 (lines=22) @@ | ||
| 115 | // builds pre processing output |
|
| 116 | $pre = Compiler::PHP_OPEN . "\n" . '$_loop' . $cnt . '_data = ' . $src . ';'; |
|
| 117 | // adds foreach properties |
|
| 118 | if ($usesAny) { |
|
| 119 | $pre .= "\n" . '$this->globals["loop"][' . $name . '] = array' . "\n("; |
|
| 120 | if ($usesIndex) { |
|
| 121 | $pre .= "\n\t" . '"index" => 0,'; |
|
| 122 | } |
|
| 123 | if ($usesIteration) { |
|
| 124 | $pre .= "\n\t" . '"iteration" => 1,'; |
|
| 125 | } |
|
| 126 | if ($usesFirst) { |
|
| 127 | $pre .= "\n\t" . '"first" => null,'; |
|
| 128 | } |
|
| 129 | if ($usesLast) { |
|
| 130 | $pre .= "\n\t" . '"last" => null,'; |
|
| 131 | } |
|
| 132 | if ($usesShow) { |
|
| 133 | $pre .= "\n\t" . '"show" => $this->isTraversable($_loop' . $cnt . '_data, true),'; |
|
| 134 | } |
|
| 135 | if ($usesTotal) { |
|
| 136 | $pre .= "\n\t" . '"total" => $this->count($_loop' . $cnt . '_data),'; |
|
| 137 | } |
|
| 138 | $pre .= "\n);\n" . '$_loop' . $cnt . '_glob =& $this->globals["loop"][' . $name . '];'; |
|
| 139 | } |
|
| 140 | // checks if the loop must be looped |
|
| 141 | $pre .= "\n" . 'if ($this->isTraversable($_loop' . $cnt . '_data' . (isset($params['hasElse']) ? ', true' : '') . ') == true)' . "\n{"; |
|
| 142 | // iterates over keys |
|