Completed
Pull Request — master (#49)
by
unknown
03:31
created
lib/Dwoo/Adapters/ZendFramework/PluginProxy.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
     /**
47 47
      * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
48 48
      *
49
-     * @param Zend_View_Interface $view
49
+     * @param Dwoo_Adapters_ZendFramework_View $view
50 50
      */
51 51
     public function __construct(Zend_View_Interface $view)
52 52
     {
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/View.php 1 patch
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,6 @@  discard block
 block discarded – undo
83 83
      *  - type class name or object for engine, dataProvider or compiler
84 84
      *  - any set* method (compileDir for setCompileDir ...)
85 85
      *
86
-     * @param array $options
87 86
      *
88 87
      * @return Dwoo_Adapters_ZendFramework_View
89 88
      */
@@ -437,7 +436,6 @@  discard block
 block discarded – undo
437 436
      * Processes a view script and outputs it. Output is then
438 437
      * passed through filters.
439 438
      *
440
-     * @param string $name The script script name to process
441 439
      *
442 440
      * @return string The script output
443 441
      */
Please login to merge, or discard this patch.
lib/Dwoo/Compiler.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      * Returns the left and right template delimiters.
279 279
      *
280
-     * @return array containing the left and the right delimiters
280
+     * @return string[] containing the left and the right delimiters
281 281
      */
282 282
     public function getDelimiters()
283 283
     {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      * Adds a preprocessor to the compiler, it will be called
363 363
      * before the template is compiled.
364 364
      *
365
-     * @param mixed $callback either a valid callback to the preprocessor or a simple name if the autoload is set to
365
+     * @param string $callback either a valid callback to the preprocessor or a simple name if the autoload is set to
366 366
      *                        true
367 367
      * @param bool  $autoload if set to true, the preprocessor is auto-loaded from one of the plugin directories, else
368 368
      *                        you must provide a valid callback
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
      *
1322 1322
      * @param array $params parameter array
1323 1323
      *
1324
-     * @return array tokens
1324
+     * @return Compiler tokens
1325 1325
      */
1326 1326
     public function getParamTokens(array $params)
1327 1327
     {
Please login to merge, or discard this patch.
Spacing   +369 added lines, -372 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";
@@ -877,20 +877,20 @@  discard block
 block discarded – undo
877 877
             switch ($type) {
878 878
                 case Core::BLOCK_PLUGIN:
879 879
                 case Core::CLASS_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
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 888
                 case Core::FUNC_PLUGIN:
889
-                    if (function_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
889
+                    if (function_exists('Plugin'.$plugin) !== false) {
890
+                        $output .= "if (function_exists('"."Plugin".$plugin."')===false)".
891 891
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892 892
                     } else {
893
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
893
+                        $output .= "if (function_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
894 894
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895 895
                     }
896 896
                     break;
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
                     $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
911 911
                     break;
912 912
                 default:
913
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
913
+                    throw new CompilationException($this, 'Type error for '.$plugin.' with type'.$type);
914 914
             }
915 915
         }
916 916
 
@@ -921,30 +921,30 @@  discard block
 block discarded – undo
921 921
         }
922 922
         foreach ($this->templatePlugins as $function) {
923 923
             if (isset($function['called']) && $function['called'] === true) {
924
-                $output .= $function['body'] . PHP_EOL;
924
+                $output .= $function['body'].PHP_EOL;
925 925
             }
926 926
         }
927 927
 
928
-        $output .= $compiled . "\n?>";
928
+        $output .= $compiled."\n?>";
929 929
 
930
-        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*' . preg_quote(self::PHP_CLOSE, '/') . preg_quote(self::PHP_OPEN, '/') . ')/', ";\n", $output);
931
-        $output = str_replace(self::PHP_CLOSE . self::PHP_OPEN, "\n", $output);
930
+        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*'.preg_quote(self::PHP_CLOSE, '/').preg_quote(self::PHP_OPEN, '/').')/', ";\n", $output);
931
+        $output = str_replace(self::PHP_CLOSE.self::PHP_OPEN, "\n", $output);
932 932
 
933 933
         // handle <?xml tag at the beginning
934 934
         $output = preg_replace('#(/\* template body \*/ \?>\s*)<\?xml#is', '$1<?php echo \'<?xml\'; ?>', $output);
935 935
 
936 936
         // add another line break after PHP closing tags that have a line break following,
937 937
         // as we do not know whether it's intended, and PHP will strip it otherwise
938
-        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0' . "\n", $output);
938
+        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0'."\n", $output);
939 939
 
940 940
         if ($this->debug) {
941
-            echo '=============================================================================================' . "\n";
941
+            echo '============================================================================================='."\n";
942 942
             $lines = preg_split('{\r\n|\n|<br />}', $output);
943 943
             array_shift($lines);
944 944
             foreach ($lines as $i => $line) {
945
-                echo ($i + 1) . '. ' . $line . "\r\n";
945
+                echo ($i+1).'. '.$line."\r\n";
946 946
             }
947
-            echo '=============================================================================================' . "\n";
947
+            echo '============================================================================================='."\n";
948 948
         }
949 949
 
950 950
         $this->template = $this->dwoo = null;
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
     protected function resolveSubTemplateDependencies($function)
962 962
     {
963 963
         if ($this->debug) {
964
-            echo 'Compiler::' . __FUNCTION__ . "\n";
964
+            echo 'Compiler::'.__FUNCTION__."\n";
965 965
         }
966 966
 
967 967
         $body = $this->templatePlugins[$function]['body'];
968 968
         foreach ($this->templatePlugins as $func => $attr) {
969
-            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
970
-            'Plugin' . Core::toCamelCase($func)) !== false) {
969
+            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS.
970
+            'Plugin'.Core::toCamelCase($func)) !== false) {
971 971
                 $this->templatePlugins[$func]['called'] = true;
972 972
                 $this->resolveSubTemplateDependencies($func);
973 973
             }
@@ -991,14 +991,14 @@  discard block
 block discarded – undo
991 991
 
992 992
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
993 993
             // buffer is not initialized yet (the block has just been created)
994
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content;
994
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
995 995
             $this->curBlock['buffer'] = '';
996 996
         } else {
997 997
             if (!isset($this->curBlock['buffer'])) {
998 998
                 throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere');
999 999
             }
1000 1000
             // append current content to current block's buffer
1001
-            $this->curBlock['buffer'] .= (string)$content;
1001
+            $this->curBlock['buffer'] .= (string) $content;
1002 1002
         }
1003 1003
         $this->line += $lineCount;
1004 1004
     }
@@ -1068,23 +1068,23 @@  discard block
 block discarded – undo
1068 1068
     public function addBlock($type, array $params, $paramtype)
