Completed
Push — master ( a400a4...020752 )
by David
07:41 queued 04:43
created
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   +380 added lines, -382 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function setNestedCommentsHandling($allow = true)
296 296
     {
297
-        $this->allowNestedComments = (bool)$allow;
297
+        $this->allowNestedComments = (bool) $allow;
298 298
     }
299 299
 
300 300
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      */
320 320
     public function setLooseOpeningHandling($allow = false)
321 321
     {
322
-        $this->allowLooseOpenings = (bool)$allow;
322
+        $this->allowLooseOpenings = (bool) $allow;
323 323
     }
324 324
 
325 325
     /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function setAutoEscape($enabled)
346 346
     {
347
-        $this->autoEscape = (bool)$enabled;
347
+        $this->autoEscape = (bool) $enabled;
348 348
     }
349 349
 
350 350
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if ($autoload) {
373 373
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', Core::toCamelCase($callback));
374
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . $name;
374
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.$name;
375 375
 
376 376
             if (class_exists($class)) {
377 377
                 $callback = array(new $class($this), 'process');
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
     {
397 397
         if (($index = array_search($callback, $this->processors['pre'], true)) !== false) {
398 398
             unset($this->processors['pre'][$index]);
399
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
399
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
400 400
                     $callback),
401 401
                 $this->processors['pre'], true)) !== false) {
402 402
             unset($this->processors['pre'][$index]);
403 403
         } else {
404
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
404
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
405 405
             foreach ($this->processors['pre'] as $index => $proc) {
406 406
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
407 407
                     unset($this->processors['pre'][$index]);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         if ($autoload) {
426 426
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
427
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . Core::toCamelCase($name);
427
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.Core::toCamelCase($name);
428 428
 
429 429
             if (class_exists($class)) {
430 430
                 $callback = array(new $class($this), 'process');
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     {
450 450
         if (($index = array_search($callback, $this->processors['post'], true)) !== false) {
451 451
             unset($this->processors['post'][$index]);
452
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
452
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
453 453
                     $callback),
454 454
                 $this->processors['post'], true)) !== false) {
455 455
             unset($this->processors['post'][$index]);
456 456
         } else {
457
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
457
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
458 458
             foreach ($this->processors['post'] as $index => $proc) {
459 459
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
460 460
                     unset($this->processors['post'][$index]);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 $this->getDwoo()->getLoader()->loadPlugin($name);
481 481
             }
482 482
             catch (Exception $e) {
483
-                throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory');
483
+                throw new Exception('Processor '.$name.' could not be found in your plugin directories, please ensure it is in a file named '.$name.'.php in the plugin directory');
484 484
             }
485 485
         }
486 486
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     public function setTemplateSource($newSource, $fromPointer = false)
667 667
     {
668 668
         if ($fromPointer === true) {
669
-            $this->templateSource = substr($this->templateSource, 0, $this->pointer) . $newSource;
669
+            $this->templateSource = substr($this->templateSource, 0, $this->pointer).$newSource;
670 670
         } else {
671 671
             $this->templateSource = $newSource;
672 672
         }
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 
738 738
                 if ($this->debug) {
739 739
                     echo "\n";
740
-                    echo 'COMPILER INIT' . "\n";
740
+                    echo 'COMPILER INIT'."\n";
741 741
                 }
742 742
 
743 743
                 if ($this->debug) {
744
-                    echo 'PROCESSING PREPROCESSORS (' . count($this->processors['pre']) . ')' . "\n";
744
+                    echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')'."\n";
745 745
                 }
746 746
 
747 747
                 // runs preprocessors
@@ -785,23 +785,23 @@  discard block
 block discarded – undo
785 785
             if ($pos === false) {
786 786
                 $this->push(substr($tpl, $ptr), 0);
787 787
                 break;
788
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
789
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1) . $this->ld);
790
-                $ptr = $pos + strlen($this->ld);
791
-            } elseif (preg_match('/^' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . 'literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', substr($tpl, $pos), $litOpen)) {
792
-                if (!preg_match('/' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . '\/literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
788
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
789
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
790
+                $ptr = $pos+strlen($this->ld);
791
+            } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
792
+                if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
793 793
                     throw new CompilationException($this, 'The {literal} blocks must be closed explicitly with {/literal}');
794 794
                 }
795 795
                 $endpos = $litClose[0][1];
796
-                $this->push(substr($tpl, $ptr, $pos - $ptr) . substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
797
-                $ptr = $endpos + strlen($litClose[0][0]);
796
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
797
+                $ptr = $endpos+strlen($litClose[0][0]);
798 798
             } else {
799
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
800
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
799
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
800
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
801 801
                     $ptr = $pos;
802 802
                 }
803 803
 
804
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
804
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
805 805
                 $ptr = $pos;
806 806
 
807 807
                 $pos += strlen($this->ld);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
                 // check that there is an end tag present
821 821
                 if (strpos($tpl, $this->rd, $pos) === false) {
822
-                    throw new CompilationException($this, 'A template tag was not closed, started with "' . substr($tpl, $ptr, 30) . '"');
822
+                    throw new CompilationException($this, 'A template tag was not closed, started with "'.substr($tpl, $ptr, 30).'"');
823 823
                 }
824 824
 
825 825
                 $ptr += strlen($this->ld);
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                         continue 2;
834 834
                     }
835 835
 
836
-                    $len = $subptr - $ptr;
836
+                    $len = $subptr-$ptr;
837 837
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
838 838
                     $ptr += $len;
839 839
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
         $compiled .= $this->removeBlock('TopLevelBlock');
848 848
 
849 849
         if ($this->debug) {
850
-            echo 'PROCESSING POSTPROCESSORS' . "\n";
850
+            echo 'PROCESSING POSTPROCESSORS'."\n";
851 851
         }
852 852
 
853 853
         foreach ($this->processors['post'] as $postProc) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         unset($postProc);
864 864
 
865 865
         if ($this->debug) {
866
-            echo 'COMPILATION COMPLETE : MEM USAGE : ' . memory_get_usage() . "\n";
866
+            echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage()."\n";
867 867
         }
868 868
 
869 869
         $output = "<?php\n/* template head */\n";
@@ -876,30 +876,30 @@  discard block
 block discarded – undo
876 876
 
877 877
             switch ($type) {
878 878
                 case Core::CLASS_PLUGIN:
879
-                case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
879
+                case Core::CLASS_PLUGIN+Core::BLOCK_PLUGIN:
880
+                    if (class_exists('Plugin'.$plugin) !== false) {
881
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
882 882
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883 883
                     } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
884
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_BLOCKS."Plugin".$plugin."')===false)".
885 885
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886 886
                     }
887 887
                     break;
888
-                case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN:
889
-                    if (class_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
888
+                case Core::CLASS_PLUGIN+Core::FUNC_PLUGIN:
889
+                    if (class_exists('Plugin'.$plugin) !== false) {
890
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
891 891
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892 892
                     } else {
893
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
893
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
894 894
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895 895
                     }
896 896
                     break;
897 897
                 case Core::FUNC_PLUGIN:
898
-                    if (function_exists('Plugin' . $plugin) !== false) {
899
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
898
+                    if (function_exists('Plugin'.$plugin) !== false) {
899
+                        $output .= "if (function_exists('"."Plugin".$plugin."')===false)".
900 900
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
901 901
                     } else {
902
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
902
+                        $output .= "if (function_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
903 903
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
904 904
                     }
905 905
                     break;
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                     $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
920 920
                     break;
921 921
                 default:
922
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
922
+                    throw new CompilationException($this, 'Type error for '.$plugin.' with type'.$type);
923 923
             }
924 924
         }
925 925
 
@@ -930,30 +930,30 @@  discard block
 block discarded – undo
930 930
         }
931 931
         foreach ($this->templatePlugins as $function) {
932 932
             if (isset($function['called']) && $function['called'] === true) {
933
-                $output .= $function['body'] . PHP_EOL;
933
+                $output .= $function['body'].PHP_EOL;
934 934
             }
935 935
         }
936 936
 
937
-        $output .= $compiled . "\n?>";
937
+        $output .= $compiled."\n?>";
938 938
 
939
-        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*' . preg_quote(self::PHP_CLOSE, '/') . preg_quote(self::PHP_OPEN, '/') . ')/', ";\n", $output);
940
-        $output = str_replace(self::PHP_CLOSE . self::PHP_OPEN, "\n", $output);
939
+        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*'.preg_quote(self::PHP_CLOSE, '/').preg_quote(self::PHP_OPEN, '/').')/', ";\n", $output);
940
+        $output = str_replace(self::PHP_CLOSE.self::PHP_OPEN, "\n", $output);
941 941
 
942 942
         // handle <?xml tag at the beginning
943 943
         $output = preg_replace('#(/\* template body \*/ \?>\s*)<\?xml#is', '$1<?php echo \'<?xml\'; ?>', $output);
944 944
 
945 945
         // add another line break after PHP closing tags that have a line break following,
946 946
         // as we do not know whether it's intended, and PHP will strip it otherwise
947
-        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0' . "\n", $output);
947
+        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0'."\n", $output);
948 948
 
949 949
         if ($this->debug) {
950
-            echo '=============================================================================================' . "\n";
950
+            echo '============================================================================================='."\n";
951 951
             $lines = preg_split('{\r\n|\n|<br />}', $output);
952 952
             array_shift($lines);
953 953
             foreach ($lines as $i => $line) {
954
-                echo ($i + 1) . '. ' . $line . "\r\n";
954
+                echo ($i+1).'. '.$line."\r\n";
955 955
             }
956
-            echo '=============================================================================================' . "\n";
956
+            echo '============================================================================================='."\n";
957 957
         }
958 958
 
959 959
         $this->template = $this->dwoo = null;
@@ -970,13 +970,13 @@  discard block
 block discarded – undo
970 970
     protected function resolveSubTemplateDependencies($function)
971 971
     {
972 972
         if ($this->debug) {
973
-            echo 'Compiler::' . __FUNCTION__ . "\n";
973
+            echo 'Compiler::'.__FUNCTION__."\n";
974 974
         }
975 975
 
976 976
         $body = $this->templatePlugins[$function]['body'];
977 977
         foreach ($this->templatePlugins as $func => $attr) {
978
-            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
979
-            'Plugin' . Core::toCamelCase($func)) !== false) {
978
+            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS.
979
+            'Plugin'.Core::toCamelCase($func)) !== false) {
980 980
                 $this->templatePlugins[$func]['called'] = true;
981 981
                 $this->resolveSubTemplateDependencies($func);
982 982
             }
@@ -1000,14 +1000,14 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
1002 1002
             // buffer is not initialized yet (the block has just been created)
1003
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content;
1003
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
1004 1004
             $this->curBlock['buffer'] = '';
1005 1005
         } else {
1006 1006
             if (!isset($this->curBlock['buffer'])) {
1007 1007
                 throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere');
1008 1008
             }
1009 1009
             // append current content to current block's buffer
1010
-            $this->curBlock['buffer'] .= (string)$content;
1010
+            $this->curBlock['buffer'] .= (string) $content;
1011 1011
         }
1012 1012
         $this->line += $lineCount;
1013 1013
     }
@@ -1077,23 +1077,23 @@  discard block
 block discarded – undo
1077 1077
     public function addBlock($type, array $params, $paramtype)
