Completed
Push — 1.2 ( 261ddf...fd7ca1 )
by David
15:45 queued 09:58
created
lib/Dwoo/Plugin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@
 block discarded – undo
79 79
 
80 80
         $out = '';
81 81
         foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
82
+            $out .= ' '.$attr.'=';
83 83
             if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
84
+                $out .= str_replace($delim, '\\'.$delim, '""');
85 85
             } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
86
+                $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"');
87 87
             } else {
88 88
                 if (!$compiler) {
89 89
                     // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
90
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91 91
                 } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92 92
                     // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
93
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94 94
                 } else {
95 95
                     // print as is
96
-                    $escapedVal = '.' . $val . '.';
96
+                    $escapedVal = '.'.$val.'.';
97 97
                 }
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
99
+                $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"');
100 100
             }
101 101
         }
102 102
 
Please login to merge, or discard this patch.
lib/Dwoo/Loader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
57 57
         if (file_exists($cacheFile)) {
58 58
             $classpath = file_get_contents($cacheFile);
59
-            $this->classPath = unserialize($classpath) + $this->classPath;
59
+            $this->classPath = unserialize($classpath)+$this->classPath;
60 60
         } else {
61 61
             $this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
62 62
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $this->paths[$pluginDir] = $cacheFile;
154 154
         if (file_exists($cacheFile)) {
155 155
             $classpath = file_get_contents($cacheFile);
156
-            $this->classPath = unserialize($classpath) + $this->classPath;
156
+            $this->classPath = unserialize($classpath)+$this->classPath;
157 157
         } else {
158 158
             $this->rebuildClassPathCache($pluginDir, $cacheFile);
159 159
         }
Please login to merge, or discard this patch.
lib/Dwoo/Compiler.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -788,23 +788,23 @@  discard block
 block discarded – undo
788 788
             if ($pos === false) {
789 789
                 $this->push(substr($tpl, $ptr), 0);
790 790
                 break;
791
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
792
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1).$this->ld);
793
-                $ptr = $pos + strlen($this->ld);
791
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
792
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
793
+                $ptr = $pos+strlen($this->ld);
794 794
             } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
795 795
                 if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
796 796
                     throw new Dwoo_Compilation_Exception($this, 'The {literal} blocks must be closed explicitly with {/literal}');
797 797
                 }
798 798
                 $endpos = $litClose[0][1];
799
-                $this->push(substr($tpl, $ptr, $pos - $ptr).substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
800
-                $ptr = $endpos + strlen($litClose[0][0]);
799
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
800
+                $ptr = $endpos+strlen($litClose[0][0]);
801 801
             } else {
802
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
803
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
802
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
803
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
804 804
                     $ptr = $pos;
805 805
                 }
806 806
 
807
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
807
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
808 808
                 $ptr = $pos;
809 809
 
810 810
                 $pos += strlen($this->ld);
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
                         continue 2;
837 837
                     }
838 838
 
839
-                    $len = $subptr - $ptr;
839
+                    $len = $subptr-$ptr;
840 840
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
841 841
                     $ptr += $len;
842 842
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
             $lines = preg_split('{\r\n|\n|<br />}', $output);
933 933
             array_shift($lines);
934 934
             foreach ($lines as $i => $line) {
935
-                echo($i + 1).'. '.$line."\r\n";
935
+                echo($i+1).'. '.$line."\r\n";
936 936
             }
937 937
             echo '============================================================================================='."\n";
938 938
         }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 
981 981
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
982 982
             // buffer is not initialized yet (the block has just been created)
983
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string) $content;
983
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
984 984
             $this->curBlock['buffer'] = '';
985 985
         } else {
986 986
             if (!isset($this->curBlock['buffer'])) {
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1069 1069
 
1070 1070
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => false, 'class' => $class, 'buffer' => null);
1071
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1071
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1072 1072
 
1073 1073
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1074 1074
     }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1095 1095
 
1096 1096
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => true, 'class' => $class, 'buffer' => null);
1097
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1097
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1098 1098
 
1099 1099
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1100 1100
     }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             $this->dwoo->getLoader()->loadPlugin($type);
1119 1119
         }
1120 1120
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => false, 'class' => $class, 'buffer' => null);
1121
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1121
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1122 1122
     }
1123 1123
 