1069 1069
     {
1070 1070
         if ($this->debug) {
1071
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1071
+            echo 'Compiler::'.__FUNCTION__."\n";
1072 1072
         }
1073 1073
 
1074
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1074
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1075 1075
         if (class_exists($class) === false) {
1076 1076
             $this->getDwoo()->getLoader()->loadPlugin($type);
1077 1077
         }
1078 1078
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1079 1079
 
1080
-        $this->stack[]  = array(
1080
+        $this->stack[] = array(
1081 1081
             'type'   => $type,
1082 1082
             'params' => $params,
1083 1083
             'custom' => false,
1084 1084
             'class'  => $class,
1085 1085
             'buffer' => null
1086 1086
         );
1087
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1087
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1088 1088
 
1089 1089
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1090 1090
     }
@@ -1109,14 +1109,14 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1111 1111
 
1112
-        $this->stack[]  = array(
1112
+        $this->stack[] = array(
1113 1113
             'type'   => $type,
1114 1114
             'params' => $params,
1115 1115
             'custom' => true,
1116 1116
             'class'  => $class,
1117 1117
             'buffer' => null
1118 1118
         );
1119
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1119
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1120 1120
 
1121 1121
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1122 1122
     }
@@ -1131,21 +1131,21 @@  discard block
 block discarded – undo
1131 1131
     public function injectBlock($type, array $params)
1132 1132
     {
1133 1133
         if ($this->debug) {
1134
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1134
+            echo 'Compiler::'.__FUNCTION__."\n";
1135 1135
         }
1136 1136
 
1137
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1137
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1138 1138
         if (class_exists($class) === false) {
1139 1139
             $this->getDwoo()->getLoader()->loadPlugin($type);
1140 1140
         }
1141
-        $this->stack[]  = array(
1141
+        $this->stack[] = array(
1142 1142
             'type'   => $type,
1143 1143
             'params' => $params,
1144 1144
             'custom' => false,
1145 1145
             'class'  => $class,
1146 1146
             'buffer' => null
1147 1147
         );
1148
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1148
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1149 1149
     }
1150 1150
 
1151 1151
     /**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
     public function removeBlock($type)
1161 1161
     {
1162 1162
         if ($this->debug) {
1163
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1163
+            echo 'Compiler::'.__FUNCTION__."\n";
1164 1164
         }
1165 1165
 
1166 1166
         $output = '';
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
                 if ($top['custom']) {
1175 1175
                     $class = $top['class'];
1176 1176
                 } else {
1177
-                    $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type']);
1177
+                    $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($top['type']);
1178 1178
                 }
1179 1179
                 if (count($this->stack)) {
1180
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1180
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1181 1181
                     $this->push(call_user_func(array(
1182 1182
                         $class,
1183 1183
                         'postProcessing'
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
                 }
1199 1199
             }
1200 1200
 
1201
-            throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened');
1201
+            throw new CompilationException($this, 'Syntax malformation, a block of type "'.$type.'" was closed but was not opened');
1202 1202
             break;
1203 1203
         }
1204 1204
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
             }
1238 1238
         }
1239 1239
 
1240
-        throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found');
1240
+        throw new CompilationException($this, 'A parent block of type "'.$type.'" is required and can not be found');
1241 1241
     }
1242 1242
 
1243 1243
     /**
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
     public function removeTopBlock()
1261 1261
     {
1262 1262
         if ($this->debug) {
1263
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1263
+            echo 'Compiler::'.__FUNCTION__."\n";
1264 1264
         }
1265 1265
 
1266 1266
         $o = array_pop($this->stack);
@@ -1270,10 +1270,10 @@  discard block
 block discarded – undo
1270 1270
         if ($o['custom']) {
1271 1271
             $class = $o['class'];
1272 1272
         } else {
1273
-            $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']);
1273
+            $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($o['type']);
1274 1274
         }
1275 1275
 
1276
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1276
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1277 1277
 
1278 1278
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1279 1279
     }
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
     protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1353 1353
     {
1354 1354
         if ($this->debug) {
1355
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1355
+            echo 'Compiler::'.__FUNCTION__."\n";
1356 1356
         }
1357 1357
 
1358 1358
         if ($to === null) {
@@ -1369,14 +1369,14 @@  discard block
 block discarded – undo
1369 1369
                 // end template tag
1370 1370
                 $pointer += strlen($this->rd);
1371 1371
                 if ($this->debug) {
1372
-                    echo 'TEMPLATE PARSING ENDED' . "\n";
1372
+                    echo 'TEMPLATE PARSING ENDED'."\n";
1373 1373
                 }
1374 1374
 
1375 1375
                 return false;
1376 1376
             }
1377
-            ++ $from;
1377
+            ++$from;
1378 1378
             if ($pointer !== null) {
1379
-                ++ $pointer;
1379
+                ++$pointer;
1380 1380
             }
1381 1381
             if ($from >= $to) {
1382 1382
                 if (is_array($parsingParams)) {
@@ -1388,22 +1388,22 @@  discard block
 block discarded – undo
1388 1388
             $first = $in[$from];
1389 1389
         }
1390 1390
 
1391
-        $substr = substr($in, $from, $to - $from);
1391
+        $substr = substr($in, $from, $to-$from);
1392 1392
 
1393 1393
         if ($this->debug) {
1394
-            echo 'PARSE CALL : PARSING "<b>' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '</b>" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n";
1394
+            echo 'PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1395 1395
         }
1396 1396
         $parsed = '';
1397 1397
 
1398 1398
         if ($curBlock === 'root' && $first === '*') {
1399 1399
             $src      = $this->getTemplateSource();
1400
-            $startpos = $this->getPointer() - strlen($this->ld);
1400
+            $startpos = $this->getPointer()-strlen($this->ld);
1401 1401
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1402 1402
                 if ($startpos > 0) {
1403 1403
                     do {
1404 1404
                         $char = substr($src, -- $startpos, 1);
1405 1405
                         if ($char == "\n") {
1406
-                            ++ $startpos;
1406
+                            ++$startpos;
1407 1407
                             $whitespaceStart = true;
1408 1408
                             break;
1409 1409
                         }
@@ -1414,12 +1414,12 @@  discard block
 block discarded – undo
1414 1414
                 if (!isset($whitespaceStart)) {
1415 1415
                     $startpos = $this->getPointer();
1416 1416
                 } else {
1417
-                    $pointer -= $this->getPointer() - $startpos;
1417
+                    $pointer -= $this->getPointer()-$startpos;
1418 1418
                 }
1419 1419
 
1420
-                if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) {
1421
-                    $comOpen  = $this->ld . '*';
1422
-                    $comClose = '*' . $this->rd;
1420
+                if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
1421
+                    $comOpen  = $this->ld.'*';
1422
+                    $comClose = '*'.$this->rd;
1423 1423
                     $level    = 1;
1424 1424
                     $ptr      = $this->getPointer();
1425 1425
 
@@ -1429,33 +1429,33 @@  discard block
 block discarded – undo
1429 1429
 
1430 1430
                         if ($open !== false && $close !== false) {
1431 1431
                             if ($open < $close) {
1432
-                                $ptr = $open + strlen($comOpen);
1433
-                                ++ $level;
1432
+                                $ptr = $open+strlen($comOpen);
1433
+                                ++$level;
1434 1434
                             } else {
1435
-                                $ptr = $close + strlen($comClose);
1436
-                                -- $level;
1435
+                                $ptr = $close+strlen($comClose);
1436
+                                --$level;
1437 1437
                             }
1438 1438
                         } elseif ($open !== false) {
1439
-                            $ptr = $open + strlen($comOpen);
1440
-                            ++ $level;
1439
+                            $ptr = $open+strlen($comOpen);
1440
+                            ++$level;
1441 1441
                         } elseif ($close !== false) {
1442
-                            $ptr = $close + strlen($comClose);
1443
-                            -- $level;
1442
+                            $ptr = $close+strlen($comClose);
1443
+                            --$level;
1444 1444
                         } else {
1445 1445
                             $ptr = strlen($src);
1446 1446
                         }
1447 1447
                     }
1448
-                    $endpos = $ptr - strlen('*' . $this->rd);
1448
+                    $endpos = $ptr-strlen('*'.$this->rd);
1449 1449
                 } else {
1450
-                    $endpos = strpos($src, '*' . $this->rd, $startpos);
1450
+                    $endpos = strpos($src, '*'.$this->rd, $startpos);
1451 1451
                     if ($endpos == false) {
1452 1452
                         throw new CompilationException($this, 'Un-ended comment');
1453 1453
                     }
1454 1454
                 }
1455
-                $pointer += $endpos - $startpos + strlen('*' . $this->rd);
1456
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) {
1455
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1456
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1457 1457
                     $pointer += strlen($m[0]);
1458
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1458
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1459 1459
                 }
1460 1460
 
1461 1461
                 return false;
@@ -1472,20 +1472,20 @@  discard block
 block discarded – undo
1472 1472
         } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) {
1473 1473
             // string
1474 1474
             $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer);
1475
-        } 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)) {
1475
+        } 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)) {
1476 1476
             // func
1477 1477
             $out    = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer);
1478 1478
             $parsed = 'func';
1479 1479
         } elseif ($first === ';') {
1480 1480
             // instruction end
1481 1481
             if ($this->debug) {
1482
-                echo 'END OF INSTRUCTION' . "\n";
1482
+                echo 'END OF INSTRUCTION'."\n";
1483 1483
             }
1484 1484
             if ($pointer !== null) {
1485
-                ++ $pointer;
1485
+                ++$pointer;
1486 1486
             }
1487 1487
 
1488
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1488
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1489 1489
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1490 1490
             // close block
1491 1491
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1502,13 +1502,13 @@  discard block
 block discarded – undo
1502 1502
                     $pointer -= strlen($match[0]);
1503 1503
                 }
1504 1504
                 if ($this->debug) {
1505
-                    echo 'TOP BLOCK CLOSED' . "\n";
1505
+                    echo 'TOP BLOCK CLOSED'."\n";
1506 1506
                 }
1507 1507
 
1508 1508
                 return $this->removeTopBlock();
1509 1509
             } else {
1510 1510
                 if ($this->debug) {
1511
-                    echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n";
1511
+                    echo 'BLOCK OF TYPE '.$match[1].' CLOSED'."\n";
1512 1512
                 }
1513 1513
 
1514 1514
                 return $this->removeBlock($match[1]);
@@ -1516,19 +1516,19 @@  discard block
 block discarded – undo
1516 1516
         } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) {
1517 1517
             // end template tag
1518 1518
             if ($this->debug) {
1519
-                echo 'TAG PARSING ENDED' . "\n";
1519
+                echo 'TAG PARSING ENDED'."\n";
1520 1520
             }
1521 1521
             $pointer += strlen($this->rd);
1522 1522
 
1523 1523
             return false;
1524
-        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) {
1524
+        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?' : '').')(?:\s+|[^=]).*#i', $substr, $match)) {
1525 1525
             // named parameter
1526 1526
             if ($this->debug) {
1527
-                echo 'NAMED PARAM FOUND' . "\n";
1527
+                echo 'NAMED PARAM FOUND'."\n";
1528 1528
             }
1529 1529
             $len = strlen($match[1]);
1530
-            while (substr($in, $from + $len, 1) === ' ') {
1531
-                ++ $len;
1530
+            while (substr($in, $from+$len, 1) === ' ') {
1531
+                ++$len;
1532 1532
             }
1533 1533
             if ($pointer !== null) {
1534 1534
                 $pointer += $len;
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
             $output = array(
1538 1538
                 trim($match[1], " \t\r\n=>'\""),
1539
-                $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer)
1539
+                $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer)
1540 1540
             );
1541 1541
 
1542 1542
             $parsingParams[] = $output;
@@ -1557,31 +1557,31 @@  discard block
 block discarded – undo
1557 1557
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1558 1558
         } else {
1559 1559
             // parse error
1560
-            throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"');
1560
+            throw new CompilationException($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1561 1561
         }
1562 1562
 
1563 1563
         if (empty($out)) {
1564 1564
             return '';
1565 1565
         }
1566 1566
 
1567
-        $substr = substr($in, $pointer, $to - $pointer);
1567
+        $substr = substr($in, $pointer, $to-$pointer);
1568 1568
 
1569 1569
         // var parsed, check if any var-extension applies
1570 1570
         if ($parsed === 'var') {
1571 1571
             if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) {
1572 1572
                 if ($this->debug) {
1573
-                    echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n";
1573
+                    echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1574 1574
                 }
1575 1575
                 // parse expressions
1576
-                $pointer += strlen($match[0]) - 1;
1576
+                $pointer += strlen($match[0])-1;
1577 1577
                 if (is_array($parsingParams)) {
1578 1578
                     if ($match[2] == '$') {
1579 1579
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1580 1580
                     } else {
1581 1581
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1582 1582
                     }
1583
-                    $out[count($out) - 1][0] .= $match[1] . $expr[0][0];
1584
-                    $out[count($out) - 1][1] .= $match[1] . $expr[0][1];
1583
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1584
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1585 1585
                 } else {
1586 1586
                     if ($match[2] == '$') {
1587 1587
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1589,26 +1589,26 @@  discard block
 block discarded – undo
1589 1589
                         $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer);
1590 1590
                     }
1591 1591
                     if (is_array($out) && is_array($expr)) {
1592
-                        $out[0] .= $match[1] . $expr[0];
1593
-                        $out[1] .= $match[1] . $expr[1];
1592
+                        $out[0] .= $match[1].$expr[0];
1593
+                        $out[1] .= $match[1].$expr[1];
1594 1594
                     } elseif (is_array($out)) {
1595
-                        $out[0] .= $match[1] . $expr;
1596
-                        $out[1] .= $match[1] . $expr;
1595
+                        $out[0] .= $match[1].$expr;
1596
+                        $out[1] .= $match[1].$expr;
1597 1597
                     } elseif (is_array($expr)) {
1598
-                        $out .= $match[1] . $expr[0];
1598
+                        $out .= $match[1].$expr[0];
1599 1599
                     } else {
1600
-                        $out .= $match[1] . $expr;
1600
+                        $out .= $match[1].$expr;
1601 1601
                     }
1602 1602
                 }
1603 1603
             } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) {
1604 1604
                 if ($this->debug) {
1605
-                    echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n";
1605
+                    echo 'PARSING POST-VAR ASSIGNMENT '.$substr."\n";
1606 1606
                 }
1607 1607
                 // parse assignment
1608 1608
                 $value    = $match[2];
1609 1609
                 $operator = trim($match[1]);
1610 1610
                 if (substr($value, 0, 1) == '=') {
1611
-                    throw new CompilationException($this, 'Unexpected "=" in <em>' . $substr . '</em>');
1611
+                    throw new CompilationException($this, 'Unexpected "=" in <em>'.$substr.'</em>');
1612 1612
                 }
1613 1613
 
1614 1614
                 if ($pointer !== null) {
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
                         throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible');
1630 1630
                     }
1631 1631
 
1632
-                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1);
1632
+                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf', 'init'), 1);
1633 1633
                     $tokens = $this->getParamTokens($parts);
1634 1634
                     $parts  = $this->getCompiledParams($parts);
1635 1635
 
@@ -1643,14 +1643,14 @@  discard block
 block discarded – undo
1643 1643
                 if ($this->autoEscape) {
1644 1644
                     $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out);
1645 1645
                 }
1646
-                $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE;
1646
+                $out = self::PHP_OPEN.$echo.$out.$operator.implode(' ', $value).self::PHP_CLOSE;
1647 1647
             } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) {
1648 1648
                 // parse namedparam with var as name (only for array)
1649 1649
                 if ($this->debug) {
1650
-                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n";
1650
+                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1651 1651
                 }
1652 1652
                 $len = strlen($match[1]);
1653
-                $var = $out[count($out) - 1];
1653
+                $var = $out[count($out)-1];
1654 1654
                 $pointer += $len;
1655 1655
 
1656 1656
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1665,16 +1665,16 @@  discard block
 block discarded – undo
1665 1665
             // parse modifier on funcs or vars
1666 1666
             $srcPointer = $pointer;
1667 1667
             if (is_array($parsingParams)) {
1668
-                $tmp                     = $this->replaceModifiers(
1668
+                $tmp = $this->replaceModifiers(
1669 1669
                     array(
1670 1670
                     null,
1671 1671
                     null,
1672
-                    $out[count($out) - 1][0],
1672
+                    $out[count($out)-1][0],
1673 1673
                     $match[0]
1674 1674
                     ), $curBlock, $pointer
1675 1675
                 );
1676
-                $out[count($out) - 1][0] = $tmp;
1677
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1676
+                $out[count($out)-1][0] = $tmp;
1677
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1678 1678
             } else {
1679 1679
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1680 1680
             }
@@ -1686,10 +1686,10 @@  discard block
 block discarded – undo
1686 1686
             $ptr = 0;
1687 1687
 
1688 1688
             if (is_array($parsingParams)) {
1689
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1689
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1690 1690
 
1691
-                $out[count($out) - 1][0] = $output;
1692
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1691
+                $out[count($out)-1][0] = $output;
1692
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1693 1693
             } else {
1694 1694
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1695 1695
             }
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
         }
1699 1699
 
1700 1700
         if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) {
1701
-            return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE;
1701
+            return self::PHP_OPEN.'echo '.$out.';'.self::PHP_CLOSE;
1702 1702
         } else {
1703 1703
             return $out;
1704 1704
         }
@@ -1724,11 +1724,11 @@  discard block
 block discarded – undo
1724 1724
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1725 1725
     {
1726 1726
         $output = '';
1727
-        $cmdstr = substr($in, $from, $to - $from);
1728
-        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match);
1727
+        $cmdstr = substr($in, $from, $to-$from);
1728
+        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1729 1729
 
1730 1730
         if (empty($match[1])) {
1731
-            throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15));
1731
+            throw new CompilationException($this, 'Parse error, invalid function name : '.substr($cmdstr, 0, 15));
1732 1732
         }
1733 1733
 
1734 1734
         $func = $match[1];
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
         }
1739 1739
 
1740 1740
         if ($this->debug) {
1741
-            echo 'FUNC FOUND (' . $func . ')' . "\n";
1741
+            echo 'FUNC FOUND ('.$func.')'."\n";
1742 1742
         }
1743 1743
 
1744 1744
         $paramsep = '';
@@ -1750,11 +1750,11 @@  discard block
 block discarded – undo
1750 1750
             $paramspos = $match[1][0][1];
1751 1751
             $paramsep  = substr($match[1][0][0], - 1) === '(' ? ')' : '';
1752 1752
             if ($paramsep === ')') {
1753
-                $paramspos += strlen($match[1][0][0]) - 1;
1753
+                $paramspos += strlen($match[1][0][0])-1;
1754 1754
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1755 1755
                     $paramsep = '';
1756 1756
                     if (strlen($match[1][0][0]) > 1) {
1757
-                        -- $paramspos;
1757
+                        --$paramspos;
1758 1758
                     }
1759 1759
                 }
1760 1760
             }
@@ -1779,8 +1779,8 @@  discard block
 block discarded – undo
1779 1779
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1780 1780
                 }
1781 1781
             }
1782
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1783
-            $paramstr   = substr($cmdstr, $paramspos + 1);
1782
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1783
+            $paramstr   = substr($cmdstr, $paramspos+1);
1784 1784
             if (substr($paramstr, - 1, 1) === $paramsep) {
1785 1785
                 $paramstr = substr($paramstr, 0, - 1);
1786 1786
             }
@@ -1802,36 +1802,36 @@  discard block
 block discarded – undo
1802 1802
 
1803 1803
                             if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') {
1804 1804
                                 if ($this->debug) {
1805
-                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT ' . $ptr . "\n";
1805
+                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr."\n";
1806 1806
                                 }
1807 1807
                                 break 2;
1808 1808
                             } elseif ($paramstr[$ptr] === ';') {
1809
-                                ++ $ptr;
1809
+                                ++$ptr;
1810 1810
                                 if ($this->debug) {
1811
-                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n";
1811
+                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr."\n";
1812 1812
                                 }
1813 1813
                                 break 2;
1814 1814
                             } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') {
1815 1815
                                 if ($this->debug) {
1816
-                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT ' . $ptr . "\n";
1816
+                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr."\n";
1817 1817
                                 }
1818 1818
                                 break 2;
1819 1819
                             } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
1820 1820
                                 if ($this->debug) {
1821
-                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT ' . $ptr . "\n";
1821
+                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr."\n";
1822 1822
                                 }
1823 1823
                                 break 2;
1824 1824
                             }
1825 1825
 
1826 1826
                             if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") {
1827
-                                ++ $ptr;
1827
+                                ++$ptr;
1828 1828
                             } else {
1829 1829
                                 break;
1830 1830
                             }
1831 1831
                         }
1832 1832
 
1833 1833
                         if ($this->debug) {
1834
-                            echo 'FUNC START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
1834
+                            echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr."\n";
1835 1835
                         }
1836 1836
 
1837 1837
                         if ($func === 'if' || $func === 'elseif' || $func === 'tif') {
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
                         }
1844 1844
 
1845 1845
                         if ($this->debug) {
1846
-                            echo 'PARAM PARSED, POINTER AT ' . $ptr . ' (' . substr($paramstr, $ptr - 1, 3) . ')' . "\n";
1846
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1847 1847
                         }
1848 1848
                     }
1849 1849
                 }
@@ -1867,16 +1867,16 @@  discard block
 block discarded – undo
1867 1867
         }
1868 1868
 
1869 1869
         if ($pointer !== null) {
1870
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1870
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1871 1871
             if ($this->debug) {
1872
-                echo 'FUNC ADDS ' . ((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)) . ' TO POINTER' . "\n";
1872
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1873 1873
             }
1874 1874
         }
1875 1875
 
1876 1876
         if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) {
1877 1877
             // handle static method calls with security policy
1878 1878
             if (strstr($func, '::') !== false && $this->securityPolicy !== null && $this->securityPolicy->isMethodAllowed(explode('::', strtolower($func))) !== true) {
1879
-                throw new SecurityException('Call to a disallowed php function : ' . $func);
1879
+                throw new SecurityException('Call to a disallowed php function : '.$func);
1880 1880
             }
1881 1881
             $pluginType = Core::NATIVE_PLUGIN;
1882 1882
         } else {
@@ -1920,14 +1920,14 @@  discard block
 block discarded – undo
1920 1920
                     $this->customPlugins[$func]['function']
1921 1921
                 ), $state);
1922 1922
             } else {
1923
-                if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
1923
+                if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
1924 1924
                     $params = $this->mapParams($params, array(
1925
-                        'Plugin' . Core::toCamelCase($func),
1925
+                        'Plugin'.Core::toCamelCase($func),
1926 1926
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1927 1927
                     ), $state);
1928 1928
                 } else {
1929 1929
                     $params = $this->mapParams($params, array(
1930
-                        Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
1930
+                        Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
1931 1931
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1932 1932
                     ), $state);
1933 1933
                 }
@@ -1937,23 +1937,21 @@  discard block
 block discarded – undo
1937 1937
                 $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state);
1938 1938
             } else {
1939 1939
                 // Custom plugin
1940
-                if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ?
1940
+                if (function_exists('Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ?
1941 1941
                         'Compile' : '')) !== false) {
1942
-                    $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType &
1942
+                    $params = $this->mapParams($params, 'Plugin'.Core::toCamelCase($func).(($pluginType &
1943 1943
                             Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1944 1944
                 } // Builtin helper plugin
1945
-                elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . (
1945
+                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(
1946 1946
                     ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) {
1947
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase
1948
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1947
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1949 1948
                 } // Builtin function plugin
1950 1949
                 else {
1951
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
1952
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1950
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1953 1951
                 }
1954 1952
             }
1955 1953
         } elseif ($pluginType & Core::SMARTY_MODIFIER) {
1956
-            $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')';
1954
+            $output = 'smarty_modifier_'.$func.'('.implode(', ', $params).')';
1957 1955
         } elseif ($pluginType & Core::PROXY_PLUGIN) {
1958 1956
             $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
1959 1957
         } elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
@@ -1988,7 +1986,7 @@  discard block
 block discarded – undo
1988 1986
         if ($pluginType & Core::NATIVE_PLUGIN) {
1989 1987
             if ($func === 'do') {
1990 1988
                 if (isset($params['*'])) {
1991
-                    $output = implode(';', $params['*']) . ';';
1989
+                    $output = implode(';', $params['*']).';';
1992 1990
                 } else {
1993 1991
                     $output = '';
1994 1992
                 }
@@ -1996,13 +1994,13 @@  discard block
 block discarded – undo
1996 1994
                 if (is_array($parsingParams) || $curBlock !== 'root') {
1997 1995
                     throw new CompilationException($this, 'Do can not be used inside another function or block');
1998 1996
                 } else {
1999
-                    return self::PHP_OPEN . $output . self::PHP_CLOSE;
1997
+                    return self::PHP_OPEN.$output.self::PHP_CLOSE;
2000 1998
                 }
2001 1999
             } else {
2002 2000
                 if (isset($params['*'])) {
2003
-                    $output = $func . '(' . implode(', ', $params['*']) . ')';
2001
+                    $output = $func.'('.implode(', ', $params['*']).')';
2004 2002
                 } else {
2005
-                    $output = $func . '()';
2003
+                    $output = $func.'()';
2006 2004
                 }
2007 2005
             }
2008 2006
         } elseif ($pluginType & Core::FUNC_PLUGIN) {
@@ -2011,16 +2009,16 @@  discard block
 block discarded – undo
2011 2009
                     $funcCompiler = $this->customPlugins[$func]['callback'];
2012 2010
                 } else {
2013 2011
                     // Custom plugin
2014
-                    if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2015
-                        $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
2012
+                    if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2013
+                        $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
2016 2014
                     } // Builtin helper plugin
2017
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2015
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2018 2016
                             'Compile') !== false) {
2019
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2017
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2020 2018
                             'Compile';
2021 2019
                     } // Builtin function plugin
2022 2020
                     else {
2023
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
2021
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
2024 2022
                             'Compile';
2025 2023
                     }
2026 2024
                 }
@@ -2035,24 +2033,24 @@  discard block
 block discarded – undo
2035 2033
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
2036 2034
                     $callback = $this->customPlugins[$func]['callback'];
2037 2035
                     if ($callback instanceof Closure) {
2038
-                        $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')';
2036
+                        $output = 'call_user_func($this->getCustomPlugin(\''.$func.'\'), '.$params.')';
2039 2037
                     } else {
2040
-                        $output = 'call_user_func(\'' . $callback . '\', ' . $params . ')';
2038
+                        $output = 'call_user_func(\''.$callback.'\', '.$params.')';
2041 2039
                     }
2042 2040
                 } else {
2043 2041
                     // Custom plugin
2044
-                    if (function_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2045
-                        $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params .
2042
+                    if (function_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2043
+                        $output = 'Plugin'.Core::toCamelCase($func).'('.$params.
2046 2044
                             ')';
2047 2045
                     } // Builtin helper plugin
2048
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !==
2046
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !==
2049 2047
                         false) {
2050
-                        $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' .
2051
-                            $params . ')';
2048
+                        $output = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'('.
2049
+                            $params.')';
2052 2050
                     } // Builtin function plugin
2053 2051
                     else {
2054
-                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '(' .
2055
-                            $params . ')';
2052
+                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'('.
2053
+                            $params.')';
2056 2054
                     }
2057 2055
                 }
2058 2056
             }
@@ -2062,7 +2060,7 @@  discard block
 block discarded – undo
2062 2060
                     $callback = $this->customPlugins[$func]['callback'];
2063 2061
                     if (!is_array($callback)) {
2064 2062
                         if (!method_exists($callback, 'compile')) {
2065
-                            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');
2063
+                            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');
2066 2064
                         }
2067 2065
                         if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
2068 2066
                             $funcCompiler = array($callback, 'compile');
@@ -2073,11 +2071,11 @@  discard block
 block discarded – undo
2073 2071
                         $funcCompiler = $callback;
2074 2072
                     }
2075 2073
                 } else {
2076
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2077
-                        $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
2074
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2075
+                        $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
2078 2076
                     } else {
2079 2077
                         $funcCompiler = array(
2080
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
2078
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
2081 2079
                             'compile'
2082 2080
                         );
2083 2081
                     }
@@ -2090,32 +2088,32 @@  discard block
 block discarded – undo
2090 2088
                     $callback = $this->customPlugins[$func]['callback'];
2091 2089
                     if (!is_array($callback)) {
2092 2090
                         if (!method_exists($callback, 'process')) {
2093
-                            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');
2091
+                            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');
2094 2092
                         }
2095 2093
                         if (($ref = new ReflectionMethod($callback, 'process')) && $ref->isStatic()) {
2096
-                            $output = 'call_user_func(array(\'' . $callback . '\', \'process\'), ' . $params . ')';
2094
+                            $output = 'call_user_func(array(\''.$callback.'\', \'process\'), '.$params.')';
2097 2095
                         } else {
2098
-                            $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback . '\'), \'process\'), ' . $params . ')';
2096
+                            $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback.'\'), \'process\'), '.$params.')';
2099 2097
                         }
2100 2098
                     } elseif (is_object($callback[0])) {
2101
-                        $output = 'call_user_func(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), ' . $params . ')';
2099
+                        $output = 'call_user_func(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), '.$params.')';
2102 2100
                     } elseif (($ref = new ReflectionMethod($callback[0], $callback[1])) && $ref->isStatic()) {
2103
-                        $output = 'call_user_func(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), ' . $params . ')';
2101
+                        $output = 'call_user_func(array(\''.$callback[0].'\', \''.$callback[1].'\'), '.$params.')';
2104 2102
                     } else {
2105
-                        $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback[0] . '\'), \'' . $callback[1] . '\'), ' . $params . ')';
2103
+                        $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback[0].'\'), \''.$callback[1].'\'), '.$params.')';
2106 2104
                     }
2107 2105
                     if (empty($params)) {
2108
-                        $output = substr($output, 0, - 3) . ')';
2106
+                        $output = substr($output, 0, - 3).')';
2109 2107
                     }
2110 2108
                 } else {
2111
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2112
-                        $output = '$this->classCall(\'Plugin' . $func . '\', array(' . $params . '))';
2113
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !==
2109
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2110
+                        $output = '$this->classCall(\'Plugin'.$func.'\', array('.$params.'))';
2111
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !==
2114 2112
                     false) {
2115
-                        $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', 
2116
-                        array(' . $params . '))';
2117
-                    } else{
2118
-                        $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
2113
+                        $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', 
2114
+                        array(' . $params.'))';
2115
+                    } else {
2116
+                        $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
2119 2117
                     }
2120 2118
                 }
2121 2119
             }
@@ -2132,21 +2130,21 @@  discard block
 block discarded – undo
2132 2130
                 $callback = $this->customPlugins[$func]['callback'];
2133 2131
                 if (is_array($callback)) {
2134 2132
                     if (is_object($callback[0])) {
2135
-                        $output = 'call_user_func_array(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2133
+                        $output = 'call_user_func_array(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array(array('.$params.'), $this))';
2136 2134
                     } else {
2137
-                        $output = 'call_user_func_array(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2135
+                        $output = 'call_user_func_array(array(\''.$callback[0].'\', \''.$callback[1].'\'), array(array('.$params.'), $this))';
2138 2136
                     }
2139 2137
                 } else {
2140
-                    $output = $callback . '(array(' . $params . '), $this)';
2138
+                    $output = $callback.'(array('.$params.'), $this)';
2141 2139
                 }
2142 2140
             } else {
2143
-                $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)';
2141
+                $output = 'smarty_function_'.$func.'(array('.$params.'), $this)';
2144 2142
             }
2145 2143
         } elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
2146 2144
             array_unshift($params, '$this');
2147 2145
             $params                                 = self::implode_r($params);
2148
-            $output                                 = 'Plugin' . Core::toCamelCase($func) .
2149
-                $this->templatePlugins[$func]['uuid'] . '(' . $params . ')';
2146
+            $output                                 = 'Plugin'.Core::toCamelCase($func).
2147
+                $this->templatePlugins[$func]['uuid'].'('.$params.')';
2150 2148
             $this->templatePlugins[$func]['called'] = true;
2151 2149
         }
2152 2150
 
@@ -2178,29 +2176,29 @@  discard block
 block discarded – undo
2178 2176
      */
2179 2177
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2180 2178
     {
2181
-        $substr = substr($in, $from, $to - $from);
2179
+        $substr = substr($in, $from, $to-$from);
2182 2180
         $first  = $substr[0];
2183 2181
 
2184 2182
         if ($this->debug) {
2185
-            echo 'STRING FOUND (in ' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . ')' . "\n";
2183
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2186 2184
         }
2187 2185
         $strend = false;
2188
-        $o      = $from + 1;
2186
+        $o      = $from+1;
2189 2187
         while ($strend === false) {
2190 2188
             $strend = strpos($in, $first, $o);
2191 2189
             if ($strend === false) {
2192
-                throw new CompilationException($this, 'Unfinished string, started with ' . substr($in, $from, $to - $from));
2190
+                throw new CompilationException($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2193 2191
             }
2194
-            if (substr($in, $strend - 1, 1) === '\\') {
2195
-                $o      = $strend + 1;
2192
+            if (substr($in, $strend-1, 1) === '\\') {
2193
+                $o      = $strend+1;
2196 2194
                 $strend = false;
2197 2195
             }
2198 2196
         }
2199 2197
         if ($this->debug) {
2200
-            echo 'STRING DELIMITED: ' . substr($in, $from, $strend + 1 - $from) . "\n";
2198
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2201 2199
         }
2202 2200
 
2203
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2201
+        $srcOutput = substr($in, $from, $strend+1-$from);
2204 2202
 
2205 2203
         if ($pointer !== null) {
2206 2204
             $pointer += strlen($srcOutput);
@@ -2209,13 +2207,13 @@  discard block
 block discarded – undo
2209 2207
         $output = $this->replaceStringVars($srcOutput, $first);
2210 2208
 
2211 2209
         // handle modifiers
2212
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2210
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2213 2211
             $modstr = $match[1];
2214 2212
 
2215 2213
             if ($curBlock === 'root' && substr($modstr, - 1) === '}') {
2216 2214
                 $modstr = substr($modstr, 0, - 1);
2217 2215
             }
2218
-            $modstr = str_replace('\\' . $first, $first, $modstr);
2216
+            $modstr = str_replace('\\'.$first, $first, $modstr);
2219 2217
             $ptr    = 0;
2220 2218
             $output = $this->replaceModifiers(array(null, null, $output, $modstr), 'string', $ptr);
2221 2219
 
@@ -2223,7 +2221,7 @@  discard block
 block discarded – undo
2223 2221
             if ($pointer !== null) {
2224 2222
                 $pointer += $ptr;
2225 2223
             }
2226
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2224
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2227 2225
         }
2228 2226
 
2229 2227
         if (is_array($parsingParams)) {
@@ -2254,10 +2252,10 @@  discard block
 block discarded – undo
2254 2252
      */
2255 2253
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2256 2254
     {
2257
-        $substr = substr($in, $from, $to - $from);
2255
+        $substr = substr($in, $from, $to-$from);
2258 2256
 
2259 2257
         if ($this->debug) {
2260
-            echo 'CONST FOUND : ' . $substr . "\n";
2258
+            echo 'CONST FOUND : '.$substr."\n";
2261 2259
         }
2262 2260
 
2263 2261
         if (!preg_match('#^%([\\\\a-z0-9_:]+)#i', $substr, $m)) {
@@ -2296,7 +2294,7 @@  discard block
 block discarded – undo
2296 2294
         }
2297 2295
 
2298 2296
         if ($curBlock !== 'root') {
2299
-            $output = '(defined("' . $key . '") ? ' . $key . ' : null)';
2297
+            $output = '(defined("'.$key.'") ? '.$key.' : null)';
2300 2298
         } else {
2301 2299
             $output = $key;
2302 2300
         }
@@ -2322,13 +2320,13 @@  discard block
 block discarded – undo
2322 2320
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2323 2321
     {
2324 2322
         $methodCall = '';
2325
-        $substr     = substr($in, $from, $to - $from);
2323
+        $substr     = substr($in, $from, $to-$from);
2326 2324
 
2327 2325
         if (preg_match(
2328
-            '#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)' . // var key
2329
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()') . // method call
2330
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()') . // simple math expressions
2331
-            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())') . // modifiers
2326
+            '#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)'.// var key
2327
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()').// method call
2328
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()').// simple math expressions
2329
+            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())').// modifiers
2332 2330
             '#i', $substr, $match
2333 2331
         )) {
2334 2332
             $key = substr($match[1], 1);
@@ -2340,13 +2338,13 @@  discard block
 block discarded – undo
2340 2338
 
2341 2339
             if (substr($key, - 1) == '.') {
2342 2340
                 $key = substr($key, 0, - 1);
2343
-                -- $matchedLength;
2341
+                --$matchedLength;
2344 2342
             }
2345 2343
 
2346 2344
             if ($hasMethodCall) {
2347
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2348
-                $key        = substr($match[1], 1, strrpos($match[1], '->') - 1);
2349
-                $methodCall = substr($match[1], strrpos($match[1], '->')) . $match[3];
2345
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2346
+                $key        = substr($match[1], 1, strrpos($match[1], '->')-1);
2347
+                $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2350 2348
             }
2351 2349
 
2352 2350
             if ($hasModifiers) {
@@ -2362,9 +2360,9 @@  discard block
 block discarded – undo
2362 2360
 
2363 2361
             if ($this->debug) {
2364 2362
                 if ($hasMethodCall) {
2365
-                    echo 'METHOD CALL FOUND : $' . $key . substr($methodCall, 0, 30) . "\n";
2363
+                    echo 'METHOD CALL FOUND : $'.$key.substr($methodCall, 0, 30)."\n";
2366 2364
                 } else {
2367
-                    echo 'VAR FOUND : $' . $key . "\n";
2365
+                    echo 'VAR FOUND : $'.$key."\n";
2368 2366
                 }
2369 2367
             }
2370 2368
 
@@ -2375,7 +2373,7 @@  discard block
 block discarded – undo
2375 2373
                 $uid           = 0;
2376 2374
                 $parsed        = array($uid => '');
2377 2375
                 $current       = &$parsed;
2378
-                $curTxt        = &$parsed[$uid ++];
2376
+                $curTxt        = &$parsed[$uid++];
2379 2377
                 $tree          = array();
2380 2378
                 $chars         = str_split($key, 1);
2381 2379
                 $inSplittedVar = false;
@@ -2384,33 +2382,33 @@  discard block
 block discarded – undo
2384 2382
                 while (($char = array_shift($chars)) !== null) {
2385 2383
                     if ($char === '[') {
2386 2384
                         if (count($tree) > 0) {
2387
-                            ++ $bracketCount;
2385
+                            ++$bracketCount;
2388 2386
                         } else {
2389 2387
                             $tree[]        = &$current;
2390
-                            $current[$uid] = array($uid + 1 => '');
2391
-                            $current       = &$current[$uid ++];
2392
-                            $curTxt        = &$current[$uid ++];
2388
+                            $current[$uid] = array($uid+1 => '');
2389
+                            $current       = &$current[$uid++];
2390
+                            $curTxt        = &$current[$uid++];
2393 2391
                             continue;
2394 2392
                         }
2395 2393
                     } elseif ($char === ']') {
2396 2394
                         if ($bracketCount > 0) {
2397
-                            -- $bracketCount;
2395
+                            --$bracketCount;
2398 2396
                         } else {
2399
-                            $current = &$tree[count($tree) - 1];
2397
+                            $current = &$tree[count($tree)-1];
2400 2398
                             array_pop($tree);
2401 2399
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2402 2400
                                 $current[$uid] = '';
2403
-                                $curTxt        = &$current[$uid ++];
2401
+                                $curTxt        = &$current[$uid++];
2404 2402
                             }
2405 2403
                             continue;
2406 2404
                         }
2407 2405
                     } elseif ($char === '$') {
2408 2406
                         if (count($tree) == 0) {
2409
-                            $curTxt        = &$current[$uid ++];
2407
+                            $curTxt        = &$current[$uid++];
2410 2408
                             $inSplittedVar = true;
2411 2409
                         }
2412 2410
                     } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) {
2413
-                        $curTxt        = &$current[$uid ++];
2411
+                        $curTxt        = &$current[$uid++];
2414 2412
                         $inSplittedVar = false;
2415 2413
                     }
2416 2414
 
@@ -2419,16 +2417,16 @@  discard block
 block discarded – undo
2419 2417
                 unset($uid, $current, $curTxt, $tree, $chars);
2420 2418
 
2421 2419
                 if ($this->debug) {
2422
-                    echo 'RECURSIVE VAR REPLACEMENT : ' . $key . "\n";
2420
+                    echo 'RECURSIVE VAR REPLACEMENT : '.$key."\n";
2423 2421
                 }
2424 2422
 
2425 2423
                 $key = $this->flattenVarTree($parsed);
2426 2424
 
2427 2425
                 if ($this->debug) {
2428
-                    echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2426
+                    echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2429 2427
                 }
2430 2428
 
2431
-                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("' . $key . '")');
2429
+                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("'.$key.'")');
2432 2430
             } else {
2433 2431
                 $output = $this->parseVarKey($key, $hasModifiers ? 'modifier' : $curBlock);
2434 2432
             }
@@ -2453,10 +2451,10 @@  discard block
 block discarded – undo
2453 2451
                     if (substr($expMatch[2][$k], 0, 1) === '=') {
2454 2452
                         $assign = true;
2455 2453
                         if ($operator === '=') {
2456
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, can not use "==" in expressions');
2454
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, can not use "==" in expressions');
2457 2455
                         }
2458 2456
                         if ($curBlock !== 'root') {
2459
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2457
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2460 2458
                         }
2461 2459
                         $operator .= '=';
2462 2460
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
@@ -2467,22 +2465,22 @@  discard block
 block discarded – undo
2467 2465
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
2468 2466
                     }
2469 2467
                     if (($operator === '+' || $operator === '-') && $expMatch[2][$k] === $operator) {
2470
-                        $output = '(' . $output . $operator . $operator . ')';
2468
+                        $output = '('.$output.$operator.$operator.')';
2471 2469
                         break;
2472 2470
                     } elseif (substr($expMatch[2][$k], 0, 1) === '$') {
2473
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2471
+                        $output = '('.$output.' '.$operator.' '.$this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2474 2472
                     } elseif (substr($expMatch[2][$k], 0, 1) === '%') {
2475
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2473
+                        $output = '('.$output.' '.$operator.' '.$this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2476 2474
                     } elseif (!empty($expMatch[2][$k])) {
2477
-                        $output = '(' . $output . ' ' . $operator . ' ' . str_replace(',', '.', $expMatch[2][$k]) . ')';
2475
+                        $output = '('.$output.' '.$operator.' '.str_replace(',', '.', $expMatch[2][$k]).')';
2478 2476
                     } else {
2479
-                        throw new CompilationException($this, 'Unfinished expression <em>' . $substr . '</em>, missing var or number after math operator');
2477
+                        throw new CompilationException($this, 'Unfinished expression <em>'.$substr.'</em>, missing var or number after math operator');
2480 2478
                     }
2481 2479
                 }
2482 2480
             }
2483 2481
 
2484 2482
             if ($this->autoEscape === true && $curBlock !== 'condition') {
2485
-                $output = '(is_string($tmp=' . $output . ') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2483
+                $output = '(is_string($tmp='.$output.') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2486 2484
             }
2487 2485
 
2488 2486
             // handle modifiers
@@ -2506,7 +2504,7 @@  discard block
 block discarded – undo
2506 2504
             } elseif ($curBlock === 'expression' || $curBlock === 'variable') {
2507 2505
                 return $output;
2508 2506
             } elseif (isset($assign)) {
2509
-                return self::PHP_OPEN . $output . ';' . self::PHP_CLOSE;
2507
+                return self::PHP_OPEN.$output.';'.self::PHP_CLOSE;
2510 2508
             } else {
2511 2509
                 return $output;
2512 2510
             }
@@ -2514,7 +2512,7 @@  discard block
 block discarded – undo
2514 2512
             if ($curBlock === 'string' || $curBlock === 'delimited_string') {
2515 2513
                 return array(0, '');
2516 2514
             } else {
2517
-                throw new CompilationException($this, 'Invalid variable name <em>' . $substr . '</em>');
2515
+                throw new CompilationException($this, 'Invalid variable name <em>'.$substr.'</em>');
2518 2516
             }
2519 2517
         }
2520 2518
     }
@@ -2569,16 +2567,16 @@  discard block
 block discarded – undo
2569 2567
             if (empty($methMatch[2])) {
2570 2568
                 // property
2571 2569
                 if ($curBlock === 'root') {
2572
-                    $output .= '->' . $methMatch[1];
2570
+                    $output .= '->'.$methMatch[1];
2573 2571
                 } else {
2574
-                    $output = '(($tmp = ' . $output . ') ? $tmp->' . $methMatch[1] . ' : null)';
2572
+                    $output = '(($tmp = '.$output.') ? $tmp->'.$methMatch[1].' : null)';
2575 2573
                 }
2576 2574
                 $ptr += strlen($methMatch[1]);
2577 2575
             } else {
2578 2576
                 // method
2579 2577
                 if (substr($methMatch[2], 0, 2) === '()') {
2580
-                    $parsedCall = $methMatch[1] . '()';
2581
-                    $ptr += strlen($methMatch[1]) + 2;
2578
+                    $parsedCall = $methMatch[1].'()';
2579
+                    $ptr += strlen($methMatch[1])+2;
2582 2580
                 } else {
2583 2581
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2584 2582
                 }
@@ -2587,15 +2585,15 @@  discard block
 block discarded – undo
2587 2585
                     $method = strtolower(substr($parsedCall, 0, $argPos));
2588 2586
                     $args   = substr($parsedCall, $argPos);
2589 2587
                     if ($curBlock === 'root') {
2590
-                        $output = '$this->getSecurityPolicy()->callMethod($this, ' . $output . ', ' . var_export($method, true) . ', array' . $args . ')';
2588
+                        $output = '$this->getSecurityPolicy()->callMethod($this, '.$output.', '.var_export($method, true).', array'.$args.')';
2591 2589
                     } else {
2592
-                        $output = '(($tmp = ' . $output . ') ? $this->getSecurityPolicy()->callMethod($this, $tmp, ' . var_export($method, true) . ', array' . $args . ') : null)';
2590
+                        $output = '(($tmp = '.$output.') ? $this->getSecurityPolicy()->callMethod($this, $tmp, '.var_export($method, true).', array'.$args.') : null)';
2593 2591
                     }
2594 2592
                 } else {
2595 2593
                     if ($curBlock === 'root') {
2596
-                        $output .= '->' . $parsedCall;
2594
+                        $output .= '->'.$parsedCall;
2597 2595
                     } else {
2598
-                        $output = '(($tmp = ' . $output . ') ? $tmp->' . $parsedCall . ' : null)';
2596
+                        $output = '(($tmp = '.$output.') ? $tmp->'.$parsedCall.' : null)';
2599 2597
                     }
2600 2598
                 }
2601 2599
             }
