Passed
Push — master ( 32c874...a28393 )
by David
57s
created
lib/Dwoo/Template/File.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 
19 19
 use Dwoo\Exception as DwooException;
20 20
 use Dwoo\Core as Core;
21
-use Dwoo\ICompiler;
22 21
 use Dwoo\ITemplate as ITemplate;
23 22
 use Dwoo\Security\Exception as SecurityException;
24 23
 use Dwoo\Template\File as TemplateFile;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     protected function isValidCompiledFile($file)
112 112
     {
113
-        return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
113
+        return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file);
114 114
     }
115 115
 
116 116
     /**
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
         } else {
149 149
             foreach ($this->getIncludePath() as $path) {
150 150
                 $path = rtrim($path, DIRECTORY_SEPARATOR);
151
-                if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) {
152
-                    return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
151
+                if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) {
152
+                    return $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file;
153 153
                 }
154 154
             }
155 155
 
156
-            throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
156
+            throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)');
157 157
         }
158 158
     }
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getUid()
167 167
     {
168
-        return (string)filemtime($this->getResourceIdentifier());
168
+        return (string) filemtime($this->getResourceIdentifier());
169 169
     }
170 170
 
171 171
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                         throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
224 224
                     }
225 225
                 } else {
226
-                    $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
226
+                    $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId;
227 227
                     if (file_exists($resourceId) === false) {
228 228
                         return null;
229 229
                     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         if ($policy = $core->getSecurityPolicy()) {
237 237
             while (true) {
238 238
                 if (preg_match('{^([a-z]+?)://}i', $resourceId)) {
239
-                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.');
239
+                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.');
240 240
                 }
241 241
 
242 242
                 if ($includePath) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                         break 2;
251 251
                     }
252 252
                 }
253
-                throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
253
+                throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>');
254 254
             }
255 255
         }
256 256
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             $this->compileId = $this->getResourceIdentifier();
278 278
         }
279 279
 
280
-        return $this->compileId . '.d' . Core::RELEASE_TAG . '.php';
280
+        return $this->compileId.'.d'.Core::RELEASE_TAG.'.php';
281 281
     }
282 282
 
283 283
     /**
@@ -288,6 +288,6 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function getIsModifiedCode()
290 290
     {
291
-        return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
291
+        return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')';
292 292
     }
293 293
 }
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         if (is_array($name)) {
99 99
             reset($name);
100
-            foreach ($name as $k => $v){
100
+            foreach ($name as $k => $v) {
101 101
                 $this->data[$k] = $v;
102 102
             }
103 103
         } else {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 }
147 147
 
148 148
                 if ($merge === true && is_array($val)) {
149
-                    $this->data[$key] = $val + $this->data[$key];
149
+                    $this->data[$key] = $val+$this->data[$key];
150 150
                 } else {
151 151
                     $this->data[$key][] = $val;
152 152
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             }
160 160
 
161 161
             if ($merge === true && is_array($val)) {
162
-                $this->data[$name] = $val + $this->data[$name];
162
+                $this->data[$name] = $val+$this->data[$name];
163 163
             } else {
164 164
                 $this->data[$name][] = $val;
165 165
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         if (isset($this->data[$name])) {
259 259
             return $this->data[$name];
260 260
         } else {
261
-            throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
261
+            throw new Exception('Tried to read a value that was not assigned yet : "'.$name.'"');
262 262
         }
263 263
     }
264 264
 }
Please login to merge, or discard this patch.
lib/Dwoo/Template/Str.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         $this->cacheTime = $cacheTime;
125 125
 
126 126
         if ($compileId !== null) {
127
-            $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
127
+            $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
128 128
         }
129 129
 
130 130
         if ($cacheId !== null) {
131
-            $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
131
+            $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
132 132
         }
133 133
     }
134 134
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) {
276 276
             // already checked, return cache file
277 277
             return $cachedFile;
278
-        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) {
278
+        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) {
279 279
             // cache is still valid and can be loaded
280 280
             self::$cache['cached'][$this->cacheId] = true;
281 281
 
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
         // thanks for his help on avoiding concurency issues
304 304
         $temp = tempnam($cacheDir, 'temp');
305 305
         if (!($file = @fopen($temp, 'wb'))) {
306
-            $temp = $cacheDir . uniqid('temp');
306
+            $temp = $cacheDir.uniqid('temp');
307 307
             if (!($file = @fopen($temp, 'wb'))) {
308
-                trigger_error('Error writing temporary file \'' . $temp . '\'', E_USER_WARNING);
308
+                trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING);
309 309
 
310 310
                 return false;
311 311
             }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         $cachedFile = $this->getCacheFilename($core);
343 343
 
344
-        return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile));
344
+        return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile));
345 345
     }
346 346
 
347 347
     /**
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             $this->compileId = $this->name;
450 450
         }
451 451
 
452
-        return $core->getCompileDir() . $this->compileId . '.d' . Core::RELEASE_TAG . '.php';
452
+        return $core->getCompileDir().$this->compileId.'.d'.Core::RELEASE_TAG.'.php';
453 453
     }
454 454
 
455 455
     /**
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             if (isset($_SERVER['REQUEST_URI']) === true) {
468 468
                 $cacheId = $_SERVER['REQUEST_URI'];
469 469
             } elseif (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv'])) {
470
-                $cacheId = $_SERVER['SCRIPT_FILENAME'] . '-' . implode('-', $_SERVER['argv']);
470
+                $cacheId = $_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']);
471 471
             } else {
472 472
                 $cacheId = '';
473 473
             }
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
             $this->getCompiledFilename($core);
476 476
 
477 477
             $this->cacheId = str_replace('../', '__',
478
-                $this->compileId . strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
478
+                $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
479 479
         }
480 480
 
481
-        return $core->getCacheDir() . $this->cacheId . '.html';
481
+        return $core->getCacheDir().$this->cacheId.'.html';
482 482
     }
483 483
 
484 484
     /**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         }
516 516
 
517 517
         $retries = 3;
518
-        while ($retries --) {
518
+        while ($retries--) {
519 519
             @mkdir($path, $chmod, true);
520 520
             if (is_dir($path)) {
521 521
                 break;
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
             $path    = strtr(str_replace($baseDir, '', $path), '\\', '/');
529 529
             $folders = explode('/', trim($path, '/'));
530 530
             foreach ($folders as $folder) {
531
-                $baseDir .= $folder . DIRECTORY_SEPARATOR;
531
+                $baseDir .= $folder.DIRECTORY_SEPARATOR;
532 532
                 if (!chmod($baseDir, $chmod)) {
533
-                    throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true));
533
+                    throw new Exception('Unable to chmod '."$baseDir to $chmod: ".print_r(error_get_last(), true));
534 534
                 }
535 535
             }
536 536
         }
Please login to merge, or discard this patch.
lib/Dwoo/Compiler.php 1 patch
Spacing   +380 added lines, -382 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function setNestedCommentsHandling($allow = true)
296 296
     {
297
-        $this->allowNestedComments = (bool)$allow;
297
+        $this->allowNestedComments = (bool) $allow;
298 298
     }
299 299
 
300 300
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      */
320 320
     public function setLooseOpeningHandling($allow = false)
321 321
     {
322
-        $this->allowLooseOpenings = (bool)$allow;
322
+        $this->allowLooseOpenings = (bool) $allow;
323 323
     }
324 324
 
325 325
     /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function setAutoEscape($enabled)
346 346
     {
347
-        $this->autoEscape = (bool)$enabled;
347
+        $this->autoEscape = (bool) $enabled;
348 348
     }
349 349
 
350 350
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if ($autoload) {
373 373
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', Core::toCamelCase($callback));
374
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . $name;
374
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.$name;
375 375
 
376 376
             if (class_exists($class)) {
377 377
                 $callback = array(new $class($this), 'process');
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
     {
397 397
         if (($index = array_search($callback, $this->processors['pre'], true)) !== false) {
398 398
             unset($this->processors['pre'][$index]);
399
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
399
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
400 400
                     $callback),
401 401
                 $this->processors['pre'], true)) !== false) {
402 402
             unset($this->processors['pre'][$index]);
403 403
         } else {
404
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
404
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
405 405
             foreach ($this->processors['pre'] as $index => $proc) {
406 406
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
407 407
                     unset($this->processors['pre'][$index]);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         if ($autoload) {
426 426
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
427
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . Core::toCamelCase($name);
427
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.Core::toCamelCase($name);
428 428
 
429 429
             if (class_exists($class)) {
430 430
                 $callback = array(new $class($this), 'process');
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     {
450 450
         if (($index = array_search($callback, $this->processors['post'], true)) !== false) {
451 451
             unset($this->processors['post'][$index]);
452
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
452
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
453 453
                     $callback),
454 454
                 $this->processors['post'], true)) !== false) {
455 455
             unset($this->processors['post'][$index]);
456 456
         } else {
457
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
457
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
458 458
             foreach ($this->processors['post'] as $index => $proc) {
459 459
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
460 460
                     unset($this->processors['post'][$index]);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 $this->getDwoo()->getLoader()->loadPlugin($name);
481 481
             }
482 482
             catch (Exception $e) {
483
-                throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory');
483
+                throw new Exception('Processor '.$name.' could not be found in your plugin directories, please ensure it is in a file named '.$name.'.php in the plugin directory');
484 484
             }
485 485
         }
486 486
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     public function setTemplateSource($newSource, $fromPointer = false)
667 667
     {
668 668
         if ($fromPointer === true) {
669
-            $this->templateSource = substr($this->templateSource, 0, $this->pointer) . $newSource;
669
+            $this->templateSource = substr($this->templateSource, 0, $this->pointer).$newSource;
670 670
         } else {
671 671
             $this->templateSource = $newSource;
672 672
         }
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 
738 738
                 if ($this->debug) {
739 739
                     echo "\n";
740
-                    echo 'COMPILER INIT' . "\n";
740
+                    echo 'COMPILER INIT'."\n";
741 741
                 }
742 742
 
743 743
                 if ($this->debug) {
744
-                    echo 'PROCESSING PREPROCESSORS (' . count($this->processors['pre']) . ')' . "\n";
744
+                    echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')'."\n";
745 745
                 }
746 746
 
747 747
                 // runs preprocessors
@@ -785,23 +785,23 @@  discard block
 block discarded – undo
785 785
             if ($pos === false) {
786 786
                 $this->push(substr($tpl, $ptr), 0);
787 787
                 break;
788
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
789
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1) . $this->ld);
790
-                $ptr = $pos + strlen($this->ld);
791
-            } elseif (preg_match('/^' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . 'literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', substr($tpl, $pos), $litOpen)) {
792
-                if (!preg_match('/' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . '\/literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
788
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
789
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
790
+                $ptr = $pos+strlen($this->ld);
791
+            } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
792
+                if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
793 793
                     throw new CompilationException($this, 'The {literal} blocks must be closed explicitly with {/literal}');
794 794
                 }
795 795
                 $endpos = $litClose[0][1];
796
-                $this->push(substr($tpl, $ptr, $pos - $ptr) . substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
797
-                $ptr = $endpos + strlen($litClose[0][0]);
796
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
797
+                $ptr = $endpos+strlen($litClose[0][0]);
798 798
             } else {
799
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
800
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
799
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
800
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
801 801
                     $ptr = $pos;
802 802
                 }
803 803
 
804
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
804
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
805 805
                 $ptr = $pos;
806 806
 
807 807
                 $pos += strlen($this->ld);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
                 // check that there is an end tag present
821 821
                 if (strpos($tpl, $this->rd, $pos) === false) {
822
-                    throw new CompilationException($this, 'A template tag was not closed, started with "' . substr($tpl, $ptr, 30) . '"');
822
+                    throw new CompilationException($this, 'A template tag was not closed, started with "'.substr($tpl, $ptr, 30).'"');
823 823
                 }
824 824
 
825 825
                 $ptr += strlen($this->ld);
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                         continue 2;
834 834
                     }
835 835
 
836
-                    $len = $subptr - $ptr;
836
+                    $len = $subptr-$ptr;
837 837
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
838 838
                     $ptr += $len;
839 839
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
         $compiled .= $this->removeBlock('TopLevelBlock');
848 848
 
849 849
         if ($this->debug) {
850
-            echo 'PROCESSING POSTPROCESSORS' . "\n";
850
+            echo 'PROCESSING POSTPROCESSORS'."\n";
851 851
         }
852 852
 
853 853
         foreach ($this->processors['post'] as $postProc) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         unset($postProc);
864 864
 
865 865
         if ($this->debug) {
866
-            echo 'COMPILATION COMPLETE : MEM USAGE : ' . memory_get_usage() . "\n";
866
+            echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage()."\n";
867 867
         }
868 868
 
869 869
         $output = "<?php\n/* template head */\n";
@@ -876,30 +876,30 @@  discard block
 block discarded – undo
876 876
 
877 877
             switch ($type) {
878 878
                 case Core::CLASS_PLUGIN:
879
-                case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
879
+                case Core::CLASS_PLUGIN+Core::BLOCK_PLUGIN:
880
+                    if (class_exists('Plugin'.$plugin) !== false) {
881
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
882 882
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883 883
                     } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
884
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_BLOCKS."Plugin".$plugin."')===false)".
885 885
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886 886
                     }
887 887
                     break;
888
-                case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN:
889
-                    if (class_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
888
+                case Core::CLASS_PLUGIN+Core::FUNC_PLUGIN:
889
+                    if (class_exists('Plugin'.$plugin) !== false) {
890
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
891 891
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892 892
                     } else {
893
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
893
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
894 894
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895 895
                     }
896 896
                     break;
897 897
                 case Core::FUNC_PLUGIN:
898
-                    if (function_exists('Plugin' . $plugin) !== false) {
899
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
898
+                    if (function_exists('Plugin'.$plugin) !== false) {
899
+                        $output .= "if (function_exists('"."Plugin".$plugin."')===false)".
900 900
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
901 901
                     } else {
902
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
902
+                        $output .= "if (function_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
903 903
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
904 904
                     }
905 905
                     break;
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                     $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
920 920
                     break;
921 921
                 default:
922
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
922
+                    throw new CompilationException($this, 'Type error for '.$plugin.' with type'.$type);
923 923
             }
924 924
         }
925 925
 
@@ -930,30 +930,30 @@  discard block
 block discarded – undo
930 930
         }