1078 1078
     {
1079 1079
         if ($this->debug) {
1080
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1080
+            echo 'Compiler::'.__FUNCTION__."\n";
1081 1081
         }
1082 1082
 
1083
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1083
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1084 1084
         if (class_exists($class) === false) {
1085 1085
             $this->getDwoo()->getLoader()->loadPlugin($type);
1086 1086
         }
1087 1087
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1088 1088
 
1089
-        $this->stack[]  = array(
1089
+        $this->stack[] = array(
1090 1090
             'type'   => $type,
1091 1091
             'params' => $params,
1092 1092
             'custom' => false,
1093 1093
             'class'  => $class,
1094 1094
             'buffer' => null
1095 1095
         );
1096
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1096
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1097 1097
 
1098 1098
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1099 1099
     }
@@ -1118,14 +1118,14 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1120 1120
 
1121
-        $this->stack[]  = array(
1121
+        $this->stack[] = array(
1122 1122
             'type'   => $type,
1123 1123
             'params' => $params,
1124 1124
             'custom' => true,
1125 1125
             'class'  => $class,
1126 1126
             'buffer' => null
1127 1127
         );
1128
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1128
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1129 1129
 
1130 1130
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1131 1131
     }
@@ -1140,21 +1140,21 @@  discard block
 block discarded – undo
1140 1140
     public function injectBlock($type, array $params)
1141 1141
     {
1142 1142
         if ($this->debug) {
1143
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1143
+            echo 'Compiler::'.__FUNCTION__."\n";
1144 1144
         }
1145 1145
 
1146
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1146
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1147 1147
         if (class_exists($class) === false) {
1148 1148
             $this->getDwoo()->getLoader()->loadPlugin($type);
1149 1149
         }
1150
-        $this->stack[]  = array(
1150
+        $this->stack[] = array(
1151 1151
             'type'   => $type,
1152 1152
             'params' => $params,
1153 1153
             'custom' => false,
1154 1154
             'class'  => $class,
1155 1155
             'buffer' => null
1156 1156
         );
1157
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1157
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1158 1158
     }
1159 1159
 
1160 1160
     /**
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
     public function removeBlock($type)
1170 1170
     {
1171 1171
         if ($this->debug) {
1172
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1172
+            echo 'Compiler::'.__FUNCTION__."\n";
1173 1173
         }
1174 1174
 
1175 1175
         $output = '';
@@ -1183,10 +1183,10 @@  discard block
 block discarded – undo
1183 1183
                 if ($top['custom']) {
1184 1184
                     $class = $top['class'];
1185 1185
                 } else {
1186
-                    $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type']);
1186
+                    $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($top['type']);
1187 1187
                 }
1188 1188
                 if (count($this->stack)) {
1189
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1189
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1190 1190
                     $this->push(call_user_func(array(
1191 1191
                         $class,
1192 1192
                         'postProcessing'
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
                 }
1208 1208
             }
1209 1209
 
1210
-            throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened');
1210
+            throw new CompilationException($this, 'Syntax malformation, a block of type "'.$type.'" was closed but was not opened');
1211 1211
         }
1212 1212
 
1213 1213
         return $output;
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
             }
1246 1246
         }
1247 1247
 
1248
-        throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found');
1248
+        throw new CompilationException($this, 'A parent block of type "'.$type.'" is required and can not be found');
1249 1249
     }
1250 1250
 
1251 1251
     /**
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
     public function removeTopBlock()
1269 1269
     {
1270 1270
         if ($this->debug) {
1271
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1271
+            echo 'Compiler::'.__FUNCTION__."\n";
1272 1272
         }
1273 1273
 
1274 1274
         $o = array_pop($this->stack);
@@ -1278,10 +1278,10 @@  discard block
 block discarded – undo
1278 1278
         if ($o['custom']) {
1279 1279
             $class = $o['class'];
1280 1280
         } else {
1281
-            $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']);
1281
+            $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($o['type']);
1282 1282
         }
1283 1283
 
1284
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1284
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1285 1285
 
1286 1286
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1287 1287
     }
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
     protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1361 1361
     {
1362 1362
         if ($this->debug) {
1363
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1363
+            echo 'Compiler::'.__FUNCTION__."\n";
1364 1364
         }
1365 1365
 
1366 1366
         if ($to === null) {
@@ -1377,14 +1377,14 @@  discard block
 block discarded – undo
1377 1377
                 // end template tag
1378 1378
                 $pointer += strlen($this->rd);
1379 1379
                 if ($this->debug) {
1380
-                    echo 'TEMPLATE PARSING ENDED' . "\n";
1380
+                    echo 'TEMPLATE PARSING ENDED'."\n";
1381 1381
                 }
1382 1382
 
1383 1383
                 return false;
1384 1384
             }
1385
-            ++ $from;
1385
+            ++$from;
1386 1386
             if ($pointer !== null) {
1387
-                ++ $pointer;
1387
+                ++$pointer;
1388 1388
             }
1389 1389
             if ($from >= $to) {
1390 1390
                 if (is_array($parsingParams)) {
@@ -1396,22 +1396,22 @@  discard block
 block discarded – undo
1396 1396
             $first = $in[$from];
1397 1397
         }
1398 1398
 
1399
-        $substr = substr($in, $from, $to - $from);
1399
+        $substr = substr($in, $from, $to-$from);
1400 1400
 
1401 1401
         if ($this->debug) {
1402
-            echo 'PARSE CALL : PARSING "' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n";
1402
+            echo 'PARSE CALL : PARSING "'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1403 1403
         }
1404 1404
         $parsed = '';
1405 1405
 
1406 1406
         if ($curBlock === 'root' && $first === '*') {
1407 1407
             $src      = $this->getTemplateSource();
1408
-            $startpos = $this->getPointer() - strlen($this->ld);
1408
+            $startpos = $this->getPointer()-strlen($this->ld);
1409 1409
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1410 1410
                 if ($startpos > 0) {
1411 1411
                     do {
1412 1412
                         $char = substr($src, -- $startpos, 1);
1413 1413
                         if ($char == "\n") {
1414
-                            ++ $startpos;
1414
+                            ++$startpos;
1415 1415
                             $whitespaceStart = true;
1416 1416
                             break;
1417 1417
                         }
@@ -1422,12 +1422,12 @@  discard block
 block discarded – undo
1422 1422
                 if (!isset($whitespaceStart)) {
1423 1423
                     $startpos = $this->getPointer();
1424 1424
                 } else {
1425
-                    $pointer -= $this->getPointer() - $startpos;
1425
+                    $pointer -= $this->getPointer()-$startpos;
1426 1426
                 }
1427 1427
 
1428
-                if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) {
1429
-                    $comOpen  = $this->ld . '*';
1430
-                    $comClose = '*' . $this->rd;
1428
+                if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
1429
+                    $comOpen  = $this->ld.'*';
1430
+                    $comClose = '*'.$this->rd;
1431 1431
                     $level    = 1;
1432 1432
                     $ptr      = $this->getPointer();
1433 1433
 
@@ -1437,33 +1437,33 @@  discard block
 block discarded – undo
1437 1437
 
1438 1438
                         if ($open !== false && $close !== false) {
1439 1439
                             if ($open < $close) {
1440
-                                $ptr = $open + strlen($comOpen);
1441
-                                ++ $level;
1440
+                                $ptr = $open+strlen($comOpen);
1441
+                                ++$level;
1442 1442
                             } else {
1443
-                                $ptr = $close + strlen($comClose);
1444
-                                -- $level;
1443
+                                $ptr = $close+strlen($comClose);
1444
+                                --$level;
1445 1445
                             }
1446 1446
                         } elseif ($open !== false) {
1447
-                            $ptr = $open + strlen($comOpen);
1448
-                            ++ $level;
1447
+                            $ptr = $open+strlen($comOpen);
1448
+                            ++$level;
1449 1449
                         } elseif ($close !== false) {
1450
-                            $ptr = $close + strlen($comClose);
1451
-                            -- $level;
1450
+                            $ptr = $close+strlen($comClose);
1451
+                            --$level;
1452 1452
                         } else {
1453 1453
                             $ptr = strlen($src);
1454 1454
                         }
1455 1455
                     }
1456
-                    $endpos = $ptr - strlen('*' . $this->rd);
1456
+                    $endpos = $ptr-strlen('*'.$this->rd);
1457 1457
                 } else {
1458
-                    $endpos = strpos($src, '*' . $this->rd, $startpos);
1458
+                    $endpos = strpos($src, '*'.$this->rd, $startpos);
1459 1459
                     if ($endpos == false) {
1460 1460
                         throw new CompilationException($this, 'Un-ended comment');
1461 1461
                     }
1462 1462
                 }
1463
-                $pointer += $endpos - $startpos + strlen('*' . $this->rd);
1464
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) {
1463
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1464
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1465 1465
                     $pointer += strlen($m[0]);
1466
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1466
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1467 1467
                 }
1468 1468
 
1469 1469
                 return false;
@@ -1480,20 +1480,20 @@  discard block
 block discarded – undo
1480 1480
         } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) {
1481 1481
             // string
1482 1482
             $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer);
1483
-        } 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)) {
1483
+        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?('.(is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|').'\s*\(|\s*'.$this->rdr.'|\s*;)/i', $substr)) {
1484 1484
             // func
1485 1485
             $out    = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer);
1486 1486
             $parsed = 'func';
1487 1487
         } elseif ($first === ';') {
1488 1488
             // instruction end
1489 1489
             if ($this->debug) {
1490
-                echo 'END OF INSTRUCTION' . "\n";
1490
+                echo 'END OF INSTRUCTION'."\n";
1491 1491
             }
1492 1492
             if ($pointer !== null) {
1493
-                ++ $pointer;
1493
+                ++$pointer;
1494 1494
             }
1495 1495
 
1496
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1496
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1497 1497
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1498 1498
             // close block
1499 1499
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1510,13 +1510,13 @@  discard block
 block discarded – undo
1510 1510
                     $pointer -= strlen($match[0]);
1511 1511
                 }
1512 1512
                 if ($this->debug) {
1513
-                    echo 'TOP BLOCK CLOSED' . "\n";
1513
+                    echo 'TOP BLOCK CLOSED'."\n";
1514 1514
                 }
1515 1515
 
1516 1516
                 return $this->removeTopBlock();
1517 1517
             } else {
1518 1518
                 if ($this->debug) {
1519
-                    echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n";
1519
+                    echo 'BLOCK OF TYPE '.$match[1].' CLOSED'."\n";
1520 1520
                 }
1521 1521
 
1522 1522
                 return $this->removeBlock($match[1]);
@@ -1524,19 +1524,19 @@  discard block
 block discarded – undo
1524 1524
         } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) {
1525 1525
             // end template tag
1526 1526
             if ($this->debug) {
1527
-                echo 'TAG PARSING ENDED' . "\n";
1527
+                echo 'TAG PARSING ENDED'."\n";
1528 1528
             }
1529 1529
             $pointer += strlen($this->rd);
1530 1530
 
1531 1531
             return false;
1532
-        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) {
1532
+        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?' : '').')(?:\s+|[^=]).*#i', $substr, $match)) {
1533 1533
             // named parameter
1534 1534
             if ($this->debug) {
1535
-                echo 'NAMED PARAM FOUND' . "\n";
1535
+                echo 'NAMED PARAM FOUND'."\n";
1536 1536
             }
1537 1537
             $len = strlen($match[1]);
1538
-            while (substr($in, $from + $len, 1) === ' ') {
1539
-                ++ $len;
1538
+            while (substr($in, $from+$len, 1) === ' ') {
1539
+                ++$len;
1540 1540
             }
1541 1541
             if ($pointer !== null) {
1542 1542
                 $pointer += $len;
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 
1545 1545
             $output = array(
1546 1546
                 trim($match[1], " \t\r\n=>'\""),
1547
-                $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer)
1547
+                $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer)
1548 1548
             );
1549 1549
 
1550 1550
             $parsingParams[] = $output;
@@ -1565,31 +1565,31 @@  discard block
 block discarded – undo
1565 1565
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1566 1566
         } else {
1567 1567
             // parse error
1568
-            throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"');
1568
+            throw new CompilationException($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1569 1569
         }
1570 1570
 
1571 1571
         if (empty($out)) {
1572 1572
             return '';
1573 1573
         }
1574 1574
 
1575
-        $substr = substr($in, $pointer, $to - $pointer);
1575
+        $substr = substr($in, $pointer, $to-$pointer);
1576 1576
 
1577 1577
         // var parsed, check if any var-extension applies
1578 1578
         if ($parsed === 'var') {
1579 1579
             if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) {
1580 1580
                 if ($this->debug) {
1581
-                    echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n";
1581
+                    echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1582 1582
                 }
1583 1583
                 // parse expressions
1584
-                $pointer += strlen($match[0]) - 1;
1584
+                $pointer += strlen($match[0])-1;
1585 1585
                 if (is_array($parsingParams)) {
1586 1586
                     if ($match[2] == '$') {
1587 1587
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1588 1588
                     } else {
1589 1589
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1590 1590
                     }
1591
-                    $out[count($out) - 1][0] .= $match[1] . $expr[0][0];
1592
-                    $out[count($out) - 1][1] .= $match[1] . $expr[0][1];
1591
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1592
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1593 1593
                 } else {
1594 1594
                     if ($match[2] == '$') {
1595 1595
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1597,26 +1597,26 @@  discard block
 block discarded – undo
1597 1597
                         $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer);
1598 1598
                     }
1599 1599
                     if (is_array($out) && is_array($expr)) {
1600
-                        $out[0] .= $match[1] . $expr[0];
1601
-                        $out[1] .= $match[1] . $expr[1];
1600
+                        $out[0] .= $match[1].$expr[0];
1601
+                        $out[1] .= $match[1].$expr[1];
1602 1602
                     } elseif (is_array($out)) {
1603
-                        $out[0] .= $match[1] . $expr;
1604
-                        $out[1] .= $match[1] . $expr;
1603
+                        $out[0] .= $match[1].$expr;
1604
+                        $out[1] .= $match[1].$expr;
1605 1605
                     } elseif (is_array($expr)) {
1606
-                        $out .= $match[1] . $expr[0];
1606
+                        $out .= $match[1].$expr[0];
1607 1607
                     } else {
1608
-                        $out .= $match[1] . $expr;
1608
+                        $out .= $match[1].$expr;
1609 1609
                     }
1610 1610
                 }
1611 1611
             } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) {
1612 1612
                 if ($this->debug) {
1613
-                    echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n";
1613
+                    echo 'PARSING POST-VAR ASSIGNMENT '.$substr."\n";
1614 1614
                 }
1615 1615
                 // parse assignment
1616 1616
                 $value    = $match[2];
1617 1617
                 $operator = trim($match[1]);
1618 1618
                 if (substr($value, 0, 1) == '=') {
1619
-                    throw new CompilationException($this, 'Unexpected "=" in <em>' . $substr . '</em>');
1619
+                    throw new CompilationException($this, 'Unexpected "=" in <em>'.$substr.'</em>');
1620 1620
                 }
1621 1621
 
1622 1622
                 if ($pointer !== null) {
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
                         throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible');
1638 1638
                     }
1639 1639
 
1640
-                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1);
1640
+                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf', 'init'), 1);
1641 1641
                     $tokens = $this->getParamTokens($parts);
1642 1642
                     $parts  = $this->getCompiledParams($parts);
1643 1643
 
@@ -1651,14 +1651,14 @@  discard block
 block discarded – undo
1651 1651
                 if ($this->autoEscape) {
1652 1652
                     $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out);
1653 1653
                 }
1654
-                $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE;
1654
+                $out = self::PHP_OPEN.$echo.$out.$operator.implode(' ', $value).self::PHP_CLOSE;
1655 1655
             } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) {
1656 1656
                 // parse namedparam with var as name (only for array)
1657 1657
                 if ($this->debug) {
1658
-                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n";
1658
+                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1659 1659
                 }
1660 1660
                 $len = strlen($match[1]);
1661
-                $var = $out[count($out) - 1];
1661
+                $var = $out[count($out)-1];
1662 1662
                 $pointer += $len;
1663 1663
 
1664 1664
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1673,16 +1673,16 @@  discard block
 block discarded – undo
1673 1673
             // parse modifier on funcs or vars
1674 1674
             $srcPointer = $pointer;
1675 1675
             if (is_array($parsingParams)) {
1676
-                $tmp                     = $this->replaceModifiers(
1676
+                $tmp = $this->replaceModifiers(
1677 1677
                     array(
1678 1678
                     null,
1679 1679
                     null,
1680
-                    $out[count($out) - 1][0],
1680
+                    $out[count($out)-1][0],
1681 1681
                     $match[0]
1682 1682
                     ), $curBlock, $pointer
1683 1683
                 );
1684
-                $out[count($out) - 1][0] = $tmp;
1685
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1684
+                $out[count($out)-1][0] = $tmp;
1685
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1686 1686
             } else {
1687 1687
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1688 1688
             }
@@ -1694,10 +1694,10 @@  discard block
 block discarded – undo
1694 1694
             $ptr = 0;
1695 1695
 
1696 1696
             if (is_array($parsingParams)) {
1697
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1697
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1698 1698
 
1699
-                $out[count($out) - 1][0] = $output;
1700
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1699
+                $out[count($out)-1][0] = $output;
1700
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1701 1701
             } else {
1702 1702
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1703 1703
             }
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
         }
1707 1707
 
1708 1708
         if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) {
1709
-            return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE;
1709
+            return self::PHP_OPEN.'echo '.$out.';'.self::PHP_CLOSE;
1710 1710
         }
1711 1711
 
1712 1712
         return $out;
@@ -1732,11 +1732,11 @@  discard block
 block discarded – undo
1732 1732
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1733 1733
     {
1734 1734
         $output = '';
1735
-        $cmdstr = substr($in, $from, $to - $from);
1736
-        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match);
1735
+        $cmdstr = substr($in, $from, $to-$from);
1736
+        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1737 1737
 
1738 1738
         if (empty($match[1])) {
1739
-            throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15));
1739
+            throw new CompilationException($this, 'Parse error, invalid function name : '.substr($cmdstr, 0, 15));
1740 1740
         }
1741 1741
 
1742 1742
         $func = $match[1];
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
         }
1747 1747
 
1748 1748
         if ($this->debug) {
1749
-            echo 'FUNC FOUND (' . $func . ')' . "\n";
1749
+            echo 'FUNC FOUND ('.$func.')'."\n";
1750 1750
         }
1751 1751
 
1752 1752
         $paramsep = '';
@@ -1758,11 +1758,11 @@  discard block
 block discarded – undo
1758 1758
             $paramspos = $match[1][0][1];
1759 1759
             $paramsep  = substr($match[1][0][0], - 1) === '(' ? ')' : '';
1760 1760
             if ($paramsep === ')') {
1761
-                $paramspos += strlen($match[1][0][0]) - 1;
1761
+                $paramspos += strlen($match[1][0][0])-1;
1762 1762
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1763 1763
                     $paramsep = '';
1764 1764
                     if (strlen($match[1][0][0]) > 1) {
1765
-                        -- $paramspos;
1765
+                        --$paramspos;
1766 1766
                     }
1767 1767
                 }
1768 1768
             }
@@ -1787,8 +1787,8 @@  discard block
 block discarded – undo
1787 1787
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1788 1788
                 }
1789 1789
             }
1790
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1791
-            $paramstr   = substr($cmdstr, $paramspos + 1);
1790
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1791
+            $paramstr   = substr($cmdstr, $paramspos+1);
1792 1792
             if (substr($paramstr, - 1, 1) === $paramsep) {
1793 1793
                 $paramstr = substr($paramstr, 0, - 1);
1794 1794
             }
@@ -1810,36 +1810,36 @@  discard block
 block discarded – undo
1810 1810
 
1811 1811
                             if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') {
1812 1812
                                 if ($this->debug) {
1813
-                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT ' . $ptr . "\n";
1813
+                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr."\n";
1814 1814
                                 }
1815 1815
                                 break 2;
1816 1816
                             } elseif ($paramstr[$ptr] === ';') {
1817
-                                ++ $ptr;
1817
+                                ++$ptr;
1818 1818
                                 if ($this->debug) {
1819
-                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n";
1819
+                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr."\n";
1820 1820
                                 }
1821 1821
                                 break 2;
1822 1822
                             } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') {
1823 1823
                                 if ($this->debug) {
1824
-                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT ' . $ptr . "\n";
1824
+                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr."\n";
1825 1825
                                 }
1826 1826
                                 break 2;
1827 1827
                             } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
1828 1828
                                 if ($this->debug) {
1829
-                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT ' . $ptr . "\n";
1829
+                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr."\n";
1830 1830
                                 }
1831 1831
                                 break 2;
1832 1832
                             }
1833 1833
 
1834 1834
                             if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") {
1835
-                                ++ $ptr;
1835
+                                ++$ptr;
1836 1836
                             } else {
1837 1837
                                 break;
1838 1838
                             }
1839 1839
                         }
1840 1840
 
1841 1841
                         if ($this->debug) {
1842
-                            echo 'FUNC START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
1842
+                            echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr."\n";
1843 1843
                         }
1844 1844
 
1845 1845
                         if ($func === 'if' || $func === 'elseif' || $func === 'tif') {
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
                         }
1852 1852
 
1853 1853
                         if ($this->debug) {
1854
-                            echo 'PARAM PARSED, POINTER AT ' . $ptr . ' (' . substr($paramstr, $ptr - 1, 3) . ')' . "\n";
1854
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1855 1855
                         }
1856 1856
                     }
1857 1857
                 }
@@ -1875,16 +1875,16 @@  discard block
 block discarded – undo
1875 1875
         }
1876 1876
 
1877 1877
         if ($pointer !== null) {
1878
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1878
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1879 1879
             if ($this->debug) {
1880
-                echo 'FUNC ADDS ' . ((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)) . ' TO POINTER' . "\n";
1880
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1881 1881
             }
1882 1882
         }
1883 1883
 
1884 1884
         if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) {
1885 1885
             // handle static method calls with security policy
1886 1886
             if (strstr($func, '::') !== false && $this->securityPolicy !== null && $this->securityPolicy->isMethodAllowed(explode('::', strtolower($func))) !== true) {
1887
-                throw new SecurityException('Call to a disallowed php function : ' . $func);
1887
+                throw new SecurityException('Call to a disallowed php function : '.$func);
1888 1888
             }
1889 1889
             $pluginType = Core::NATIVE_PLUGIN;
1890 1890
         } else {
@@ -1929,19 +1929,19 @@  discard block
 block discarded – undo
1929 1929
                     $this->customPlugins[$func]['function']
1930 1930
                 ), $state);
1931 1931
             } else {
1932
-                if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
1932
+                if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
1933 1933
                     $params = $this->mapParams($params, array(
1934
-                        'Plugin' . Core::toCamelCase($func),
1934
+                        'Plugin'.Core::toCamelCase($func),
1935 1935
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1936 1936
                     ), $state);
1937
-                } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) {
1937
+                } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !== false) {
1938 1938
                     $params = $this->mapParams($params, array(
1939
-                        Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func),
1939
+                        Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func),
1940 1940
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1941 1941
                     ), $state);
1942 1942
                 } else {
1943 1943
                     $params = $this->mapParams($params, array(
1944
-                        Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
1944
+                        Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
1945 1945
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1946 1946
                     ), $state);
1947 1947
                 }
@@ -1952,24 +1952,22 @@  discard block
 block discarded – undo
1952 1952
                 $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state);
1953 1953
             } else {
1954 1954
                 // Custom plugin
1955
-                if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ?
1955
+                if (function_exists('Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ?
1956 1956
                         'Compile' : '')) !== false) {
1957
-                    $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType &
1957
+                    $params = $this->mapParams($params, 'Plugin'.Core::toCamelCase($func).(($pluginType &
1958 1958
                             Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1959 1959
                 } // Builtin helper plugin
1960
-                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . (
1960
+                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(
1961 1961
                     ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) {
1962
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase
1963
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1962
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1964 1963
                 } // Builtin function plugin
1965 1964
                 else {
1966
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
1967
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1965
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1968 1966
                 }
1969 1967
             }
1970 1968
         } // Smarty modifier
1971 1969
         elseif ($pluginType & Core::SMARTY_MODIFIER) {
1972
-            $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')';
1970
+            $output = 'smarty_modifier_'.$func.'('.implode(', ', $params).')';
1973 1971
         } // Proxy plugin
1974 1972
         elseif ($pluginType & Core::PROXY_PLUGIN) {
1975 1973
             $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -2009,19 +2007,19 @@  discard block
 block discarded – undo
2009 2007
             if ($func === 'do') {
2010 2008
                 $output = '';
2011 2009
                 if (isset($params['*'])) {
2012
-                    $output = implode(';', $params['*']) . ';';
2010
+                    $output = implode(';', $params['*']).';';
2013 2011
                 }
2014 2012
 
2015 2013
                 if (is_array($parsingParams) || $curBlock !== 'root') {
2016 2014
                     throw new CompilationException($this, 'Do can not be used inside another function or block');
2017 2015
                 }
2018 2016
 
2019
-                return self::PHP_OPEN . $output . self::PHP_CLOSE;
2017
+                return self::PHP_OPEN.$output.self::PHP_CLOSE;
2020 2018
             } else {
2021 2019
                 if (isset($params['*'])) {
2022
-                    $output = $func . '(' . implode(', ', $params['*']) . ')';
2020
+                    $output = $func.'('.implode(', ', $params['*']).')';
2023 2021
                 } else {
2024
-                    $output = $func . '()';
2022
+                    $output = $func.'()';
2025 2023
                 }
2026 2024
             }
2027 2025
         } // Block class OR Function class
@@ -2031,7 +2029,7 @@  discard block
 block discarded – undo
2031 2029
                     $callback = $this->customPlugins[$func]['callback'];
2032 2030
                     if (!is_array($callback)) {
2033 2031
                         if (!method_exists($callback, 'compile')) {
2034
-                            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');
2032
+                            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');
2035 2033
                         }
2036 2034
                         if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
2037 2035
                             $funcCompiler = array($callback, 'compile');
@@ -2042,13 +2040,13 @@  discard block
 block discarded – undo
2042 2040
                         $funcCompiler = $callback;
2043 2041
                     }
2044 2042
                 } else {
2045
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2046
-                        $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
2047
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) {
2048
-                        $funcCompiler = array(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func), 'compile');
2043
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2044
+                        $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
2045
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !== false) {
2046
+                        $funcCompiler = array(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func), 'compile');
2049 2047
                     } else {
2050 2048
                         $funcCompiler = array(
2051
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
2049
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
2052 2050
                             'compile'
2053 2051
                         );
2054 2052
                     }
@@ -2065,31 +2063,31 @@  discard block
 block discarded – undo
2065 2063
                     $callback = $this->customPlugins[$func]['callback'];
2066 2064
                     if (!is_array($callback)) {
2067 2065
                         if (!method_exists($callback, 'process')) {
2068
-                            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');
2066
+                            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');
2069 2067
                         }
2070 2068
                         if (($ref = new ReflectionMethod($callback, 'process')) && $ref->isStatic()) {
2071
-                            $output = 'call_user_func(array(\'' . $callback . '\', \'process\'), ' . $params . ')';
2069
+                            $output = 'call_user_func(array(\''.$callback.'\', \'process\'), '.$params.')';
2072 2070
                         } else {
2073
-                            $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback . '\'), \'process\'), ' . $params . ')';
2071
+                            $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback.'\'), \'process\'), '.$params.')';
2074 2072
                         }
2075 2073
                     } elseif (is_object($callback[0])) {
2076
-                        $output = 'call_user_func(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), ' . $params . ')';
2074
+                        $output = 'call_user_func(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), '.$params.')';
2077 2075
                     } elseif (($ref = new ReflectionMethod($callback[0], $callback[1])) && $ref->isStatic()) {
2078
-                        $output = 'call_user_func(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), ' . $params . ')';
2076
+                        $output = 'call_user_func(array(\''.$callback[0].'\', \''.$callback[1].'\'), '.$params.')';
2079 2077
                     } else {
2080
-                        $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback[0] . '\'), \'' . $callback[1] . '\'), ' . $params . ')';
2078
+                        $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback[0].'\'), \''.$callback[1].'\'), '.$params.')';
2081 2079
                     }
2082 2080
                     if (empty($params)) {
2083
-                        $output = substr($output, 0, - 3) . ')';
2081
+                        $output = substr($output, 0, - 3).')';
2084 2082
                     }
2085 2083
                 } else {
2086
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2087
-                        $output = '$this->classCall(\'Plugin' . $func . '\', array(' . $params . '))';
2088
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) {
2089
-                        $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', 
2090
-                        array(' . $params . '))';
2084
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2085
+                        $output = '$this->classCall(\'Plugin'.$func.'\', array('.$params.'))';
2086
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !== false) {
2087
+                        $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', 
2088
+                        array(' . $params.'))';
2091 2089
                     } else {
2092
-                        $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
2090
+                        $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
2093 2091
                     }
2094 2092
                 }
2095 2093
             }
@@ -2100,15 +2098,15 @@  discard block
 block discarded – undo
2100 2098
                     $funcCompiler = $this->customPlugins[$func]['callback'];
2101 2099
                 } else {
2102 2100
                     // Custom plugin
2103
-                    if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2104
-                        $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
2101
+                    if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2102
+                        $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
2105 2103
                     } // Builtin helper plugin
2106
-                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2107
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2104
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2105
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2108 2106
                             'Compile';
2109 2107
                     } // Builtin function plugin
2110 2108
                     else {
2111
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
2109
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
2112 2110
                             'Compile';
2113 2111
                     }
2114 2112
                 }
@@ -2124,24 +2122,24 @@  discard block
 block discarded – undo
2124 2122
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
2125 2123
                     $callback = $this->customPlugins[$func]['callback'];
2126 2124
                     if ($callback instanceof Closure) {
2127
-                        $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')';
2125
+                        $output = 'call_user_func($this->getCustomPlugin(\''.$func.'\'), '.$params.')';
2128 2126
                     } else {
2129
-                        $output = 'call_user_func(\'' . $callback . '\', ' . $params . ')';
2127
+                        $output = 'call_user_func(\''.$callback.'\', '.$params.')';
2130 2128
                     }
2131 2129
                 } else {
2132 2130
                     // Custom plugin
2133
-                    if (function_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2134
-                        $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params .
2131
+                    if (function_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2132
+                        $output = 'Plugin'.Core::toCamelCase($func).'('.$params.
2135 2133
                             ')';
2136 2134
                     } // Builtin helper plugin
2137
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !==
2135
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !==
2138 2136
                         false) {
2139
-                        $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' .
2140
-                            $params . ')';
2137
+                        $output = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'('.
2138
+                            $params.')';
2141 2139
                     } // Builtin function plugin
2142 2140
                     else {
2143
-                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '(' .
2144
-                            $params . ')';
2141
+                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'('.
2142
+                            $params.')';
2145 2143
                     }
2146 2144
                 }
2147 2145
             }
@@ -2159,22 +2157,22 @@  discard block
 block discarded – undo
2159 2157
                 $callback = $this->customPlugins[$func]['callback'];
2160 2158
                 if (is_array($callback)) {
2161 2159
                     if (is_object($callback[0])) {
2162
-                        $output = 'call_user_func_array(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2160
+                        $output = 'call_user_func_array(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array(array('.$params.'), $this))';
2163 2161
                     } else {
2164
-                        $output = 'call_user_func_array(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2162
+                        $output = 'call_user_func_array(array(\''.$callback[0].'\', \''.$callback[1].'\'), array(array('.$params.'), $this))';
2165 2163
                     }
2166 2164
                 } else {
2167
-                    $output = $callback . '(array(' . $params . '), $this)';
2165
+                    $output = $callback.'(array('.$params.'), $this)';
2168 2166
                 }
2169 2167
             } else {
2170
-                $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)';
2168
+                $output = 'smarty_function_'.$func.'(array('.$params.'), $this)';
2171 2169
             }
2172 2170
         } // Template plugin
2173 2171
         elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
2174 2172
             array_unshift($params, '$this');
2175 2173
             $params                                 = self::implode_r($params);
2176
-            $output                                 = 'Plugin' . Core::toCamelCase($func) .
2177
-                $this->templatePlugins[$func]['uuid'] . '(' . $params . ')';
2174
+            $output                                 = 'Plugin'.Core::toCamelCase($func).
2175
+                $this->templatePlugins[$func]['uuid'].'('.$params.')';
2178 2176
             $this->templatePlugins[$func]['called'] = true;
2179 2177
         }
2180 2178
 
@@ -2206,29 +2204,29 @@  discard block
 block discarded – undo
2206 2204
      */
2207 2205
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2208 2206
     {
2209
-        $substr = substr($in, $from, $to - $from);
2207
+        $substr = substr($in, $from, $to-$from);
2210 2208
         $first  = $substr[0];
2211 2209
 
2212 2210
         if ($this->debug) {
2213
-            echo 'STRING FOUND (in ' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . ')' . "\n";
2211
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2214 2212
         }
2215 2213
         $strend = false;
2216
-        $o      = $from + 1;
2214
+        $o      = $from+1;
2217 2215
         while ($strend === false) {
2218 2216
             $strend = strpos($in, $first, $o);
2219 2217
             if ($strend === false) {
2220
-                throw new CompilationException($this, 'Unfinished string, started with ' . substr($in, $from, $to - $from));
2218
+                throw new CompilationException($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2221 2219
             }
2222
-            if (substr($in, $strend - 1, 1) === '\\') {
2223
-                $o      = $strend + 1;
2220
+            if (substr($in, $strend-1, 1) === '\\') {
2221
+                $o      = $strend+1;
2224 2222
                 $strend = false;
2225 2223
             }
2226 2224
         }
2227 2225
         if ($this->debug) {
2228
-            echo 'STRING DELIMITED: ' . substr($in, $from, $strend + 1 - $from) . "\n";
2226
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2229 2227
         }
2230 2228
 
2231
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2229
+        $srcOutput = substr($in, $from, $strend+1-$from);
2232 2230
 
2233 2231
         if ($pointer !== null) {
2234 2232
             $pointer += strlen($srcOutput);
@@ -2237,13 +2235,13 @@  discard block
 block discarded – undo
2237 2235
         $output = $this->replaceStringVars($srcOutput, $first);
2238 2236
 
2239 2237
         // handle modifiers
2240
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2238
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2241 2239
             $modstr = $match[1];
2242 2240
 
2243 2241
             if ($curBlock === 'root' && substr($modstr, - 1) === '}') {
2244 2242
                 $modstr = substr($modstr, 0, - 1);
2245 2243
             }
2246
-            $modstr = str_replace('\\' . $first, $first, $modstr);
2244
+            $modstr = str_replace('\\'.$first, $first, $modstr);
2247 2245
             $ptr    = 0;
2248 2246
             $output = $this->replaceModifiers(array(null, null, $output, $modstr), 'string', $ptr);
2249 2247
 
@@ -2251,7 +2249,7 @@  discard block
 block discarded – undo
2251 2249
             if ($pointer !== null) {
2252 2250
                 $pointer += $ptr;
2253 2251
             }
2254
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2252
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2255 2253
         }
2256 2254
 
2257 2255
         if (is_array($parsingParams)) {
@@ -2282,10 +2280,10 @@  discard block
 block discarded – undo
2282 2280
      */
2283 2281
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2284 2282
     {
2285
-        $substr = substr($in, $from, $to - $from);
2283
+        $substr = substr($in, $from, $to-$from);
2286 2284
 
2287 2285
         if ($this->debug) {
2288
-            echo 'CONST FOUND : ' . $substr . "\n";
2286
+            echo 'CONST FOUND : '.$substr."\n";
2289 2287
         }
2290 2288
 
2291 2289
         if (!preg_match('#^%([\\\\a-z0-9_:]+)#i', $substr, $m)) {
@@ -2326,7 +2324,7 @@  discard block
 block discarded – undo
2326 2324
         }
2327 2325
 
2328 2326
         if ($curBlock !== 'root') {
2329
-            return '(defined("' . $key . '") ? ' . $key . ' : null)';
2327
+            return '(defined("'.$key.'") ? '.$key.' : null)';
2330 2328
         }
2331 2329
 
2332 2330
         return $key;
@@ -2349,7 +2347,7 @@  discard block
 block discarded – undo
2349 2347
      */
2350 2348
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2351 2349
     {
2352
-        $substr = substr($in, $from, $to - $from);
2350
+        $substr = substr($in, $from, $to-$from);
2353 2351
 
2354 2352
         // var key
2355 2353
         $varRegex = '(\\$?\\.?[a-z0-9\\\\_:]*(?:(?:(?:\\.|->)(?:[a-z0-9\\\\_:]+|(?R))|\\[(?:[a-z0-9\\\\_:]+|(?R)|(["\'])[^\\2]*?\\2)\\]))*)';
@@ -2377,13 +2375,13 @@  discard block
 block discarded – undo
2377 2375
 
2378 2376
             if (substr($key, - 1) == '.') {
2379 2377
                 $key = substr($key, 0, - 1);
2380
-                -- $matchedLength;
2378
+                --$matchedLength;
2381 2379
             }
2382 2380
 
2383 2381
             if ($hasMethodCall) {
2384
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2385
-                $key        = substr($match[1], 1, strrpos($match[1], '->') - 1);
2386
-                $methodCall = substr($match[1], strrpos($match[1], '->')) . $match[3];
2382
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2383
+                $key        = substr($match[1], 1, strrpos($match[1], '->')-1);
2384
+                $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2387 2385
             }
2388 2386
 
2389 2387
             if ($hasModifiers) {
@@ -2399,9 +2397,9 @@  discard block
 block discarded – undo
2399 2397
 
2400 2398
             if ($this->debug) {
2401 2399
                 if ($hasMethodCall) {
2402
-                    echo 'METHOD CALL FOUND : $' . $key . substr($methodCall, 0, 30) . "\n";
2400
+                    echo 'METHOD CALL FOUND : $'.$key.substr($methodCall, 0, 30)."\n";
2403 2401
                 } else {
2404
-                    echo 'VAR FOUND : $' . $key . "\n";
2402
+                    echo 'VAR FOUND : $'.$key."\n";
2405 2403
                 }
2406 2404
             }
2407 2405
 
@@ -2412,7 +2410,7 @@  discard block
 block discarded – undo
2412 2410
                 $uid           = 0;
2413 2411
                 $parsed        = array($uid => '');
2414 2412
                 $current       = &$parsed;
2415
-                $curTxt        = &$parsed[$uid ++];
2413
+                $curTxt        = &$parsed[$uid++];
2416 2414
                 $tree          = array();
2417 2415
                 $chars         = str_split($key, 1);
2418 2416
                 $inSplittedVar = false;
@@ -2421,33 +2419,33 @@  discard block
 block discarded – undo
2421 2419
                 while (($char = array_shift($chars)) !== null) {
2422 2420
                     if ($char === '[') {
2423 2421
                         if (count($tree) > 0) {
2424
-                            ++ $bracketCount;
2422
+                            ++$bracketCount;
2425 2423
                         } else {
2426 2424
                             $tree[]        = &$current;
2427
-                            $current[$uid] = array($uid + 1 => '');
2428
-                            $current       = &$current[$uid ++];
2429
-                            $curTxt        = &$current[$uid ++];
2425
+                            $current[$uid] = array($uid+1 => '');
2426
+                            $current       = &$current[$uid++];
2427
+                            $curTxt        = &$current[$uid++];
2430 2428
                             continue;
2431 2429
                         }
2432 2430
                     } elseif ($char === ']') {
2433 2431
                         if ($bracketCount > 0) {
2434
-                            -- $bracketCount;
2432
+                            --$bracketCount;
2435 2433
                         } else {
2436
-                            $current = &$tree[count($tree) - 1];
2434
+                            $current = &$tree[count($tree)-1];
2437 2435
                             array_pop($tree);
2438 2436
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2439 2437
                                 $current[$uid] = '';
2440
-                                $curTxt        = &$current[$uid ++];
2438
+                                $curTxt        = &$current[$uid++];
2441 2439
                             }
2442 2440
                             continue;
2443 2441
                         }
2444 2442
                     } elseif ($char === '$') {
2445 2443
                         if (count($tree) == 0) {
2446
-                            $curTxt        = &$current[$uid ++];
2444
+                            $curTxt        = &$current[$uid++];
2447 2445
                             $inSplittedVar = true;
2448 2446
                         }
2449 2447
                     } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) {
2450
-                        $curTxt        = &$current[$uid ++];
2448
+                        $curTxt        = &$current[$uid++];
2451 2449
                         $inSplittedVar = false;
2452 2450
                     }
2453 2451
 
@@ -2456,16 +2454,16 @@  discard block
 block discarded – undo
2456 2454
                 unset($uid, $current, $curTxt, $tree, $chars);
2457 2455
 
2458 2456
                 if ($this->debug) {
2459
-                    echo 'RECURSIVE VAR REPLACEMENT : ' . $key . "\n";
2457
+                    echo 'RECURSIVE VAR REPLACEMENT : '.$key."\n";
2460 2458
                 }
2461 2459
 
2462 2460
                 $key = $this->flattenVarTree($parsed);
2463 2461
 
2464 2462
                 if ($this->debug) {
2465
-                    echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2463
+                    echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2466 2464
                 }
2467 2465
 
2468
-                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("' . $key . '")');
2466
+                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("'.$key.'")');
2469 2467
             } else {
2470 2468
                 $output = $this->parseVarKey($key, $hasModifiers ? 'modifier' : $curBlock);
2471 2469
             }
@@ -2490,10 +2488,10 @@  discard block
 block discarded – undo
2490 2488
                     if (substr($expMatch[2][$k], 0, 1) === '=') {
2491 2489
                         $assign = true;
2492 2490
                         if ($operator === '=') {
2493
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, can not use "==" in expressions');
2491
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, can not use "==" in expressions');
2494 2492
                         }
2495 2493
                         if ($curBlock !== 'root') {
2496
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2494
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2497 2495
                         }
2498 2496
                         $operator .= '=';
2499 2497
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
@@ -2504,22 +2502,22 @@  discard block
 block discarded – undo
2504 2502
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
2505 2503
                     }
2506 2504
                     if (($operator === '+' || $operator === '-') && $expMatch[2][$k] === $operator) {
2507
-                        $output = '(' . $output . $operator . $operator . ')';
2505
+                        $output = '('.$output.$operator.$operator.')';
2508 2506
                         break;
2509 2507
                     } elseif (substr($expMatch[2][$k], 0, 1) === '$') {
2510
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2508
+                        $output = '('.$output.' '.$operator.' '.$this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2511 2509
                     } elseif (substr($expMatch[2][$k], 0, 1) === '%') {
2512
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2510
+                        $output = '('.$output.' '.$operator.' '.$this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2513 2511
                     } elseif (!empty($expMatch[2][$k])) {
2514
-                        $output = '(' . $output . ' ' . $operator . ' ' . str_replace(',', '.', $expMatch[2][$k]) . ')';
2512
+                        $output = '('.$output.' '.$operator.' '.str_replace(',', '.', $expMatch[2][$k]).')';
2515 2513
                     } else {
2516
-                        throw new CompilationException($this, 'Unfinished expression <em>' . $substr . '</em>, missing var or number after math operator');
2514
+                        throw new CompilationException($this, 'Unfinished expression <em>'.$substr.'</em>, missing var or number after math operator');
2517 2515
                     }
2518 2516
                 }
2519 2517
             }
2520 2518
 
2521 2519
             if ($this->autoEscape === true && $curBlock !== 'condition') {
2522
-                $output = '(is_string($tmp=' . $output . ') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2520
+                $output = '(is_string($tmp='.$output.') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2523 2521
             }
2524 2522
 
2525 2523
             // handle modifiers
@@ -2543,7 +2541,7 @@  discard block
 block discarded – undo
2543 2541
             } elseif ($curBlock === 'expression' || $curBlock === 'variable') {
2544 2542
                 return $output;
2545 2543
             } elseif (isset($assign)) {
2546
-                return self::PHP_OPEN . $output . ';' . self::PHP_CLOSE;
2544
+                return self::PHP_OPEN.$output.';'.self::PHP_CLOSE;
2547 2545
             }
2548 2546
 
2549 2547
             return $output;
@@ -2551,7 +2549,7 @@  discard block
 block discarded – undo
2551 2549
             if ($curBlock === 'string' || $curBlock === 'delimited_string') {
2552 2550
                 return array(0, '');
2553 2551
             }
2554
-            throw new CompilationException($this, 'Invalid variable name <em>' . $substr . '</em>');
2552
+            throw new CompilationException($this, 'Invalid variable name <em>'.$substr.'</em>');
2555 2553
         }
2556 2554
     }
2557 2555
 
@@ -2605,16 +2603,16 @@  discard block
 block discarded – undo
2605 2603
             if (empty($methMatch[2])) {
2606 2604
                 // property
2607 2605
                 if ($curBlock === 'root') {
2608
-                    $output .= '->' . $methMatch[1];
2606
+                    $output .= '->'.$methMatch[1];
2609 2607
                 } else {
2610
-                    $output = '(($tmp = ' . $output . ') ? $tmp->' . $methMatch[1] . ' : null)';
2608
+                    $output = '(($tmp = '.$output.') ? $tmp->'.$methMatch[1].' : null)';
2611 2609
                 }
2612 2610
                 $ptr += strlen($methMatch[1]);
2613 2611
             } else {
2614 2612
                 // method
2615 2613
                 if (substr($methMatch[2], 0, 2) === '()') {
2616
-                    $parsedCall = $methMatch[1] . '()';
2617
-                    $ptr += strlen($methMatch[1]) + 2;
2614
+                    $parsedCall = $methMatch[1].'()';
2615
+                    $ptr += strlen($methMatch[1])+2;
2618 2616
                 } else {
2619 2617
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2620 2618
                 }
@@ -2623,15 +2621,15 @@  discard block
 block discarded – undo
2623 2621
                     $method = strtolower(substr($parsedCall, 0, $argPos));
2624 2622
                     $args   = substr($parsedCall, $argPos);
2625 2623
                     if ($curBlock === 'root') {
2626
-                        $output = '$this->getSecurityPolicy()->callMethod($this, ' . $output . ', ' . var_export($method, true) . ', array' . $args . ')';
2624
+                        $output = '$this->getSecurityPolicy()->callMethod($this, '.$output.', '.var_export($method, true).', array'.$args.')';
2627 2625
                     } else {
2628
-                        $output = '(($tmp = ' . $output . ') ? $this->getSecurityPolicy()->callMethod($this, $tmp, ' . var_export($method, true) . ', array' . $args . ') : null)';
2626
+                        $output = '(($tmp = '.$output.') ? $this->getSecurityPolicy()->callMethod($this, $tmp, '.var_export($method, true).', array'.$args.') : null)';
2629 2627
                     }
2630 2628
                 } else {
2631 2629
                     if ($curBlock === 'root') {
2632
-                        $output .= '->' . $parsedCall;
2630
+                        $output .= '->'.$parsedCall;
2633 2631
                     } else {
2634
-                        $output = '(($tmp = ' . $output . ') ? $tmp->' . $parsedCall . ' : null)';
2632
+                        $output = '(($tmp = '.$output.') ? $tmp->'.$parsedCall.' : null)';
2635 2633
                     }
2636 2634
                 }
2637 2635
             }
@@ -2657,21 +2655,21 @@  discard block
 block discarded – undo
2657 2655
             return '$this->scope';
2658 2656
         }