@@ -2621,21 +2619,21 @@  discard block
 block discarded – undo
2621 2619
             return '$this->scope';
2622 2620
         }
2623 2621
         if (substr($key, 0, 1) === '.') {
2624
-            $key = 'dwoo' . $key;
2622
+            $key = 'dwoo'.$key;
2625 2623
         }
2626 2624
         if (preg_match('#dwoo\.(get|post|server|cookies|session|env|request)((?:\.[a-z0-9_-]+)+)#i', $key, $m)) {
2627 2625
             $global = strtoupper($m[1]);
2628 2626
             if ($global === 'COOKIES') {
2629 2627
                 $global = 'COOKIE';
2630 2628
             }
2631
-            $key = '$_' . $global;
2629
+            $key = '$_'.$global;
2632 2630
             foreach (explode('.', ltrim($m[2], '.')) as $part) {
2633
-                $key .= '[' . var_export($part, true) . ']';
2631
+                $key .= '['.var_export($part, true).']';
2634 2632
             }
2635 2633
             if ($curBlock === 'root') {
2636 2634
                 $output = $key;
2637 2635
             } else {
2638
-                $output = '(isset(' . $key . ')?' . $key . ':null)';
2636
+                $output = '(isset('.$key.')?'.$key.':null)';
2639 2637
             }
2640 2638
         } elseif (preg_match('#dwoo\.const\.([a-z0-9_:]+)#i', $key, $m)) {
2641 2639
             return $this->parseConstKey($m[1], $curBlock);
@@ -2651,9 +2649,9 @@  discard block
 block discarded – undo
2651 2649
                     $output = '$tmp_key';
2652 2650
                 } else {
2653 2651
                     if ($curBlock === 'root') {
2654
-                        $output = '$this->scope["' . $key . '"]';
2652
+                        $output = '$this->scope["'.$key.'"]';
2655 2653
                     } else {
2656
-                        $output = '(isset($this->scope["' . $key . '"]) ? $this->scope["' . $key . '"] : null)';
2654
+                        $output = '(isset($this->scope["'.$key.'"]) ? $this->scope["'.$key.'"] : null)';
2657 2655
                     }
2658 2656
                 }