931 931
         foreach ($this->templatePlugins as $function) {
932 932
             if (isset($function['called']) && $function['called'] === true) {
933
-                $output .= $function['body'] . PHP_EOL;
933
+                $output .= $function['body'].PHP_EOL;
934 934
             }
935 935
         }
936 936
 
937
-        $output .= $compiled . "\n?>";
937
+        $output .= $compiled."\n?>";
938 938
 
939
-        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*' . preg_quote(self::PHP_CLOSE, '/') . preg_quote(self::PHP_OPEN, '/') . ')/', ";\n", $output);
940
-        $output = str_replace(self::PHP_CLOSE . self::PHP_OPEN, "\n", $output);
939
+        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*'.preg_quote(self::PHP_CLOSE, '/').preg_quote(self::PHP_OPEN, '/').')/', ";\n", $output);
940
+        $output = str_replace(self::PHP_CLOSE.self::PHP_OPEN, "\n", $output);
941 941
 
942 942
         // handle <?xml tag at the beginning
943 943
         $output = preg_replace('#(/\* template body \*/ \?>\s*)<\?xml#is', '$1<?php echo \'<?xml\'; ?>', $output);
944 944
 
945 945
         // add another line break after PHP closing tags that have a line break following,
946 946
         // as we do not know whether it's intended, and PHP will strip it otherwise
947
-        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0' . "\n", $output);
947
+        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0'."\n", $output);
948 948
 
949 949
         if ($this->debug) {
950
-            echo '=============================================================================================' . "\n";
950
+            echo '============================================================================================='."\n";
951 951
             $lines = preg_split('{\r\n|\n|<br />}', $output);
952 952
             array_shift($lines);
953 953
             foreach ($lines as $i => $line) {
954
-                echo ($i + 1) . '. ' . $line . "\r\n";
954
+                echo ($i+1).'. '.$line."\r\n";
955 955
             }
956
-            echo '=============================================================================================' . "\n";
956
+            echo '============================================================================================='."\n";
957 957
         }
958 958
 
959 959
         $this->template = $this->dwoo = null;
@@ -970,13 +970,13 @@  discard block
 block discarded – undo
970 970
     protected function resolveSubTemplateDependencies($function)
971 971
     {
972 972
         if ($this->debug) {
973
-            echo 'Compiler::' . __FUNCTION__ . "\n";
973
+            echo 'Compiler::'.__FUNCTION__."\n";
974 974
         }
975 975
 
976 976
         $body = $this->templatePlugins[$function]['body'];
977 977
         foreach ($this->templatePlugins as $func => $attr) {
978
-            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
979
-            'Plugin' . Core::toCamelCase($func)) !== false) {
978
+            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS.
979
+            'Plugin'.Core::toCamelCase($func)) !== false) {
980 980
                 $this->templatePlugins[$func]['called'] = true;
981 981
                 $this->resolveSubTemplateDependencies($func);
982 982
             }
@@ -1000,14 +1000,14 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
1002 1002
             // buffer is not initialized yet (the block has just been created)
1003
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content;
1003
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
1004 1004
             $this->curBlock['buffer'] = '';
1005 1005
         } else {
1006 1006
             if (!isset($this->curBlock['buffer'])) {
1007 1007
                 throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere');
1008 1008
             }
1009 1009
             // append current content to current block's buffer
1010
-            $this->curBlock['buffer'] .= (string)$content;
1010
+            $this->curBlock['buffer'] .= (string) $content;
1011 1011
         }
1012 1012
         $this->line += $lineCount;
1013 1013
     }
@@ -1077,23 +1077,23 @@  discard block
 block discarded – undo
1077 1077
     public function addBlock($type, array $params, $paramtype)