1124 1124
     /**
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
                     $class = 'Dwoo_Plugin_'.$top['type'];
1152 1152
                 }
1153 1153
                 if (count($this->stack)) {
1154
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1154
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1155 1155
                     $this->push(call_user_func(array($class, 'postProcessing'), $this, $top['params'], '', '', $top['buffer']), 0);
1156 1156
                 } else {
1157 1157
                     $null = null;
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
             $class = 'Dwoo_Plugin_'.$o['type'];
1242 1242
         }
1243 1243
 
1244
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1244
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1245 1245
 
1246 1246
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1247 1247
     }
@@ -1353,16 +1353,16 @@  discard block
 block discarded – undo
1353 1353
             $first = $in[$from];
1354 1354
         }
1355 1355
 
1356
-        $substr = substr($in, $from, $to - $from);
1356
+        $substr = substr($in, $from, $to-$from);
1357 1357
 
1358 1358
         if ($this->debug) {
1359
-            echo 'PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to - $from, 50))).(($to - $from) > 50 ? '...' : '').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1359
+            echo 'PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1360 1360
         }
1361 1361
         $parsed = '';
1362 1362
 
1363 1363
         if ($curBlock === 'root' && $first === '*') {
1364 1364
             $src = $this->getTemplateSource();
1365
-            $startpos = $this->getPointer() - strlen($this->ld);
1365
+            $startpos = $this->getPointer()-strlen($this->ld);
1366 1366
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1367 1367
                 if ($startpos > 0) {
1368 1368
                     do {
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
                 if (!isset($whitespaceStart)) {
1379 1379
                     $startpos = $this->getPointer();
1380 1380
                 } else {
1381
-                    $pointer -= $this->getPointer() - $startpos;
1381
+                    $pointer -= $this->getPointer()-$startpos;
1382 1382
                 }
1383 1383
 
1384 1384
                 if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
@@ -1393,33 +1393,33 @@  discard block
 block discarded – undo
1393 1393
 
1394 1394
                         if ($open !== false && $close !== false) {
1395 1395
                             if ($open < $close) {
1396
-                                $ptr = $open + strlen($comOpen);
1396
+                                $ptr = $open+strlen($comOpen);
1397 1397
                                 ++$level;
1398 1398
                             } else {
1399
-                                $ptr = $close + strlen($comClose);
1399
+                                $ptr = $close+strlen($comClose);
1400 1400
                                 --$level;
1401 1401
                             }
1402 1402
                         } elseif ($open !== false) {
1403
-                            $ptr = $open + strlen($comOpen);
1403
+                            $ptr = $open+strlen($comOpen);
1404 1404
                             ++$level;
1405 1405
                         } elseif ($close !== false) {
1406
-                            $ptr = $close + strlen($comClose);
1406
+                            $ptr = $close+strlen($comClose);
1407 1407
                             --$level;
1408 1408
                         } else {
1409 1409
                             $ptr = strlen($src);
1410 1410
                         }
1411 1411
                     }
1412
-                    $endpos = $ptr - strlen('*'.$this->rd);
1412
+                    $endpos = $ptr-strlen('*'.$this->rd);
1413 1413
                 } else {
1414 1414
                     $endpos = strpos($src, '*'.$this->rd, $startpos);
1415 1415
                     if ($endpos == false) {
1416 1416
                         throw new Dwoo_Compilation_Exception($this, 'Un-ended comment');
1417 1417
                     }
1418 1418
                 }
1419
-                $pointer += $endpos - $startpos + strlen('*'.$this->rd);
1420
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*'.$this->rd)), $m)) {
1419
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1420
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1421 1421
                     $pointer += strlen($m[0]);
1422
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1422
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1423 1423
                 }
1424 1424
 
1425 1425
                 return false;
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
                 ++$pointer;
1450 1450
             }
1451 1451
 
1452
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1452
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1453 1453
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1454 1454
             // close block
1455 1455
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
                 echo 'NAMED PARAM FOUND'."\n";
1492 1492
             }
1493 1493
             $len = strlen($match[1]);
1494
-            while (substr($in, $from + $len, 1) === ' ') {
1494
+            while (substr($in, $from+$len, 1) === ' ') {
1495 1495
                 ++$len;
1496 1496
             }
1497 1497
             if ($pointer !== null) {
1498 1498
                 $pointer += $len;
1499 1499
             }
1500 1500
 
1501
-            $output = array(trim($match[1], " \t\r\n=>'\""), $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer));
1501
+            $output = array(trim($match[1], " \t\r\n=>'\""), $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer));
1502 1502
 
1503 1503
             $parsingParams[] = $output;
1504 1504
 
@@ -1518,14 +1518,14 @@  discard block
 block discarded – undo
1518 1518
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1519 1519
         } else {
1520 1520
             // parse error
1521
-            throw new Dwoo_Compilation_Exception($this, 'Parse error in "'.substr($in, $from, $to - $from).'"');
1521
+            throw new Dwoo_Compilation_Exception($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1522 1522
         }
1523 1523
 
1524 1524
         if (empty($out)) {
1525 1525
             return '';
1526 1526
         }
1527 1527
 
1528
-        $substr = substr($in, $pointer, $to - $pointer);
1528
+        $substr = substr($in, $pointer, $to-$pointer);
1529 1529
 
1530 1530
         // var parsed, check if any var-extension applies
1531 1531
         if ($parsed === 'var') {
@@ -1534,15 +1534,15 @@  discard block
 block discarded – undo
1534 1534
                     echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1535 1535
                 }
1536 1536
                 // parse expressions
1537
-                $pointer += strlen($match[0]) - 1;
1537
+                $pointer += strlen($match[0])-1;
1538 1538
                 if (is_array($parsingParams)) {
1539 1539
                     if ($match[2] == '$') {
1540 1540
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1541 1541
                     } else {
1542 1542
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1543 1543
                     }
1544
-                    $out[count($out) - 1][0] .= $match[1].$expr[0][0];
1545
-                    $out[count($out) - 1][1] .= $match[1].$expr[0][1];
1544
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1545
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1546 1546
                 } else {
1547 1547
                     if ($match[2] == '$') {
1548 1548
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
                     echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1611 1611
                 }
1612 1612
                 $len = strlen($match[1]);
1613
-                $var = $out[count($out) - 1];
1613
+                $var = $out[count($out)-1];
1614 1614
                 $pointer += $len;
1615 1615
 
1616 1616
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1625,9 +1625,9 @@  discard block
 block discarded – undo
1625 1625
             // parse modifier on funcs or vars
1626 1626
             $srcPointer = $pointer;
1627 1627
             if (is_array($parsingParams)) {
1628
-                $tmp = $this->replaceModifiers(array(null, null, $out[count($out) - 1][0], $match[0]), $curBlock, $pointer);
1629
-                $out[count($out) - 1][0] = $tmp;
1630
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1628
+                $tmp = $this->replaceModifiers(array(null, null, $out[count($out)-1][0], $match[0]), $curBlock, $pointer);
1629
+                $out[count($out)-1][0] = $tmp;
1630
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1631 1631
             } else {
1632 1632
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1633 1633
             }
@@ -1639,10 +1639,10 @@  discard block
 block discarded – undo
1639 1639
             $ptr = 0;
1640 1640
 
1641 1641
             if (is_array($parsingParams)) {
1642
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1642
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1643 1643
 
1644
-                $out[count($out) - 1][0] = $output;
1645
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1644
+                $out[count($out)-1][0] = $output;
1645
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1646 1646
             } else {
1647 1647
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1648 1648
             }
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
      */