2659 2657
             } else {
@@ -2664,7 +2662,7 @@  discard block
 block discarded – undo
2664 2662
                     $parentCnt = 0;
2665 2663
 
2666 2664
                     while (true) {
2667
-                        ++ $parentCnt;
2665
+                        ++$parentCnt;
2668 2666
                         array_shift($m[2]);
2669 2667
                         array_shift($m[1]);
2670 2668
                         if (current($m[2]) === '_parent') {
@@ -2673,7 +2671,7 @@  discard block
 block discarded – undo
2673 2671
                         break;
2674 2672
                     }
2675 2673
 
2676
-                    $output = '$this->readParentVar(' . $parentCnt . ')';
2674
+                    $output = '$this->readParentVar('.$parentCnt.')';
2677 2675
                 } else {
2678 2676
                     if ($i === 'dwoo') {
2679 2677
                         $output = '$this->globals';
@@ -2692,28 +2690,28 @@  discard block
 block discarded – undo
2692 2690
                     while (count($m[1]) && $m[1][0] !== '->') {
2693 2691
                         $m[2][0] = preg_replace('/(^\\\([\'"])|\\\([\'"])$)/x', '$2$3', $m[2][0]);
2694 2692
                         if (substr($m[2][0], 0, 1) == '"' || substr($m[2][0], 0, 1) == "'") {
2695
-                            $output .= '[' . $m[2][0] . ']';
2693
+                            $output .= '['.$m[2][0].']';
2696 2694
                         } else {
2697
-                            $output .= '["' . $m[2][0] . '"]';
2695
+                            $output .= '["'.$m[2][0].'"]';
2698 2696
                         }
2699 2697
                         array_shift($m[2]);
2700 2698
                         array_shift($m[1]);
2701 2699
                     }
2702 2700
 
2703 2701
                     if ($curBlock !== 'root') {
2704
-                        $output = '(isset(' . $output . ') ? ' . $output . ':null)';
2702
+                        $output = '(isset('.$output.') ? '.$output.':null)';
2705 2703
                     }
2706 2704
                 }
2707 2705
 
2708 2706
                 if (count($m[2])) {
2709 2707
                     unset($m[0]);
2710
-                    $output = '$this->readVarInto(' . str_replace("\n", '', var_export($m, true)) . ', ' . $output . ', ' . ($curBlock == 'root' ? 'false' : 'true') . ')';
2708
+                    $output = '$this->readVarInto('.str_replace("\n", '', var_export($m, true)).', '.$output.', '.($curBlock == 'root' ? 'false' : 'true').')';
2711 2709
                 }
2712 2710
             }
2713 2711
         } else {
2714 2712
             preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+)\]?#i', $key, $m);