1078 1078
     {
1079 1079
         if ($this->debug) {
1080
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1080
+            echo 'Compiler::'.__FUNCTION__."\n";
1081 1081
         }
1082 1082
 
1083
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1083
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1084 1084
         if (class_exists($class) === false) {
1085 1085
             $this->getDwoo()->getLoader()->loadPlugin($type);
1086 1086
         }
1087 1087
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1088 1088
 
1089
-        $this->stack[]  = array(
1089
+        $this->stack[] = array(
1090 1090
             'type'   => $type,
1091 1091
             'params' => $params,
1092 1092
             'custom' => false,
1093 1093
             'class'  => $class,
1094 1094
             'buffer' => null
1095 1095
         );
1096
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1096
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1097 1097
 
1098 1098
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1099 1099
     }
@@ -1118,14 +1118,14 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1120 1120
 
1121
-        $this->stack[]  = array(
1121
+        $this->stack[] = array(
1122 1122
             'type'   => $type,
1123 1123
             'params' => $params,
1124 1124
             'custom' => true,
1125 1125
             'class'  => $class,
1126 1126
             'buffer' => null
1127 1127
         );
1128
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1128
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1129 1129
 
1130 1130
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1131 1131
     }
@@ -1140,21 +1140,21 @@  discard block
 block discarded – undo
1140 1140
     public function injectBlock($type, array $params)
1141 1141
     {
1142 1142
         if ($this->debug) {
1143
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1143
+            echo 'Compiler::'.__FUNCTION__."\n";
1144 1144
         }
1145 1145
 
1146
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1146
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1147 1147
         if (class_exists($class) === false) {
1148 1148
             $this->getDwoo()->getLoader()->loadPlugin($type);
1149 1149
         }
1150
-        $this->stack[]  = array(
1150
+        $this->stack[] = array(
1151 1151
             'type'   => $type,
1152 1152
             'params' => $params,
1153 1153
             'custom' => false,
1154 1154
             'class'  => $class,
1155 1155
             'buffer' => null
1156 1156
         );
1157
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1157
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1158 1158
     }
1159 1159
 
1160 1160
     /**
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
     public function removeBlock($type)
1170 1170
     {
1171 1171
         if ($this->debug) {
1172
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1172
+            echo 'Compiler::'.__FUNCTION__."\n";
1173 1173
         }
1174 1174
 
1175 1175
         $output = '';
@@ -1183,10 +1183,10 @@  discard block
 block discarded – undo
1183 1183
                 if ($top['custom']) {
1184 1184
                     $class = $top['class'];
1185 1185
                 } else {
1186
-                    $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type']);
1186
+                    $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($top['type']);
1187 1187
                 }
1188 1188
                 if (count($this->stack)) {
1189
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1189
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1190 1190
                     $this->push(call_user_func(array(
1191 1191
                         $class,
1192 1192
                         'postProcessing'
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
                 }
1208 1208
             }
1209 1209
 
1210
-            throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened');
1210
+            throw new CompilationException($this, 'Syntax malformation, a block of type "'.$type.'" was closed but was not opened');
1211 1211
             break;
1212 1212
         }
1213 1213
 
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
             }
1247 1247
         }
1248 1248
 
1249
-        throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found');
1249
+        throw new CompilationException($this, 'A parent block of type "'.$type.'" is required and can not be found');
1250 1250
     }
1251 1251
 
1252 1252
     /**
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
     public function removeTopBlock()
1270 1270
     {
1271 1271
         if ($this->debug) {
1272
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1272
+            echo 'Compiler::'.__FUNCTION__."\n";
1273 1273
         }
1274 1274
 
1275 1275
         $o = array_pop($this->stack);
@@ -1279,10 +1279,10 @@  discard block
 block discarded – undo
1279 1279
         if ($o['custom']) {
1280 1280
             $class = $o['class'];
1281 1281
         } else {
1282
-            $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']);
1282
+            $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($o['type']);
1283 1283
         }
1284 1284
 
1285
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1285
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1286 1286
 
1287 1287
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1288 1288
     }
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
     protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1362 1362
     {
1363 1363
         if ($this->debug) {
1364
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1364
+            echo 'Compiler::'.__FUNCTION__."\n";
1365 1365
         }
1366 1366
 
1367 1367
         if ($to === null) {
@@ -1378,14 +1378,14 @@  discard block
 block discarded – undo
1378 1378
                 // end template tag
1379 1379
                 $pointer += strlen($this->rd);
1380 1380
                 if ($this->debug) {
1381
-                    echo 'TEMPLATE PARSING ENDED' . "\n";
1381
+                    echo 'TEMPLATE PARSING ENDED'."\n";
1382 1382
                 }
1383 1383
 
1384 1384
                 return false;
1385 1385
             }
1386
-            ++ $from;
1386
+            ++$from;
1387 1387
             if ($pointer !== null) {
1388
-                ++ $pointer;
1388
+                ++$pointer;
1389 1389
             }
1390 1390
             if ($from >= $to) {
1391 1391
                 if (is_array($parsingParams)) {
@@ -1397,22 +1397,22 @@  discard block
 block discarded – undo
1397 1397
             $first = $in[$from];
1398 1398
         }
1399 1399
 
1400
-        $substr = substr($in, $from, $to - $from);
1400
+        $substr = substr($in, $from, $to-$from);
1401 1401
 
1402 1402
         if ($this->debug) {
1403
-            echo 'PARSE CALL : PARSING "' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n";
1403
+            echo 'PARSE CALL : PARSING "'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1404 1404
         }
1405 1405
         $parsed = '';
1406 1406
 
1407 1407
         if ($curBlock === 'root' && $first === '*') {
1408 1408
             $src      = $this->getTemplateSource();
1409
-            $startpos = $this->getPointer() - strlen($this->ld);
1409
+            $startpos = $this->getPointer()-strlen($this->ld);
1410 1410
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1411 1411
                 if ($startpos > 0) {
1412 1412
                     do {
1413 1413
                         $char = substr($src, -- $startpos, 1);
1414 1414
                         if ($char == "\n") {
1415
-                            ++ $startpos;
1415
+                            ++$startpos;
1416 1416
                             $whitespaceStart = true;
1417 1417
                             break;
1418 1418
                         }
@@ -1423,12 +1423,12 @@  discard block
 block discarded – undo
1423 1423
                 if (!isset($whitespaceStart)) {
1424 1424
                     $startpos = $this->getPointer();
1425 1425
                 } else {
1426
-                    $pointer -= $this->getPointer() - $startpos;
1426
+                    $pointer -= $this->getPointer()-$startpos;
1427 1427
                 }
1428 1428
 
1429
-                if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) {
1430
-                    $comOpen  = $this->ld . '*';
1431
-                    $comClose = '*' . $this->rd;
1429
+                if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
1430
+                    $comOpen  = $this->ld.'*';
1431
+                    $comClose = '*'.$this->rd;
1432 1432
                     $level    = 1;
1433 1433
                     $ptr      = $this->getPointer();
1434 1434
 
@@ -1438,33 +1438,33 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
                         if ($open !== false && $close !== false) {
1440 1440
                             if ($open < $close) {
1441
-                                $ptr = $open + strlen($comOpen);
1442
-                                ++ $level;
1441
+                                $ptr = $open+strlen($comOpen);
1442
+                                ++$level;
1443 1443
                             } else {
1444
-                                $ptr = $close + strlen($comClose);
1445
-                                -- $level;
1444
+                                $ptr = $close+strlen($comClose);
1445
+                                --$level;
1446 1446
                             }
1447 1447
                         } elseif ($open !== false) {
1448
-                            $ptr = $open + strlen($comOpen);
1449
-                            ++ $level;
1448
+                            $ptr = $open+strlen($comOpen);
1449
+                            ++$level;
1450 1450
                         } elseif ($close !== false) {
1451
-                            $ptr = $close + strlen($comClose);
1452
-                            -- $level;
1451
+                            $ptr = $close+strlen($comClose);
1452
+                            --$level;
1453 1453
                         } else {
1454 1454
                             $ptr = strlen($src);
1455 1455
                         }
1456 1456
                     }
1457
-                    $endpos = $ptr - strlen('*' . $this->rd);
1457
+                    $endpos = $ptr-strlen('*'.$this->rd);
1458 1458
                 } else {
1459
-                    $endpos = strpos($src, '*' . $this->rd, $startpos);
1459
+                    $endpos = strpos($src, '*'.$this->rd, $startpos);
1460 1460
                     if ($endpos == false) {
1461 1461
                         throw new CompilationException($this, 'Un-ended comment');
1462 1462
                     }
1463 1463
                 }
1464
-                $pointer += $endpos - $startpos + strlen('*' . $this->rd);
1465
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) {
1464
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1465
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1466 1466
                     $pointer += strlen($m[0]);
1467
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1467
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1468 1468
                 }
1469 1469
 
1470 1470
                 return false;
@@ -1481,20 +1481,20 @@  discard block
 block discarded – undo
1481 1481
         } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) {
1482 1482
             // string
1483 1483
             $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer);
1484
-        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?(' . (is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|') . '\s*\(|\s*' . $this->rdr . '|\s*;)/i', $substr)) {
1484
+        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?('.(is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|').'\s*\(|\s*'.$this->rdr.'|\s*;)/i', $substr)) {
1485 1485
             // func
1486 1486
             $out    = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer);
1487 1487
             $parsed = 'func';
1488 1488
         } elseif ($first === ';') {
1489 1489
             // instruction end
1490 1490
             if ($this->debug) {
1491
-                echo 'END OF INSTRUCTION' . "\n";
1491
+                echo 'END OF INSTRUCTION'."\n";
1492 1492
             }
1493 1493
             if ($pointer !== null) {
1494
-                ++ $pointer;
1494
+                ++$pointer;
1495 1495
             }
1496 1496
 
1497
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1497
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1498 1498
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1499 1499
             // close block
1500 1500
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1511,13 +1511,13 @@  discard block
 block discarded – undo
1511 1511
                     $pointer -= strlen($match[0]);
1512 1512
                 }
1513 1513
                 if ($this->debug) {
1514
-                    echo 'TOP BLOCK CLOSED' . "\n";
1514
+                    echo 'TOP BLOCK CLOSED'."\n";
1515 1515
                 }
1516 1516
 
1517 1517
                 return $this->removeTopBlock();
1518 1518
             } else {
1519 1519
                 if ($this->debug) {
1520
-                    echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n";
1520
+                    echo 'BLOCK OF TYPE '.$match[1].' CLOSED'."\n";
1521 1521
                 }
1522 1522
 
1523 1523
                 return $this->removeBlock($match[1]);
@@ -1525,19 +1525,19 @@  discard block
 block discarded – undo
1525 1525
         } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) {
1526 1526
             // end template tag
1527 1527
             if ($this->debug) {
1528
-                echo 'TAG PARSING ENDED' . "\n";
1528
+                echo 'TAG PARSING ENDED'."\n";
1529 1529
             }
1530 1530
             $pointer += strlen($this->rd);
1531 1531
 
1532 1532
             return false;
1533
-        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) {
1533
+        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?' : '').')(?:\s+|[^=]).*#i', $substr, $match)) {
1534 1534
             // named parameter
1535 1535
             if ($this->debug) {
1536
-                echo 'NAMED PARAM FOUND' . "\n";
1536
+                echo 'NAMED PARAM FOUND'."\n";
1537 1537
             }
1538 1538
             $len = strlen($match[1]);
1539
-            while (substr($in, $from + $len, 1) === ' ') {
1540
-                ++ $len;
1539
+            while (substr($in, $from+$len, 1) === ' ') {
1540
+                ++$len;
1541 1541
             }
1542 1542
             if ($pointer !== null) {
1543 1543
                 $pointer += $len;
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
             $output = array(
1547 1547
                 trim($match[1], " \t\r\n=>'\""),
1548
-                $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer)
1548
+                $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer)
1549 1549
             );
1550 1550
 
1551 1551
             $parsingParams[] = $output;
@@ -1566,31 +1566,31 @@  discard block
 block discarded – undo
1566 1566
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1567 1567
         } else {
1568 1568
             // parse error
1569
-            throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"');
1569
+            throw new CompilationException($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1570 1570
         }
1571 1571
 
1572 1572
         if (empty($out)) {
1573 1573
             return '';
1574 1574
         }
1575 1575
 
1576
-        $substr = substr($in, $pointer, $to - $pointer);
1576
+        $substr = substr($in, $pointer, $to-$pointer);
1577 1577
 
1578 1578
         // var parsed, check if any var-extension applies
1579 1579
         if ($parsed === 'var') {
1580 1580
             if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) {
1581 1581
                 if ($this->debug) {
1582
-                    echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n";
1582
+                    echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1583 1583
                 }
1584 1584
                 // parse expressions
1585
-                $pointer += strlen($match[0]) - 1;
1585
+                $pointer += strlen($match[0])-1;
1586 1586
                 if (is_array($parsingParams)) {
1587 1587
                     if ($match[2] == '$') {
1588 1588
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1589 1589
                     } else {
1590 1590
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1591 1591
                     }
1592
-                    $out[count($out) - 1][0] .= $match[1] . $expr[0][0];
1593
-                    $out[count($out) - 1][1] .= $match[1] . $expr[0][1];
1592
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1593
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1594 1594
                 } else {
1595 1595
                     if ($match[2] == '$') {
1596 1596
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1598,26 +1598,26 @@  discard block
 block discarded – undo
1598 1598
                         $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer);
1599 1599
                     }
1600 1600
                     if (is_array($out) && is_array($expr)) {
1601
-                        $out[0] .= $match[1] . $expr[0];
1602
-                        $out[1] .= $match[1] . $expr[1];
1601
+                        $out[0] .= $match[1].$expr[0];
1602
+                        $out[1] .= $match[1].$expr[1];
1603 1603
                     } elseif (is_array($out)) {
1604
-                        $out[0] .= $match[1] . $expr;
1605
-                        $out[1] .= $match[1] . $expr;
1604
+                        $out[0] .= $match[1].$expr;
1605
+                        $out[1] .= $match[1].$expr;
1606 1606
                     } elseif (is_array($expr)) {
1607
-                        $out .= $match[1] . $expr[0];
1607
+                        $out .= $match[1].$expr[0];
1608 1608
                     } else {
1609
-                        $out .= $match[1] . $expr;
1609
+                        $out .= $match[1].$expr;
1610 1610
                     }
1611 1611
                 }
1612 1612
             } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) {
1613 1613
                 if ($this->debug) {
1614
-                    echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n";
1614
+                    echo 'PARSING POST-VAR ASSIGNMENT '.$substr."\n";
1615 1615
                 }
1616 1616
                 // parse assignment
1617 1617
                 $value    = $match[2];
1618 1618
                 $operator = trim($match[1]);
1619 1619
                 if (substr($value, 0, 1) == '=') {
1620
-                    throw new CompilationException($this, 'Unexpected "=" in <em>' . $substr . '</em>');
1620
+                    throw new CompilationException($this, 'Unexpected "=" in <em>'.$substr.'</em>');
1621 1621
                 }
1622 1622
 
1623 1623
                 if ($pointer !== null) {
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
                         throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible');
1639 1639
                     }
1640 1640
 
1641
-                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1);
1641
+                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf', 'init'), 1);
1642 1642
                     $tokens = $this->getParamTokens($parts);
1643 1643
                     $parts  = $this->getCompiledParams($parts);
1644 1644
 
@@ -1652,14 +1652,14 @@  discard block
 block discarded – undo
1652 1652
                 if ($this->autoEscape) {
1653 1653
                     $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out);
1654 1654
                 }
1655
-                $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE;
1655
+                $out = self::PHP_OPEN.$echo.$out.$operator.implode(' ', $value).self::PHP_CLOSE;
1656 1656
             } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) {
1657 1657
                 // parse namedparam with var as name (only for array)
1658 1658
                 if ($this->debug) {
1659
-                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n";
1659
+                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1660 1660
                 }
1661 1661
                 $len = strlen($match[1]);
1662
-                $var = $out[count($out) - 1];
1662
+                $var = $out[count($out)-1];
1663 1663
                 $pointer += $len;
1664 1664
 
1665 1665
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1674,16 +1674,16 @@  discard block
 block discarded – undo
1674 1674
             // parse modifier on funcs or vars
1675 1675
             $srcPointer = $pointer;
1676 1676
             if (is_array($parsingParams)) {
1677
-                $tmp                     = $this->replaceModifiers(
1677
+                $tmp = $this->replaceModifiers(
1678 1678
                     array(
1679 1679
                     null,
1680 1680
                     null,
1681
-                    $out[count($out) - 1][0],
1681
+                    $out[count($out)-1][0],
1682 1682
                     $match[0]
1683 1683
                     ), $curBlock, $pointer
1684 1684
                 );
1685
-                $out[count($out) - 1][0] = $tmp;
1686
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1685
+                $out[count($out)-1][0] = $tmp;
1686
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1687 1687
             } else {
1688 1688
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1689 1689
             }
@@ -1695,10 +1695,10 @@  discard block
 block discarded – undo
1695 1695
             $ptr = 0;
1696 1696
 
1697 1697
             if (is_array($parsingParams)) {
1698
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1698
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1699 1699
 
1700
-                $out[count($out) - 1][0] = $output;
1701
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1700
+                $out[count($out)-1][0] = $output;
1701
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1702 1702
             } else {
1703 1703
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1704 1704
             }
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
         }
1708 1708
 
1709 1709
         if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) {
1710
-            return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE;
1710
+            return self::PHP_OPEN.'echo '.$out.';'.self::PHP_CLOSE;
1711 1711
         } else {
1712 1712
             return $out;
1713 1713
         }
@@ -1733,11 +1733,11 @@  discard block
 block discarded – undo
1733 1733
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1734 1734
     {
1735 1735
         $output = '';
1736
-        $cmdstr = substr($in, $from, $to - $from);
1737
-        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match);
1736
+        $cmdstr = substr($in, $from, $to-$from);
1737
+        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1738 1738
 
1739 1739
         if (empty($match[1])) {
1740
-            throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15));
1740
+            throw new CompilationException($this, 'Parse error, invalid function name : '.substr($cmdstr, 0, 15));
1741 1741
         }
1742 1742
 
1743 1743
         $func = $match[1];
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
         }
1748 1748
 
1749 1749
         if ($this->debug) {
1750
-            echo 'FUNC FOUND (' . $func . ')' . "\n";
1750
+            echo 'FUNC FOUND ('.$func.')'."\n";
1751 1751
         }
1752 1752
 
1753 1753
         $paramsep = '';
@@ -1759,11 +1759,11 @@  discard block
 block discarded – undo
1759 1759
             $paramspos = $match[1][0][1];
1760 1760
             $paramsep  = substr($match[1][0][0], - 1) === '(' ? ')' : '';
1761 1761
             if ($paramsep === ')') {
1762
-                $paramspos += strlen($match[1][0][0]) - 1;
1762
+                $paramspos += strlen($match[1][0][0])-1;
1763 1763
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1764 1764
                     $paramsep = '';
1765 1765
                     if (strlen($match[1][0][0]) > 1) {
1766
-                        -- $paramspos;
1766
+                        --$paramspos;
1767 1767
                     }
1768 1768
                 }
1769 1769
             }
@@ -1788,8 +1788,8 @@  discard block
 block discarded – undo
1788 1788
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1789 1789
                 }
1790 1790
             }
1791
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1792
-            $paramstr   = substr($cmdstr, $paramspos + 1);
1791
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1792
+            $paramstr   = substr($cmdstr, $paramspos+1);
1793 1793
             if (substr($paramstr, - 1, 1) === $paramsep) {
1794 1794
                 $paramstr = substr($paramstr, 0, - 1);
1795 1795
             }
@@ -1811,36 +1811,36 @@  discard block
 block discarded – undo
1811 1811
 
1812 1812
                             if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') {
1813 1813
                                 if ($this->debug) {
1814
-                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT ' . $ptr . "\n";
1814
+                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr."\n";
1815 1815
                                 }
1816 1816
                                 break 2;
1817 1817
                             } elseif ($paramstr[$ptr] === ';') {
1818
-                                ++ $ptr;
1818
+                                ++$ptr;
1819 1819
                                 if ($this->debug) {
1820
-                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n";
1820
+                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr."\n";
1821 1821
                                 }
1822 1822
                                 break 2;
1823 1823
                             } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') {
1824 1824
                                 if ($this->debug) {
1825
-                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT ' . $ptr . "\n";
1825
+                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr."\n";
1826 1826
                                 }
1827 1827
                                 break 2;
1828 1828
                             } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
1829 1829
                                 if ($this->debug) {
1830
-                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT ' . $ptr . "\n";
1830
+                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr."\n";
1831 1831
                                 }
1832 1832
                                 break 2;
1833 1833
                             }
1834 1834
 
1835 1835
                             if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") {
1836
-                                ++ $ptr;
1836
+                                ++$ptr;
1837 1837
                             } else {
1838 1838
                                 break;
1839 1839
                             }
1840 1840
                         }
1841 1841
 
1842 1842
                         if ($this->debug) {
1843
-                            echo 'FUNC START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
1843
+                            echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr."\n";
1844 1844
                         }
1845 1845
 
1846 1846
                         if ($func === 'if' || $func === 'elseif' || $func === 'tif') {
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
                         }
1853 1853
 
1854 1854
                         if ($this->debug) {
1855
-                            echo 'PARAM PARSED, POINTER AT ' . $ptr . ' (' . substr($paramstr, $ptr - 1, 3) . ')' . "\n";
1855
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1856 1856
                         }
1857 1857
                     }
1858 1858
                 }
@@ -1876,16 +1876,16 @@  discard block
 block discarded – undo
1876 1876
         }
1877 1877
 
1878 1878
         if ($pointer !== null) {
1879
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1879
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1880 1880
             if ($this->debug) {
1881
-                echo 'FUNC ADDS ' . ((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)) . ' TO POINTER' . "\n";
1881
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1882 1882
             }
1883 1883
         }
1884 1884
 
1885 1885
         if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) {
1886 1886
             // handle static method calls with security policy
1887 1887
             if (strstr($func, '::') !== false && $this->securityPolicy !== null && $this->securityPolicy->isMethodAllowed(explode('::', strtolower($func))) !== true) {
1888
-                throw new SecurityException('Call to a disallowed php function : ' . $func);
1888
+                throw new SecurityException('Call to a disallowed php function : '.$func);
1889 1889
             }
1890 1890
             $pluginType = Core::NATIVE_PLUGIN;
1891 1891
         } else {
@@ -1930,19 +1930,19 @@  discard block
 block discarded – undo
1930 1930
                     $this->customPlugins[$func]['function']
1931 1931
                 ), $state);
1932 1932
             } else {
1933
-                if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
1933
+                if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
1934 1934
                     $params = $this->mapParams($params, array(
1935
-                        'Plugin' . Core::toCamelCase($func),
1935
+                        'Plugin'.Core::toCamelCase($func),
1936 1936
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1937 1937
                     ), $state);
1938
-                } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) {
1938
+                } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !== false) {
1939 1939
                     $params = $this->mapParams($params, array(
1940
-                        Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func),
1940
+                        Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func),
1941 1941
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1942 1942
                     ), $state);
1943 1943
                 } else {
1944 1944
                     $params = $this->mapParams($params, array(
1945
-                        Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
1945
+                        Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
1946 1946
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1947 1947
                     ), $state);
1948 1948
                 }
@@ -1953,24 +1953,22 @@  discard block
 block discarded – undo
1953 1953
                 $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state);
1954 1954
             } else {
1955 1955
                 // Custom plugin
1956
-                if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ?
1956
+                if (function_exists('Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ?
1957 1957
                         'Compile' : '')) !== false) {
1958
-                    $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType &
1958
+                    $params = $this->mapParams($params, 'Plugin'.Core::toCamelCase($func).(($pluginType &
1959 1959
                             Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1960 1960
                 } // Builtin helper plugin
1961
-                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . (
1961
+                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(
1962 1962
                     ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) {
1963
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase
1964
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1963
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1965 1964
                 } // Builtin function plugin
1966 1965
                 else {
1967
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
1968
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1966
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1969 1967
                 }
1970 1968
             }
1971 1969
         } // Smarty modifier
1972 1970
         elseif ($pluginType & Core::SMARTY_MODIFIER) {
1973
-            $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')';
1971
+            $output = 'smarty_modifier_'.$func.'('.implode(', ', $params).')';
1974 1972
         } // Proxy plugin
1975 1973
         elseif ($pluginType & Core::PROXY_PLUGIN) {
1976 1974
             $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -2010,19 +2008,19 @@  discard block
 block discarded – undo
2010 2008
             if ($func === 'do') {
2011 2009
                 $output = '';
2012 2010
                 if (isset($params['*'])) {
2013
-                    $output = implode(';', $params['*']) . ';';
2011
+                    $output = implode(';', $params['*']).';';
2014 2012
                 }
2015 2013
 
2016 2014
                 if (is_array($parsingParams) || $curBlock !== 'root') {
2017 2015
                     throw new CompilationException($this, 'Do can not be used inside another function or block');
2018 2016
                 }
2019 2017
 
2020
-                return self::PHP_OPEN . $output . self::PHP_CLOSE;
2018
+                return self::PHP_OPEN.$output.self::PHP_CLOSE;
2021 2019
             } else {
2022 2020
                 if (isset($params['*'])) {
2023
-                    $output = $func . '(' . implode(', ', $params['*']) . ')';
2021
+                    $output = $func.'('.implode(', ', $params['*']).')';
2024 2022
                 } else {
2025
-                    $output = $func . '()';
2023
+                    $output = $func.'()';
2026 2024
                 }
2027 2025
             }
2028 2026
         } // Block class OR Function class
@@ -2032,7 +2030,7 @@  discard block
 block discarded – undo
2032 2030
                     $callback = $this->customPlugins[$func]['callback'];
2033 2031
                     if (!is_array($callback)) {
2034 2032
                         if (!method_exists($callback, 'compile')) {
2035
-                            throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
2033
+                            throw new Exception('Custom plugin '.$func.' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
2036 2034
                         }
2037 2035
                         if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
2038 2036
                             $funcCompiler = array($callback, 'compile');
@@ -2043,13 +2041,13 @@  discard block
 block discarded – undo
2043 2041
                         $funcCompiler = $callback;
2044 2042
                     }
2045 2043
                 } else {
2046
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2047
-                        $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
2048
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) {
2049
-                        $funcCompiler = array(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func), 'compile');
2044
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2045
+                        $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
2046
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !== false) {
2047
+                        $funcCompiler = array(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func), 'compile');
2050 2048
                     } else {
2051 2049
                         $funcCompiler = array(
2052
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
2050
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
2053 2051
                             'compile'
2054 2052
                         );
2055 2053
                     }
@@ -2066,31 +2064,31 @@  discard block
 block discarded – undo
2066 2064
                     $callback = $this->customPlugins[$func]['callback'];
2067 2065
                     if (!is_array($callback)) {
2068 2066
                         if (!method_exists($callback, 'process')) {
2069
-                            throw new Exception('Custom plugin ' . $func . ' must implement the "process" method to be usable, or you should provide a full callback to the method to use');
2067
+                            throw new Exception('Custom plugin '.$func.' must implement the "process" method to be usable, or you should provide a full callback to the method to use');
2070 2068
                         }
2071 2069
                         if (($ref = new ReflectionMethod($callback, 'process')) && $ref->isStatic()) {
2072
-                            $output = 'call_user_func(array(\'' . $callback . '\', \'process\'), ' . $params . ')';
2070
+                            $output = 'call_user_func(array(\''.$callback.'\', \'process\'), '.$params.')';
2073 2071
                         } else {
2074
-                            $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback . '\'), \'process\'), ' . $params . ')';
2072
+                            $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback.'\'), \'process\'), '.$params.')';
2075 2073
                         }
2076 2074
                     } elseif (is_object($callback[0])) {
2077
-                        $output = 'call_user_func(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), ' . $params . ')';
2075
+                        $output = 'call_user_func(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), '.$params.')';
2078 2076
                     } elseif (($ref = new ReflectionMethod($callback[0], $callback[1])) && $ref->isStatic()) {
2079
-                        $output = 'call_user_func(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), ' . $params . ')';
2077
+                        $output = 'call_user_func(array(\''.$callback[0].'\', \''.$callback[1].'\'), '.$params.')';
2080 2078
                     } else {
2081
-                        $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback[0] . '\'), \'' . $callback[1] . '\'), ' . $params . ')';
2079
+                        $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback[0].'\'), \''.$callback[1].'\'), '.$params.')';
2082 2080
                     }
2083 2081
                     if (empty($params)) {
2084
-                        $output = substr($output, 0, - 3) . ')';
2082
+                        $output = substr($output, 0, - 3).')';
2085 2083
                     }
2086 2084
                 } else {
2087
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2088
-                        $output = '$this->classCall(\'Plugin' . $func . '\', array(' . $params . '))';
2089
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) {
2090
-                        $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', 
2091
-                        array(' . $params . '))';
2085
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2086
+                        $output = '$this->classCall(\'Plugin'.$func.'\', array('.$params.'))';
2087
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !== false) {
2088
+                        $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', 
2089
+                        array(' . $params.'))';
2092 2090
                     } else {
2093
-                        $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
2091
+                        $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
2094 2092
                     }
2095 2093
                 }
2096 2094
             }
@@ -2101,15 +2099,15 @@  discard block
 block discarded – undo
2101 2099
                     $funcCompiler = $this->customPlugins[$func]['callback'];
2102 2100
                 } else {
2103 2101
                     // Custom plugin
2104
-                    if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2105
-                        $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
2102
+                    if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2103
+                        $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
2106 2104
                     } // Builtin helper plugin
2107
-                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2108
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2105
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2106
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2109 2107
                             'Compile';
2110 2108
                     } // Builtin function plugin
2111 2109
                     else {
2112
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
2110
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
2113 2111
                             'Compile';
2114 2112
                     }
2115 2113
                 }
@@ -2125,24 +2123,24 @@  discard block
 block discarded – undo
2125 2123
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
2126 2124
                     $callback = $this->customPlugins[$func]['callback'];
2127 2125
                     if ($callback instanceof Closure) {
2128
-                        $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')';
2126
+                        $output = 'call_user_func($this->getCustomPlugin(\''.$func.'\'), '.$params.')';
2129 2127
                     } else {
2130
-                        $output = 'call_user_func(\'' . $callback . '\', ' . $params . ')';
2128
+                        $output = 'call_user_func(\''.$callback.'\', '.$params.')';
2131 2129
                     }
2132 2130
                 } else {
2133 2131
                     // Custom plugin
2134
-                    if (function_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2135
-                        $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params .
2132
+                    if (function_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2133
+                        $output = 'Plugin'.Core::toCamelCase($func).'('.$params.
2136 2134
                             ')';
2137 2135
                     } // Builtin helper plugin
2138
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !==
2136
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !==
2139 2137
                         false) {
2140
-                        $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' .
2141
-                            $params . ')';
2138
+                        $output = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'('.
2139
+                            $params.')';
2142 2140
                     } // Builtin function plugin
2143 2141
                     else {
2144
-                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '(' .
2145
-                            $params . ')';
2142
+                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'('.
2143
+                            $params.')';
2146 2144
                     }
2147 2145
                 }
2148 2146
             }
@@ -2160,22 +2158,22 @@  discard block
 block discarded – undo
2160 2158
                 $callback = $this->customPlugins[$func]['callback'];
2161 2159
                 if (is_array($callback)) {
2162 2160
                     if (is_object($callback[0])) {
2163
-                        $output = 'call_user_func_array(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2161
+                        $output = 'call_user_func_array(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array(array('.$params.'), $this))';
2164 2162
                     } else {
2165
-                        $output = 'call_user_func_array(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2163
+                        $output = 'call_user_func_array(array(\''.$callback[0].'\', \''.$callback[1].'\'), array(array('.$params.'), $this))';
2166 2164
                     }
2167 2165
                 } else {
2168
-                    $output = $callback . '(array(' . $params . '), $this)';
2166
+                    $output = $callback.'(array('.$params.'), $this)';
2169 2167
                 }
2170 2168
             } else {
2171
-                $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)';
2169
+                $output = 'smarty_function_'.$func.'(array('.$params.'), $this)';
2172 2170
             }
2173 2171
         } // Template plugin
2174 2172
         elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
2175 2173
             array_unshift($params, '$this');
2176 2174
             $params                                 = self::implode_r($params);
2177
-            $output                                 = 'Plugin' . Core::toCamelCase($func) .
2178
-                $this->templatePlugins[$func]['uuid'] . '(' . $params . ')';
2175
+            $output                                 = 'Plugin'.Core::toCamelCase($func).
2176
+                $this->templatePlugins[$func]['uuid'].'('.$params.')';
2179 2177
             $this->templatePlugins[$func]['called'] = true;
2180 2178
         }
2181 2179
 
@@ -2207,29 +2205,29 @@  discard block
 block discarded – undo
2207 2205
      */
2208 2206
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2209 2207
     {
2210
-        $substr = substr($in, $from, $to - $from);
2208
+        $substr = substr($in, $from, $to-$from);
2211 2209
         $first  = $substr[0];
2212 2210
 
2213 2211
         if ($this->debug) {
2214
-            echo 'STRING FOUND (in ' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . ')' . "\n";
2212
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2215 2213
         }
2216 2214
         $strend = false;
2217
-        $o      = $from + 1;
2215
+        $o      = $from+1;
2218 2216
         while ($strend === false) {
2219 2217
             $strend = strpos($in, $first, $o);
2220 2218
             if ($strend === false) {
2221
-                throw new CompilationException($this, 'Unfinished string, started with ' . substr($in, $from, $to - $from));
2219
+                throw new CompilationException($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2222 2220
             }
2223
-            if (substr($in, $strend - 1, 1) === '\\') {
2224
-                $o      = $strend + 1;
2221
+            if (substr($in, $strend-1, 1) === '\\') {
2222
+                $o      = $strend+1;
2225 2223
                 $strend = false;
2226 2224
             }
2227 2225
         }
2228 2226
         if ($this->debug) {
2229
-            echo 'STRING DELIMITED: ' . substr($in, $from, $strend + 1 - $from) . "\n";
2227
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2230 2228
         }
2231 2229
 
2232
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2230
+        $srcOutput = substr($in, $from, $strend+1-$from);
2233 2231
 
2234 2232
         if ($pointer !== null) {
2235 2233
             $pointer += strlen($srcOutput);
@@ -2238,13 +2236,13 @@  discard block
 block discarded – undo
2238 2236
         $output = $this->replaceStringVars($srcOutput, $first);
2239 2237
 
2240 2238
         // handle modifiers
2241
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2239
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2242 2240
             $modstr = $match[1];
2243 2241
 
2244 2242
             if ($curBlock === 'root' && substr($modstr, - 1) === '}') {
2245 2243
                 $modstr = substr($modstr, 0, - 1);
2246 2244
             }
2247
-            $modstr = str_replace('\\' . $first, $first, $modstr);
2245
+            $modstr = str_replace('\\'.$first, $first, $modstr);
2248 2246
             $ptr    = 0;
2249 2247
             $output = $this->replaceModifiers(array(null, null, $output, $modstr), 'string', $ptr);
2250 2248
 
@@ -2252,7 +2250,7 @@  discard block
 block discarded – undo
2252 2250
             if ($pointer !== null) {
2253 2251
                 $pointer += $ptr;
2254 2252
             }
2255
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2253
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2256 2254
         }
2257 2255
 
2258 2256
         if (is_array($parsingParams)) {
@@ -2283,10 +2281,10 @@  discard block
 block discarded – undo
2283 2281
      */
2284 2282
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2285 2283
     {
2286
-        $substr = substr($in, $from, $to - $from);
2284
+        $substr = substr($in, $from, $to-$from);
2287 2285
 
2288 2286
         if ($this->debug) {
2289
-            echo 'CONST FOUND : ' . $substr . "\n";
2287
+            echo 'CONST FOUND : '.$substr."\n";
2290 2288
         }
2291 2289
 
2292 2290
         if (!preg_match('#^%([\\\\a-z0-9_:]+)#i', $substr, $m)) {
@@ -2325,7 +2323,7 @@  discard block
 block discarded – undo
2325 2323
         }
2326 2324
 
2327 2325
         if ($curBlock !== 'root') {
2328
-            $output = '(defined("' . $key . '") ? ' . $key . ' : null)';
2326
+            $output = '(defined("'.$key.'") ? '.$key.' : null)';
2329 2327
         } else {
2330 2328
             $output = $key;
2331 2329
         }
@@ -2350,7 +2348,7 @@  discard block
 block discarded – undo
2350 2348
      */
2351 2349
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2352 2350
     {
2353
-        $substr = substr($in, $from, $to - $from);
2351
+        $substr = substr($in, $from, $to-$from);
2354 2352
 
2355 2353
         // var key
2356 2354
         $varRegex = '(\\$?\\.?[a-z0-9\\\\_:]*(?:(?:(?:\\.|->)(?:[a-z0-9\\\\_:]+|(?R))|\\[(?:[a-z0-9\\\\_:]+|(?R)|(["\'])[^\\2]*?\\2)\\]))*)';
@@ -2378,13 +2376,13 @@  discard block
 block discarded – undo
2378 2376
 
2379 2377
             if (substr($key, - 1) == '.') {
2380 2378
                 $key = substr($key, 0, - 1);
2381
-                -- $matchedLength;
2379
+                --$matchedLength;
2382 2380
             }
2383 2381
 
2384 2382
             if ($hasMethodCall) {
2385
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2386
-                $key        = substr($match[1], 1, strrpos($match[1], '->') - 1);
2387
-                $methodCall = substr($match[1], strrpos($match[1], '->')) . $match[3];
2383
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2384
+                $key        = substr($match[1], 1, strrpos($match[1], '->')-1);
2385
+                $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2388 2386
             }
2389 2387
 
2390 2388
             if ($hasModifiers) {
@@ -2400,9 +2398,9 @@  discard block
 block discarded – undo
2400 2398
 
2401 2399
             if ($this->debug) {
2402 2400
                 if ($hasMethodCall) {
2403
-                    echo 'METHOD CALL FOUND : $' . $key . substr($methodCall, 0, 30) . "\n";
2401
+                    echo 'METHOD CALL FOUND : $'.$key.substr($methodCall, 0, 30)."\n";
2404 2402
                 } else {
2405
-                    echo 'VAR FOUND : $' . $key . "\n";
2403
+                    echo 'VAR FOUND : $'.$key."\n";
2406 2404
                 }
2407 2405
             }
2408 2406
 
@@ -2413,7 +2411,7 @@  discard block
 block discarded – undo
2413 2411
                 $uid           = 0;
2414 2412
                 $parsed        = array($uid => '');
2415 2413
                 $current       = &$parsed;
2416
-                $curTxt        = &$parsed[$uid ++];
2414
+                $curTxt        = &$parsed[$uid++];
2417 2415
                 $tree          = array();
2418 2416
                 $chars         = str_split($key, 1);
2419 2417
                 $inSplittedVar = false;
@@ -2422,33 +2420,33 @@  discard block
 block discarded – undo
2422 2420
                 while (($char = array_shift($chars)) !== null) {
2423 2421
                     if ($char === '[') {
2424 2422
                         if (count($tree) > 0) {
2425
-                            ++ $bracketCount;
2423
+                            ++$bracketCount;
2426 2424
                         } else {
2427 2425
                             $tree[]        = &$current;
2428
-                            $current[$uid] = array($uid + 1 => '');
2429
-                            $current       = &$current[$uid ++];
2430
-                            $curTxt        = &$current[$uid ++];
2426
+                            $current[$uid] = array($uid+1 => '');
2427
+                            $current       = &$current[$uid++];
2428
+                            $curTxt        = &$current[$uid++];
2431 2429
                             continue;
2432 2430
                         }
2433 2431
                     } elseif ($char === ']') {
2434 2432
                         if ($bracketCount > 0) {
2435
-                            -- $bracketCount;
2433
+                            --$bracketCount;
2436 2434
                         } else {
2437
-                            $current = &$tree[count($tree) - 1];
2435
+                            $current = &$tree[count($tree)-1];
2438 2436
                             array_pop($tree);
2439 2437
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2440 2438
                                 $current[$uid] = '';
2441
-                                $curTxt        = &$current[$uid ++];
2439
+                                $curTxt        = &$current[$uid++];
2442 2440
                             }
2443 2441
                             continue;
2444 2442
                         }
2445 2443
                     } elseif ($char === '$') {
2446 2444
                         if (count($tree) == 0) {
2447
-                            $curTxt        = &$current[$uid ++];
2445
+                            $curTxt        = &$current[$uid++];
2448 2446
                             $inSplittedVar = true;
2449 2447
                         }
2450 2448
                     } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) {
2451
-                        $curTxt        = &$current[$uid ++];
2449
+                        $curTxt        = &$current[$uid++];
2452 2450
                         $inSplittedVar = false;
2453 2451
                     }
2454 2452
 
@@ -2457,16 +2455,16 @@  discard block
 block discarded – undo
2457 2455
                 unset($uid, $current, $curTxt, $tree, $chars);
2458 2456
 
2459 2457
                 if ($this->debug) {
2460
-                    echo 'RECURSIVE VAR REPLACEMENT : ' . $key . "\n";
2458
+                    echo 'RECURSIVE VAR REPLACEMENT : '.$key."\n";
2461 2459
                 }
2462 2460
 
2463 2461
                 $key = $this->flattenVarTree($parsed);
2464 2462
 
2465 2463
                 if ($this->debug) {
2466
-                    echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2464
+                    echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2467 2465
                 }
2468 2466
 
2469
-                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("' . $key . '")');
2467
+                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("'.$key.'")');
2470 2468
             } else {
2471 2469
                 $output = $this->parseVarKey($key, $hasModifiers ? 'modifier' : $curBlock);
2472 2470
             }
@@ -2491,10 +2489,10 @@  discard block
 block discarded – undo
2491 2489
                     if (substr($expMatch[2][$k], 0, 1) === '=') {
2492 2490
                         $assign = true;
2493 2491
                         if ($operator === '=') {
2494
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, can not use "==" in expressions');
2492
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, can not use "==" in expressions');
2495 2493
                         }
2496 2494
                         if ($curBlock !== 'root') {
2497
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2495
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2498 2496
                         }
2499 2497
                         $operator .= '=';
2500 2498
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
@@ -2505,22 +2503,22 @@  discard block
 block discarded – undo
2505 2503
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
2506 2504
                     }
2507 2505
                     if (($operator === '+' || $operator === '-') && $expMatch[2][$k] === $operator) {
2508
-                        $output = '(' . $output . $operator . $operator . ')';
2506
+                        $output = '('.$output.$operator.$operator.')';
2509 2507
                         break;
2510 2508
                     } elseif (substr($expMatch[2][$k], 0, 1) === '$') {
2511
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2509
+                        $output = '('.$output.' '.$operator.' '.$this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2512 2510
                     } elseif (substr($expMatch[2][$k], 0, 1) === '%') {
2513
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2511
+                        $output = '('.$output.' '.$operator.' '.$this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2514 2512
                     } elseif (!empty($expMatch[2][$k])) {
2515
-                        $output = '(' . $output . ' ' . $operator . ' ' . str_replace(',', '.', $expMatch[2][$k]) . ')';
2513
+                        $output = '('.$output.' '.$operator.' '.str_replace(',', '.', $expMatch[2][$k]).')';
2516 2514
                     } else {
2517
-                        throw new CompilationException($this, 'Unfinished expression <em>' . $substr . '</em>, missing var or number after math operator');
2515
+                        throw new CompilationException($this, 'Unfinished expression <em>'.$substr.'</em>, missing var or number after math operator');
2518 2516
                     }
2519 2517
                 }
2520 2518
             }
2521 2519
 
2522 2520
             if ($this->autoEscape === true && $curBlock !== 'condition') {
2523
-                $output = '(is_string($tmp=' . $output . ') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2521
+                $output = '(is_string($tmp='.$output.') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2524 2522
             }
2525 2523
 
2526 2524
             // handle modifiers
@@ -2544,7 +2542,7 @@  discard block
 block discarded – undo
2544 2542
             } elseif ($curBlock === 'expression' || $curBlock === 'variable') {
2545 2543
                 return $output;
2546 2544
             } elseif (isset($assign)) {
2547
-                return self::PHP_OPEN . $output . ';' . self::PHP_CLOSE;
2545
+                return self::PHP_OPEN.$output.';'.self::PHP_CLOSE;
2548 2546
             } else {
2549 2547
                 return $output;
2550 2548
             }
@@ -2552,7 +2550,7 @@  discard block
 block discarded – undo
2552 2550
             if ($curBlock === 'string' || $curBlock === 'delimited_string') {
2553 2551
                 return array(0, '');
2554 2552
             } else {
2555
-                throw new CompilationException($this, 'Invalid variable name <em>' . $substr . '</em>');
2553
+                throw new CompilationException($this, 'Invalid variable name <em>'.$substr.'</em>');
2556 2554
             }
2557 2555
         }
2558 2556
     }
@@ -2607,16 +2605,16 @@  discard block
 block discarded – undo
2607 2605
             if (empty($methMatch[2])) {
2608 2606
                 // property
2609 2607
                 if ($curBlock === 'root') {
2610
-                    $output .= '->' . $methMatch[1];
2608
+                    $output .= '->'.$methMatch[1];
2611 2609
                 } else {
2612
-                    $output = '(($tmp = ' . $output . ') ? $tmp->' . $methMatch[1] . ' : null)';
2610
+                    $output = '(($tmp = '.$output.') ? $tmp->'.$methMatch[1].' : null)';
2613 2611
                 }
2614 2612
                 $ptr += strlen($methMatch[1]);
2615 2613
             } else {
2616 2614
                 // method
2617 2615
                 if (substr($methMatch[2], 0, 2) === '()') {
2618
-                    $parsedCall = $methMatch[1] . '()';
2619
-                    $ptr += strlen($methMatch[1]) + 2;
2616
+                    $parsedCall = $methMatch[1].'()';
2617
+                    $ptr += strlen($methMatch[1])+2;
2620 2618
                 } else {
2621 2619
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2622 2620
                 }
@@ -2625,15 +2623,15 @@  discard block
 block discarded – undo
2625 2623
                     $method = strtolower(substr($parsedCall, 0, $argPos));
2626 2624
                     $args   = substr($parsedCall, $argPos);
2627 2625
                     if ($curBlock === 'root') {
2628
-                        $output = '$this->getSecurityPolicy()->callMethod($this, ' . $output . ', ' . var_export($method, true) . ', array' . $args . ')';
2626
+                        $output = '$this->getSecurityPolicy()->callMethod($this, '.$output.', '.var_export($method, true).', array'.$args.')';
2629 2627
                     } else {
2630
-                        $output = '(($tmp = ' . $output . ') ? $this->getSecurityPolicy()->callMethod($this, $tmp, ' . var_export($method, true) . ', array' . $args . ') : null)';
2628
+                        $output = '(($tmp = '.$output.') ? $this->getSecurityPolicy()->callMethod($this, $tmp, '.var_export($method, true).', array'.$args.') : null)';
2631 2629
                     }
2632 2630
                 } else {
2633 2631
                     if ($curBlock === 'root') {
2634
-                        $output .= '->' . $parsedCall;
2632
+                        $output .= '->'.$parsedCall;
2635 2633
                     } else {
2636
-                        $output = '(($tmp = ' . $output . ') ? $tmp->' . $parsedCall . ' : null)';
2634
+                        $output = '(($tmp = '.$output.') ? $tmp->'.$parsedCall.' : null)';
2637 2635
                     }
2638 2636
                 }
2639 2637
             }
@@ -2659,21 +2657,21 @@  discard block
 block discarded – undo
2659 2657
             return '$this->scope';
2660 2658
         }