2659 2657
         if (substr($key, 0, 1) === '.') {
2660
-            $key = 'dwoo' . $key;
2658
+            $key = 'dwoo'.$key;
2661 2659
         }
2662 2660
         if (preg_match('#dwoo\.(get|post|server|cookies|session|env|request)((?:\.[a-z0-9_-]+)+)#i', $key, $m)) {
2663 2661
             $global = strtoupper($m[1]);
2664 2662
             if ($global === 'COOKIES') {
2665 2663
                 $global = 'COOKIE';
2666 2664
             }
2667
-            $key = '$_' . $global;
2665
+            $key = '$_'.$global;
2668 2666
             foreach (explode('.', ltrim($m[2], '.')) as $part) {
2669
-                $key .= '[' . var_export($part, true) . ']';
2667
+                $key .= '['.var_export($part, true).']';
2670 2668
             }
2671 2669
             if ($curBlock === 'root') {
2672 2670
                 $output = $key;
2673 2671
             } else {
2674
-                $output = '(isset(' . $key . ')?' . $key . ':null)';
2672
+                $output = '(isset('.$key.')?'.$key.':null)';
2675 2673
             }
2676 2674
         } elseif (preg_match('#dwoo\\.const\\.([a-z0-9\\\\_:]+)#i', $key, $m)) {
2677 2675
             return $this->parseConstKey($m[1], $curBlock);
@@ -2687,9 +2685,9 @@  discard block
 block discarded – undo
2687 2685
                     $output = '$tmp_key';
2688 2686
                 } else {
2689 2687
                     if ($curBlock === 'root') {
2690
-                        $output = '$this->scope["' . $key . '"]';
2688
+                        $output = '$this->scope["'.$key.'"]';
2691 2689
                     } else {
2692
-                        $output = '(isset($this->scope["' . $key . '"]) ? $this->scope["' . $key . '"] : null)';
2690
+                        $output = '(isset($this->scope["'.$key.'"]) ? $this->scope["'.$key.'"] : null)';
2693 2691
                     }
2694 2692
                 }