2715 2713
             unset($m[0]);
2716
-            $output = '$this->readVar(' . str_replace("\n", '', var_export($m, true)) . ')';
2714
+            $output = '$this->readVar('.str_replace("\n", '', var_export($m, true)).')';
2717 2715
         }
2718 2716
 
2719 2717
         return $output;
@@ -2733,38 +2731,38 @@  discard block
 block discarded – undo
2733 2731
         $out = $recursed ? '".$this->readVarInto(' : '';
2734 2732
         foreach ($tree as $bit) {
2735 2733
             if (is_array($bit)) {
2736
-                $out .= '.' . $this->flattenVarTree($bit, false);
2734
+                $out .= '.'.$this->flattenVarTree($bit, false);
2737 2735
             } else {
2738 2736
                 $key = str_replace('"', '\\"', $bit);
2739 2737
 
2740 2738
                 if (substr($key, 0, 1) === '$') {
2741
-                    $out .= '".' . $this->parseVar($key, 0, strlen($key), false, 'variable') . '."';
2739
+                    $out .= '".'.$this->parseVar($key, 0, strlen($key), false, 'variable').'."';
2742 2740
                 } else {
2743 2741
                     $cnt = substr_count($key, '$');
2744 2742
 
2745 2743
                     if ($this->debug) {
2746
-                        echo 'PARSING SUBVARS IN : ' . $key . "\n";
2744
+                        echo 'PARSING SUBVARS IN : '.$key."\n";
2747 2745
                     }
2748 2746
                     if ($cnt > 0) {
2749
-                        while (-- $cnt >= 0) {
2747
+                        while (--$cnt >= 0) {
2750 2748
                             if (isset($last)) {
2751
-                                $last = strrpos($key, '$', - (strlen($key) - $last + 1));
2749
+                                $last = strrpos($key, '$', - (strlen($key)-$last+1));
2752 2750
                             } else {
2753 2751
                                 $last = strrpos($key, '$');
2754 2752
                             }
2755
-                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2753
+                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2756 2754
 
2757 2755
                             $len = strlen($submatch[0]);
2758 2756
                             $key = substr_replace(
2759 2757
                                 $key, preg_replace_callback(
2760
-                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2758
+                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2761 2759
                                         $this,
2762 2760
                                         'replaceVarKeyHelper'
2763 2761
                                     ), substr($key, $last, $len)
2764 2762
                                 ), $last, $len
2765 2763
                             );
2766 2764
                             if ($this->debug) {
2767
-                                echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2765
+                                echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2768 2766
                             }
2769 2767
                         }
2770 2768
                         unset($last);
@@ -2790,7 +2788,7 @@  discard block
 block discarded – undo
2790 2788
      */
2791 2789
     protected function replaceVarKeyHelper($match)
2792 2790
     {
2793
-        return '".' . $this->parseVar($match[0], 0, strlen($match[0]), false, 'variable') . '."';
2791
+        return '".'.$this->parseVar($match[0], 0, strlen($match[0]), false, 'variable').'."';
2794 2792
     }
2795 2793
 
2796 2794
     /**
@@ -2810,7 +2808,7 @@  discard block
 block discarded – undo
2810 2808
      */
2811 2809
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2812 2810
     {
2813
-        $substr = substr($in, $from, $to - $from);
2811
+        $substr = substr($in, $from, $to-$from);
2814 2812
 
2815 2813
         $end = strlen($substr);
2816 2814
 
@@ -2884,48 +2882,48 @@  discard block
 block discarded – undo
2884 2882
 
2885 2883
         if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') {
2886 2884
             if ($this->debug) {
2887
-                echo 'BOOLEAN(FALSE) PARSED' . "\n";
2885
+                echo 'BOOLEAN(FALSE) PARSED'."\n";
2888 2886
             }
2889 2887
             $substr = 'false';
2890 2888
             $type   = self::T_BOOL;
2891 2889
         } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') {
2892 2890
             if ($this->debug) {
2893
-                echo 'BOOLEAN(TRUE) PARSED' . "\n";
2891
+                echo 'BOOLEAN(TRUE) PARSED'."\n";
2894 2892
             }
2895 2893
             $substr = 'true';
2896 2894
             $type   = self::T_BOOL;
2897 2895
         } elseif ($substr === 'null' || $substr === 'NULL') {
2898 2896
             if ($this->debug) {
2899
-                echo 'NULL PARSED' . "\n";
2897
+                echo 'NULL PARSED'."\n";
2900 2898
             }
2901 2899
             $substr = 'null';
2902 2900
             $type   = self::T_NULL;
2903 2901
         } elseif (is_numeric($substr)) {
2904
-            $substr = (float)$substr;
2905
-            if ((int)$substr == $substr) {
2906
-                $substr = (int)$substr;
2902
+            $substr = (float) $substr;
2903
+            if ((int) $substr == $substr) {
2904
+                $substr = (int) $substr;
2907 2905
             }
2908 2906
             $type = self::T_NUMERIC;
2909 2907
             if ($this->debug) {
2910
-                echo 'NUMBER (' . $substr . ') PARSED' . "\n";
2908
+                echo 'NUMBER ('.$substr.') PARSED'."\n";
2911 2909
             }
2912 2910
         } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) {
2913 2911
             if ($this->debug) {
2914 2912
                 echo 'SIMPLE MATH PARSED . "\n"';
2915 2913
             }
2916 2914
             $type   = self::T_MATH;
2917
-            $substr = '(' . $substr . ')';
2915
+            $substr = '('.$substr.')';
2918 2916
         } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) {
2919 2917
             if ($this->debug) {
2920
-                echo 'BREAKCHAR (' . $substr . ') PARSED' . "\n";
2918
+                echo 'BREAKCHAR ('.$substr.') PARSED'."\n";
2921 2919
             }
2922 2920
             $type = self::T_BREAKCHAR;
2923 2921
             //$substr = '"'.$substr.'"';
2924 2922
         } else {
2925
-            $substr = $this->replaceStringVars('\'' . str_replace('\'', '\\\'', $substr) . '\'', '\'', $curBlock);
2923
+            $substr = $this->replaceStringVars('\''.str_replace('\'', '\\\'', $substr).'\'', '\'', $curBlock);
2926 2924
             $type   = self::T_UNQUOTED_STRING;
2927 2925
             if ($this->debug) {
2928
-                echo 'BLABBER (' . $substr . ') CASTED AS STRING' . "\n";
2926
+                echo 'BLABBER ('.$substr.') CASTED AS STRING'."\n";
2929 2927
             }
2930 2928
         }
2931 2929
 
@@ -2955,28 +2953,28 @@  discard block
 block discarded – undo
2955 2953
     {
2956 2954
         $pos = 0;
2957 2955
         if ($this->debug) {
2958
-            echo 'STRING VAR REPLACEMENT : ' . $string . "\n";
2956
+            echo 'STRING VAR REPLACEMENT : '.$string."\n";
2959 2957
         }
2960 2958
         // replace vars
2961 2959
         while (($pos = strpos($string, '$', $pos)) !== false) {
2962
-            $prev = substr($string, $pos - 1, 1);
2960
+            $prev = substr($string, $pos-1, 1);
2963 2961
             if ($prev === '\\') {
2964
-                ++ $pos;
2962
+                ++$pos;
2965 2963
                 continue;
2966 2964
             }
2967 2965
 
2968 2966
             $var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2969 2967
             $len = $var[0];
2970
-            $var = $this->parse(str_replace('\\' . $first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2968
+            $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2971 2969
 
2972
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
2973
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos - 1, $len + 2);
2970
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
2971
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
2974 2972
             } else {
2975
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos, $len);
2973
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
2976 2974
             }
2977
-            $pos += strlen($var[1]) + 2;
2975
+            $pos += strlen($var[1])+2;
2978 2976
             if ($this->debug) {
2979
-                echo 'STRING VAR REPLACEMENT DONE : ' . $string . "\n";
2977
+                echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
2980 2978
             }
2981 2979
         }
2982 2980
 
@@ -3012,7 +3010,7 @@  discard block
 block discarded – undo
3012 3010
     protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null)
3013 3011
     {
3014 3012
         if ($this->debug) {
3015
-            echo 'PARSING MODIFIERS : ' . $m[3] . "\n";
3013
+            echo 'PARSING MODIFIERS : '.$m[3]."\n";
3016 3014
         }
3017 3015
 
3018 3016
         if ($pointer !== null) {
@@ -3036,7 +3034,7 @@  discard block
 block discarded – undo
3036 3034
             }
3037 3035
             if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) {
3038 3036
                 if ($this->debug) {
3039
-                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND' . "\n";
3037
+                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND'."\n";
3040 3038
                 }
3041 3039
                 $continue = false;
3042 3040
                 if ($pointer !== null) {
@@ -3047,7 +3045,7 @@  discard block
 block discarded – undo
3047 3045
             $cmdstr   = $cmdstrsrc;
3048 3046
             $paramsep = ':';
3049 3047
             if (!preg_match('/^(@{0,2}[a-z_][a-z0-9_]*)(:)?/i', $cmdstr, $match)) {
3050
-                throw new CompilationException($this, 'Invalid modifier name, started with : ' . substr($cmdstr, 0, 10));
3048
+                throw new CompilationException($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
3051 3049
             }
3052 3050
             $paramspos = !empty($match[2]) ? strlen($match[1]) : false;
3053 3051
             $func      = $match[1];
@@ -3057,10 +3055,10 @@  discard block
 block discarded – undo
3057 3055
                 $cmdstrsrc = substr($cmdstrsrc, strlen($func));
3058 3056
                 $params    = array();
3059 3057
                 if ($this->debug) {
3060
-                    echo 'MODIFIER (' . $func . ') CALLED WITH NO PARAMS' . "\n";
3058
+                    echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
3061 3059
                 }
3062 3060
             } else {
3063
-                $paramstr = substr($cmdstr, $paramspos + 1);
3061
+                $paramstr = substr($cmdstr, $paramspos+1);
3064 3062
                 if (substr($paramstr, - 1, 1) === $paramsep) {
3065 3063
                     $paramstr = substr($paramstr, 0, - 1);
3066 3064
                 }
@@ -3069,41 +3067,41 @@  discard block
 block discarded – undo
3069 3067
                 $params = array();
3070 3068
                 while ($ptr < strlen($paramstr)) {
3071 3069
                     if ($this->debug) {
3072
-                        echo 'MODIFIER (' . $func . ') START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
3070
+                        echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr."\n";
3073 3071
                     }
3074 3072
                     if ($this->debug) {
3075
-                        echo $paramstr . '--' . $ptr . '--' . strlen($paramstr) . '--modifier' . "\n";
3073
+                        echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier'."\n";
3076 3074
                     }
3077 3075
                     $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr);
3078 3076
                     if ($this->debug) {
3079
-                        echo 'PARAM PARSED, POINTER AT ' . $ptr . "\n";
3077
+                        echo 'PARAM PARSED, POINTER AT '.$ptr."\n";
3080 3078
                     }
3081 3079
 
3082 3080
                     if ($ptr >= strlen($paramstr)) {
3083 3081
                         if ($this->debug) {
3084
-                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED' . "\n";
3082
+                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED'."\n";
3085 3083
                         }
3086 3084
                         break;
3087 3085
                     }
3088 3086
 
3089 3087
                     if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
3090 3088
                         if ($this->debug) {
3091
-                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT ' . $ptr . "\n";
3089
+                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr."\n";
3092 3090
                         }
3093 3091
                         if ($paramstr[$ptr] !== '|') {
3094 3092
                             $continue = false;
3095 3093
                             if ($pointer !== null) {
3096
-                                $pointer -= strlen($paramstr) - $ptr;
3094
+                                $pointer -= strlen($paramstr)-$ptr;
3097 3095
                             }
3098 3096
                         }
3099
-                        ++ $ptr;
3097
+                        ++$ptr;
3100 3098
                         break;
3101 3099
                     }
3102 3100
                     if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') {
3103
-                        ++ $ptr;
3101
+                        ++$ptr;
3104 3102
                     }
3105 3103
                 }
3106
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
3104
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
3107 3105
                 foreach ($params as $k => $p) {
3108 3106
                     if (is_array($p) && is_array($p[1])) {
3109 3107
                         $state |= 2;
@@ -3143,9 +3141,9 @@  discard block
 block discarded – undo
3143 3141
                 $params = self::implode_r($params);
3144 3142
 
3145 3143
                 if ($mapped) {
3146
-                    $output = '$this->arrayMap(\'' . $func . '\', array(' . $params . '))';
3144
+                    $output = '$this->arrayMap(\''.$func.'\', array('.$params.'))';
3147 3145
                 } else {
3148
-                    $output = $func . '(' . $params . ')';
3146
+                    $output = $func.'('.$params.')';
3149 3147
                 }
3150 3148
             } elseif ($pluginType & Core::PROXY_PLUGIN) {
3151 3149
                 $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -3163,36 +3161,36 @@  discard block
 block discarded – undo
3163 3161
                     $callback = $this->customPlugins[$func]['callback'];
3164 3162
                     if (is_array($callback)) {
3165 3163
                         if (is_object($callback[0])) {
3166
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3164
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3167 3165
                         } else {
3168
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3166
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3169 3167
                         }
3170 3168
                     } elseif ($mapped) {
3171
-                        $output = '$this->arrayMap(\'' . $callback . '\', array(' . $params . '))';
3169
+                        $output = '$this->arrayMap(\''.$callback.'\', array('.$params.'))';
3172 3170
                     } else {
3173
-                        $output = $callback . '(' . $params . ')';
3171
+                        $output = $callback.'('.$params.')';
3174 3172
                     }
3175 3173
                 } elseif ($mapped) {
3176
-                    $output = '$this->arrayMap(\'smarty_modifier_' . $func . '\', array(' . $params . '))';
3174
+                    $output = '$this->arrayMap(\'smarty_modifier_'.$func.'\', array('.$params.'))';
3177 3175
                 } else {
3178
-                    $output = 'smarty_modifier_' . $func . '(' . $params . ')';
3176
+                    $output = 'smarty_modifier_'.$func.'('.$params.')';
3179 3177
                 }
3180 3178
             } else {
3181 3179
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
3182 3180
                     $callback   = $this->customPlugins[$func]['callback'];
3183 3181
                     $pluginName = $callback;
3184 3182
                 } else {
3185
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' .
3186
-                            Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3183
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false || function_exists('Plugin'.
3184
+                            Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3187 3185
                         !== false) {
3188
-                        $pluginName = 'Plugin' . Core::toCamelCase($func);
3186
+                        $pluginName = 'Plugin'.Core::toCamelCase($func);
3189 3187
                     } else {
3190
-                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func);
3188
+                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func);
3191 3189
                     }