2661 2659
         if (substr($key, 0, 1) === '.') {
2662
-            $key = 'dwoo' . $key;
2660
+            $key = 'dwoo'.$key;
2663 2661
         }
2664 2662
         if (preg_match('#dwoo\.(get|post|server|cookies|session|env|request)((?:\.[a-z0-9_-]+)+)#i', $key, $m)) {
2665 2663
             $global = strtoupper($m[1]);
2666 2664
             if ($global === 'COOKIES') {
2667 2665
                 $global = 'COOKIE';
2668 2666
             }
2669
-            $key = '$_' . $global;
2667
+            $key = '$_'.$global;
2670 2668
             foreach (explode('.', ltrim($m[2], '.')) as $part) {
2671
-                $key .= '[' . var_export($part, true) . ']';
2669
+                $key .= '['.var_export($part, true).']';
2672 2670
             }
2673 2671
             if ($curBlock === 'root') {
2674 2672
                 $output = $key;
2675 2673
             } else {
2676
-                $output = '(isset(' . $key . ')?' . $key . ':null)';
2674
+                $output = '(isset('.$key.')?'.$key.':null)';
2677 2675
             }
2678 2676
         } elseif (preg_match('#dwoo\\.const\\.([a-z0-9\\\\_:]+)#i', $key, $m)) {
2679 2677
             return $this->parseConstKey($m[1], $curBlock);
@@ -2689,9 +2687,9 @@  discard block
 block discarded – undo
2689 2687
                     $output = '$tmp_key';
2690 2688
                 } else {
2691 2689
                     if ($curBlock === 'root') {
2692
-                        $output = '$this->scope["' . $key . '"]';
2690
+                        $output = '$this->scope["'.$key.'"]';
2693 2691
                     } else {
2694
-                        $output = '(isset($this->scope["' . $key . '"]) ? $this->scope["' . $key . '"] : null)';
2692
+                        $output = '(isset($this->scope["'.$key.'"]) ? $this->scope["'.$key.'"] : null)';
2695 2693
                     }
2696 2694
                 }