2695 2693
             } else {
@@ -2700,7 +2698,7 @@  discard block
 block discarded – undo
2700 2698
                     $parentCnt = 0;
2701 2699
 
2702 2700
                     while (true) {
2703
-                        ++ $parentCnt;
2701
+                        ++$parentCnt;
2704 2702
                         array_shift($m[2]);
2705 2703
                         array_shift($m[1]);
2706 2704
                         if (current($m[2]) === '_parent') {
@@ -2709,7 +2707,7 @@  discard block
 block discarded – undo
2709 2707
                         break;
2710 2708
                     }
2711 2709
 
2712
-                    $output = '$this->readParentVar(' . $parentCnt . ')';
2710
+                    $output = '$this->readParentVar('.$parentCnt.')';
2713 2711
                 } else {
2714 2712
                     if ($i === 'dwoo') {
2715 2713
                         $output = '$this->globals';
@@ -2728,28 +2726,28 @@  discard block
 block discarded – undo
2728 2726
                     while (count($m[1]) && $m[1][0] !== '->') {
2729 2727
                         $m[2][0] = preg_replace('/(^\\\([\'"])|\\\([\'"])$)/x', '$2$3', $m[2][0]);
2730 2728
                         if (substr($m[2][0], 0, 1) == '"' || substr($m[2][0], 0, 1) == "'") {
2731
-                            $output .= '[' . $m[2][0] . ']';
2729
+                            $output .= '['.$m[2][0].']';
2732 2730
                         } else {
2733
-                            $output .= '["' . $m[2][0] . '"]';
2731
+                            $output .= '["'.$m[2][0].'"]';
2734 2732
                         }
2735 2733
                         array_shift($m[2]);
2736 2734
                         array_shift($m[1]);
2737 2735
                     }
2738 2736
 
2739 2737
                     if ($curBlock !== 'root') {
2740
-                        $output = '(isset(' . $output . ') ? ' . $output . ':null)';
2738
+                        $output = '(isset('.$output.') ? '.$output.':null)';
2741 2739
                     }
2742 2740
                 }
2743 2741
 
2744 2742
                 if (count($m[2])) {
2745 2743
                     unset($m[0]);
2746
-                    $output = '$this->readVarInto(' . str_replace("\n", '', var_export($m, true)) . ', ' . $output . ', ' . ($curBlock == 'root' ? 'false' : 'true') . ')';
2744
+                    $output = '$this->readVarInto('.str_replace("\n", '', var_export($m, true)).', '.$output.', '.($curBlock == 'root' ? 'false' : 'true').')';
2747 2745
                 }
2748 2746
             }
2749 2747
         } else {
2750 2748
             preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+)\]?#i', $key, $m);