3192 3190
                     if ($pluginType & Core::CLASS_PLUGIN) {
3193 3191
                         $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process');
3194 3192
                     } else {
3195
-                        $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3193
+                        $callback = $pluginName.(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3196 3194
                     }
3197 3195
                 }
3198 3196
                 $params = $this->mapParams($params, $callback, $state);
@@ -3209,10 +3207,10 @@  discard block
 block discarded – undo
3209 3207
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3210 3208
                             $funcCompiler = $this->customPlugins[$func]['callback'];
3211 3209
                         } else {
3212
-                            if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
3213
-                                $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
3210
+                            if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
3211
+                                $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
3214 3212
                             } else {
3215
-                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
3213
+                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
3216 3214
                                     'Compile';
3217 3215
                             }
3218 3216
                         }
@@ -3223,9 +3221,9 @@  discard block
 block discarded – undo
3223 3221
 
3224 3222
                         $params = self::implode_r($params);
3225 3223
                         if ($mapped) {
3226
-                            $output = '$this->arrayMap(\'' . $pluginName . '\', array(' . $params . '))';
3224
+                            $output = '$this->arrayMap(\''.$pluginName.'\', array('.$params.'))';
3227 3225
                         } else {
3228
-                            $output = $pluginName . '(' . $params . ')';
3226
+                            $output = $pluginName.'('.$params.')';
3229 3227
                         }
3230 3228
                     }
3231 3229
                 } else {
@@ -3237,7 +3235,7 @@  discard block
 block discarded – undo
3237 3235
                             $callback = $this->customPlugins[$func]['callback'];
3238 3236
                             if (!is_array($callback)) {
3239 3237
                                 if (!method_exists($callback, 'compile')) {
3240
-                                    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');
3238
+                                    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');
3241 3239
                                 }
3242 3240
                                 if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
3243 3241
                                     $funcCompiler = array($callback, 'compile');
@@ -3248,11 +3246,11 @@  discard block
 block discarded – undo
3248 3246
                                 $funcCompiler = $callback;
3249 3247
                             }
3250 3248
                         } else {
3251
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3252
-                                $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
3249
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3250
+                                $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
3253 3251
                             } else {
3254 3252
                                 $funcCompiler = array(
3255
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
3253
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
3256 3254
                                     'compile'
3257 3255
                                 );
3258 3256
                             }
@@ -3264,19 +3262,19 @@  discard block
 block discarded – undo
3264 3262
 
3265 3263
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3266 3264
                             if (is_object($callback[0])) {
3267
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3265
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3268 3266
                             } else {
3269
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3267
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3270 3268
                             }
3271 3269
                         } elseif ($mapped) {
3272 3270
                             $output = '$this->arrayMap(array($this->getObjectPlugin(\''.
3273
-                                Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), 
3274
-                            \'process\'), array(' . $params . '))';
3271
+                                Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'\'), 
3272
+                            \'process\'), array(' . $params.'))';
3275 3273
                         } else {
3276
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3277
-                                $output = '$this->classCall(\'Plugin' . Core::toCamelCase($func) . '\', array(' . $params . '))';
3274
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3275
+                                $output = '$this->classCall(\'Plugin'.Core::toCamelCase($func).'\', array('.$params.'))';
3278 3276
                             } else {
3279
-                                $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
3277
+                                $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
3280 3278
                             }
3281 3279
                         }
3282 3280
                     }
@@ -3289,7 +3287,7 @@  discard block
 block discarded – undo
3289 3287
         } elseif ($curBlock === 'var' || $m[1] === null) {
3290 3288
             return $output;
3291 3289
         } elseif ($curBlock === 'string' || $curBlock === 'root') {
3292
-            return $m[1] . '.' . $output . '.' . $m[1] . (isset($add) ? $add : null);
3290
+            return $m[1].'.'.$output.'.'.$m[1].(isset($add) ? $add : null);
3293 3291
         }
3294 3292
 
3295 3293
         return '';
@@ -3312,14 +3310,14 @@  discard block
 block discarded – undo
3312 3310
             if (is_array($p)) {
3313 3311
                 $out2 = 'array(';
3314 3312
                 foreach ($p as $k2 => $v) {
3315
-                    $out2 .= var_export($k2, true) . ' => ' . (is_array($v) ? 'array(' . self::implode_r($v, true) . ')' : $v) . ', ';
3313
+                    $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', ';
3316 3314
                 }
3317
-                $p = rtrim($out2, ', ') . ')';
3315
+                $p = rtrim($out2, ', ').')';
3318 3316
             }
3319 3317
             if ($recursiveCall) {
3320
-                $out .= var_export($k, true) . ' => ' . $p . ', ';
3318
+                $out .= var_export($k, true).' => '.$p.', ';
3321 3319
             } else {
3322
-                $out .= $p . ', ';
3320
+                $out .= $p.', ';
3323 3321
             }
3324 3322
         }
3325 3323
 
@@ -3343,7 +3341,7 @@  discard block
 block discarded – undo
3343 3341
         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)) {
3344 3342
             $phpFunc = true;
3345 3343
         } elseif ($this->securityPolicy !== null && function_exists($name) && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) === false) {
3346
-            throw new SecurityException('Call to a disallowed php function : ' . $name);
3344
+            throw new SecurityException('Call to a disallowed php function : '.$name);
3347 3345
         }
3348 3346
 
3349 3347
         while ($pluginType <= 0) {
@@ -3354,61 +3352,60 @@  discard block
 block discarded – undo
3354 3352
             elseif (isset($this->customPlugins[$name])) {
3355 3353
                 $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN;
3356 3354
             } // Class blocks plugin
3357
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), false) !==
3355
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), false) !==
3358 3356
                 false) {
3359
-                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3357
+                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3360 3358
                     $pluginType = Core::BLOCK_PLUGIN;
3361 3359
                 } else {
3362 3360
                     $pluginType = Core::CLASS_PLUGIN;
3363 3361
                 }
3364
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name));
3362
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name));
3365 3363
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3366 3364
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3367 3365
                 }
3368 3366
             } // Class functions plugin
3369
-            elseif(class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name), false) !==
3367
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name), false) !==
3370 3368
                 false) {
3371 3369
                 $pluginType = Core::CLASS_PLUGIN;
3372
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name));
3370
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name));
3373 3371
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3374 3372
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3375 3373
                 }
3376 3374
             } // Class without namespace
3377
-            elseif(class_exists('Plugin' . Core::toCamelCase($name), false) !== false) {
3375
+            elseif (class_exists('Plugin'.Core::toCamelCase($name), false) !== false) {
3378 3376
                 $pluginType = Core::CLASS_PLUGIN;
3379
-                $interfaces = class_implements('Plugin' . Core::toCamelCase($name));
3377
+                $interfaces = class_implements('Plugin'.Core::toCamelCase($name));
3380 3378
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3381 3379
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3382 3380
                 }
3383 3381
             } // Function plugin (with/without namespaces)
3384
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
3385
-                    ($name)) !==
3386
-                false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3382
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !==
3383
+                false || function_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3387 3384
                 $pluginType = Core::FUNC_PLUGIN;
3388 3385
             } // Function plugin compile (with/without namespaces)
3389
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) .
3390
-                    'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !==
3386
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name).
3387
+                    'Compile') !== false || function_exists('Plugin'.Core::toCamelCase($name).'Compile') !==
3391 3388
                 false) {
3392 3389
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3393 3390
             } // Helper plugin compile
3394
-            elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile')
3391
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name).'Compile')
3395 3392
                 !== false) {
3396 3393
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3397 3394
             } // Smarty modifier
3398
-            elseif (function_exists('smarty_modifier_' . $name) !== false) {
3395
+            elseif (function_exists('smarty_modifier_'.$name) !== false) {
3399 3396
                 $pluginType = Core::SMARTY_MODIFIER;
3400 3397
             } // Smarty function
3401
-            elseif (function_exists('smarty_function_' . $name) !== false) {
3398
+            elseif (function_exists('smarty_function_'.$name) !== false) {
3402 3399
                 $pluginType = Core::SMARTY_FUNCTION;
3403 3400
             } // Smarty block
3404
-            elseif (function_exists('smarty_block_' . $name) !== false) {
3401
+            elseif (function_exists('smarty_block_'.$name) !== false) {
3405 3402
                 $pluginType = Core::SMARTY_BLOCK;
3406 3403
             } // Everything else
3407 3404
             else {
3408 3405
                 if ($pluginType === - 1) {
3409 3406
                     try {
3410 3407
                         $this->getDwoo()->getLoader()->loadPlugin(
3411
-                            'Plugin' . Core::toCamelCase($name));
3408
+                            'Plugin'.Core::toCamelCase($name));
3412 3409
                     }
3413 3410
                     catch (Exception $e) {
3414 3411
                         if (isset($phpFunc)) {
@@ -3421,9 +3418,9 @@  discard block
 block discarded – undo
3421 3418
                         }
3422 3419
                     }
3423 3420
                 } else {
3424
-                    throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType);
3421
+                    throw new Exception('Plugin "'.$name.'" could not be found, type:'.$pluginType);
3425 3422
                 }
3426
-                ++ $pluginType;
3423
+                ++$pluginType;
3427 3424
             }
3428 3425
         }
3429 3426
 
@@ -3498,9 +3495,9 @@  discard block
 block discarded – undo