2697 2695
             } else {
@@ -2702,7 +2700,7 @@  discard block
 block discarded – undo
2702 2700
                     $parentCnt = 0;
2703 2701
 
2704 2702
                     while (true) {
2705
-                        ++ $parentCnt;
2703
+                        ++$parentCnt;
2706 2704
                         array_shift($m[2]);
2707 2705
                         array_shift($m[1]);
2708 2706
                         if (current($m[2]) === '_parent') {
@@ -2711,7 +2709,7 @@  discard block
 block discarded – undo
2711 2709
                         break;
2712 2710
                     }
2713 2711
 
2714
-                    $output = '$this->readParentVar(' . $parentCnt . ')';
2712
+                    $output = '$this->readParentVar('.$parentCnt.')';
2715 2713
                 } else {
2716 2714
                     if ($i === 'dwoo') {
2717 2715
                         $output = '$this->globals';
@@ -2730,28 +2728,28 @@  discard block
 block discarded – undo
2730 2728
                     while (count($m[1]) && $m[1][0] !== '->') {
2731 2729
                         $m[2][0] = preg_replace('/(^\\\([\'"])|\\\([\'"])$)/x', '$2$3', $m[2][0]);
2732 2730
                         if (substr($m[2][0], 0, 1) == '"' || substr($m[2][0], 0, 1) == "'") {
2733
-                            $output .= '[' . $m[2][0] . ']';
2731
+                            $output .= '['.$m[2][0].']';
2734 2732
                         } else {
2735
-                            $output .= '["' . $m[2][0] . '"]';
2733
+                            $output .= '["'.$m[2][0].'"]';
2736 2734
                         }
2737 2735
                         array_shift($m[2]);
2738 2736
                         array_shift($m[1]);
2739 2737
                     }
2740 2738
 
2741 2739
                     if ($curBlock !== 'root') {
2742
-                        $output = '(isset(' . $output . ') ? ' . $output . ':null)';
2740
+                        $output = '(isset('.$output.') ? '.$output.':null)';
2743 2741
                     }
2744 2742
                 }
2745 2743
 
2746 2744
                 if (count($m[2])) {
2747 2745
                     unset($m[0]);
2748
-                    $output = '$this->readVarInto(' . str_replace("\n", '', var_export($m, true)) . ', ' . $output . ', ' . ($curBlock == 'root' ? 'false' : 'true') . ')';
2746
+                    $output = '$this->readVarInto('.str_replace("\n", '', var_export($m, true)).', '.$output.', '.($curBlock == 'root' ? 'false' : 'true').')';
2749 2747
                 }
2750 2748
             }
2751 2749
         } else {
2752 2750
             preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+)\]?#i', $key, $m);
