@@ -1538,8 +1538,9 @@ |
||
| 1538 | 1538 | array_pop($this->scopeTree); |
| 1539 | 1539 | $this->scope =& $this->data; |
| 1540 | 1540 | $cnt = count($this->scopeTree); |
| 1541 | - for ($i=0;$i<$cnt;$i++) |
|
| 1542 | - $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1541 | + for ($i=0;$i<$cnt;$i++) { |
|
| 1542 | + $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1543 | + } |
|
| 1543 | 1544 | } elseif ($bit === '__' || $bit === '_root') { |
| 1544 | 1545 | $this->scope =& $this->data; |
| 1545 | 1546 | $this->scopeTree = array(); |
@@ -183,17 +183,17 @@ |
||
| 183 | 183 | $phpTags = SMARTY_PHP_ALLOW; |
| 184 | 184 | } |
| 185 | 185 | switch($phpTags) { |
| 186 | - case SMARTY_PHP_ALLOW: |
|
| 187 | - case SMARTY_PHP_PASSTHRU: |
|
| 188 | - $phpTags = Dwoo_Security_Policy::PHP_ALLOW; |
|
| 189 | - break; |
|
| 190 | - case SMARTY_PHP_QUOTE: |
|
| 191 | - $phpTags = Dwoo_Security_Policy::PHP_ENCODE; |
|
| 192 | - break; |
|
| 193 | - case SMARTY_PHP_REMOVE: |
|
| 194 | - default: |
|
| 195 | - $phpTags = Dwoo_Security_Policy::PHP_REMOVE; |
|
| 196 | - break; |
|
| 186 | + case SMARTY_PHP_ALLOW: |
|
| 187 | + case SMARTY_PHP_PASSTHRU: |
|
| 188 | + $phpTags = Dwoo_Security_Policy::PHP_ALLOW; |
|
| 189 | + break; |
|
| 190 | + case SMARTY_PHP_QUOTE: |
|
| 191 | + $phpTags = Dwoo_Security_Policy::PHP_ENCODE; |
|
| 192 | + break; |
|
| 193 | + case SMARTY_PHP_REMOVE: |
|
| 194 | + default: |
|
| 195 | + $phpTags = Dwoo_Security_Policy::PHP_REMOVE; |
|
| 196 | + break; |
|
| 197 | 197 | } |
| 198 | 198 | $policy->setPhpHandling($phpTags); |
| 199 | 199 | |
@@ -297,9 +297,10 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | public function unregister_prefilter($callback) |
| 299 | 299 | { |
| 300 | - foreach ($this->_filters['pre'] as $index => $processor) |
|
| 301 | - if ($processor->callback === $callback) { |
|
| 300 | + foreach ($this->_filters['pre'] as $index => $processor) { |
|
| 301 | + if ($processor->callback === $callback) { |
|
| 302 | 302 | $this->compiler->removePostProcessor($processor); |
| 303 | + } |
|
| 303 | 304 | unset($this->_filters['pre'][$index]); |
| 304 | 305 | } |
| 305 | 306 | } |
@@ -314,9 +315,10 @@ discard block |
||
| 314 | 315 | |
| 315 | 316 | public function unregister_postfilter($callback) |
| 316 | 317 | { |
| 317 | - foreach ($this->_filters['post'] as $index => $processor) |
|
| 318 | - if ($processor->callback === $callback) { |
|
| 318 | + foreach ($this->_filters['post'] as $index => $processor) { |
|
| 319 | + if ($processor->callback === $callback) { |
|
| 319 | 320 | $this->compiler->removePostProcessor($processor); |
| 321 | + } |
|
| 320 | 322 | unset($this->_filters['post'][$index]); |
| 321 | 323 | } |
| 322 | 324 | } |
@@ -331,9 +333,10 @@ discard block |
||
| 331 | 333 | |
| 332 | 334 | public function unregister_outputfilter($callback) |
| 333 | 335 | { |
| 334 | - foreach ($this->_filters['output'] as $index => $filter) |
|
| 335 | - if ($filter->callback === $callback) { |
|
| 336 | + foreach ($this->_filters['output'] as $index => $filter) { |
|
| 337 | + if ($filter->callback === $callback) { |
|
| 336 | 338 | $this->removeOutputFilter($filter); |
| 339 | + } |
|
| 337 | 340 | unset($this->_filters['output'][$index]); |
| 338 | 341 | } |
| 339 | 342 | } |
@@ -419,10 +422,11 @@ discard block |
||
| 419 | 422 | } |
| 420 | 423 | |
| 421 | 424 | $data = $this->dataProvider->getData(); |
| 422 | - if ($name === null) |
|
| 423 | - return $data; |
|
| 424 | - elseif (isset($data[$name])) |
|
| 425 | - return $data[$name]; |
|
| 425 | + if ($name === null) { |
|
| 426 | + return $data; |
|
| 427 | + } elseif (isset($data[$name])) { |
|
| 428 | + return $data[$name]; |
|
| 429 | + } |
|
| 426 | 430 | return null; |
| 427 | 431 | } |
| 428 | 432 | |
@@ -450,8 +454,9 @@ discard block |
||
| 450 | 454 | |
| 451 | 455 | protected function makeTemplate($file, $cacheId, $compileId) |
| 452 | 456 | { |
| 453 | - if ($compileId === null) |
|
| 454 | - $compileId = $this->compile_id; |
|
| 457 | + if ($compileId === null) { |
|
| 458 | + $compileId = $this->compile_id; |
|
| 459 | + } |
|
| 455 | 460 | |
| 456 | 461 | $hash = bin2hex(md5($file.$cacheId.$compileId, true)); |
| 457 | 462 | if (!isset(self::$tplCache[$hash])) { |
@@ -511,8 +516,7 @@ discard block |
||
| 511 | 516 | { |
| 512 | 517 | interface Smarty {} |
| 513 | 518 | class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter implements Smarty {} |
| 514 | -} |
|
| 515 | -else |
|
| 519 | +} else |
|
| 516 | 520 | { |
| 517 | 521 | class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter {} |
| 518 | 522 | } |
@@ -100,11 +100,12 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function allowPhpFunction($func) |
| 102 | 102 | { |
| 103 | - if (is_array($func)) |
|
| 104 | - foreach ($func as $fname) |
|
| 103 | + if (is_array($func)) { |
|
| 104 | + foreach ($func as $fname) |
|
| 105 | 105 | $this->allowedPhpFunctions[strtolower($fname)] = true; |
| 106 | - else |
|
| 107 | - $this->allowedPhpFunctions[strtolower($func)] = true; |
|
| 106 | + } else { |
|
| 107 | + $this->allowedPhpFunctions[strtolower($func)] = true; |
|
| 108 | + } |
|
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | /** |
@@ -114,11 +115,12 @@ discard block |
||
| 114 | 115 | */ |
| 115 | 116 | public function disallowPhpFunction($func) |
| 116 | 117 | { |
| 117 | - if (is_array($func)) |
|
| 118 | - foreach ($func as $fname) |
|
| 118 | + if (is_array($func)) { |
|
| 119 | + foreach ($func as $fname) |
|
| 119 | 120 | unset($this->allowedPhpFunctions[strtolower($fname)]); |
| 120 | - else |
|
| 121 | - unset($this->allowedPhpFunctions[strtolower($func)]); |
|
| 121 | + } else { |
|
| 122 | + unset($this->allowedPhpFunctions[strtolower($func)]); |
|
| 123 | + } |
|
| 122 | 124 | } |
| 123 | 125 | |
| 124 | 126 | /** |
@@ -142,11 +144,12 @@ discard block |
||
| 142 | 144 | */ |
| 143 | 145 | public function allowMethod($class, $method = null) |
| 144 | 146 | { |
| 145 | - if (is_array($class)) |
|
| 146 | - foreach ($class as $elem) |
|
| 147 | + if (is_array($class)) { |
|
| 148 | + foreach ($class as $elem) |
|
| 147 | 149 | $this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])] = true; |
| 148 | - else |
|
| 149 | - $this->allowedMethods[strtolower($class)][strtolower($method)] = true; |
|
| 150 | + } else { |
|
| 151 | + $this->allowedMethods[strtolower($class)][strtolower($method)] = true; |
|
| 152 | + } |
|
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | /** |
@@ -157,11 +160,12 @@ discard block |
||
| 157 | 160 | */ |
| 158 | 161 | public function disallowMethod($class, $method = null) |
| 159 | 162 | { |
| 160 | - if (is_array($class)) |
|
| 161 | - foreach ($class as $elem) |
|
| 163 | + if (is_array($class)) { |
|
| 164 | + foreach ($class as $elem) |
|
| 162 | 165 | unset($this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])]); |
| 163 | - else |
|
| 164 | - unset($this->allowedMethods[strtolower($class)][strtolower($method)]); |
|
| 166 | + } else { |
|
| 167 | + unset($this->allowedMethods[strtolower($class)][strtolower($method)]); |
|
| 168 | + } |
|
| 165 | 169 | } |
| 166 | 170 | |
| 167 | 171 | /** |
@@ -185,11 +189,12 @@ discard block |
||
| 185 | 189 | */ |
| 186 | 190 | public function allowDirectory($path) |
| 187 | 191 | { |
| 188 | - if (is_array($path)) |
|
| 189 | - foreach ($path as $dir) |
|
| 192 | + if (is_array($path)) { |
|
| 193 | + foreach ($path as $dir) |
|
| 190 | 194 | $this->allowedDirectories[realpath($dir)] = true; |
| 191 | - else |
|
| 192 | - $this->allowedDirectories[realpath($path)] = true; |
|
| 195 | + } else { |
|
| 196 | + $this->allowedDirectories[realpath($path)] = true; |
|
| 197 | + } |
|
| 193 | 198 | } |
| 194 | 199 | |
| 195 | 200 | /** |
@@ -199,11 +204,12 @@ discard block |
||
| 199 | 204 | */ |
| 200 | 205 | public function disallowDirectory($path) |
| 201 | 206 | { |
| 202 | - if (is_array($path)) |
|
| 203 | - foreach ($path as $dir) |
|
| 207 | + if (is_array($path)) { |
|
| 208 | + foreach ($path as $dir) |
|
| 204 | 209 | unset($this->allowedDirectories[realpath($dir)]); |
| 205 | - else |
|
| 206 | - unset($this->allowedDirectories[realpath($path)]); |
|
| 210 | + } else { |
|
| 211 | + unset($this->allowedDirectories[realpath($path)]); |
|
| 212 | + } |
|
| 207 | 213 | } |
| 208 | 214 | |
| 209 | 215 | /** |
@@ -713,9 +713,13 @@ discard block |
||
| 713 | 713 | $compiled = $this->addBlock('topLevelBlock', array(), 0); |
| 714 | 714 | $this->stack[0]['buffer'] = ''; |
| 715 | 715 | |
| 716 | - if ($this->debug) echo 'COMPILER INIT<br />'; |
|
| 716 | + if ($this->debug) { |
|
| 717 | + echo 'COMPILER INIT<br />'; |
|
| 718 | + } |
|
| 717 | 719 | |
| 718 | - if ($this->debug) echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')<br>'; |
|
| 720 | + if ($this->debug) { |
|
| 721 | + echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')<br>'; |
|
| 722 | + } |
|
| 719 | 723 | |
| 720 | 724 | // runs preprocessors |
| 721 | 725 | foreach ($this->processors['pre'] as $preProc) { |
@@ -731,7 +735,9 @@ discard block |
||
| 731 | 735 | unset($preProc); |
| 732 | 736 | |
| 733 | 737 | // show template source if debug |
| 734 | - if ($this->debug) echo '<pre>'.print_r(htmlentities($tpl), true).'</pre><hr />'; |
|
| 738 | + if ($this->debug) { |
|
| 739 | + echo '<pre>'.print_r(htmlentities($tpl), true).'</pre><hr />'; |
|
| 740 | + } |
|
| 735 | 741 | |
| 736 | 742 | // strips php tags if required by the security policy |
| 737 | 743 | if ($this->securityPolicy !== null) { |
@@ -820,7 +826,9 @@ discard block |
||
| 820 | 826 | |
| 821 | 827 | $compiled .= $this->removeBlock('topLevelBlock'); |
| 822 | 828 | |
| 823 | - if ($this->debug) echo 'PROCESSING POSTPROCESSORS<br>'; |
|
| 829 | + if ($this->debug) { |
|
| 830 | + echo 'PROCESSING POSTPROCESSORS<br>'; |
|
| 831 | + } |
|
| 824 | 832 | |
| 825 | 833 | foreach ($this->processors['post'] as $postProc) { |
| 826 | 834 | if (is_array($postProc) && isset($postProc['autoload'])) { |
@@ -834,7 +842,9 @@ discard block |
||
| 834 | 842 | } |
| 835 | 843 | unset($postProc); |
| 836 | 844 | |
| 837 | - if ($this->debug) echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage().'<br>'; |
|
| 845 | + if ($this->debug) { |
|
| 846 | + echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage().'<br>'; |
|
| 847 | + } |
|
| 838 | 848 | |
| 839 | 849 | $output = "<?php\n/* template head */\n"; |
| 840 | 850 | |
@@ -902,7 +912,9 @@ discard block |
||
| 902 | 912 | echo ($i+1).'. '.$line."\r\n"; |
| 903 | 913 | } |
| 904 | 914 | } |
| 905 | - if ($this->debug) echo '<hr></pre></pre>'; |
|
| 915 | + if ($this->debug) { |
|
| 916 | + echo '<hr></pre></pre>'; |
|
| 917 | + } |
|
| 906 | 918 | |
| 907 | 919 | $this->template = $this->dwoo = null; |
| 908 | 920 | $tpl = null; |
@@ -987,8 +999,9 @@ discard block |
||
| 987 | 999 | reset($this->scopeTree); |
| 988 | 1000 | $this->scope =& $this->data; |
| 989 | 1001 | $cnt = count($this->scopeTree); |
| 990 | - for ($i=0;$i<$cnt;$i++) |
|
| 991 | - $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1002 | + for ($i=0;$i<$cnt;$i++) { |
|
| 1003 | + $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1004 | + } |
|
| 992 | 1005 | } elseif ($bit === '_root' || $bit === '__') { |
| 993 | 1006 | $this->scope =& $this->data; |
| 994 | 1007 | $this->scopeTree = array(); |
@@ -1253,7 +1266,9 @@ discard block |
||
| 1253 | 1266 | if ($curBlock === 'root' && substr($in, $from, strlen($this->rd)) === $this->rd) { |
| 1254 | 1267 | // end template tag |
| 1255 | 1268 | $pointer += strlen($this->rd); |
| 1256 | - if ($this->debug) echo 'TEMPLATE PARSING ENDED<br />'; |
|
| 1269 | + if ($this->debug) { |
|
| 1270 | + echo 'TEMPLATE PARSING ENDED<br />'; |
|
| 1271 | + } |
|
| 1257 | 1272 | return false; |
| 1258 | 1273 | } |
| 1259 | 1274 | $from++; |
@@ -1272,7 +1287,9 @@ discard block |
||
| 1272 | 1287 | |
| 1273 | 1288 | $substr = substr($in, $from, $to-$from); |
| 1274 | 1289 | |
| 1275 | - if ($this->debug) echo '<br />PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...':'').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer.'<br/>'; |
|
| 1290 | + if ($this->debug) { |
|
| 1291 | + echo '<br />PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...':'').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer.'<br/>'; |
|
| 1292 | + } |
|
| 1276 | 1293 | $parsed = ""; |
| 1277 | 1294 | |
| 1278 | 1295 | if ($curBlock === 'root' && $first === '*') { |
@@ -1357,7 +1374,9 @@ discard block |
||
| 1357 | 1374 | $parsed = 'func'; |
| 1358 | 1375 | } elseif ($first === ';') { |
| 1359 | 1376 | // instruction end |
| 1360 | - if ($this->debug) echo 'END OF INSTRUCTION<br />'; |
|
| 1377 | + if ($this->debug) { |
|
| 1378 | + echo 'END OF INSTRUCTION<br />'; |
|
| 1379 | + } |
|
| 1361 | 1380 | if ($pointer !== null) { |
| 1362 | 1381 | $pointer++; |
| 1363 | 1382 | } |
@@ -1377,20 +1396,28 @@ discard block |
||
| 1377 | 1396 | if ($this->curBlock['type'] == 'else' || $this->curBlock['type'] == 'elseif') { |
| 1378 | 1397 | $pointer -= strlen($match[0]); |
| 1379 | 1398 | } |
| 1380 | - if ($this->debug) echo 'TOP BLOCK CLOSED<br />'; |
|
| 1399 | + if ($this->debug) { |
|
| 1400 | + echo 'TOP BLOCK CLOSED<br />'; |
|
| 1401 | + } |
|
| 1381 | 1402 | return $this->removeTopBlock(); |
| 1382 | 1403 | } else { |
| 1383 | - if ($this->debug) echo 'BLOCK OF TYPE '.$match[1].' CLOSED<br />'; |
|
| 1404 | + if ($this->debug) { |
|
| 1405 | + echo 'BLOCK OF TYPE '.$match[1].' CLOSED<br />'; |
|
| 1406 | + } |
|
| 1384 | 1407 | return $this->removeBlock($match[1]); |
| 1385 | 1408 | } |
| 1386 | 1409 | } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) { |
| 1387 | 1410 | // end template tag |
| 1388 | - if ($this->debug) echo 'TAG PARSING ENDED<br />'; |
|
| 1411 | + if ($this->debug) { |
|
| 1412 | + echo 'TAG PARSING ENDED<br />'; |
|
| 1413 | + } |
|
| 1389 | 1414 | $pointer += strlen($this->rd); |
| 1390 | 1415 | return false; |
| 1391 | 1416 | } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?':'').')(?:\s+|[^=]).*#i', $substr, $match)) { |
| 1392 | 1417 | // named parameter |
| 1393 | - if ($this->debug) echo 'NAMED PARAM FOUND<br />'; |
|
| 1418 | + if ($this->debug) { |
|
| 1419 | + echo 'NAMED PARAM FOUND<br />'; |
|
| 1420 | + } |
|
| 1394 | 1421 | $len = strlen($match[1]); |
| 1395 | 1422 | while (substr($in, $from+$len, 1)===' ') { |
| 1396 | 1423 | $len++; |
@@ -1430,7 +1457,9 @@ discard block |
||
| 1430 | 1457 | // var parsed, check if any var-extension applies |
| 1431 | 1458 | if ($parsed==='var') { |
| 1432 | 1459 | if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) { |
| 1433 | - if($this->debug) echo 'PARSING POST-VAR EXPRESSION '.$substr.'<br />'; |
|
| 1460 | + if($this->debug) { |
|
| 1461 | + echo 'PARSING POST-VAR EXPRESSION '.$substr.'<br />'; |
|
| 1462 | + } |
|
| 1434 | 1463 | // parse expressions |
| 1435 | 1464 | $pointer += strlen($match[0]) - 1; |
| 1436 | 1465 | if (is_array($parsingParams)) { |
@@ -1460,7 +1489,9 @@ discard block |
||
| 1460 | 1489 | } |
| 1461 | 1490 | } |
| 1462 | 1491 | } else if ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) { |
| 1463 | - if($this->debug) echo 'PARSING POST-VAR ASSIGNMENT '.$substr.'<br />'; |
|
| 1492 | + if($this->debug) { |
|
| 1493 | + echo 'PARSING POST-VAR ASSIGNMENT '.$substr.'<br />'; |
|
| 1494 | + } |
|
| 1464 | 1495 | // parse assignment |
| 1465 | 1496 | $value = $match[2]; |
| 1466 | 1497 | $operator = trim($match[1]); |
@@ -1502,7 +1533,9 @@ discard block |
||
| 1502 | 1533 | $out = Dwoo_Compiler::PHP_OPEN. $echo . $out . $operator . implode(' ', $value) . Dwoo_Compiler::PHP_CLOSE; |
| 1503 | 1534 | } else if ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) { |
| 1504 | 1535 | // parse namedparam with var as name (only for array) |
| 1505 | - if ($this->debug) echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND<br />'; |
|
| 1536 | + if ($this->debug) { |
|
| 1537 | + echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND<br />'; |
|
| 1538 | + } |
|
| 1506 | 1539 | $len = strlen($match[1]); |
| 1507 | 1540 | $var = $out[count($out)-1]; |
| 1508 | 1541 | $pointer += $len; |
@@ -1576,7 +1609,9 @@ discard block |
||
| 1576 | 1609 | $cmdstr = $match[1]; |
| 1577 | 1610 | } |
| 1578 | 1611 | |
| 1579 | - if ($this->debug) echo 'FUNC FOUND ('.$func.')<br />'; |
|
| 1612 | + if ($this->debug) { |
|
| 1613 | + echo 'FUNC FOUND ('.$func.')<br />'; |
|
| 1614 | + } |
|
| 1580 | 1615 | |
| 1581 | 1616 | $paramsep = ''; |
| 1582 | 1617 | |
@@ -1638,17 +1673,25 @@ discard block |
||
| 1638 | 1673 | } |
| 1639 | 1674 | |
| 1640 | 1675 | if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') { |
| 1641 | - if ($this->debug) echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1676 | + if ($this->debug) { |
|
| 1677 | + echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1678 | + } |
|
| 1642 | 1679 | break 2; |
| 1643 | 1680 | } elseif ($paramstr[$ptr] === ';') { |
| 1644 | 1681 | $ptr++; |
| 1645 | - if ($this->debug) echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1682 | + if ($this->debug) { |
|
| 1683 | + echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1684 | + } |
|
| 1646 | 1685 | break 2; |
| 1647 | 1686 | } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') { |
| 1648 | - if ($this->debug) echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1687 | + if ($this->debug) { |
|
| 1688 | + echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1689 | + } |
|
| 1649 | 1690 | break 2; |
| 1650 | 1691 | } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) { |
| 1651 | - if ($this->debug) echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1692 | + if ($this->debug) { |
|
| 1693 | + echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 1694 | + } |
|
| 1652 | 1695 | break 2; |
| 1653 | 1696 | } |
| 1654 | 1697 | |
@@ -1659,7 +1702,9 @@ discard block |
||
| 1659 | 1702 | } |
| 1660 | 1703 | } |
| 1661 | 1704 | |
| 1662 | - if ($this->debug) echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr.'<br/>'; |
|
| 1705 | + if ($this->debug) { |
|
| 1706 | + echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr.'<br/>'; |
|
| 1707 | + } |
|
| 1663 | 1708 | |
| 1664 | 1709 | if ($func === 'if' || $func === 'elseif' || $func === 'tif') { |
| 1665 | 1710 | $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'condition', $ptr); |
@@ -1669,7 +1714,9 @@ discard block |
||
| 1669 | 1714 | $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'function', $ptr); |
| 1670 | 1715 | } |
| 1671 | 1716 | |
| 1672 | - if ($this->debug) echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')<br/>'; |
|
| 1717 | + if ($this->debug) { |
|
| 1718 | + echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')<br/>'; |
|
| 1719 | + } |
|
| 1673 | 1720 | } |
| 1674 | 1721 | } |
| 1675 | 1722 | $paramstr = substr($paramstr, 0, $ptr); |
@@ -1693,7 +1740,9 @@ discard block |
||
| 1693 | 1740 | |
| 1694 | 1741 | if ($pointer !== null) { |
| 1695 | 1742 | $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0); |
| 1696 | - if ($this->debug) echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)).' TO POINTER<br/>'; |
|
| 1743 | + if ($this->debug) { |
|
| 1744 | + echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)).' TO POINTER<br/>'; |
|
| 1745 | + } |
|
| 1697 | 1746 | } |
| 1698 | 1747 | |
| 1699 | 1748 | if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) { |
@@ -1931,7 +1980,9 @@ discard block |
||
| 1931 | 1980 | $substr = substr($in, $from, $to-$from); |
| 1932 | 1981 | $first = $substr[0]; |
| 1933 | 1982 | |
| 1934 | - if ($this->debug) echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...':'').')<br />'; |
|
| 1983 | + if ($this->debug) { |
|
| 1984 | + echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...':'').')<br />'; |
|
| 1985 | + } |
|
| 1935 | 1986 | $strend = false; |
| 1936 | 1987 | $o = $from+1; |
| 1937 | 1988 | while ($strend === false) { |
@@ -1944,7 +1995,9 @@ discard block |
||
| 1944 | 1995 | $strend = false; |
| 1945 | 1996 | } |
| 1946 | 1997 | } |
| 1947 | - if ($this->debug) echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from).'<br/>'; |
|
| 1998 | + if ($this->debug) { |
|
| 1999 | + echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from).'<br/>'; |
|
| 2000 | + } |
|
| 1948 | 2001 | |
| 1949 | 2002 | $srcOutput = substr($in, $from, $strend+1-$from); |
| 1950 | 2003 | |
@@ -2150,11 +2203,15 @@ discard block |
||
| 2150 | 2203 | } |
| 2151 | 2204 | unset($uid, $current, $curTxt, $tree, $chars); |
| 2152 | 2205 | |
| 2153 | - if ($this->debug) echo 'RECURSIVE VAR REPLACEMENT : '.$key.'<br>'; |
|
| 2206 | + if ($this->debug) { |
|
| 2207 | + echo 'RECURSIVE VAR REPLACEMENT : '.$key.'<br>'; |
|
| 2208 | + } |
|
| 2154 | 2209 | |
| 2155 | 2210 | $key = $this->flattenVarTree($parsed); |
| 2156 | 2211 | |
| 2157 | - if ($this->debug) echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key.'<br>'; |
|
| 2212 | + if ($this->debug) { |
|
| 2213 | + echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key.'<br>'; |
|
| 2214 | + } |
|
| 2158 | 2215 | |
| 2159 | 2216 | $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("'.$key.'")'); |
| 2160 | 2217 | } else { |
@@ -2334,8 +2391,9 @@ discard block |
||
| 2334 | 2391 | $global = 'COOKIE'; |
| 2335 | 2392 | } |
| 2336 | 2393 | $key = '$_'.$global; |
| 2337 | - foreach (explode('.', ltrim($m[2], '.')) as $part) |
|
| 2338 | - $key .= '['.var_export($part, true).']'; |
|
| 2394 | + foreach (explode('.', ltrim($m[2], '.')) as $part) { |
|
| 2395 | + $key .= '['.var_export($part, true).']'; |
|
| 2396 | + } |
|
| 2339 | 2397 | if ($curBlock === 'root') { |
| 2340 | 2398 | $output = $key; |
| 2341 | 2399 | } else { |
@@ -2445,7 +2503,9 @@ discard block |
||
| 2445 | 2503 | } else { |
| 2446 | 2504 | $cnt = substr_count($key, '$'); |
| 2447 | 2505 | |
| 2448 | - if ($this->debug) echo 'PARSING SUBVARS IN : '.$key.'<br>'; |
|
| 2506 | + if ($this->debug) { |
|
| 2507 | + echo 'PARSING SUBVARS IN : '.$key.'<br>'; |
|
| 2508 | + } |
|
| 2449 | 2509 | if ($cnt > 0) { |
| 2450 | 2510 | while (--$cnt >= 0) { |
| 2451 | 2511 | if (isset($last)) { |
@@ -2467,7 +2527,9 @@ discard block |
||
| 2467 | 2527 | $last, |
| 2468 | 2528 | $len |
| 2469 | 2529 | ); |
| 2470 | - if ($this->debug) echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key.'<br>'; |
|
| 2530 | + if ($this->debug) { |
|
| 2531 | + echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key.'<br>'; |
|
| 2532 | + } |
|
| 2471 | 2533 | } |
| 2472 | 2534 | unset($last); |
| 2473 | 2535 | |
@@ -2548,15 +2610,21 @@ discard block |
||
| 2548 | 2610 | $substr = trim($substr); |
| 2549 | 2611 | |
| 2550 | 2612 | if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') { |
| 2551 | - if ($this->debug) echo 'BOOLEAN(FALSE) PARSED<br />'; |
|
| 2613 | + if ($this->debug) { |
|
| 2614 | + echo 'BOOLEAN(FALSE) PARSED<br />'; |
|
| 2615 | + } |
|
| 2552 | 2616 | $substr = 'false'; |
| 2553 | 2617 | $type = self::T_BOOL; |
| 2554 | 2618 | } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') { |
| 2555 | - if ($this->debug) echo 'BOOLEAN(TRUE) PARSED<br />'; |
|
| 2619 | + if ($this->debug) { |
|
| 2620 | + echo 'BOOLEAN(TRUE) PARSED<br />'; |
|
| 2621 | + } |
|
| 2556 | 2622 | $substr = 'true'; |
| 2557 | 2623 | $type = self::T_BOOL; |
| 2558 | 2624 | } elseif ($substr === 'null' || $substr === 'NULL') { |
| 2559 | - if ($this->debug) echo 'NULL PARSED<br />'; |
|
| 2625 | + if ($this->debug) { |
|
| 2626 | + echo 'NULL PARSED<br />'; |
|
| 2627 | + } |
|
| 2560 | 2628 | $substr = 'null'; |
| 2561 | 2629 | $type = self::T_NULL; |
| 2562 | 2630 | } elseif (is_numeric($substr)) { |
@@ -2565,19 +2633,27 @@ discard block |
||
| 2565 | 2633 | $substr = (int) $substr; |
| 2566 | 2634 | } |
| 2567 | 2635 | $type = self::T_NUMERIC; |
| 2568 | - if ($this->debug) echo 'NUMBER ('.$substr.') PARSED<br />'; |
|
| 2636 | + if ($this->debug) { |
|
| 2637 | + echo 'NUMBER ('.$substr.') PARSED<br />'; |
|
| 2638 | + } |
|
| 2569 | 2639 | } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) { |
| 2570 | - if ($this->debug) echo 'SIMPLE MATH PARSED<br />'; |
|
| 2640 | + if ($this->debug) { |
|
| 2641 | + echo 'SIMPLE MATH PARSED<br />'; |
|
| 2642 | + } |
|
| 2571 | 2643 | $type = self::T_MATH; |
| 2572 | 2644 | $substr = '('.$substr.')'; |
| 2573 | 2645 | } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) { |
| 2574 | - if ($this->debug) echo 'BREAKCHAR ('.$substr.') PARSED<br />'; |
|
| 2646 | + if ($this->debug) { |
|
| 2647 | + echo 'BREAKCHAR ('.$substr.') PARSED<br />'; |
|
| 2648 | + } |
|
| 2575 | 2649 | $type = self::T_BREAKCHAR; |
| 2576 | 2650 | //$substr = '"'.$substr.'"'; |
| 2577 | 2651 | } else { |
| 2578 | 2652 | $substr = $this->replaceStringVars('\''.str_replace('\'', '\\\'', $substr).'\'', '\'', $curBlock); |
| 2579 | 2653 | $type = self::T_UNQUOTED_STRING; |
| 2580 | - if ($this->debug) echo 'BLABBER ('.$substr.') CASTED AS STRING<br />'; |
|
| 2654 | + if ($this->debug) { |
|
| 2655 | + echo 'BLABBER ('.$substr.') CASTED AS STRING<br />'; |
|
| 2656 | + } |
|
| 2581 | 2657 | } |
| 2582 | 2658 | |
| 2583 | 2659 | if (is_array($parsingParams)) { |
@@ -2603,7 +2679,9 @@ discard block |
||
| 2603 | 2679 | protected function replaceStringVars($string, $first, $curBlock='') |
| 2604 | 2680 | { |
| 2605 | 2681 | $pos = 0; |
| 2606 | - if ($this->debug) echo 'STRING VAR REPLACEMENT : '.$string.'<br>'; |
|
| 2682 | + if ($this->debug) { |
|
| 2683 | + echo 'STRING VAR REPLACEMENT : '.$string.'<br>'; |
|
| 2684 | + } |
|
| 2607 | 2685 | // replace vars |
| 2608 | 2686 | while (($pos = strpos($string, '$', $pos)) !== false) { |
| 2609 | 2687 | $prev = substr($string, $pos-1, 1); |
@@ -2622,7 +2700,9 @@ discard block |
||
| 2622 | 2700 | $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len); |
| 2623 | 2701 | } |
| 2624 | 2702 | $pos += strlen($var[1]) + 2; |
| 2625 | - if ($this->debug) echo 'STRING VAR REPLACEMENT DONE : '.$string.'<br>'; |
|
| 2703 | + if ($this->debug) { |
|
| 2704 | + echo 'STRING VAR REPLACEMENT DONE : '.$string.'<br>'; |
|
| 2705 | + } |
|
| 2626 | 2706 | } |
| 2627 | 2707 | |
| 2628 | 2708 | // handle modifiers |
@@ -2646,7 +2726,9 @@ discard block |
||
| 2646 | 2726 | */ |
| 2647 | 2727 | protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null) |
| 2648 | 2728 | { |
| 2649 | - if ($this->debug) echo 'PARSING MODIFIERS : '.$m[3].'<br />'; |
|
| 2729 | + if ($this->debug) { |
|
| 2730 | + echo 'PARSING MODIFIERS : '.$m[3].'<br />'; |
|
| 2731 | + } |
|
| 2650 | 2732 | |
| 2651 | 2733 | if ($pointer !== null) { |
| 2652 | 2734 | $pointer += strlen($m[3]); |
@@ -2668,7 +2750,9 @@ discard block |
||
| 2668 | 2750 | continue; |
| 2669 | 2751 | } |
| 2670 | 2752 | if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) { |
| 2671 | - if ($this->debug) echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND<br/>'; |
|
| 2753 | + if ($this->debug) { |
|
| 2754 | + echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND<br/>'; |
|
| 2755 | + } |
|
| 2672 | 2756 | $continue = false; |
| 2673 | 2757 | if ($pointer !== null) { |
| 2674 | 2758 | $pointer -= strlen($cmdstrsrc); |
@@ -2687,7 +2771,9 @@ discard block |
||
| 2687 | 2771 | if ($paramspos === false) { |
| 2688 | 2772 | $cmdstrsrc = substr($cmdstrsrc, strlen($func)); |
| 2689 | 2773 | $params = array(); |
| 2690 | - if ($this->debug) echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS<br/>'; |
|
| 2774 | + if ($this->debug) { |
|
| 2775 | + echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS<br/>'; |
|
| 2776 | + } |
|
| 2691 | 2777 | } else { |
| 2692 | 2778 | $paramstr = substr($cmdstr, $paramspos+1); |
| 2693 | 2779 | if (substr($paramstr, -1, 1) === $paramsep) { |
@@ -2697,18 +2783,28 @@ discard block |
||
| 2697 | 2783 | $ptr = 0; |
| 2698 | 2784 | $params = array(); |
| 2699 | 2785 | while ($ptr < strlen($paramstr)) { |
| 2700 | - if ($this->debug) echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr.'<br/>'; |
|
| 2701 | - if ($this->debug) echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier<br/>'; |
|
| 2786 | + if ($this->debug) { |
|
| 2787 | + echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr.'<br/>'; |
|
| 2788 | + } |
|
| 2789 | + if ($this->debug) { |
|
| 2790 | + echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier<br/>'; |
|
| 2791 | + } |
|
| 2702 | 2792 | $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr); |
| 2703 | - if ($this->debug) echo 'PARAM PARSED, POINTER AT '.$ptr.'<br/>'; |
|
| 2793 | + if ($this->debug) { |
|
| 2794 | + echo 'PARAM PARSED, POINTER AT '.$ptr.'<br/>'; |
|
| 2795 | + } |
|
| 2704 | 2796 | |
| 2705 | 2797 | if ($ptr >= strlen($paramstr)) { |
| 2706 | - if ($this->debug) echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED<br/>'; |
|
| 2798 | + if ($this->debug) { |
|
| 2799 | + echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED<br/>'; |
|
| 2800 | + } |
|
| 2707 | 2801 | break; |
| 2708 | 2802 | } |
| 2709 | 2803 | |
| 2710 | 2804 | if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) { |
| 2711 | - if ($this->debug) echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 2805 | + if ($this->debug) { |
|
| 2806 | + echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr.'<br/>'; |
|
| 2807 | + } |
|
| 2712 | 2808 | if ($paramstr[$ptr] !== '|') { |
| 2713 | 2809 | $continue = false; |
| 2714 | 2810 | if ($pointer !== null) { |
@@ -2769,8 +2865,9 @@ discard block |
||
| 2769 | 2865 | } |
| 2770 | 2866 | } elseif ($pluginType & Dwoo_Core::PROXY_PLUGIN) { |
| 2771 | 2867 | $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state); |
| 2772 | - foreach ($params as &$p) |
|
| 2773 | - $p = $p[0]; |
|
| 2868 | + foreach ($params as &$p) { |
|
| 2869 | + $p = $p[0]; |
|
| 2870 | + } |
|
| 2774 | 2871 | $output = call_user_func(array($this->dwoo->getPluginProxy(), 'getCode'), $func, $params); |
| 2775 | 2872 | } elseif ($pluginType & Dwoo_Core::SMARTY_MODIFIER) { |
| 2776 | 2873 | $params = $this->mapParams($params, null, $state); |
@@ -2812,8 +2909,9 @@ discard block |
||
| 2812 | 2909 | |
| 2813 | 2910 | $params = $this->mapParams($params, $callback, $state); |
| 2814 | 2911 | |
| 2815 | - foreach ($params as &$p) |
|
| 2816 | - $p = $p[0]; |
|
| 2912 | + foreach ($params as &$p) { |
|
| 2913 | + $p = $p[0]; |
|
| 2914 | + } |
|
| 2817 | 2915 | |
| 2818 | 2916 | if ($pluginType & Dwoo_Core::FUNC_PLUGIN) { |
| 2819 | 2917 | if ($pluginType & Dwoo_Core::COMPILABLE_PLUGIN) { |
@@ -2904,8 +3002,9 @@ discard block |
||
| 2904 | 3002 | foreach ($params as $k=>$p) { |
| 2905 | 3003 | if (is_array($p)) { |
| 2906 | 3004 | $out2 = 'array('; |
| 2907 | - foreach ($p as $k2=>$v) |
|
| 2908 | - $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', '; |
|
| 3005 | + foreach ($p as $k2=>$v) { |
|
| 3006 | + $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', '; |
|
| 3007 | + } |
|
| 2909 | 3008 | $p = rtrim($out2, ', ').')'; |
| 2910 | 3009 | } |
| 2911 | 3010 | if ($recursiveCall) { |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if (!defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | require "dwoo/dwooAutoload.php"; |
| 4 | 6 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if (!defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | // The name of the directory where templates are located. |
| 4 | 6 | $config['template_dir'] = dirname(FCPATH) . '/../application/views/'; |
@@ -248,8 +248,7 @@ discard block |
||
| 248 | 248 | // |
| 249 | 249 | elseif (is_subclass_of($engine, 'Dwoo') || 'Dwoo' === $engine) { |
| 250 | 250 | $this->_engine = new $engine(); |
| 251 | - } |
|
| 252 | - else { |
|
| 251 | + } else { |
|
| 253 | 252 | throw new Dwoo_Exception("Custom engine must be a subclass of Dwoo"); |
| 254 | 253 | } |
| 255 | 254 | } |
@@ -277,11 +276,9 @@ discard block |
||
| 277 | 276 | { |
| 278 | 277 | if ($data instanceof Dwoo_IDataProvider) { |
| 279 | 278 | $this->_dataProvider = $data; |
| 280 | - } |
|
| 281 | - elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) { |
|
| 279 | + } elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) { |
|
| 282 | 280 | $this->_dataProvider = new $data(); |
| 283 | - } |
|
| 284 | - else { |
|
| 281 | + } else { |
|
| 285 | 282 | throw new Dwoo_Exception("Custom data provider must be a subclass of Dwoo_Data or instance of Dwoo_IDataProvider"); |
| 286 | 283 | } |
| 287 | 284 | } |
@@ -320,8 +317,7 @@ discard block |
||
| 320 | 317 | // if param given as a string |
| 321 | 318 | elseif (is_subclass_of($compiler, 'Dwoo_Compiler') || 'Dwoo_Compiler' == $compiler) { |
| 322 | 319 | $this->_compiler = new $compiler; |
| 323 | - } |
|
| 324 | - else { |
|
| 320 | + } else { |
|
| 325 | 321 | throw new Dwoo_Exception("Custom compiler must be a subclass of Dwoo_Compiler or instance of Dwoo_ICompiler"); |
| 326 | 322 | } |
| 327 | 323 | } |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | if ($name === null) { |
| 46 | 46 | $this->data = array(); |
| 47 | 47 | } elseif (is_array($name)) { |
| 48 | - foreach ($name as $index) |
|
| 49 | - unset($this->data[$index]); |
|
| 48 | + foreach ($name as $index) { |
|
| 49 | + unset($this->data[$index]); |
|
| 50 | + } |
|
| 50 | 51 | } else { |
| 51 | 52 | unset($this->data[$name]); |
| 52 | 53 | } |
@@ -90,8 +91,9 @@ discard block |
||
| 90 | 91 | { |
| 91 | 92 | if (is_array($name)) { |
| 92 | 93 | reset($name); |
| 93 | - while (list($k,$v) = each($name)) |
|
| 94 | - $this->data[$k] = $v; |
|
| 94 | + while (list($k,$v) = each($name)) { |
|
| 95 | + $this->data[$k] = $v; |
|
| 96 | + } |
|
| 95 | 97 | } else { |
| 96 | 98 | $this->data[$name] = $val; |
| 97 | 99 | } |
@@ -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)); |