2751 2749
             unset($m[0]);
2752
-            $output = '$this->readVar(' . str_replace("\n", '', var_export($m, true)) . ')';
2750
+            $output = '$this->readVar('.str_replace("\n", '', var_export($m, true)).')';
2753 2751
         }
2754 2752
 
2755 2753
         return $output;
@@ -2769,38 +2767,38 @@  discard block
 block discarded – undo
2769 2767
         $out = $recursed ? '".$this->readVarInto(' : '';
2770 2768
         foreach ($tree as $bit) {
2771 2769
             if (is_array($bit)) {
2772
-                $out .= '.' . $this->flattenVarTree($bit, false);
2770
+                $out .= '.'.$this->flattenVarTree($bit, false);
2773 2771
             } else {
2774 2772
                 $key = str_replace('"', '\\"', $bit);
2775 2773
 
2776 2774
                 if (substr($key, 0, 1) === '$') {
2777
-                    $out .= '".' . $this->parseVar($key, 0, strlen($key), false, 'variable') . '."';
2775
+                    $out .= '".'.$this->parseVar($key, 0, strlen($key), false, 'variable').'."';
2778 2776
                 } else {
2779 2777
                     $cnt = substr_count($key, '$');
2780 2778
 
2781 2779
                     if ($this->debug) {
2782
-                        echo 'PARSING SUBVARS IN : ' . $key . "\n";
2780
+                        echo 'PARSING SUBVARS IN : '.$key."\n";
2783 2781
                     }
2784 2782
                     if ($cnt > 0) {
2785
-                        while (-- $cnt >= 0) {
2783
+                        while (--$cnt >= 0) {
2786 2784
                             if (isset($last)) {
2787
-                                $last = strrpos($key, '$', - (strlen($key) - $last + 1));
2785
+                                $last = strrpos($key, '$', - (strlen($key)-$last+1));
2788 2786
                             } else {
2789 2787
                                 $last = strrpos($key, '$');
2790 2788
                             }
2791
-                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2789
+                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2792 2790
 
2793 2791
                             $len = strlen($submatch[0]);
2794 2792
                             $key = substr_replace(
2795 2793
                                 $key, preg_replace_callback(
2796
-                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2794
+                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2797 2795
                                         $this,
2798 2796
                                         'replaceVarKeyHelper'
2799 2797
                                     ), substr($key, $last, $len)
2800 2798
                                 ), $last, $len
2801 2799
                             );
2802 2800
                             if ($this->debug) {
2803
-                                echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2801
+                                echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2804 2802
                             }
2805 2803
                         }
2806 2804
                         unset($last);
@@ -2826,7 +2824,7 @@  discard block
 block discarded – undo
2826 2824
      */
2827 2825
     protected function replaceVarKeyHelper($match)
2828 2826
     {
2829
-        return '".' . $this->parseVar($match[0], 0, strlen($match[0]), false, 'variable') . '."';
2827
+        return '".'.$this->parseVar($match[0], 0, strlen($match[0]), false, 'variable').'."';
2830 2828
     }
2831 2829
 
2832 2830
     /**
@@ -2846,7 +2844,7 @@  discard block
 block discarded – undo
2846 2844
      */
2847 2845
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2848 2846
     {
2849
-        $substr = substr($in, $from, $to - $from);
2847
+        $substr = substr($in, $from, $to-$from);
2850 2848
 
2851 2849
         $end = strlen($substr);
2852 2850
 
@@ -2920,48 +2918,48 @@  discard block
 block discarded – undo
2920 2918
 
2921 2919
         if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') {
2922 2920
             if ($this->debug) {
2923
-                echo 'BOOLEAN(FALSE) PARSED' . "\n";
2921
+                echo 'BOOLEAN(FALSE) PARSED'."\n";
2924 2922
             }
2925 2923
             $substr = 'false';
2926 2924
             $type   = self::T_BOOL;
2927 2925
         } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') {
2928 2926
             if ($this->debug) {
2929
-                echo 'BOOLEAN(TRUE) PARSED' . "\n";
2927
+                echo 'BOOLEAN(TRUE) PARSED'."\n";
2930 2928
             }
2931 2929
             $substr = 'true';
2932 2930
             $type   = self::T_BOOL;
2933 2931
         } elseif ($substr === 'null' || $substr === 'NULL') {
2934 2932
             if ($this->debug) {
2935
-                echo 'NULL PARSED' . "\n";
2933
+                echo 'NULL PARSED'."\n";
2936 2934
             }
2937 2935
             $substr = 'null';
2938 2936
             $type   = self::T_NULL;
2939 2937
         } elseif (is_numeric($substr)) {
2940
-            $substr = (float)$substr;
2941
-            if ((int)$substr == $substr) {
2942
-                $substr = (int)$substr;
2938
+            $substr = (float) $substr;
2939
+            if ((int) $substr == $substr) {
2940
+                $substr = (int) $substr;
2943 2941
             }
2944 2942
             $type = self::T_NUMERIC;
2945 2943
             if ($this->debug) {
2946
-                echo 'NUMBER (' . $substr . ') PARSED' . "\n";
2944
+                echo 'NUMBER ('.$substr.') PARSED'."\n";
2947 2945
             }
2948 2946
         } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) {
2949 2947
             if ($this->debug) {
2950 2948
                 echo 'SIMPLE MATH PARSED . "\n"';
2951 2949
             }
2952 2950
             $type   = self::T_MATH;
2953
-            $substr = '(' . $substr . ')';
2951
+            $substr = '('.$substr.')';
2954 2952
         } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) {
2955 2953
             if ($this->debug) {
2956
-                echo 'BREAKCHAR (' . $substr . ') PARSED' . "\n";
2954
+                echo 'BREAKCHAR ('.$substr.') PARSED'."\n";
2957 2955
             }
2958 2956
             $type = self::T_BREAKCHAR;
2959 2957
             //$substr = '"'.$substr.'"';
2960 2958
         } else {
2961
-            $substr = $this->replaceStringVars('\'' . str_replace('\'', '\\\'', $substr) . '\'', '\'', $curBlock);
2959
+            $substr = $this->replaceStringVars('\''.str_replace('\'', '\\\'', $substr).'\'', '\'', $curBlock);
2962 2960
             $type   = self::T_UNQUOTED_STRING;
2963 2961
             if ($this->debug) {
2964
-                echo 'BLABBER (' . $substr . ') CASTED AS STRING' . "\n";
2962
+                echo 'BLABBER ('.$substr.') CASTED AS STRING'."\n";
2965 2963
             }
2966 2964
         }
2967 2965
 
@@ -2991,28 +2989,28 @@  discard block
 block discarded – undo
2991 2989
     {
2992 2990
         $pos = 0;
2993 2991
         if ($this->debug) {
2994
-            echo 'STRING VAR REPLACEMENT : ' . $string . "\n";
2992
+            echo 'STRING VAR REPLACEMENT : '.$string."\n";
2995 2993
         }
2996 2994
         // replace vars
2997 2995
         while (($pos = strpos($string, '$', $pos)) !== false) {
2998
-            $prev = substr($string, $pos - 1, 1);
2996
+            $prev = substr($string, $pos-1, 1);
2999 2997
             if ($prev === '\\') {
3000
-                ++ $pos;
2998
+                ++$pos;
3001 2999
                 continue;
3002 3000
             }
3003 3001
 
3004 3002
             $var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3005 3003
             $len = $var[0];
3006
-            $var = $this->parse(str_replace('\\' . $first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3004
+            $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
3007 3005
 
3008
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
3009
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos - 1, $len + 2);
3006
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
3007
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
3010 3008
             } else {
3011
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos, $len);
3009
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
3012 3010
             }
3013
-            $pos += strlen($var[1]) + 2;
3011
+            $pos += strlen($var[1])+2;
3014 3012
             if ($this->debug) {
3015
-                echo 'STRING VAR REPLACEMENT DONE : ' . $string . "\n";
3013
+                echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
3016 3014
             }
3017 3015
         }
3018 3016
 
@@ -3048,7 +3046,7 @@  discard block
 block discarded – undo
3048 3046
     protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null)
3049 3047
     {
3050 3048
         if ($this->debug) {
3051
-            echo 'PARSING MODIFIERS : ' . $m[3] . "\n";
3049
+            echo 'PARSING MODIFIERS : '.$m[3]."\n";
3052 3050
         }
3053 3051
 
3054 3052
         if ($pointer !== null) {
@@ -3072,7 +3070,7 @@  discard block
 block discarded – undo
3072 3070
             }
3073 3071
             if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) {
3074 3072
                 if ($this->debug) {
3075
-                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND' . "\n";
3073
+                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND'."\n";
3076 3074
                 }
3077 3075
                 $continue = false;
3078 3076
                 if ($pointer !== null) {
@@ -3083,7 +3081,7 @@  discard block
 block discarded – undo
3083 3081
             $cmdstr   = $cmdstrsrc;
3084 3082
             $paramsep = ':';
3085 3083
             if (!preg_match('/^(@{0,2}[a-z_][a-z0-9_]*)(:)?/i', $cmdstr, $match)) {
3086
-                throw new CompilationException($this, 'Invalid modifier name, started with : ' . substr($cmdstr, 0, 10));
3084
+                throw new CompilationException($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
3087 3085
             }
3088 3086
             $paramspos = !empty($match[2]) ? strlen($match[1]) : false;
3089 3087
             $func      = $match[1];
@@ -3093,10 +3091,10 @@  discard block
 block discarded – undo
3093 3091
                 $cmdstrsrc = substr($cmdstrsrc, strlen($func));
3094 3092
                 $params    = array();
3095 3093
                 if ($this->debug) {
3096
-                    echo 'MODIFIER (' . $func . ') CALLED WITH NO PARAMS' . "\n";
3094
+                    echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
3097 3095
                 }
3098 3096
             } else {
3099
-                $paramstr = substr($cmdstr, $paramspos + 1);
3097
+                $paramstr = substr($cmdstr, $paramspos+1);
3100 3098
                 if (substr($paramstr, - 1, 1) === $paramsep) {
3101 3099
                     $paramstr = substr($paramstr, 0, - 1);
3102 3100
                 }
@@ -3105,41 +3103,41 @@  discard block
 block discarded – undo
3105 3103
                 $params = array();
3106 3104
                 while ($ptr < strlen($paramstr)) {
3107 3105
                     if ($this->debug) {
3108
-                        echo 'MODIFIER (' . $func . ') START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
3106
+                        echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr."\n";
3109 3107
                     }
3110 3108
                     if ($this->debug) {
3111
-                        echo $paramstr . '--' . $ptr . '--' . strlen($paramstr) . '--modifier' . "\n";
3109
+                        echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier'."\n";
3112 3110
                     }
3113 3111
                     $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr);
3114 3112
                     if ($this->debug) {
3115
-                        echo 'PARAM PARSED, POINTER AT ' . $ptr . "\n";
3113
+                        echo 'PARAM PARSED, POINTER AT '.$ptr."\n";
3116 3114
                     }
3117 3115
 
3118 3116
                     if ($ptr >= strlen($paramstr)) {
3119 3117
                         if ($this->debug) {
3120
-                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED' . "\n";
3118
+                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED'."\n";
3121 3119
                         }
3122 3120
                         break;
3123 3121
                     }
3124 3122
 
3125 3123
                     if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
3126 3124
                         if ($this->debug) {
3127
-                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT ' . $ptr . "\n";
3125
+                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr."\n";
3128 3126
                         }
3129 3127
                         if ($paramstr[$ptr] !== '|') {
3130 3128
                             $continue = false;
3131 3129
                             if ($pointer !== null) {
3132
-                                $pointer -= strlen($paramstr) - $ptr;
3130
+                                $pointer -= strlen($paramstr)-$ptr;
3133 3131
                             }
3134 3132
                         }
3135
-                        ++ $ptr;
3133
+                        ++$ptr;
3136 3134
                         break;
3137 3135
                     }
3138 3136
                     if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') {
3139
-                        ++ $ptr;
3137
+                        ++$ptr;
3140 3138
                     }
3141 3139
                 }
3142
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
3140
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
3143 3141
                 foreach ($params as $k => $p) {
3144 3142
                     if (is_array($p) && is_array($p[1])) {
3145 3143
                         $state |= 2;
@@ -3179,9 +3177,9 @@  discard block
 block discarded – undo
3179 3177
                 $params = self::implode_r($params);
3180 3178
 
3181 3179
                 if ($mapped) {
3182
-                    $output = '$this->arrayMap(\'' . $func . '\', array(' . $params . '))';
3180
+                    $output = '$this->arrayMap(\''.$func.'\', array('.$params.'))';
3183 3181
                 } else {
3184
-                    $output = $func . '(' . $params . ')';
3182
+                    $output = $func.'('.$params.')';
3185 3183
                 }
3186 3184
             } elseif ($pluginType & Core::PROXY_PLUGIN) {
3187 3185
                 $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -3199,36 +3197,36 @@  discard block
 block discarded – undo
3199 3197
                     $callback = $this->customPlugins[$func]['callback'];
3200 3198
                     if (is_array($callback)) {
3201 3199
                         if (is_object($callback[0])) {
3202
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3200
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3203 3201
                         } else {
3204
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3202
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3205 3203
                         }
3206 3204
                     } elseif ($mapped) {
3207
-                        $output = '$this->arrayMap(\'' . $callback . '\', array(' . $params . '))';
3205
+                        $output = '$this->arrayMap(\''.$callback.'\', array('.$params.'))';
3208 3206
                     } else {
3209
-                        $output = $callback . '(' . $params . ')';
3207
+                        $output = $callback.'('.$params.')';
3210 3208
                     }
3211 3209
                 } elseif ($mapped) {
3212
-                    $output = '$this->arrayMap(\'smarty_modifier_' . $func . '\', array(' . $params . '))';
3210
+                    $output = '$this->arrayMap(\'smarty_modifier_'.$func.'\', array('.$params.'))';
3213 3211
                 } else {
3214
-                    $output = 'smarty_modifier_' . $func . '(' . $params . ')';
3212
+                    $output = 'smarty_modifier_'.$func.'('.$params.')';
3215 3213
                 }
3216 3214
             } else {
3217 3215
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
3218 3216
                     $callback   = $this->customPlugins[$func]['callback'];
3219 3217
                     $pluginName = $callback;
3220 3218
                 } else {
3221
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' .
3222
-                            Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3219
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false || function_exists('Plugin'.
3220
+                            Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3223 3221
                         !== false) {
3224
-                        $pluginName = 'Plugin' . Core::toCamelCase($func);
3222
+                        $pluginName = 'Plugin'.Core::toCamelCase($func);
3225 3223
                     } else {
3226
-                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func);
3224
+                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func);
3227 3225
                     }