2753 2751
             unset($m[0]);
2754
-            $output = '$this->readVar(' . str_replace("\n", '', var_export($m, true)) . ')';
2752
+            $output = '$this->readVar('.str_replace("\n", '', var_export($m, true)).')';
2755 2753
         }
2756 2754
 
2757 2755
         return $output;
@@ -2771,38 +2769,38 @@  discard block
 block discarded – undo
2771 2769
         $out = $recursed ? '".$this->readVarInto(' : '';
2772 2770
         foreach ($tree as $bit) {
2773 2771
             if (is_array($bit)) {
2774
-                $out .= '.' . $this->flattenVarTree($bit, false);
2772
+                $out .= '.'.$this->flattenVarTree($bit, false);
2775 2773
             } else {
2776 2774
                 $key = str_replace('"', '\\"', $bit);
2777 2775
 
2778 2776
                 if (substr($key, 0, 1) === '$') {
2779
-                    $out .= '".' . $this->parseVar($key, 0, strlen($key), false, 'variable') . '."';
2777
+                    $out .= '".'.$this->parseVar($key, 0, strlen($key), false, 'variable').'."';
2780 2778
                 } else {
2781 2779
                     $cnt = substr_count($key, '$');
2782 2780
 
2783 2781
                     if ($this->debug) {
2784
-                        echo 'PARSING SUBVARS IN : ' . $key . "\n";
2782
+                        echo 'PARSING SUBVARS IN : '.$key."\n";
2785 2783
                     }
2786 2784
                     if ($cnt > 0) {
2787
-                        while (-- $cnt >= 0) {
2785
+                        while (--$cnt >= 0) {
2788 2786
                             if (isset($last)) {
2789
-                                $last = strrpos($key, '$', - (strlen($key) - $last + 1));
2787
+                                $last = strrpos($key, '$', - (strlen($key)-$last+1));
2790 2788
                             } else {
2791 2789
                                 $last = strrpos($key, '$');
2792 2790
                             }
2793
-                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2791
+                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2794 2792
 
2795 2793
                             $len = strlen($submatch[0]);
2796 2794
                             $key = substr_replace(
2797 2795
                                 $key, preg_replace_callback(
2798
-                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2796
+                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2799 2797
                                         $this,
2800 2798
                                         'replaceVarKeyHelper'
2801 2799
                                     ), substr($key, $last, $len)
2802 2800
                                 ), $last, $len
2803 2801
                             );
2804 2802
                             if ($this->debug) {
2805
-                                echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2803
+                                echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2806 2804
                             }
2807 2805
                         }
2808 2806
                         unset($last);
@@ -2828,7 +2826,7 @@  discard block
 block discarded – undo
2828 2826
      */
2829 2827
     protected function replaceVarKeyHelper($match)
2830 2828
     {
2831
-        return '".' . $this->parseVar($match[0], 0, strlen($match[0]), false, 'variable') . '."';
2829
+        return '".'.$this->parseVar($match[0], 0, strlen($match[0]), false, 'variable').'."';
2832 2830
     }
2833 2831
 
2834 2832
     /**
@@ -2848,7 +2846,7 @@  discard block
 block discarded – undo
2848 2846
      */
2849 2847
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2850 2848
     {
2851
-        $substr = substr($in, $from, $to - $from);
2849
+        $substr = substr($in, $from, $to-$from);
2852 2850
 
2853 2851
         $end = strlen($substr);
2854 2852
 
@@ -2922,48 +2920,48 @@  discard block
 block discarded – undo
2922 2920
 
2923 2921
         if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') {
2924 2922
             if ($this->debug) {
2925
-                echo 'BOOLEAN(FALSE) PARSED' . "\n";
2923
+                echo 'BOOLEAN(FALSE) PARSED'."\n";
2926 2924
             }
2927 2925
             $substr = 'false';
2928 2926
             $type   = self::T_BOOL;
2929 2927
         } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') {
2930 2928
             if ($this->debug) {
2931
-                echo 'BOOLEAN(TRUE) PARSED' . "\n";
2929
+                echo 'BOOLEAN(TRUE) PARSED'."\n";
2932 2930
             }
2933 2931
             $substr = 'true';
2934 2932
             $type   = self::T_BOOL;
2935 2933
         } elseif ($substr === 'null' || $substr === 'NULL') {
2936 2934
             if ($this->debug) {
2937
-                echo 'NULL PARSED' . "\n";
2935
+                echo 'NULL PARSED'."\n";
2938 2936
             }
2939 2937
             $substr = 'null';
2940 2938
             $type   = self::T_NULL;
2941 2939
         } elseif (is_numeric($substr)) {
2942
-            $substr = (float)$substr;
2943
-            if ((int)$substr == $substr) {
2944
-                $substr = (int)$substr;
2940
+            $substr = (float) $substr;
2941
+            if ((int) $substr == $substr) {
2942
+                $substr = (int) $substr;
2945 2943
             }
2946 2944
             $type = self::T_NUMERIC;
2947 2945
             if ($this->debug) {
2948
-                echo 'NUMBER (' . $substr . ') PARSED' . "\n";
2946
+                echo 'NUMBER ('.$substr.') PARSED'."\n";
2949 2947
             }
2950 2948
         } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) {
2951 2949
             if ($this->debug) {
2952 2950
                 echo 'SIMPLE MATH PARSED . "\n"';
2953 2951
             }
2954 2952
             $type   = self::T_MATH;
2955
-            $substr = '(' . $substr . ')';
2953
+            $substr = '('.$substr.')';
2956 2954
         } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) {
2957 2955
             if ($this->debug) {
2958
-                echo 'BREAKCHAR (' . $substr . ') PARSED' . "\n";
2956
+                echo 'BREAKCHAR ('.$substr.') PARSED'."\n";
2959 2957
             }
2960 2958
             $type = self::T_BREAKCHAR;
2961 2959
             //$substr = '"'.$substr.'"';
2962 2960
         } else {
2963
-            $substr = $this->replaceStringVars('\'' . str_replace('\'', '\\\'', $substr) . '\'', '\'', $curBlock);
2961
+            $substr = $this->replaceStringVars('\''.str_replace('\'', '\\\'', $substr).'\'', '\'', $curBlock);
2964 2962
             $type   = self::T_UNQUOTED_STRING;
2965 2963
             if ($this->debug) {
2966
-                echo 'BLABBER (' . $substr . ') CASTED AS STRING' . "\n";
2964
+                echo 'BLABBER ('.$substr.') CASTED AS STRING'."\n";
2967 2965
             }
2968 2966
         }
2969 2967
 
@@ -2993,28 +2991,28 @@  discard block
 block discarded – undo
2993 2991
     {
2994 2992
         $pos = 0;
2995 2993
         if ($this->debug) {
2996
-            echo 'STRING VAR REPLACEMENT : ' . $string . "\n";
2994
+            echo 'STRING VAR REPLACEMENT : '.$string."\n";
2997 2995
         }
2998 2996
         // replace vars
2999 2997
         while (($pos = strpos($string, '$', $pos)) !== false) {
3000
-            $prev = substr($string, $pos - 1, 1);
2998
+            $prev = substr($string, $pos-1, 1);
3001 2999
             if ($prev === '\\') {
3002
-                ++ $pos;
3000
+                ++$pos;
3003 3001
                 continue;
3004 3002
             }
3005 3003
 
3006 3004
             $var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3007 3005
             $len = $var[0];
3008
-            $var = $this->parse(str_replace('\\' . $first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3006
+            $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3009 3007
 
3010
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
3011
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos - 1, $len + 2);
3008
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
3009
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
3012 3010
             } else {
3013
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos, $len);
3011
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
3014 3012
             }
3015
-            $pos += strlen($var[1]) + 2;
3013
+            $pos += strlen($var[1])+2;
3016 3014
             if ($this->debug) {
3017
-                echo 'STRING VAR REPLACEMENT DONE : ' . $string . "\n";
3015
+                echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
3018 3016
             }
3019 3017
         }
3020 3018
 
@@ -3050,7 +3048,7 @@  discard block
 block discarded – undo
3050 3048
     protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null)
3051 3049
     {
3052 3050
         if ($this->debug) {
3053
-            echo 'PARSING MODIFIERS : ' . $m[3] . "\n";
3051
+            echo 'PARSING MODIFIERS : '.$m[3]."\n";
3054 3052
         }
3055 3053
 
3056 3054
         if ($pointer !== null) {
@@ -3074,7 +3072,7 @@  discard block
 block discarded – undo
3074 3072
             }
3075 3073
             if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) {
3076 3074
                 if ($this->debug) {
3077
-                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND' . "\n";
3075
+                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND'."\n";
3078 3076
                 }
3079 3077
                 $continue = false;
3080 3078
                 if ($pointer !== null) {
@@ -3085,7 +3083,7 @@  discard block
 block discarded – undo
3085 3083
             $cmdstr   = $cmdstrsrc;
3086 3084
             $paramsep = ':';
3087 3085
             if (!preg_match('/^(@{0,2}[a-z_][a-z0-9_]*)(:)?/i', $cmdstr, $match)) {
3088
-                throw new CompilationException($this, 'Invalid modifier name, started with : ' . substr($cmdstr, 0, 10));
3086
+                throw new CompilationException($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
3089 3087
             }
3090 3088
             $paramspos = !empty($match[2]) ? strlen($match[1]) : false;
3091 3089
             $func      = $match[1];
@@ -3095,10 +3093,10 @@  discard block
 block discarded – undo
3095 3093
                 $cmdstrsrc = substr($cmdstrsrc, strlen($func));
3096 3094
                 $params    = array();
3097 3095
                 if ($this->debug) {
3098
-                    echo 'MODIFIER (' . $func . ') CALLED WITH NO PARAMS' . "\n";
3096
+                    echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
3099 3097
                 }
3100 3098
             } else {
3101
-                $paramstr = substr($cmdstr, $paramspos + 1);
3099
+                $paramstr = substr($cmdstr, $paramspos+1);
3102 3100
                 if (substr($paramstr, - 1, 1) === $paramsep) {
3103 3101
                     $paramstr = substr($paramstr, 0, - 1);
3104 3102
                 }
@@ -3107,41 +3105,41 @@  discard block
 block discarded – undo
3107 3105
                 $params = array();
3108 3106
                 while ($ptr < strlen($paramstr)) {
3109 3107
                     if ($this->debug) {
3110
-                        echo 'MODIFIER (' . $func . ') START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
3108
+                        echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr."\n";
3111 3109
                     }
3112 3110
                     if ($this->debug) {
3113
-                        echo $paramstr . '--' . $ptr . '--' . strlen($paramstr) . '--modifier' . "\n";
3111
+                        echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier'."\n";
3114 3112
                     }
3115 3113
                     $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr);
3116 3114
                     if ($this->debug) {
3117
-                        echo 'PARAM PARSED, POINTER AT ' . $ptr . "\n";
3115
+                        echo 'PARAM PARSED, POINTER AT '.$ptr."\n";
3118 3116
                     }
3119 3117
 
3120 3118
                     if ($ptr >= strlen($paramstr)) {
3121 3119
                         if ($this->debug) {
3122
-                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED' . "\n";
3120
+                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED'."\n";
3123 3121
                         }
3124 3122
                         break;
3125 3123
                     }
3126 3124
 
3127 3125
                     if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
3128 3126
                         if ($this->debug) {
3129
-                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT ' . $ptr . "\n";
3127
+                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr."\n";
3130 3128
                         }
3131 3129
                         if ($paramstr[$ptr] !== '|') {
3132 3130
                             $continue = false;
3133 3131
                             if ($pointer !== null) {
3134
-                                $pointer -= strlen($paramstr) - $ptr;
3132
+                                $pointer -= strlen($paramstr)-$ptr;
3135 3133
                             }
3136 3134
                         }
3137
-                        ++ $ptr;
3135
+                        ++$ptr;
3138 3136
                         break;
3139 3137
                     }
3140 3138
                     if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') {
3141
-                        ++ $ptr;
3139
+                        ++$ptr;
3142 3140
                     }
3143 3141
                 }
3144
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
3142
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
3145 3143
                 foreach ($params as $k => $p) {
3146 3144
                     if (is_array($p) && is_array($p[1])) {
3147 3145
                         $state |= 2;
@@ -3181,9 +3179,9 @@  discard block
 block discarded – undo
3181 3179
                 $params = self::implode_r($params);
3182 3180
 
3183 3181
                 if ($mapped) {
3184
-                    $output = '$this->arrayMap(\'' . $func . '\', array(' . $params . '))';
3182
+                    $output = '$this->arrayMap(\''.$func.'\', array('.$params.'))';
3185 3183
                 } else {
3186
-                    $output = $func . '(' . $params . ')';
3184
+                    $output = $func.'('.$params.')';
3187 3185
                 }
3188 3186
             } elseif ($pluginType & Core::PROXY_PLUGIN) {
3189 3187
                 $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -3201,36 +3199,36 @@  discard block
 block discarded – undo
3201 3199
                     $callback = $this->customPlugins[$func]['callback'];
3202 3200
                     if (is_array($callback)) {
3203 3201
                         if (is_object($callback[0])) {
3204
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3202
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3205 3203
                         } else {
3206
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3204
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3207 3205
                         }
3208 3206
                     } elseif ($mapped) {
3209
-                        $output = '$this->arrayMap(\'' . $callback . '\', array(' . $params . '))';
3207
+                        $output = '$this->arrayMap(\''.$callback.'\', array('.$params.'))';
3210 3208
                     } else {
3211
-                        $output = $callback . '(' . $params . ')';
3209
+                        $output = $callback.'('.$params.')';
3212 3210
                     }
3213 3211
                 } elseif ($mapped) {
3214
-                    $output = '$this->arrayMap(\'smarty_modifier_' . $func . '\', array(' . $params . '))';
3212
+                    $output = '$this->arrayMap(\'smarty_modifier_'.$func.'\', array('.$params.'))';
3215 3213
                 } else {
3216
-                    $output = 'smarty_modifier_' . $func . '(' . $params . ')';
3214
+                    $output = 'smarty_modifier_'.$func.'('.$params.')';
3217 3215
                 }
3218 3216
             } else {
3219 3217
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
3220 3218
                     $callback   = $this->customPlugins[$func]['callback'];
3221 3219
                     $pluginName = $callback;
3222 3220
                 } else {
3223
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' .
3224
-                            Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3221
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false || function_exists('Plugin'.
3222
+                            Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3225 3223
                         !== false) {
3226
-                        $pluginName = 'Plugin' . Core::toCamelCase($func);
3224
+                        $pluginName = 'Plugin'.Core::toCamelCase($func);
3227 3225
                     } else {
3228
-                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func);
3226
+                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func);
3229 3227
                     }