3498 3495
                 if (count($ps) === 0) {
3499 3496
                     if ($v[1] === false) {
3500 3497
                         throw new CompilationException(
3501
-                            $this, 'Rest argument missing for ' . str_replace(
3498
+                            $this, 'Rest argument missing for '.str_replace(
3502 3499
                                 array(
3503
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3500
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3504 3501
                                 'Compile'
3505 3502
                                 ), '', (is_array($callback) ? $callback[0] : $callback)
3506 3503
                             )
@@ -3533,7 +3530,7 @@  discard block
 block discarded – undo
3533 3530
                 // parameter is not defined and not optional, throw error
3534 3531
                 if (is_array($callback)) {
3535 3532
                     if (is_object($callback[0])) {
3536
-                        $name = get_class($callback[0]) . '::' . $callback[1];
3533
+                        $name = get_class($callback[0]).'::'.$callback[1];
3537 3534
                     } else {
3538 3535
                         $name = $callback[0];
3539 3536
                     }
@@ -3542,9 +3539,9 @@  discard block
 block discarded – undo
3542 3539
                 }
3543 3540
 
3544 3541
                 throw new CompilationException(
3545
-                    $this, 'Argument ' . $k . '/' . $v[0] . ' missing for ' . str_replace(
3542
+                    $this, 'Argument '.$k.'/'.$v[0].' missing for '.str_replace(
3546 3543
                         array(
3547
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3544
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3548 3545
                         'Compile'
3549 3546
                         ), '', $name
3550 3547
                     )
Please login to merge, or discard this patch.
lib/Dwoo/Core.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      * Adds a filter to this Dwoo instance, it will be used to filter the output of all the templates rendered by this
537 537
      * instance.
538 538
      *
539
-     * @param mixed $callback a callback or a filter name if it is autoloaded from a plugin directory
539
+     * @param Smarty\Filter\Adapter $callback a callback or a filter name if it is autoloaded from a plugin directory
540 540
      * @param bool  $autoload if true, the first parameter must be a filter name from one of the plugin directories
541 541
      *
542 542
      * @return void
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
      * @param mixed  $value the value to assign
1548 1548
      * @param string $scope the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property")
1549 1549
      *
1550
-     * @return bool true if assigned correctly or false if a problem occured while parsing the var string
1550
+     * @return null|false true if assigned correctly or false if a problem occured while parsing the var string
1551 1551
      */
1552 1552
     public function assignInScope($value, $scope)
1553 1553
     {
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
             }
376 376
 
377 377
             if ($doCache === true) {
378
-                $out = preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php /*' . $dynamicId . '*/ echo \'$1\'; ?>', $out);
379
-                if (!class_exists(self::NAMESPACE_PLUGINS_BLOCKS . 'PluginDynamic')) {
378
+                $out = preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php /*'.$dynamicId.'*/ echo \'$1\'; ?>', $out);
379
+                if (!class_exists(self::NAMESPACE_PLUGINS_BLOCKS.'PluginDynamic')) {
380 380
                     $this->getLoader()->loadPlugin('PluginDynamic');
381 381
                 }
382 382
                 $out = PluginDynamic::unescape($out, $dynamicId, $compiledTemplate);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
     public function addFilter($callback, $autoload = false)
546 546
     {
547 547
         if ($autoload) {
548
-            $class = self::NAMESPACE_PLUGINS_FILTERS . self::toCamelCase($callback);
548
+            $class = self::NAMESPACE_PLUGINS_FILTERS.self::toCamelCase($callback);
549 549
             if (!class_exists($class) && !function_exists($class)) {
550 550
                 try {
551 551
                     $this->getLoader()->loadPlugin($callback);
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
                 catch (Exception $e) {
554 554
                     if (strstr($callback, self::NAMESPACE_PLUGINS_FILTERS)) {
555 555
                         throw new Exception(
556
-                            'Wrong filter name : ' . $callback . ', the "Dwoo_Filter_" prefix should 
557
-                        not be used, please only use "' . str_replace('Dwoo_Filter_', '', $callback) . '"'
556
+                            'Wrong filter name : '.$callback.', the "Dwoo_Filter_" prefix should 
557
+                        not be used, please only use "' . str_replace('Dwoo_Filter_', '', $callback).'"'
558 558
                         );
559 559
                     } else {
560 560
                         throw new Exception(
561
-                            'Wrong filter name : ' . $callback . ', when using autoload the filter must
561
+                            'Wrong filter name : '.$callback.', when using autoload the filter must
562 562
                          be in one of your plugin dir as "name.php" containig a class or function named
563 563
                          "Dwoo_Filter_name"'
564 564
                         );
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
                 $callback = $class;
573 573
             } else {
574 574
                 throw new Exception(
575
-                    'Wrong filter name : ' . $callback . ', when using autoload the filter must be in
575
+                    'Wrong filter name : '.$callback.', when using autoload the filter must be in
576 576
                 one of your plugin dir as "name.php" containig a class or function named "Dwoo_Filter_name"'
577 577
                 );
578 578
             }
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
      */
593 593
     public function removeFilter($callback)
594 594
     {
595
-        if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS. 'Filter' . self::toCamelCase($callback), $this->filters,
595
+        if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS.'Filter'.self::toCamelCase($callback), $this->filters,
596 596
                 true)) !==
597 597
             false) {
598 598
             unset($this->filters[$index]);
599 599
         } elseif (($index = array_search($callback, $this->filters, true)) !== false) {
600 600
             unset($this->filters[$index]);
601 601
         } else {
602
-            $class = self::NAMESPACE_PLUGINS_FILTERS . 'Filter' . $callback;
602
+            $class = self::NAMESPACE_PLUGINS_FILTERS.'Filter'.$callback;
603 603
             foreach ($this->filters as $index => $filter) {
604 604
                 if (is_array($filter) && $filter[0] instanceof $class) {
605 605
                     unset($this->filters[$index]);
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
     public function getCacheDir()
723 723
     {
724 724
         if ($this->cacheDir === null) {
725
-            $this->setCacheDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);
725
+            $this->setCacheDir(dirname(__DIR__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR);
726 726
         }
727 727
 
728 728
         return $this->cacheDir;
@@ -738,9 +738,9 @@  discard block
 block discarded – undo
738 738
      */
739 739
     public function setCacheDir($dir)
740 740
     {
741
-        $this->cacheDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
741
+        $this->cacheDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
742 742
         if (is_writable($this->cacheDir) === false) {
743
-            throw new Exception('The cache directory must be writable, chmod "' . $this->cacheDir . '" to make it writable');
743
+            throw new Exception('The cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
744 744
         }
745 745
     }
746 746
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
     public function getCompileDir()
753 753
     {
754 754
         if ($this->compileDir === null) {
755
-            $this->setCompileDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'compiled' . DIRECTORY_SEPARATOR);
755
+            $this->setCompileDir(dirname(__DIR__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR);
756 756
         }
757 757
 
758 758
         return $this->compileDir;
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
      */
769 769
     public function setCompileDir($dir)
770 770
     {
771
-        $this->compileDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
771
+        $this->compileDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
772 772
         if (is_writable($this->compileDir) === false) {
773
-            throw new Exception('The compile directory must be writable, chmod "' . $this->compileDir . '" to make it writable');
773
+            throw new Exception('The compile directory must be writable, chmod "'.$this->compileDir.'" to make it writable');
774 774
         }
775 775
     }
776 776
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
      */
794 794
     public function setCacheTime($seconds)
795 795
     {
796
-        $this->cacheTime = (int)$seconds;
796
+        $this->cacheTime = (int) $seconds;
797 797
     }
798 798
 
799 799
     /**
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
      */
818 818
     public function setCharset($charset)
819 819
     {
820
-        $this->charset = strtolower((string)$charset);
820
+        $this->charset = strtolower((string) $charset);
821 821
     }
822 822
 
823 823
     /**
@@ -954,11 +954,11 @@  discard block
 block discarded – undo
954 954
     public function clearCache($olderThan = - 1)
955 955
     {
956 956
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCacheDir()), \RecursiveIteratorIterator::SELF_FIRST);
957
-        $expired  = time() - $olderThan;
957
+        $expired  = time()-$olderThan;
958 958
         $count    = 0;
959 959
         foreach ($iterator as $file) {
960 960
             if ($file->isFile() && $file->getCTime() < $expired) {
961
-                $count += unlink((string)$file) ? 1 : 0;
961
+                $count += unlink((string) $file) ? 1 : 0;
962 962
             }
963 963
         }
964 964
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
             return $class::templateFactory($this, $resourceId, $cacheTime, $cacheId, $compileId, $parentTemplate);
992 992
         }
993 993
 
994
-        throw new Exception('Unknown resource type : ' . $resourceName);
994
+        throw new Exception('Unknown resource type : '.$resourceName);
995 995
     }
996 996
 
997 997
     /**
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
         if (!($tplIdentifier = $this->template->getResourceIdentifier())) {
1092 1092
             $tplIdentifier = $this->template->getResourceName();
1093 1093
         }
1094
-        trigger_error('Dwoo error (in ' . $tplIdentifier . ') : ' . $message, $level);
1094
+        trigger_error('Dwoo error (in '.$tplIdentifier.') : '.$message, $level);
1095 1095
     }
1096 1096
 
1097 1097
     /**
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         if (isset($this->plugins[$blockName])) {
1108 1108
             $class = $this->plugins[$blockName]['class'];
1109 1109
         } else {
1110
-            $class = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . self::toCamelCase($blockName);
1110
+            $class = self::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.self::toCamelCase($blockName);
1111 1111
         }
1112 1112
 
1113 1113
         if ($this->curBlock !== null) {
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
     {
1171 1171
         $index = array_search($block, $this->stack, true);
1172 1172
         if ($index !== false && $index > 0) {
1173
-            return $this->stack[$index - 1];
1173
+            return $this->stack[$index-1];
1174 1174
         }
1175 1175
 
1176 1176
         return false;
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
         if (isset($this->plugins[$type])) {
1189 1189
             $type = $this->plugins[$type]['class'];
1190 1190
         } else {
1191
-            $type = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin_' . str_replace(self::NAMESPACE_PLUGINS_BLOCKS.'Plugin',
1191
+            $type = self::NAMESPACE_PLUGINS_BLOCKS.'Plugin_'.str_replace(self::NAMESPACE_PLUGINS_BLOCKS.'Plugin',
1192 1192
                     '', $type);
1193 1193
         }
1194 1194
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 
1267 1267
                 if (is_string($callback) === false) {
1268 1268
                     while (($i = array_shift($keys)) !== null) {
1269
-                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
1269
+                        $out[] = call_user_func_array($callback, array(1 => $items[$i])+$params);
1270 1270
                     }
1271 1271
                 } elseif ($cnt === 1) {
1272 1272
                     while (($i = array_shift($keys)) !== null) {
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
                     }
1283 1283
                 } else {
1284 1284
                     while (($i = array_shift($keys)) !== null) {
1285
-                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
1285
+                        $out[] = call_user_func_array($callback, array(1 => $items[$i])+$params);
1286 1286
                     }
1287 1287
                 }
1288 1288
             } else {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 
1292 1292
                 if (is_string($callback) === false) {
1293 1293
                     while (($i = array_shift($keys)) !== null) {
1294
-                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
1294
+                        $out[] = call_user_func_array($callback, array($items[$i])+$params);
1295 1295
                     }
1296 1296
                 } elseif ($cnt === 1) {
1297 1297
                     while (($i = array_shift($keys)) !== null) {
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
                     }
1312 1312
                 } else {
1313 1313
                     while (($i = array_shift($keys)) !== null) {
1314
-                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
1314
+                        $out[] = call_user_func_array($callback, array($items[$i])+$params);
1315 1315
                     }
1316 1316
                 }
1317 1317
             }
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
         $tree = $this->scopeTree;
1382 1382
         $cur  = $this->data;
1383 1383
 
1384
-        while ($parentLevels -- !== 0) {
1384
+        while ($parentLevels-- !== 0) {
1385 1385
             array_pop($tree);
1386 1386
         }
1387 1387
 
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
                 } elseif ($varstr === '__' || $varstr === '_root') {
1420 1420
                     return $this->data;
1421 1421
                 } elseif ($varstr === '_' || $varstr === '_parent') {
1422
-                    $varstr = '.' . $varstr;
1422
+                    $varstr = '.'.$varstr;
1423 1423
                     $tree   = $this->scopeTree;
1424 1424
                     $cur    = $this->data;
1425 1425
                     array_pop($tree);
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
             }
1446 1446
 
1447 1447
             if (substr($varstr, 0, 1) === '.') {
1448
-                $varstr = 'dwoo' . $varstr;
1448
+                $varstr = 'dwoo'.$varstr;
1449 1449
             }
1450 1450
 
1451 1451
             preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m);
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
     public function assignInScope($value, $scope)
1553 1553
     {
1554 1554
         if (!is_string($scope)) {
1555
-            $this->triggerError('Assignments must be done into strings, (' . gettype($scope) . ') ' . var_export($scope, true) . ' given', E_USER_ERROR);
1555
+            $this->triggerError('Assignments must be done into strings, ('.gettype($scope).') '.var_export($scope, true).' given', E_USER_ERROR);
1556 1556
         }
1557 1557
         if (strstr($scope, '.') === false && strstr($scope, '->') === false) {
1558 1558
             $this->scope[$scope] = $value;
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
     {
1704 1704
         $proxy = $this->getPluginProxy();
1705 1705
         if (!$proxy) {
1706
-            throw new Exception('Call to undefined method ' . __CLASS__ . '::' . $method . '()');
1706
+            throw new Exception('Call to undefined method '.__CLASS__.'::'.$method.'()');
1707 1707
         }
1708 1708
 
1709 1709
         return call_user_func_array($proxy->getCallback($method), $args);
Please login to merge, or discard this patch.
lib/Dwoo/Loader.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     /**
58 58
      * Loader constructor.
59 59
      *
60
-     * @param $cacheDir
60
+     * @param string $cacheDir
61 61
      */
62 62
     public function __construct($cacheDir)
63 63
     {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function __construct($cacheDir)
63 63
     {
64
-        $this->corePluginDir = __DIR__ . DIRECTORY_SEPARATOR . 'Plugins';
65
-        $this->cacheDir      = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
64
+        $this->corePluginDir = __DIR__.DIRECTORY_SEPARATOR.'Plugins';
65
+        $this->cacheDir      = rtrim($cacheDir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
66 66
 
67 67
         // include class paths or rebuild paths if the cache file isn't there
68
-        $cacheFile = $this->cacheDir . 'classpath.cache.d' . Core::RELEASE_TAG . '.php';
68
+        $cacheFile = $this->cacheDir.'classpath.cache.d'.Core::RELEASE_TAG.'.php';
69 69
         if (file_exists($cacheFile)) {
70 70
             $classpath       = file_get_contents($cacheFile);
71
-            $this->classPath = unserialize($classpath) + $this->classPath;
71
+            $this->classPath = unserialize($classpath)+$this->classPath;
72 72
         } else {
73 73
             $this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
74 74
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         // iterates over all files/folders
93
-        $list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*');
93
+        $list = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*');
94 94
         if (is_array($list)) {
95 95
             foreach ($list as $f) {
96 96
                 if (is_dir($f)) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         // save in file if it's the first call (not recursed)
119 119
         if ($cacheFile !== false) {
120 120
             if (!file_put_contents($cacheFile, serialize($this->classPath))) {
121
-                throw new Exception('Could not write into ' . $cacheFile .
121
+                throw new Exception('Could not write into '.$cacheFile.
122 122
                     ', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
123 123
             }
124 124
             $this->classPath += $tmp;
@@ -144,23 +144,23 @@  discard block
 block discarded – undo
144 144
          * so we check for that before trying to include() the plugin.
145 145
          */
146 146
         if ((!isset($this->classPath[$class]) || !is_readable($this->classPath[$class])) || (!isset
147
-                ($this->classPath[$class . 'Compile']) || !is_readable($this->classPath[$class . 'Compile']))) {
147
+                ($this->classPath[$class.'Compile']) || !is_readable($this->classPath[$class.'Compile']))) {
148 148
             if ($forceRehash) {
149
-                $this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir . 'classpath.cache.d' .
150
-                    Core::RELEASE_TAG . '.php');
149
+                $this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir.'classpath.cache.d'.
150
+                    Core::RELEASE_TAG.'.php');
151 151
                 foreach ($this->paths as $path => $file) {
152 152
                     $this->rebuildClassPathCache($path, $file);
153 153
                 }
154 154
                 if (isset($this->classPath[$class])) {
155 155
                     include_once $this->classPath[$class];
156
-                } elseif (isset($this->classPath[$class . 'Compile'])) {
157
-                    include_once $this->classPath[$class . 'Compile'];
156
+                } elseif (isset($this->classPath[$class.'Compile'])) {
157
+                    include_once $this->classPath[$class.'Compile'];
158 158
                 } else {
159
-                    throw new Exception('Plugin "' . $class .
159
+                    throw new Exception('Plugin "'.$class.
160 160
                         '" can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
161 161
                 }
162 162
             } else {
163
-                throw new Exception('Plugin "' . $class .
163
+                throw new Exception('Plugin "'.$class.
164 164
                     '" can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
165 165
             }
166 166
         }
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $pluginDir = realpath($pluginDirectory);
185 185
         if (!$pluginDir) {
186
-            throw new Exception('Plugin directory does not exist or can not be read : ' . $pluginDirectory);
186
+            throw new Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
187 187
         }
188
-        $cacheFile = $this->cacheDir . 'classpath-' . substr(strtr($pluginDir, '/\\:' . PATH_SEPARATOR, '----'),
189
-                strlen($pluginDir) > 80 ? - 80 : 0) . '.d' . Core::RELEASE_TAG . '.php';
188
+        $cacheFile = $this->cacheDir.'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----'),
189
+                strlen($pluginDir) > 80 ? -80 : 0).'.d'.Core::RELEASE_TAG.'.php';
190 190
         $this->paths[$pluginDir] = $cacheFile;
191 191
         if (file_exists($cacheFile)) {
192 192
             $classpath       = file_get_contents($cacheFile);
193
-            $this->classPath = unserialize($classpath) + $this->classPath;
193
+            $this->classPath = unserialize($classpath)+$this->classPath;
194 194
         } else {
195 195
             $this->rebuildClassPathCache($pluginDir, $cacheFile);
196 196
         }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginDynamic.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@
 block discarded – undo
85 85
 
86 86
     /**
87 87
      * @param $output
88
-     * @param $dynamicId
89
-     * @param $compiledFile
88
+     * @param string $dynamicId
89
+     * @param string $compiledFile
90 90
      *
91 91
      * @return mixed|string
92 92
      */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
         }
68 68
         catch (CompilationException $e) {
69 69
         }
70
-        $output = Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>' . str_replace('\'', '\\\'', $content) . '</dwoo:dynamic_\'.$dynamicId.\'>\';' . "\n} else {\n\t";
70
+        $output = Compiler::PHP_OPEN.'if($doCache) {'."\n\t".'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'.str_replace('\'', '\\\'', $content).'</dwoo:dynamic_\'.$dynamicId.\'>\';'."\n} else {\n\t";
71 71
         if (substr($content, 0, strlen(Compiler::PHP_OPEN)) == Compiler::PHP_OPEN) {
72 72
             $output .= substr($content, strlen(Compiler::PHP_OPEN));
73 73
         } else {
74
-            $output .= Compiler::PHP_CLOSE . $content;
74
+            $output .= Compiler::PHP_CLOSE.$content;
75 75
         }
76 76
         if (substr($output, - strlen(Compiler::PHP_CLOSE)) == Compiler::PHP_CLOSE) {
77 77
             $output = substr($output, 0, - strlen(Compiler::PHP_CLOSE));
78 78
         } else {
79 79
             $output .= Compiler::PHP_OPEN;
80 80
         }
81
-        $output .= "\n}" . Compiler::PHP_CLOSE;
81
+        $output .= "\n}".Compiler::PHP_CLOSE;
82 82
 
83 83
         return $output;
84 84
     }
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public static function unescape($output, $dynamicId, $compiledFile)
94 94
     {
95
-        $output = preg_replace_callback('/<dwoo:dynamic_(' . $dynamicId . ')>(.+?)<\/dwoo:dynamic_' . $dynamicId . '>/s', array(
95
+        $output = preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/s', array(
96 96
             'self',
97 97
             'unescapePhp'
98 98
         ), $output, - 1, $count);
99 99
         // re-add the includes on top of the file
100 100
         if ($count && preg_match('#/\* template head \*/(.+?)/\* end template head \*/#s', file_get_contents($compiledFile), $m)) {
101
-            $output = '<?php ' . $m[1] . ' ?>' . $output;
101
+            $output = '<?php '.$m[1].' ?>'.$output;
102 102
         }
103 103
 
104 104
         return $output;
@@ -111,6 +111,6 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public static function unescapePhp($match)
113 113
     {
114
-        return preg_replace('{<\?php /\*' . $match[1] . '\*/ echo \'(.+?)\'; \?>}s', '$1', $match[2]);
114
+        return preg_replace('{<\?php /\*'.$match[1].'\*/ echo \'(.+?)\'; \?>}s', '$1', $match[2]);
115 115
     }
116 116
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginStrip.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      * @param string   $append
60 60
      * @param string   $content
61 61
      *
62
-     * @return mixed|string
62
+     * @return string
63 63
      */
64 64
     public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content)
65 65
     {
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDump.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -86,6 +86,9 @@  discard block
 block discarded – undo
86 86
         return $out;
87 87
     }
88 88
 
89
+    /**
90
+     * @param string $i
91
+     */
89 92
     protected function exportVar($i, $v)
90 93
     {
91 94
         if (is_string($v) || is_bool($v) || is_numeric($v)) {
@@ -99,6 +102,9 @@  discard block
 block discarded – undo
99 102
         }
100 103
     }
101 104
 
105
+    /**
106
+     * @param string $i
107
+     */
102 108
     protected function exportObj($i, $obj)
103 109
     {
104 110
         if (array_search($obj, $this->outputObjects, true) !== false) {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $out .= $this->export($var, $scope);
64 64
 
65
-        return $out . '</div></div>';
65
+        return $out.'</div></div>';
66 66
     }
67 67
 
68 68
     protected function export($var, $scope)
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
         $out = '';
71 71
         foreach ($var as $i => $v) {
72 72
             if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
73
-                $out .= $i . ' (' . (is_array($v) ? 'array' : 'object: ' . get_class($v)) . ')';
73
+                $out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')';
74 74
                 if ($v === $scope) {
75
-                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">' . $this->export($v, $scope) . '</div>';
75
+                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>';
76 76
                 } else {
77
-                    $out .= ':<div style="padding-left:20px;">' . $this->export($v, $scope) . '</div>';
77
+                    $out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>';
78 78
                 }
79 79
             } elseif (is_object($v)) {
80
-                $out .= $this->exportObj($i . ' (object: ' . get_class($v) . '):', $v);
80
+                $out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v);
81 81
             } else {
82
-                $out .= $this->exportVar($i . ' = ', $v);
82
+                $out .= $this->exportVar($i.' = ', $v);
83 83
             }
84 84
         }
85 85
 
@@ -89,27 +89,27 @@  discard block
 block discarded – undo
89 89
     protected function exportVar($i, $v)
90 90
     {
91 91
         if (is_string($v) || is_bool($v) || is_numeric($v)) {
92
-            return $i . htmlentities(var_export($v, true)) . '<br />';
92
+            return $i.htmlentities(var_export($v, true)).'<br />';
93 93
         } elseif (is_null($v)) {
94
-            return $i . 'null<br />';
94
+            return $i.'null<br />';
95 95
         } elseif (is_resource($v)) {
96
-            return $i . 'resource(' . get_resource_type($v) . ')<br />';
96
+            return $i.'resource('.get_resource_type($v).')<br />';
97 97
         } else {
98
-            return $i . htmlentities(var_export($v, true)) . '<br />';
98
+            return $i.htmlentities(var_export($v, true)).'<br />';
99 99
         }
100 100
     }
101 101
 
102 102
     protected function exportObj($i, $obj)
103 103
     {
104 104
         if (array_search($obj, $this->outputObjects, true) !== false) {
105
-            return $i . ' [recursion, skipped]<br />';
105
+            return $i.' [recursion, skipped]<br />';
106 106
         }
107 107
 
108 108
         $this->outputObjects[] = $obj;
109 109
 
110
-        $list = (array)$obj;
110
+        $list = (array) $obj;
111 111
 
112
-        $protectedLength = strlen(get_class($obj)) + 2;
112
+        $protectedLength = strlen(get_class($obj))+2;
113 113
 
114 114
         $out = array();
115 115
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 
128 128
                 $params = array();
129 129
                 foreach ($method->getParameters() as $param) {
130
-                    $params[] = ($param->isPassedByReference() ? '&' : '') . '$' . $param->getName() . ($param->isOptional() ? ' = ' . var_export($param->getDefaultValue(), true) : '');
130
+                    $params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
131 131
                 }
132 132
 
133
-                $out['method'] .= '(method) ' . $method->getName() . '(' . implode(', ', $params) . ')<br />';
133
+                $out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />';
134 134
             }
135 135
         }
136 136
 
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
                 $out[$key] = '';
150 150
             }
151 151
 
152
-            $out[$key] .= '(' . $key . ') ';
152
+            $out[$key] .= '('.$key.') ';
153 153
 
154 154
             if (is_array($attributeValue)) {
155
-                $out[$key] .= $attributeName . ' (array):<br />
156
-							<div style="padding-left:20px;">' . $this->export($attributeValue, false) . '</div>';
155
+                $out[$key] .= $attributeName.' (array):<br />
156
+							<div style="padding-left:20px;">' . $this->export($attributeValue, false).'</div>';
157 157
             } elseif (is_object($attributeValue)) {
158
-                $out[$key] .= $this->exportObj($attributeName . ' (object: ' . get_class($attributeValue) . '):', $attributeValue);
158
+                $out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue);
159 159
             } else {
160
-                $out[$key] .= $this->exportVar($attributeName . ' = ', $attributeValue);
160
+                $out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue);
161 161
             }
162 162
         }
163 163
 
164
-        $return = $i . '<br /><div style="padding-left:20px;">';
164
+        $return = $i.'<br /><div style="padding-left:20px;">';
165 165
 
166 166
         if (!empty($out['method'])) {
167 167
             $return .= $out['method'];
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
             $return .= $out['private'];
180 180
         }
181 181
 
182
-        return $return . '</div>';
182
+        return $return.'</div>';
183 183
     }
184 184
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Processors/PluginSmartyCompatible.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     /**
30 30
      * @param string $input
31 31
      *
32
-     * @return mixed
32
+     * @return string
33 33
      */
34 34
     public function process($input)
35 35
     {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,38 +38,38 @@  discard block
 block discarded – undo
38 38
         $rl           = preg_quote($l, '/');
39 39
         $rr           = preg_quote($r, '/');
40 40
         $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
41
-        $input        = preg_replace_callback('/' . $rl . '\s*section ' . str_repeat($sectionParam, 6) . '\s*' . $rr . '(.+?)(?:' . $rl . '\s*sectionelse\s*' . $rr . '(.+?))?' . $rl . '\s*\/section\s*' . $rr . '/is', array(
41
+        $input        = preg_replace_callback('/'.$rl.'\s*section '.str_repeat($sectionParam, 6).'\s*'.$rr.'(.+?)(?:'.$rl.'\s*sectionelse\s*'.$rr.'(.+?))?'.$rl.'\s*\/section\s*'.$rr.'/is', array(
42 42
             $this,
43 43
             'convertSection'
44 44
         ), $input);
45
-        $input        = str_replace('$smarty.section.', '$smarty.for.', $input);
45
+        $input = str_replace('$smarty.section.', '$smarty.for.', $input);
46 46
 
47 47
         $smarty = array(
48
-            '/' . $rl . '\s*ldelim\s*' . $rr . '/',
49
-            '/' . $rl . '\s*rdelim\s*' . $rr . '/',
50
-            '/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/',
51
-            '/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/',
48
+            '/'.$rl.'\s*ldelim\s*'.$rr.'/',
49
+            '/'.$rl.'\s*rdelim\s*'.$rr.'/',
50
+            '/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/',
51
+            '/'.$rl.'\s*\$smarty\.rdelim\s*'.$rr.'/',
52 52
             '/\$smarty\./',
53
-            '/' . $rl . '\s*php\s*' . $rr . '/',
54
-            '/' . $rl . '\s*\/php\s*' . $rr . '/',
55
-            '/\|(@?)strip(\||' . $rr . ')/',
56
-            '/' . $rl . '\s*sectionelse\s*' . $rr . '/',
53
+            '/'.$rl.'\s*php\s*'.$rr.'/',
54
+            '/'.$rl.'\s*\/php\s*'.$rr.'/',
55
+            '/\|(@?)strip(\||'.$rr.')/',
56
+            '/'.$rl.'\s*sectionelse\s*'.$rr.'/',
57 57
         );
58 58
 
59 59
         $dwoo = array(
60
-            '\\' . $l,
60
+            '\\'.$l,
61 61
             $r,
62
-            '\\' . $l,
62
+            '\\'.$l,
63 63
             $r,
64 64
             '$dwoo.',
65 65
             '<?php ',
66 66
             ' ?>',
67 67
             '|$1whitespace$2',
68
-            $l . 'else' . $r,
68
+            $l.'else'.$r,
69 69
         );
70 70
 
71 71
         if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
72
-            trigger_error('The Smarty Compatibility Module has detected that you use |@' . $matches[1] . ' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE);
72
+            trigger_error('The Smarty Compatibility Module has detected that you use |@'.$matches[1].' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE);
73 73
         }
74 74
 
75 75
         return preg_replace($smarty, $dwoo, $input);
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         $params = array();
86 86
         $index  = 1;
87 87
         while (!empty($matches[$index]) && $index < 13) {
88
-            $params[$matches[$index]] = $matches[$index + 1];
88
+            $params[$matches[$index]] = $matches[$index+1];
89 89
             $index += 2;
90 90
         }
91 91
 
92
-        return str_replace('[' . trim($params['name'], '"\'') . ']', '[$' . trim($params['name'], '"\'') . ']', $matches[0]);
92
+        return str_replace('['.trim($params['name'], '"\'').']', '[$'.trim($params['name'], '"\'').']', $matches[0]);
93 93
     }
94 94
 }
Please login to merge, or discard this patch.