3228 3226
                     if ($pluginType & Core::CLASS_PLUGIN) {
3229 3227
                         $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process');
3230 3228
                     } else {
3231
-                        $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3229
+                        $callback = $pluginName.(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3232 3230
                     }
3233 3231
                 }
3234 3232
                 $params = $this->mapParams($params, $callback, $state);
@@ -3246,10 +3244,10 @@  discard block
 block discarded – undo
3246 3244
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3247 3245
                             $funcCompiler = $this->customPlugins[$func]['callback'];
3248 3246
                         } else {
3249
-                            if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
3250
-                                $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
3247
+                            if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
3248
+                                $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
3251 3249
                             } else {
3252
-                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
3250
+                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
3253 3251
                                     'Compile';
3254 3252
                             }
3255 3253
                         }
@@ -3260,9 +3258,9 @@  discard block
 block discarded – undo
3260 3258
 
3261 3259
                         $params = self::implode_r($params);
3262 3260
                         if ($mapped) {
3263
-                            $output = '$this->arrayMap(\'' . $pluginName . '\', array(' . $params . '))';
3261
+                            $output = '$this->arrayMap(\''.$pluginName.'\', array('.$params.'))';
3264 3262
                         } else {
3265
-                            $output = $pluginName . '(' . $params . ')';
3263
+                            $output = $pluginName.'('.$params.')';
3266 3264
                         }