1676 1676
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1677 1677
     {
1678
-        $cmdstr = substr($in, $from, $to - $from);
1678
+        $cmdstr = substr($in, $from, $to-$from);
1679 1679
         preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1680 1680
 
1681 1681
         if (empty($match[1])) {
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
             $paramspos = $match[1][0][1];
1702 1702
             $paramsep = substr($match[1][0][0], -1) === '(' ? ')' : '';
1703 1703
             if ($paramsep === ')') {
1704
-                $paramspos += strlen($match[1][0][0]) - 1;
1704
+                $paramspos += strlen($match[1][0][0])-1;
1705 1705
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1706 1706
                     $paramsep = '';
1707 1707
                     if (strlen($match[1][0][0]) > 1) {
@@ -1730,8 +1730,8 @@  discard block
 block discarded – undo
1730 1730
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1731 1731
                 }
1732 1732
             }
1733
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1734
-            $paramstr = substr($cmdstr, $paramspos + 1);
1733
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1734
+            $paramstr = substr($cmdstr, $paramspos+1);
1735 1735
             if (substr($paramstr, -1, 1) === $paramsep) {
1736 1736
                 $paramstr = substr($paramstr, 0, -1);
1737 1737
             }
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
                         }
1795 1795
 
1796 1796
                         if ($this->debug) {
1797
-                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr - 1, 3).')'."\n";
1797
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1798 1798
                         }
1799 1799
                     }
1800 1800
                 }
@@ -1818,9 +1818,9 @@  discard block
 block discarded – undo
1818 1818
         }
1819 1819
 
1820 1820
         if ($pointer !== null) {
1821
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1821
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1822 1822
             if ($this->debug) {
1823
-                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)).' TO POINTER'."\n";
1823
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1824 1824
             }
1825 1825
         }
1826 1826
 
@@ -2062,29 +2062,29 @@  discard block
 block discarded – undo
2062 2062
      */
2063 2063
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2064 2064
     {
2065
-        $substr = substr($in, $from, $to - $from);
2065
+        $substr = substr($in, $from, $to-$from);
2066 2066
         $first = $substr[0];
2067 2067
 
2068 2068
         if ($this->debug) {
2069
-            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to - $from, 50))).(($to - $from) > 50 ? '...' : '').')'."\n";
2069
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2070 2070
         }
2071 2071
         $strend = false;