3230 3228
                     if ($pluginType & Core::CLASS_PLUGIN) {
3231 3229
                         $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process');
3232 3230
                     } else {
3233
-                        $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3231
+                        $callback = $pluginName.(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3234 3232
                     }
3235 3233
                 }
3236 3234
                 $params = $this->mapParams($params, $callback, $state);
@@ -3248,10 +3246,10 @@  discard block
 block discarded – undo
3248 3246
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3249 3247
                             $funcCompiler = $this->customPlugins[$func]['callback'];
3250 3248
                         } else {
3251
-                            if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
3252
-                                $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
3249
+                            if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
3250
+                                $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
3253 3251
                             } else {
3254
-                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
3252
+                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
3255 3253
                                     'Compile';
3256 3254
                             }
3257 3255
                         }
@@ -3262,9 +3260,9 @@  discard block
 block discarded – undo
3262 3260
 
3263 3261
                         $params = self::implode_r($params);
3264 3262
                         if ($mapped) {
3265
-                            $output = '$this->arrayMap(\'' . $pluginName . '\', array(' . $params . '))';
3263
+                            $output = '$this->arrayMap(\''.$pluginName.'\', array('.$params.'))';
3266 3264
                         } else {
3267
-                            $output = $pluginName . '(' . $params . ')';
3265
+                            $output = $pluginName.'('.$params.')';
3268 3266
                         }