3267 3265
                     }
3268 3266
                 } else {
@@ -3274,7 +3272,7 @@  discard block
 block discarded – undo
3274 3272
                             $callback = $this->customPlugins[$func]['callback'];
3275 3273
                             if (!is_array($callback)) {
3276 3274
                                 if (!method_exists($callback, 'compile')) {
3277
-                                    throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
3275
+                                    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');
3278 3276
                                 }
3279 3277
                                 if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
3280 3278
                                     $funcCompiler = array($callback, 'compile');
@@ -3285,11 +3283,11 @@  discard block
 block discarded – undo
3285 3283
                                 $funcCompiler = $callback;
3286 3284
                             }
3287 3285
                         } else {
3288
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3289
-                                $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
3286
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3287
+                                $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
3290 3288
                             } else {
3291 3289
                                 $funcCompiler = array(
3292
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
3290
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
3293 3291
                                     'compile'
3294 3292
                                 );
3295 3293
                             }
@@ -3301,23 +3299,23 @@  discard block
 block discarded – undo
3301 3299
 
3302 3300
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3303 3301
                             if (is_object($callback[0])) {
3304
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3302
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3305 3303
                             } else {
3306
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3304
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3307 3305
                             }
3308 3306
                         } elseif ($mapped) {
3309 3307
                             $output = '$this->arrayMap(array($this->getObjectPlugin(\''.
3310
-                                Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), 
3311
-                            \'process\'), array(' . $params . '))';
3308
+                                Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'\'), 
3309
+                            \'process\'), array(' . $params.'))';
3312 3310
                         } else {
3313
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3314
-                                $output = '$this->classCall(\'Plugin' . Core::toCamelCase($func) . '\', array(' . $params . '))';
3315
-                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($func)) !== false) {
3316
-                                $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . $func . '\', array(' . $params . '))';
3317
-                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) {
3318
-                                $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', array(' . $params . '))';
3311
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3312
+                                $output = '$this->classCall(\'Plugin'.Core::toCamelCase($func).'\', array('.$params.'))';
3313
+                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($func)) !== false) {
3314
+                                $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.$func.'\', array('.$params.'))';
3315
+                            } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !== false) {
3316
+                                $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', array('.$params.'))';
3319 3317
                             } else {
3320
-                                $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
3318
+                                $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
3321 3319
                             }
3322 3320
                         }
3323 3321
                     }
@@ -3330,7 +3328,7 @@  discard block
 block discarded – undo
3330 3328
         } elseif ($curBlock === 'var' || $m[1] === null) {
3331 3329
             return $output;
3332 3330
         } elseif ($curBlock === 'string' || $curBlock === 'root') {
3333
-            return $m[1] . '.' . $output . '.' . $m[1] . (isset($add) ? $add : null);
3331
+            return $m[1].'.'.$output.'.'.$m[1].(isset($add) ? $add : null);
3334 3332
         }
3335 3333
 
3336 3334
         return '';
@@ -3353,14 +3351,14 @@  discard block
 block discarded – undo
3353 3351
             if (is_array($p)) {
3354 3352
                 $out2 = 'array(';
3355 3353
                 foreach ($p as $k2 => $v) {
3356
-                    $out2 .= var_export($k2, true) . ' => ' . (is_array($v) ? 'array(' . self::implode_r($v, true) . ')' : $v) . ', ';
3354
+                    $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', ';
3357 3355
                 }
3358
-                $p = rtrim($out2, ', ') . ')';
3356
+                $p = rtrim($out2, ', ').')';
3359 3357
             }
3360 3358
             if ($recursiveCall) {
3361
-                $out .= var_export($k, true) . ' => ' . $p . ', ';
3359
+                $out .= var_export($k, true).' => '.$p.', ';
3362 3360
             } else {
3363
-                $out .= $p . ', ';
3361
+                $out .= $p.', ';
3364 3362
             }
3365 3363
         }
3366 3364
 
@@ -3384,7 +3382,7 @@  discard block
 block discarded – undo
3384 3382
         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)) {
3385 3383
             $phpFunc = true;
3386 3384
         } elseif ($this->securityPolicy !== null && function_exists($name) && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) === false) {
3387
-            throw new SecurityException('Call to a disallowed php function : ' . $name);
3385
+            throw new SecurityException('Call to a disallowed php function : '.$name);
3388 3386
         }
3389 3387
 
3390 3388
         while ($pluginType <= 0) {
@@ -3395,58 +3393,58 @@  discard block
 block discarded – undo
3395 3393
             elseif (isset($this->customPlugins[$name])) {
3396 3394
                 $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN;
3397 3395
             } // Class blocks plugin
3398
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3396
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name)) !== false) {
3399 3397
                 $pluginType = Core::CLASS_PLUGIN;
3400
-                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3398
+                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3401 3399
                     $pluginType += Core::BLOCK_PLUGIN;
3402 3400
                 }
3403
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name));
3401
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name));
3404 3402
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3405 3403
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3406 3404
                 }
3407 3405
             } // Class functions plugin
3408
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3409
-                $pluginType = Core::FUNC_PLUGIN + Core::CLASS_PLUGIN;
3410
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name));
3406
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !== false) {
3407
+                $pluginType = Core::FUNC_PLUGIN+Core::CLASS_PLUGIN;
3408
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name));
3411 3409
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3412 3410
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3413 3411
                 }
3414 3412
             } // Class without namespace
3415
-            elseif (class_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3413
+            elseif (class_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3416 3414
                 $pluginType = Core::CLASS_PLUGIN;
3417
-                $interfaces = class_implements('Plugin' . Core::toCamelCase($name));
3415
+                $interfaces = class_implements('Plugin'.Core::toCamelCase($name));
3418 3416
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3419 3417
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3420 3418
                 }
3421 3419
             } // Function plugin (with/without namespaces)
3422
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase ($name)) !==
3423
-                false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3420
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !==
3421
+                false || function_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3424 3422
                 $pluginType = Core::FUNC_PLUGIN;
3425 3423
             } // Function plugin compile (with/without namespaces)
3426
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) .
3427
-                    'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !==
3424
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name).
3425
+                    'Compile') !== false || function_exists('Plugin'.Core::toCamelCase($name).'Compile') !==
3428 3426
                 false) {
3429 3427
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3430 3428
             } // Helper plugin class compile
3431
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name)) !== false) {
3429
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name)) !== false) {
3432 3430
                 $pluginType = Core::CLASS_PLUGIN | Core::COMPILABLE_PLUGIN;
3433 3431
             } // Helper plugin function compile
3434
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile') !== false) {
3432
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name).'Compile') !== false) {
3435 3433
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3436 3434
             } // Smarty modifier