2072
-        $o = $from + 1;
2072
+        $o = $from+1;
2073 2073
         while ($strend === false) {
2074 2074
             $strend = strpos($in, $first, $o);
2075 2075
             if ($strend === false) {
2076
-                throw new Dwoo_Compilation_Exception($this, 'Unfinished string, started with '.substr($in, $from, $to - $from));
2076
+                throw new Dwoo_Compilation_Exception($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2077 2077
             }
2078
-            if (substr($in, $strend - 1, 1) === '\\') {
2079
-                $o = $strend + 1;
2078
+            if (substr($in, $strend-1, 1) === '\\') {
2079
+                $o = $strend+1;
2080 2080
                 $strend = false;
2081 2081
             }
2082 2082
         }
2083 2083
         if ($this->debug) {
2084
-            echo 'STRING DELIMITED: '.substr($in, $from, $strend + 1 - $from)."\n";
2084
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2085 2085
         }
2086 2086
 
2087
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2087
+        $srcOutput = substr($in, $from, $strend+1-$from);
2088 2088
 
2089 2089
         if ($pointer !== null) {
2090 2090
             $pointer += strlen($srcOutput);
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
         $output = $this->replaceStringVars($srcOutput, $first);
2094 2094
 
2095 2095
         // handle modifiers
2096
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2096
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2097 2097
             $modstr = $match[1];
2098 2098
 
2099 2099
             if ($curBlock === 'root' && substr($modstr, -1) === '}') {
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
             if ($pointer !== null) {
2108 2108
                 $pointer += $ptr;
2109 2109
             }
2110
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2110
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2111 2111
         }
2112 2112
 
2113 2113
         if (is_array($parsingParams)) {
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
      */
2138 2138
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2139 2139
     {
2140
-        $substr = substr($in, $from, $to - $from);
2140
+        $substr = substr($in, $from, $to-$from);
2141 2141
 
2142 2142
         if ($this->debug) {
2143 2143
             echo 'CONST FOUND : '.$substr."\n";
@@ -2203,12 +2203,12 @@  discard block
 block discarded – undo
2203 2203
      */
2204 2204
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2205 2205
     {
2206
-        $substr = substr($in, $from, $to - $from);
2206
+        $substr = substr($in, $from, $to-$from);
2207 2207
 
2208
-        if (preg_match('#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)'. // var key
2209
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()'). // method call
2210
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()'). // simple math expressions
2211
-            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())'). // modifiers
2208
+        if (preg_match('#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)'.// var key
2209
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()').// method call
2210
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()').// simple math expressions
2211
+            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())').// modifiers
2212 2212
             '#i', $substr, $match)) {
2213 2213
             $key = substr($match[1], 1);
2214 2214
 
@@ -2223,8 +2223,8 @@  discard block
 block discarded – undo
2223 2223
             }
2224 2224
 
2225 2225
             if ($hasMethodCall) {
2226
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2227
-                $key = substr($match[1], 1, strrpos($match[1], '->') - 1);
2226
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2227
+                $key = substr($match[1], 1, strrpos($match[1], '->')-1);
2228 2228
                 $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2229 2229
             }
2230 2230
 
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
                             ++$bracketCount;
2267 2267
                         } else {
2268 2268
                             $tree[] = &$current;
2269
-                            $current[$uid] = array($uid + 1 => '');
2269
+                            $current[$uid] = array($uid+1 => '');
2270 2270
                             $current = &$current[$uid++];
2271 2271
                             $curTxt = &$current[$uid++];
2272 2272
                             continue;
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
                         if ($bracketCount > 0) {
2276 2276
                             --$bracketCount;
2277 2277
                         } else {
2278
-                            $current = &$tree[count($tree) - 1];
2278
+                            $current = &$tree[count($tree)-1];
2279 2279
                             array_pop($tree);
2280 2280
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2281 2281
                                 $current[$uid] = '';
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
                 // method
2440 2440
                 if (substr($methMatch[2], 0, 2) === '()') {
2441 2441
                     $parsedCall = $methMatch[1].'()';
2442
-                    $ptr += strlen($methMatch[1]) + 2;
2442
+                    $ptr += strlen($methMatch[1])+2;
2443 2443
                 } else {
2444 2444
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2445 2445
                 }
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
                     if ($cnt > 0) {
2609 2609
                         while (--$cnt >= 0) {
2610 2610
                             if (isset($last)) {
2611
-                                $last = strrpos($key, '$', -(strlen($key) - $last + 1));
2611
+                                $last = strrpos($key, '$', -(strlen($key)-$last+1));
2612 2612
                             } else {
2613 2613
                                 $last = strrpos($key, '$');
2614 2614
                             }
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2674 2674
     {
2675 2675
         $first = $in[$from];
2676
-        $substr = substr($in, $from, $to - $from);
2676
+        $substr = substr($in, $from, $to-$from);
2677 2677
 
2678 2678
         $end = strlen($substr);
2679 2679
 
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
         }
2791 2791
         // replace vars
2792 2792
         while (($pos = strpos($string, '$', $pos)) !== false) {
2793
-            $prev = substr($string, $pos - 1, 1);
2793
+            $prev = substr($string, $pos-1, 1);
2794 2794
             if ($prev === '\\') {
2795 2795
                 ++$pos;
2796 2796
                 continue;
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
             $len = $var[0];
2801 2801
             $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2802 2802
 
2803
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
2804
-                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos - 1, $len + 2);
2803
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
2804
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
2805 2805
             } else {
2806 2806
                 $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
2807 2807
             }
2808
-            $pos += strlen($var[1]) + 2;
2808
+            $pos += strlen($var[1])+2;
2809 2809
             if ($this->debug) {
2810 2810
                 echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
2811 2811
             }
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
                     echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
2887 2887
                 }
2888 2888
             } else {
2889
-                $paramstr = substr($cmdstr, $paramspos + 1);
2889
+                $paramstr = substr($cmdstr, $paramspos+1);
2890 2890
                 if (substr($paramstr, -1, 1) === $paramsep) {
2891 2891
                     $paramstr = substr($paramstr, 0, -1);
2892 2892
                 }
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
                         if ($paramstr[$ptr] !== '|') {
2920 2920
                             $continue = false;
2921 2921
                             if ($pointer !== null) {
2922
-                                $pointer -= strlen($paramstr) - $ptr;
2922
+                                $pointer -= strlen($paramstr)-$ptr;
2923 2923
                             }
2924 2924
                         }
2925 2925
                         ++$ptr;
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
                         ++$ptr;
2930 2930
                     }
2931 2931
                 }
2932
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
2932
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
2933 2933
                 $paramstr = substr($paramstr, 0, $ptr);
2934 2934
                 foreach ($params as $k => $p) {
2935 2935
                     if (is_array($p) && is_array($p[1])) {
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 }
144 144
 
145 145
                 if ($merge === true && is_array($val)) {
146
-                    $this->data[$key] = $val + $this->data[$key];
146
+                    $this->data[$key] = $val+$this->data[$key];
147 147
                 } else {
148 148
                     $this->data[$key][] = $val;
149 149
                 }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             }
157 157
 
158 158
             if ($merge === true && is_array($val)) {
159
-                $this->data[$name] = $val + $this->data[$name];
159
+                $this->data[$name] = $val+$this->data[$name];
160 160
             } else {
161 161
                 $this->data[$name][] = $val;
162 162
             }
Please login to merge, or discard this patch.
lib/Dwoo/Smarty/Adapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 }
6 6
 
7 7
 if (!defined('SMARTY_PHP_PASSTHRU')) {
8
-    define('SMARTY_PHP_PASSTHRU',   0);
9
-    define('SMARTY_PHP_QUOTE',      1);
10
-    define('SMARTY_PHP_REMOVE',     2);
11
-    define('SMARTY_PHP_ALLOW',      3);
8
+    define('SMARTY_PHP_PASSTHRU', 0);
9
+    define('SMARTY_PHP_QUOTE', 1);
10
+    define('SMARTY_PHP_REMOVE', 2);
11
+    define('SMARTY_PHP_ALLOW', 3);
12 12
 }
13 13
 
14 14
 /**
Please login to merge, or discard this patch.
lib/Dwoo/Template/String.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) {
270 270
             // already checked, return cache file
271 271
             return $cachedFile;
272
-        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
272
+        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
273 273
             // cache is still valid and can be loaded
274 274
             self::$cache['cached'][$this->cacheId] = true;
275 275
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     {
336 336
         $cachedFile = $this->getCacheFilename($dwoo);
337 337
 
338
-        return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile));
338
+        return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile));
339 339
     }
340 340
 
341 341
     /**
Please login to merge, or discard this patch.
lib/Dwoo/Core.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!defined('DWOO_DIRECTORY')) {
4
-    define('DWOO_DIRECTORY', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
4
+    define('DWOO_DIRECTORY', dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR);
5 5
 }
6 6
 
7 7
 /**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             }
375 375
 
376 376
             if ($doCache === true) {
377
-                $out = preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php /*' . $dynamicId . '*/ echo \'$1\'; ?>', $out);
377
+                $out = preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php /*'.$dynamicId.'*/ echo \'$1\'; ?>', $out);
378 378
                 if (!class_exists('Dwoo_plugin_dynamic')) {
379 379
                     $this->getLoader()->loadPlugin('dynamic');
380 380
                 }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     public function addFilter($callback, $autoload = false)
551 551
     {
552 552
         if ($autoload) {
553
-            $class = 'Dwoo_Filter_' . $callback;
553
+            $class = 'Dwoo_Filter_'.$callback;
554 554
 
555 555
             if (!class_exists($class) && !function_exists($class)) {
556 556
                 try {
@@ -558,9 +558,9 @@  discard block
 block discarded – undo
558 558
                 }
559 559
                 catch (Dwoo_Exception $e) {
560 560
                     if (strstr($callback, 'Dwoo_Filter_')) {
561
-                        throw new Dwoo_Exception('Wrong filter name : ' . $callback . ', the "Dwoo_Filter_" prefix should not be used, please only use "' . str_replace('Dwoo_Filter_', '', $callback) . '"');
561
+                        throw new Dwoo_Exception('Wrong filter name : '.$callback.', the "Dwoo_Filter_" prefix should not be used, please only use "'.str_replace('Dwoo_Filter_', '', $callback).'"');
562 562
                     } else {
563
-                        throw new Dwoo_Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Filter_name"');
563
+                        throw new Dwoo_Exception('Wrong filter name : '.$callback.', when using autoload the filter must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Filter_name"');
564 564
                     }
565 565
                 }
566 566
             }
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
             } elseif (function_exists($class)) {
574 574
                 $callback = $class;
575 575
             } else {
576
-                throw new Dwoo_Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Filter_name"');
576
+                throw new Dwoo_Exception('Wrong filter name : '.$callback.', when using autoload the filter must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Filter_name"');
577 577
             }
578 578
 
579 579
             $this->filters[] = $callback;
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
      */
592 592
     public function removeFilter($callback)
593 593
     {
594
-        if (($index = array_search('Dwoo_Filter_' . $callback, $this->filters, true)) !== false) {
594
+        if (($index = array_search('Dwoo_Filter_'.$callback, $this->filters, true)) !== false) {
595 595
             unset($this->filters[$index]);
596 596
         } elseif (($index = array_search($callback, $this->filters, true)) !== false) {
597 597
             unset($this->filters[$index]);
598 598
         } else {
599
-            $class = 'Dwoo_Filter_' . $callback;
599
+            $class = 'Dwoo_Filter_'.$callback;
600 600
             foreach ($this->filters as $index => $filter) {
601 601
                 if (is_array($filter) && $filter[0] instanceof $class) {
602 602
                     unset($this->filters[$index]);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
     public function getCacheDir()
703 703
     {
704 704
         if ($this->cacheDir === null) {
705
-            $this->setCacheDir(DWOO_DIRECTORY . 'cache' . DIRECTORY_SEPARATOR);
705
+            $this->setCacheDir(DWOO_DIRECTORY.'cache'.DIRECTORY_SEPARATOR);
706 706
         }
707 707
 
708 708
         return $this->cacheDir;
@@ -718,9 +718,9 @@  discard block
 block discarded – undo
718 718
      */
719 719
     public function setCacheDir($dir)
720 720
     {
721
-        $this->cacheDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
721
+        $this->cacheDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
722 722
         if (is_writable($this->cacheDir) === false) {
723
-            throw new Dwoo_Exception('The cache directory must be writable, chmod "' . $this->cacheDir . '" to make it writable');
723
+            throw new Dwoo_Exception('The cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
724 724
         }
725 725
     }
726 726
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
     public function getCompileDir()
733 733
     {
734 734
         if ($this->compileDir === null) {
735
-            $this->setCompileDir(DWOO_DIRECTORY . 'compiled' . DIRECTORY_SEPARATOR);
735
+            $this->setCompileDir(DWOO_DIRECTORY.'compiled'.DIRECTORY_SEPARATOR);
736 736
         }
737 737
 
738 738
         return $this->compileDir;
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
      */
749 749
     public function setCompileDir($dir)
750 750
     {
751
-        $this->compileDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
751
+        $this->compileDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
752 752
         if (is_writable($this->compileDir) === false) {
753
-            throw new Dwoo_Exception('The compile directory must be writable, chmod "' . $this->compileDir . '" to make it writable');
753
+            throw new Dwoo_Exception('The compile directory must be writable, chmod "'.$this->compileDir.'" to make it writable');
754 754
         }
755 755
     }
756 756
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
      */
774 774
     public function setCacheTime($seconds)
775 775
     {
776
-        $this->cacheTime = (int)$seconds;
776
+        $this->cacheTime = (int) $seconds;
777 777
     }
778 778
 
779 779
     /**
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
      */
798 798
     public function setCharset($charset)
799 799
     {
800
-        $this->charset = strtolower((string)$charset);
800
+        $this->charset = strtolower((string) $charset);
801 801
     }
802 802
 
803 803
     /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
     public function clearCache($olderThan = - 1)
935 935
     {
936 936
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCacheDir()), \RecursiveIteratorIterator::SELF_FIRST);
937
-        $expired  = time() - $olderThan;
937
+        $expired  = time()-$olderThan;
938 938
         $count    = 0;
939 939
         foreach ($iterator as $file) {
940 940
             if ($file->isFile() && $file->getCTime() < $expired) {
941
-                $count += unlink((string)$file) ? 1 : 0;
941
+                $count += unlink((string) $file) ? 1 : 0;
942 942
             }
943 943
         }
944 944
 
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
             ), $this, $resourceId, $cacheTime, $cacheId, $compileId, $parentTemplate);
969 969
         }
970 970
 
971
-        throw new Dwoo_Exception('Unknown resource type : ' . $resourceName);
971
+        throw new Dwoo_Exception('Unknown resource type : '.$resourceName);
972 972
     }
973 973
 
974 974
     /**
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         if (!($tplIdentifier = $this->template->getResourceIdentifier())) {
1069 1069
             $tplIdentifier = $this->template->getResourceName();
1070 1070
         }
1071
-        trigger_error('Dwoo error (in ' . $tplIdentifier . ') : ' . $message, $level);
1071
+        trigger_error('Dwoo error (in '.$tplIdentifier.') : '.$message, $level);
1072 1072
     }
1073 1073
 
1074 1074
     /**
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
         if (isset($this->plugins[$blockName])) {
1085 1085
             $class = $this->plugins[$blockName]['class'];
1086 1086
         } else {
1087
-            $class = 'Dwoo_Plugin_' . $blockName;
1087
+            $class = 'Dwoo_Plugin_'.$blockName;
1088 1088
         }
1089 1089
 
1090 1090
         if ($this->curBlock !== null) {
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
     {
1180 1180
         $index = array_search($block, $this->stack, true);
1181 1181
         if ($index !== false && $index > 0) {
1182
-            return $this->stack[$index - 1];
1182
+            return $this->stack[$index-1];
1183 1183
         }
1184 1184
 
1185 1185
         return false;
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
         if (isset($this->plugins[$type])) {
1198 1198
             $type = $this->plugins[$type]['class'];
1199 1199
         } else {
1200
-            $type = 'Dwoo_Plugin_' . str_replace('Dwoo_Plugin_', '', $type);
1200
+            $type = 'Dwoo_Plugin_'.str_replace('Dwoo_Plugin_', '', $type);
1201 1201
         }
1202 1202
 
1203 1203
         $keys = array_keys($this->stack);
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
      */
1239 1239
     public function classCall($plugName, array $params = array())
1240 1240
     {
1241
-        $class = 'Dwoo_Plugin_' . $plugName;
1241
+        $class = 'Dwoo_Plugin_'.$plugName;
1242 1242
 
1243 1243
         $plugin = $this->getObjectPlugin($class);
1244 1244
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 
1292 1292
                 if (is_string($callback) === false) {
1293 1293
                     while (($i = array_shift($keys)) !== null) {
1294
-                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
1294
+                        $out[] = call_user_func_array($callback, array(1 => $items[$i])+$params);
1295 1295
                     }
1296 1296
                 } elseif ($cnt === 1) {
1297 1297
                     while (($i = array_shift($keys)) !== null) {
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                     }
1308 1308
                 } else {
1309 1309
                     while (($i = array_shift($keys)) !== null) {
1310
-                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
1310
+                        $out[] = call_user_func_array($callback, array(1 => $items[$i])+$params);
1311 1311
                     }
1312 1312
                 }
1313 1313
             } else {
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
                 if (is_string($callback) === false) {
1318 1318
                     while (($i = array_shift($keys)) !== null) {
1319
-                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
1319
+                        $out[] = call_user_func_array($callback, array($items[$i])+$params);
1320 1320
                     }
1321 1321
                 } elseif ($cnt === 1) {
1322 1322
                     while (($i = array_shift($keys)) !== null) {
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
                     }
1337 1337
                 } else {
1338 1338
                     while (($i = array_shift($keys)) !== null) {
1339
-                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
1339
+                        $out[] = call_user_func_array($callback, array($items[$i])+$params);
1340 1340
                     }
1341 1341
                 }
1342 1342
             }
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
         $tree = $this->scopeTree;
1407 1407
         $cur  = $this->data;
1408 1408
 
1409
-        while ($parentLevels -- !== 0) {
1409
+        while ($parentLevels-- !== 0) {
1410 1410
             array_pop($tree);
1411 1411
         }
1412 1412
 
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
                 } elseif ($varstr === '__' || $varstr === '_root') {
1445 1445
                     return $this->data;
1446 1446
                 } elseif ($varstr === '_' || $varstr === '_parent') {
1447
-                    $varstr = '.' . $varstr;
1447
+                    $varstr = '.'.$varstr;
1448 1448
                     $tree   = $this->scopeTree;
1449 1449
                     $cur    = $this->data;
1450 1450
                     array_pop($tree);
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
             }
1471 1471
 
1472 1472
             if (substr($varstr, 0, 1) === '.') {
1473
-                $varstr = 'dwoo' . $varstr;
1473
+                $varstr = 'dwoo'.$varstr;
1474 1474
             }
1475 1475
 
1476 1476
             preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m);
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
         $data = &$this->data;
1581 1581
 
1582 1582
         if (!is_string($scope)) {
1583
-            $this->triggerError('Assignments must be done into strings, (' . gettype($scope) . ') ' . var_export($scope, true) . ' given', E_USER_ERROR);
1583
+            $this->triggerError('Assignments must be done into strings, ('.gettype($scope).') '.var_export($scope, true).' given', E_USER_ERROR);
1584 1584
         }
1585 1585
         if (strstr($scope, '.') === false && strstr($scope, '->') === false) {
1586 1586
             $this->scope[$scope] = $value;
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
     {
1732 1732
         $proxy = $this->getPluginProxy();
1733 1733
         if (!$proxy) {
1734
-            throw new Dwoo_Exception('Call to undefined method ' . __CLASS__ . '::' . $method . '()');
1734
+            throw new Dwoo_Exception('Call to undefined method '.__CLASS__.'::'.$method.'()');
1735 1735
         }
1736 1736
 
1737 1737
         return call_user_func_array($proxy->getCallback($method), $args);
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/if.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -150,37 +150,37 @@  discard block
 block discarded – undo
150 150
                     $p[] = $v;
151 151
                     break;
152 152
                 }
153
-                if (isset($params[$k + 1]) && strtolower(trim($params[$k + 1], '"\'')) === 'not' && $tokens[$k + 1] === Dwoo_Compiler::T_UNQUOTED_STRING) {
153
+                if (isset($params[$k+1]) && strtolower(trim($params[$k+1], '"\'')) === 'not' && $tokens[$k+1] === Dwoo_Compiler::T_UNQUOTED_STRING) {
154 154
                     $negate = true;
155 155
                     next($params);
156 156
                 } else {
157 157
                     $negate = false;
158 158
                 }
159
-                $ptr = 1 + (int) $negate;
160
-                if ($tokens[$k + $ptr] !== Dwoo_Compiler::T_UNQUOTED_STRING) {
159
+                $ptr = 1+(int) $negate;
160
+                if ($tokens[$k+$ptr] !== Dwoo_Compiler::T_UNQUOTED_STRING) {
161 161
                     break;
162 162
                 }
163
-                if (!isset($params[$k + $ptr])) {
164
-                    $params[$k + $ptr] = '';
163
+                if (!isset($params[$k+$ptr])) {
164
+                    $params[$k+$ptr] = '';
165 165
                 } else {
166
-                    $params[$k + $ptr] = trim($params[$k + $ptr], '"\'');
166
+                    $params[$k+$ptr] = trim($params[$k+$ptr], '"\'');
167 167
                 }
168
-                switch ($params[$k + $ptr]) {
168
+                switch ($params[$k+$ptr]) {
169 169
 
170 170
                 case 'div':
171
-                    if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
172
-                        $p[] = ' % '.$params[$k + $ptr + 2].' '.($negate ? '!' : '=').'== 0';
171
+                    if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') {
172
+                        $p[] = ' % '.$params[$k+$ptr+2].' '.($negate ? '!' : '=').'== 0';
173 173
                         next($params);
174 174
                         next($params);
175 175
                         next($params);
176 176
                     } else {
177
-                        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
+                        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]);
178 178
                     }
179 179
                     break;
180 180
                 case 'even':
181 181
                     $a = array_pop($p);
182
-                    if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
183
-                        $b = $params[$k + $ptr + 2];
182
+                    if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') {
183
+                        $b = $params[$k+$ptr+2];
184 184
                         $p[] = '('.$a.' / '.$b.') % 2 '.($negate ? '!' : '=').'== 0';
185 185
                         next($params);
186 186
                         next($params);
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
                     break;
192 192
                 case 'odd':
193 193
                     $a = array_pop($p);
194
-                    if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
195
-                        $b = $params[$k + $ptr + 2];
194
+                    if (isset($params[$k+$ptr+1]) && strtolower(trim($params[$k+$ptr+1], '"\'')) === 'by') {
195
+                        $b = $params[$k+$ptr+2];
196 196
                         $p[] = '('.$a.' / '.$b.') % 2 '.($negate ? '=' : '!').'== 0';
197 197
                         next($params);
198 198
                         next($params);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                     next($params);
203 203
                     break;
204 204
                 default:
205
-                    throw new Dwoo_Compilation_Exception($compiler, 'If : Syntax error : syntax should be "if $a is [not] (div|even|odd) [by $b]", found '.$params[$k - 1].' is '.$params[$k + $ptr + 1]);
205
+                    throw new Dwoo_Compilation_Exception($compiler, 'If : Syntax error : syntax should be "if $a is [not] (div|even|odd) [by $b]", found '.$params[$k-1].' is '.$params[$k+$ptr+1]);
206 206
 
207 207
                 }
208 208
                 break;
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/textformat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $this->wrapCut = (bool) $wrap_cut;
62 62
         $this->indent = (int) $indent;
63 63
         $this->indChar = (string) $indent_char;
64
-        $this->indFirst = (int) $indent_first + $this->indent;
64
+        $this->indFirst = (int) $indent_first+$this->indent;
65 65
         $this->assign = (string) $assign;
66 66
     }
67 67
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $pgs[$i] = str_repeat($this->indChar, $this->indFirst).
83 83
                     wordwrap(
84 84
                             $pgs[$i],
85
-                            max($this->wrap - $this->indent, 1),
85
+                            max($this->wrap-$this->indent, 1),
86 86
                             $this->wrapChar.str_repeat($this->indChar, $this->indent),
87 87
                             $this->wrapCut
88 88
                     );
Please login to merge, or discard this patch.