3269 3267
                     }
3270 3268
                 } else {
@@ -3276,7 +3274,7 @@  discard block
 block discarded – undo
3276 3274
                             $callback = $this->customPlugins[$func]['callback'];
3277 3275
                             if (!is_array($callback)) {
3278 3276
                                 if (!method_exists($callback, 'compile')) {
3279
-                                    throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
3277
+                                    throw new Exception('Custom plugin '.$func.' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
3280 3278
                                 }
3281 3279
                                 if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
3282 3280
                                     $funcCompiler = array($callback, 'compile');
@@ -3287,11 +3285,11 @@  discard block
 block discarded – undo
3287 3285
                                 $funcCompiler = $callback;
3288 3286
                             }
3289 3287
                         } else {
3290
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3291
-                                $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
3288
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3289
+                                $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
3292 3290
                             } else {
3293 3291
                                 $funcCompiler = array(
3294
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
3292
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
3295 3293
                                     'compile'
3296 3294
                                 );
3297 3295
                             }
@@ -3303,23 +3301,23 @@  discard block
 block discarded – undo
3303 3301
 
3304 3302
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3305 3303
                             if (is_object($callback[0])) {
3306
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3304
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3307 3305
                             } else {
3308
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3306
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3309 3307
                             }
3310 3308
                         } elseif ($mapped) {
3311 3309
                             $output = '$this->arrayMap(array($this->getObjectPlugin(\''.
3312
-                                Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), 
3313
-                            \'process\'), array(' . $params . '))';
3310
+                                Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'\'), 
3311
+                            \'process\'), array(' . $params.'))';
3314 3312
                         } else {
3315
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3316
-                                $output = '$this->classCall(\'Plugin' . Core::toCamelCase($func) . '\', array(' . $params . '))';
3317
-                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($func)) !== false) {
3318
-                                $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . $func . '\', array(' . $params . '))';
3319
-                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) {
3320
-                                $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', array(' . $params . '))';
3313
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3314
+                                $output = '$this->classCall(\'Plugin'.Core::toCamelCase($func).'\', array('.$params.'))';
3315
+                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($func)) !== false) {
3316
+                                $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.$func.'\', array('.$params.'))';
3317
+                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !== false) {
3318
+                                $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', array('.$params.'))';
3321 3319
                             } else {
3322
-                                $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
3320
+                                $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
3323 3321
                             }
3324 3322
                         }
3325 3323
                     }
@@ -3332,7 +3330,7 @@  discard block
 block discarded – undo
3332 3330
         } elseif ($curBlock === 'var' || $m[1] === null) {
3333 3331
             return $output;
3334 3332
         } elseif ($curBlock === 'string' || $curBlock === 'root') {
3335
-            return $m[1] . '.' . $output . '.' . $m[1] . (isset($add) ? $add : null);
3333
+            return $m[1].'.'.$output.'.'.$m[1].(isset($add) ? $add : null);
3336 3334
         }
3337 3335
 
3338 3336
         return '';
@@ -3355,14 +3353,14 @@  discard block
 block discarded – undo
3355 3353
             if (is_array($p)) {
3356 3354
                 $out2 = 'array(';
3357 3355
                 foreach ($p as $k2 => $v) {
3358
-                    $out2 .= var_export($k2, true) . ' => ' . (is_array($v) ? 'array(' . self::implode_r($v, true) . ')' : $v) . ', ';
3356
+                    $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', ';
3359 3357
                 }
3360
-                $p = rtrim($out2, ', ') . ')';
3358
+                $p = rtrim($out2, ', ').')';
3361 3359
             }
3362 3360
             if ($recursiveCall) {
3363
-                $out .= var_export($k, true) . ' => ' . $p . ', ';
3361
+                $out .= var_export($k, true).' => '.$p.', ';
3364 3362
             } else {
3365
-                $out .= $p . ', ';
3363
+                $out .= $p.', ';
3366 3364
             }
3367 3365
         }
3368 3366
 
@@ -3386,7 +3384,7 @@  discard block
 block discarded – undo
3386 3384
         if (($this->securityPolicy === null && (function_exists($name) || strtolower($name) === 'isset' || strtolower($name) === 'empty')) || ($this->securityPolicy !== null && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) !== false)) {
3387 3385
             $phpFunc = true;
3388 3386
         } elseif ($this->securityPolicy !== null && function_exists($name) && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) === false) {
3389
-            throw new SecurityException('Call to a disallowed php function : ' . $name);
3387
+            throw new SecurityException('Call to a disallowed php function : '.$name);
3390 3388
         }
3391 3389
 
3392 3390
         while ($pluginType <= 0) {
@@ -3397,58 +3395,58 @@  discard block
 block discarded – undo
3397 3395
             elseif (isset($this->customPlugins[$name])) {
3398 3396
                 $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN;
3399 3397
             } // Class blocks plugin
3400
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3398
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name)) !== false) {
3401 3399
                 $pluginType = Core::CLASS_PLUGIN;
3402
-                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3400
+                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3403 3401
                     $pluginType += Core::BLOCK_PLUGIN;
3404 3402
                 }
3405
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name));
3403
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name));
3406 3404
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3407 3405
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3408 3406
                 }
3409 3407
             } // Class functions plugin
3410
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3411
-                $pluginType = Core::FUNC_PLUGIN + Core::CLASS_PLUGIN;
3412
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name));
3408
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !== false) {
3409
+                $pluginType = Core::FUNC_PLUGIN+Core::CLASS_PLUGIN;
3410
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name));
3413 3411
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3414 3412
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3415 3413
                 }
3416 3414
             } // Class without namespace
3417
-            elseif (class_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3415
+            elseif (class_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3418 3416
                 $pluginType = Core::CLASS_PLUGIN;
3419
-                $interfaces = class_implements('Plugin' . Core::toCamelCase($name));
3417
+                $interfaces = class_implements('Plugin'.Core::toCamelCase($name));
3420 3418
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3421 3419
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3422 3420
                 }
3423 3421
             } // Function plugin (with/without namespaces)
3424
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase ($name)) !==
3425
-                false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3422
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !==
3423
+                false || function_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3426 3424
                 $pluginType = Core::FUNC_PLUGIN;
3427 3425
             } // Function plugin compile (with/without namespaces)
3428
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) .
3429
-                    'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !==
3426
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name).
3427
+                    'Compile') !== false || function_exists('Plugin'.Core::toCamelCase($name).'Compile') !==
3430 3428
                 false) {
3431 3429
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3432 3430
             } // Helper plugin class compile
3433
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3431
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name)) !== false) {
3434 3432
                 $pluginType = Core::CLASS_PLUGIN | Core::COMPILABLE_PLUGIN;
3435 3433
             } // Helper plugin function compile
3436
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile') !== false) {
3434
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name).'Compile') !== false) {
3437 3435
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3438 3436
             } // Smarty modifier
3439
-            elseif (function_exists('smarty_modifier_' . $name) !== false) {
3437
+            elseif (function_exists('smarty_modifier_'.$name) !== false) {
3440 3438
                 $pluginType = Core::SMARTY_MODIFIER;
3441 3439
             } // Smarty function
3442
-            elseif (function_exists('smarty_function_' . $name) !== false) {
3440
+            elseif (function_exists('smarty_function_'.$name) !== false) {
3443 3441
                 $pluginType = Core::SMARTY_FUNCTION;
3444 3442
             } // Smarty block
3445
-            elseif (function_exists('smarty_block_' . $name) !== false) {
3443
+            elseif (function_exists('smarty_block_'.$name) !== false) {
3446 3444
                 $pluginType = Core::SMARTY_BLOCK;
3447 3445
             } // Everything else
3448 3446
             else {
3449 3447
                 if ($pluginType === - 1) {
3450 3448
                     try {
3451
-                        $this->getDwoo()->getLoader()->loadPlugin('Plugin' . Core::toCamelCase($name));
3449
+                        $this->getDwoo()->getLoader()->loadPlugin('Plugin'.Core::toCamelCase($name));
3452 3450
                     }
3453 3451
                     catch (Exception $e) {
3454 3452
                         if (isset($phpFunc)) {
@@ -3461,9 +3459,9 @@  discard block
 block discarded – undo
3461 3459
                         }
3462 3460
                     }
3463 3461
                 } else {
3464
-                    throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType);
3462
+                    throw new Exception('Plugin "'.$name.'" could not be found, type:'.$pluginType);
3465 3463
                 }
3466
-                ++ $pluginType;
3464
+                ++$pluginType;
3467 3465
             }
3468 3466
         }
3469 3467
 
@@ -3532,15 +3530,15 @@  discard block
 block discarded – undo
3532 3530
         }
3533 3531
 
3534 3532
         // loops over the param map and assigns values from the template or default value for unset optional params
3535
-        foreach ($map as $k => $v){
3533
+        foreach ($map as $k => $v) {
3536 3534
             if ($v[0] === '*') {
3537 3535
                 // "rest" array parameter, fill every remaining params in it and then break
3538 3536
                 if (count($ps) === 0) {
3539 3537
                     if ($v[1] === false) {
3540 3538
                         throw new CompilationException(
3541
-                            $this, 'Rest argument missing for ' . str_replace(
3539
+                            $this, 'Rest argument missing for '.str_replace(
3542 3540
                                 array(
3543
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3541
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3544 3542
                                 'Compile'
3545 3543
                                 ), '', (is_array($callback) ? $callback[0] : $callback)
3546 3544
                             )
@@ -3573,7 +3571,7 @@  discard block
 block discarded – undo
3573 3571
                 // parameter is not defined and not optional, throw error
3574 3572
                 if (is_array($callback)) {
3575 3573
                     if (is_object($callback[0])) {
3576
-                        $name = get_class($callback[0]) . '::' . $callback[1];
3574
+                        $name = get_class($callback[0]).'::'.$callback[1];
3577 3575
                     } else {
3578 3576
                         $name = $callback[0];
3579 3577
                     }
@@ -3582,9 +3580,9 @@  discard block
 block discarded – undo
3582 3580
                 }
3583 3581
 
3584 3582
                 throw new CompilationException(
3585
-                    $this, 'Argument ' . $k . '/' . $v[0] . ' missing for ' . str_replace(
3583
+                    $this, 'Argument '.$k.'/'.$v[0].' missing for '.str_replace(
3586 3584
                         array(
3587
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3585
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3588 3586
                         'Compile'
3589 3587
                         ), '', $name
3590 3588
                     )
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCapitalize.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
     public function process($value, $numwords = false)
39 39
     {
40 40
         if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
-            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
41
+            return mb_convert_case((string) $value, MB_CASE_TITLE, $this->core->getCharset());
42 42
         } else {
43
-            $bits = explode(' ', (string)$value);
43
+            $bits = explode(' ', (string) $value);
44 44
             $out  = '';
45
-            foreach ($bits as $k => $v){
45
+            foreach ($bits as $k => $v) {
46 46
                 if (preg_match('#^[^0-9]+$#', $v)) {
47
-                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
47
+                    $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48 48
                 } else {
49
-                    $out .= ' ' . $v;
49
+                    $out .= ' '.$v;
50 50
                 }
51 51
             }
52 52
 
Please login to merge, or discard this patch.