3437
-            elseif (function_exists('smarty_modifier_' . $name) !== false) {
3435
+            elseif (function_exists('smarty_modifier_'.$name) !== false) {
3438 3436
                 $pluginType = Core::SMARTY_MODIFIER;
3439 3437
             } // Smarty function
3440
-            elseif (function_exists('smarty_function_' . $name) !== false) {
3438
+            elseif (function_exists('smarty_function_'.$name) !== false) {
3441 3439
                 $pluginType = Core::SMARTY_FUNCTION;
3442 3440
             } // Smarty block
3443
-            elseif (function_exists('smarty_block_' . $name) !== false) {
3441
+            elseif (function_exists('smarty_block_'.$name) !== false) {
3444 3442
                 $pluginType = Core::SMARTY_BLOCK;
3445 3443
             } // Everything else
3446 3444
             else {
3447 3445
                 if ($pluginType === - 1) {
3448 3446
                     try {
3449
-                        $this->getDwoo()->getLoader()->loadPlugin('Plugin' . Core::toCamelCase($name));
3447
+                        $this->getDwoo()->getLoader()->loadPlugin('Plugin'.Core::toCamelCase($name));
3450 3448
                     }
3451 3449
                     catch (Exception $e) {
3452 3450
                         if (isset($phpFunc)) {
@@ -3459,9 +3457,9 @@  discard block
 block discarded – undo
3459 3457
                         }
3460 3458
                     }
3461 3459
                 } else {
3462
-                    throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType);
3460
+                    throw new Exception('Plugin "'.$name.'" could not be found, type:'.$pluginType);
3463 3461
                 }
3464
-                ++ $pluginType;
3462
+                ++$pluginType;
3465 3463
             }
3466 3464
         }
3467 3465
 
@@ -3530,15 +3528,15 @@  discard block
 block discarded – undo
3530 3528
         }
3531 3529
 
3532 3530
         // loops over the param map and assigns values from the template or default value for unset optional params
3533
-        foreach ($map as $k => $v){
3531
+        foreach ($map as $k => $v) {
3534 3532
             if ($v[0] === '*') {
3535 3533
                 // "rest" array parameter, fill every remaining params in it and then break
3536 3534
                 if (count($ps) === 0) {
3537 3535
                     if ($v[1] === false) {
3538 3536
                         throw new CompilationException(
3539
-                            $this, 'Rest argument missing for ' . str_replace(
3537
+                            $this, 'Rest argument missing for '.str_replace(
3540 3538
                                 array(
3541
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3539
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3542 3540
                                 'Compile'
3543 3541
                                 ), '', (is_array($callback) ? $callback[0] : $callback)
3544 3542
                             )
@@ -3571,7 +3569,7 @@  discard block
 block discarded – undo
3571 3569
                 // parameter is not defined and not optional, throw error
3572 3570
                 if (is_array($callback)) {
3573 3571
                     if (is_object($callback[0])) {
3574
-                        $name = get_class($callback[0]) . '::' . $callback[1];
3572
+                        $name = get_class($callback[0]).'::'.$callback[1];
3575 3573
                     } else {
3576 3574
                         $name = $callback[0];
3577 3575
                     }
@@ -3580,9 +3578,9 @@  discard block
 block discarded – undo
3580 3578
                 }
3581 3579
 
3582 3580
                 throw new CompilationException(
3583
-                    $this, 'Argument ' . $k . '/' . $v[0] . ' missing for ' . str_replace(
3581
+                    $this, 'Argument '.$k.'/'.$v[0].' missing for '.str_replace(
3584 3582
                         array(
3585
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3583
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3586 3584
                         'Compile'
3587 3585
                         ), '', $name
3588 3586
                     )
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/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.
lib/Dwoo/Smarty/Adapter.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -312,7 +312,7 @@
 block discarded – undo
312 312
 
313 313
     /**
314 314
      * @param mixed $_tpl
315
-     * @param array $data
315
+     * @param Data $data
316 316
      * @param null  $_compiler
317 317
      * @param bool  $_output
318 318
      *
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
         }
64 64
         if (array_key_exists($p, $this->compat['properties']) !== false) {
65 65
             if ($this->show_compat_errors) {
66
-                $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
66
+                $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
67 67
             }
68 68
             $this->compat['properties'][$p] = $v;
69 69
         } else {
70 70
             if ($this->show_compat_errors) {
71
-                $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
71
+                $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
72 72
             }
73 73
         }
74 74
     }
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
     {
83 83
         if (array_key_exists($p, $this->compat['properties']) !== false) {
84 84
             if ($this->show_compat_errors) {
85
-                $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
85
+                $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
86 86
             }
87 87
 
88 88
             return $this->compat['properties'][$p];
89 89
         } else {
90 90
             if ($this->show_compat_errors) {
91
-                $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
91
+                $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
92 92
             }
93 93
         }
94 94
     }
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
             );
111 111
         } elseif ($this->show_compat_errors) {
112 112
             if (array_search($m, $this->compat['methods']) !== false) {
113
-                $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
113
+                $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE);
114 114
             } else {
115
-                $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
115
+                $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE);
116 116
             }
117 117
         }
118 118
     }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
         if (isset($data[$name]) && is_object($data[$name])) {
526 526
             return $data[$name];
527 527
         } else {
528
-            trigger_error('Dwoo_Compiler: object "' . $name . '" was not registered or is not an object', E_USER_ERROR);
528
+            trigger_error('Dwoo_Compiler: object "'.$name.'" was not registered or is not an object', E_USER_ERROR);
529 529
         }
530 530
     }
531 531
 
@@ -537,10 +537,10 @@  discard block
 block discarded – undo
537 537
     public function template_exists($filename)
538 538
     {
539 539
         if (!is_array($this->template_dir)) {
540
-            return file_exists($this->template_dir . DIRECTORY_SEPARATOR . $filename);
540
+            return file_exists($this->template_dir.DIRECTORY_SEPARATOR.$filename);
541 541
         } else {
542 542
             foreach ($this->template_dir as $tpl_dir) {
543
-                if (file_exists($tpl_dir . DIRECTORY_SEPARATOR . $filename)) {
543
+                if (file_exists($tpl_dir.DIRECTORY_SEPARATOR.$filename)) {
544 544
                     return true;
545 545
                 }
546 546
             }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             $compileId = $this->compile_id;
670 670
         }
671 671
 
672
-        $hash = bin2hex(md5($file . $cacheId . $compileId, true));
672
+        $hash = bin2hex(md5($file.$cacheId.$compileId, true));
673 673
         if (!isset(self::$tplCache[$hash])) {
674 674
             // abs path
675 675
             if (substr($file, 0, 1) === '/' || substr($file, 1, 1) === ':') {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             } elseif (is_string($this->template_dir) || is_array($this->template_dir)) {
678 678
                 self::$tplCache[$hash] = new TemplateFile($file, null, $cacheId, $compileId, $this->template_dir);
679 679
             } else {
680
-                throw new Exception('Unable to load "' . $file . '", check the template_dir');
680
+                throw new Exception('Unable to load "'.$file.'", check the template_dir');
681 681
             }
682 682
         }
683 683
 
@@ -693,6 +693,6 @@  discard block
 block discarded – undo
693 693
         if (is_object($this->template)) {
694 694
             parent::triggerError($message, $level);
695 695
         }
696
-        trigger_error('Dwoo error : ' . $message, $level);
696
+        trigger_error('Dwoo error : '.$message, $level);
697 697
     }
698 698
 }
Please login to merge, or discard this patch.
lib/Dwoo/Compilation/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     {
40 40
         $this->compiler = $compiler;
41 41
         $this->template = $compiler->getDwoo()->getTemplate();
42
-        parent::__construct('Compilation error at line ' . $compiler->getLine() . ' in "' . $this->template->getResourceName() . ':' . $this->template->getResourceIdentifier() . '" : ' . $message);
42
+        parent::__construct('Compilation error at line '.$compiler->getLine().' in "'.$this->template->getResourceName().':'.$this->template->getResourceIdentifier().'" : '.$message);
43 43
     }
44 44
 
45 45
     /**
Please login to merge, or discard this patch.
lib/Dwoo/Plugin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@
 block discarded – undo
79 79
 
80 80
         $out = '';
81 81
         foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
82
+            $out .= ' '.$attr.'=';
83 83
             if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
84
+                $out .= str_replace($delim, '\\'.$delim, '""');
85 85
             } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
86
+                $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"');
87 87
             } else {
88 88
                 if (!$compiler) {
89 89
                     // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
90
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91 91
                 } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92 92
                     // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
93
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94 94
                 } else {
95 95
                     // print as is
96
-                    $escapedVal = '.' . $val . '.';
96
+                    $escapedVal = '.'.$val.'.';
97 97
                 }
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
99
+                $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"');
100 100
             }
101 101
         }
102 102
 
Please login to merge, or discard this patch.
lib/Dwoo/Block/Plugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90 90
     {
91
-        return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
91
+        return DwooCompiler::PHP_OPEN.$prepend.'$this->addStack("'.$type.'", array('.DwooCompiler::implode_r($compiler->getCompiledParams($params)).'));'.$append.DwooCompiler::PHP_CLOSE;
92 92
     }
93 93
 
94 94
     /**
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116 116
     {
117
-        return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
117
+        return $content.DwooCompiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.DwooCompiler::PHP_CLOSE;
118 118
     }
119 119
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginExtends.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
         self::$l     = preg_quote($l, '/');
57 57
         self::$r     = preg_quote($r, '/');
58 58
         self::$regex = '/
59
-			' . self::$l . 'block\s(["\']?)(.+?)\1' . self::$r . '(?:\r?\n?)
59
+			' . self::$l.'block\s(["\']?)(.+?)\1'.self::$r.'(?:\r?\n?)
60 60
 			((?:
61 61
 				(?R)
62 62
 				|
63
-				[^' . self::$l . ']*
63
+				[^' . self::$l.']*
64 64
 				(?:
65
-					(?! ' . self::$l . '\/?block\b )
66
-					' . self::$l . '
67
-					[^' . self::$l . ']*+
65
+					(?! ' . self::$l.'\/?block\b )
66
+					' . self::$l.'
67
+					[^' . self::$l.']*+
68 68
 				)*
69 69
 			)*)
70
-			' . self::$l . '\/block' . self::$r . '
70
+			' . self::$l.'\/block'.self::$r.'
71 71
 			/six';
72 72
 
73 73
         if ($compiler->getLooseOpeningHandling()) {
74 74
             self::$l .= '\s*';
75
-            self::$r = '\s*' . self::$r;
75
+            self::$r = '\s*'.self::$r;
76 76
         }
77 77
         $inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
-        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
78
+        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()).DIRECTORY_SEPARATOR;
79 79
         $curTpl          = $compiler->getDwoo()->getTemplate();
80 80
 
81 81
         while (!empty($file)) {
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
                 $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98 98
             }
99 99
             catch (SecurityException $e) {
100
-                throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
100
+                throw new CompilationException($compiler, 'Extends : Security restriction : '.$e->getMessage());
101 101
             }
102 102
             catch (Exception $e) {
103
-                throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
103
+                throw new CompilationException($compiler, 'Extends : '.$e->getMessage());
104 104
             }
105 105
 
106 106
             if ($parent === null) {
107
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
107
+                throw new CompilationException($compiler, 'Extends : Resource "'.$resource.':'.$identifier.'" not found.');
108 108
             } elseif ($parent === false) {
109
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
109
+                throw new CompilationException($compiler, 'Extends : Resource "'.$resource.'" does not support extends.');
110 110
             }
111 111
 
112 112
             $curTpl    = $parent;
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
             }
122 122
             $inheritanceTree[] = $newParent;
123 123
 
124
-            if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
-                $curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
124
+            if (preg_match('/^'.self::$l.'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?'.self::$r.'/i', $parent->getSource(), $match)) {
125
+                $curPath = dirname($identifier).DIRECTORY_SEPARATOR;
126 126
                 if (isset($match[2]) && $match[2] == '"') {
127
-                    $file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
127
+                    $file = '"'.str_replace('"', '\\"', substr($match[1], 1, - 1)).'"';
128 128
                 } elseif (isset($match[2]) && $match[2] == "'") {
129
-                    $file = '"' . substr($match[1], 1, - 1) . '"';
129
+                    $file = '"'.substr($match[1], 1, - 1).'"';
130 130
                 } else {
131
-                    $file = '"' . $match[1] . '"';
131
+                    $file = '"'.$match[1].'"';
132 132
                 }
133 133
             } else {
134 134
                 $file = false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                 'Dwoo\Plugins\Functions\PluginExtends',
148 148
                 'replaceBlock'
149 149
             ), $newSource);
150
-            $newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
150
+            $newSource = $l.'do extendsCheck('.var_export($parent['resource'].':'.$parent['identifier'], true).')'.$r.$newSource;
151 151
 
152 152
             if (self::$lastReplacement) {
153 153
                 break;
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
             $r = stripslashes(self::$r);
175 175
 
176 176
             if (self::$lastReplacement) {
177
-                return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
177
+                return preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override);
178 178
             }
179 179
 
180
-            return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
180
+            return $l.'block '.$matches[1].$matches[2].$matches[1].$r.preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override).$l.'/block'.$r;
181 181
         }
182 182
 
183 183
         if (preg_match(self::$regex, $matches[3])) {
Please login to merge, or discard this patch.