Completed
Push — master ( bf2930...494091 )
by David
07:08 queued 03:26
created
lib/Dwoo/Smarty/Adapter.php 1 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/Data.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 }
147 147
 
148 148
                 if ($merge === true && is_array($val)) {
149
-                    $this->data[$key] = $val + $this->data[$key];
149
+                    $this->data[$key] = $val+$this->data[$key];
150 150
                 } else {
151 151
                     $this->data[$key][] = $val;
152 152
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             }
160 160
 
161 161
             if ($merge === true && is_array($val)) {
162
-                $this->data[$name] = $val + $this->data[$name];
162
+                $this->data[$name] = $val+$this->data[$name];
163 163
             } else {
164 164
                 $this->data[$name][] = $val;
165 165
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         if (isset($this->data[$name])) {
259 259
             return $this->data[$name];
260 260
         } else {
261
-            throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
261
+            throw new Exception('Tried to read a value that was not assigned yet : "'.$name.'"');
262 262
         }
263 263
     }
264 264
 }
Please login to merge, or discard this patch.
lib/Dwoo/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/Compiler.php 2 patches
Switch Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
                         $search = array('{<\?.*?\?>}', '{<%.*?%>}');
770 770
                     }
771 771
                     switch ($this->securityPolicy->getPhpHandling()) {
772
-                        case SecurityPolicy::PHP_ALLOW:
773
-                            break;
774
-                        case SecurityPolicy::PHP_ENCODE:
775
-                            $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl);
776
-                            break;
777
-                        case SecurityPolicy::PHP_REMOVE:
778
-                            $tpl = preg_replace($search, '', $tpl);
772
+                    case SecurityPolicy::PHP_ALLOW:
773
+                        break;
774
+                    case SecurityPolicy::PHP_ENCODE:
775
+                        $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl);
776
+                        break;
777
+                    case SecurityPolicy::PHP_REMOVE:
778
+                        $tpl = preg_replace($search, '', $tpl);
779 779
                     }
780 780
                 }
781 781
             }
@@ -875,42 +875,42 @@  discard block
 block discarded – undo
875 875
             }
876 876
 
877 877
             switch ($type) {
878
-                case Core::BLOCK_PLUGIN:
879
-                case Core::CLASS_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
882
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883
-                    } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
885
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886
-                    }
887
-                    break;
888
-                case Core::FUNC_PLUGIN:
889
-                    if (function_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
891
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892
-                    } else {
893
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
894
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895
-                    }
896
-                    break;
897
-                case Core::SMARTY_MODIFIER:
898
-                    $output .= "if (function_exists('smarty_modifier_$plugin')===false)".
899
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
900
-                    break;
901
-                case Core::SMARTY_FUNCTION:
902
-                    $output .= "if (function_exists('smarty_function_$plugin')===false)".
903
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
904
-                    break;
905
-                case Core::SMARTY_BLOCK:
906
-                    $output .= "if (function_exists('smarty_block_$plugin')===false)".
907
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
908
-                    break;
909
-                case Core::PROXY_PLUGIN:
910
-                    $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
911
-                    break;
912
-                default:
913
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
878
+            case Core::BLOCK_PLUGIN:
879
+            case Core::CLASS_PLUGIN:
880
+                if (class_exists('Plugin' . $plugin) !== false) {
881
+                    $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
882
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883
+                } else {
884
+                    $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
885
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886
+                }
887
+                break;
888
+            case Core::FUNC_PLUGIN:
889
+                if (function_exists('Plugin' . $plugin) !== false) {
890
+                    $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
891
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892
+                } else {
893
+                    $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
894
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895
+                }
896
+                break;
897
+            case Core::SMARTY_MODIFIER:
898
+                $output .= "if (function_exists('smarty_modifier_$plugin')===false)".
899
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
900
+                break;
901
+            case Core::SMARTY_FUNCTION:
902
+                $output .= "if (function_exists('smarty_function_$plugin')===false)".
903
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
904
+                break;
905
+            case Core::SMARTY_BLOCK:
906
+                $output .= "if (function_exists('smarty_block_$plugin')===false)".
907
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
908
+                break;
909
+            case Core::PROXY_PLUGIN:
910
+                $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
911
+                break;
912
+            default:
913
+                throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
914 914
             }
915 915
         }
916 916
 
Please login to merge, or discard this patch.
Spacing   +365 added lines, -368 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function setNestedCommentsHandling($allow = true)
296 296
     {
297
-        $this->allowNestedComments = (bool)$allow;
297
+        $this->allowNestedComments = (bool) $allow;
298 298
     }
299 299
 
300 300
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      */
320 320
     public function setLooseOpeningHandling($allow = false)
321 321
     {
322
-        $this->allowLooseOpenings = (bool)$allow;
322
+        $this->allowLooseOpenings = (bool) $allow;
323 323
     }
324 324
 
325 325
     /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function setAutoEscape($enabled)
346 346
     {
347
-        $this->autoEscape = (bool)$enabled;
347
+        $this->autoEscape = (bool) $enabled;
348 348
     }
349 349
 
350 350
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if ($autoload) {
373 373
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', Core::toCamelCase($callback));
374
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . $name;
374
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.$name;
375 375
 
376 376
             if (class_exists($class)) {
377 377
                 $callback = array(new $class($this), 'process');
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
     {
397 397
         if (($index = array_search($callback, $this->processors['pre'], true)) !== false) {
398 398
             unset($this->processors['pre'][$index]);
399
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
399
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
400 400
                     $callback),
401 401
                 $this->processors['pre'], true)) !== false) {
402 402
             unset($this->processors['pre'][$index]);
403 403
         } else {
404
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
404
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
405 405
             foreach ($this->processors['pre'] as $index => $proc) {
406 406
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
407 407
                     unset($this->processors['pre'][$index]);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         if ($autoload) {
426 426
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
427
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . Core::toCamelCase($name);
427
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.Core::toCamelCase($name);
428 428
 
429 429
             if (class_exists($class)) {
430 430
                 $callback = array(new $class($this), 'process');
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     {
450 450
         if (($index = array_search($callback, $this->processors['post'], true)) !== false) {
451 451
             unset($this->processors['post'][$index]);
452
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
452
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
453 453
                     $callback),
454 454
                 $this->processors['post'], true)) !== false) {
455 455
             unset($this->processors['post'][$index]);
456 456
         } else {
457
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
457
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
458 458
             foreach ($this->processors['post'] as $index => $proc) {
459 459
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
460 460
                     unset($this->processors['post'][$index]);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 $this->getDwoo()->getLoader()->loadPlugin($name);
481 481
             }
482 482
             catch (Exception $e) {
483
-                throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory');
483
+                throw new Exception('Processor '.$name.' could not be found in your plugin directories, please ensure it is in a file named '.$name.'.php in the plugin directory');
484 484
             }
485 485
         }
486 486
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     public function setTemplateSource($newSource, $fromPointer = false)
667 667
     {
668 668
         if ($fromPointer === true) {
669
-            $this->templateSource = substr($this->templateSource, 0, $this->pointer) . $newSource;
669
+            $this->templateSource = substr($this->templateSource, 0, $this->pointer).$newSource;
670 670
         } else {
671 671
             $this->templateSource = $newSource;
672 672
         }
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 
738 738
                 if ($this->debug) {
739 739
                     echo "\n";
740
-                    echo 'COMPILER INIT' . "\n";
740
+                    echo 'COMPILER INIT'."\n";
741 741
                 }
742 742
 
743 743
                 if ($this->debug) {
744
-                    echo 'PROCESSING PREPROCESSORS (' . count($this->processors['pre']) . ')' . "\n";
744
+                    echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')'."\n";
745 745
                 }
746 746
 
747 747
                 // runs preprocessors
@@ -785,23 +785,23 @@  discard block
 block discarded – undo
785 785
             if ($pos === false) {
786 786
                 $this->push(substr($tpl, $ptr), 0);
787 787
                 break;
788
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
789
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1) . $this->ld);
790
-                $ptr = $pos + strlen($this->ld);
791
-            } elseif (preg_match('/^' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . 'literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', substr($tpl, $pos), $litOpen)) {
792
-                if (!preg_match('/' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . '\/literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
788
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
789
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
790
+                $ptr = $pos+strlen($this->ld);
791
+            } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
792
+                if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
793 793
                     throw new CompilationException($this, 'The {literal} blocks must be closed explicitly with {/literal}');
794 794
                 }
795 795
                 $endpos = $litClose[0][1];
796
-                $this->push(substr($tpl, $ptr, $pos - $ptr) . substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
797
-                $ptr = $endpos + strlen($litClose[0][0]);
796
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
797
+                $ptr = $endpos+strlen($litClose[0][0]);
798 798
             } else {
799
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
800
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
799
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
800
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
801 801
                     $ptr = $pos;
802 802
                 }
803 803
 
804
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
804
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
805 805
                 $ptr = $pos;
806 806
 
807 807
                 $pos += strlen($this->ld);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
                 // check that there is an end tag present
821 821
                 if (strpos($tpl, $this->rd, $pos) === false) {
822
-                    throw new CompilationException($this, 'A template tag was not closed, started with "' . substr($tpl, $ptr, 30) . '"');
822
+                    throw new CompilationException($this, 'A template tag was not closed, started with "'.substr($tpl, $ptr, 30).'"');
823 823
                 }
824 824
 
825 825
                 $ptr += strlen($this->ld);
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                         continue 2;
834 834
                     }
835 835
 
836
-                    $len = $subptr - $ptr;
836
+                    $len = $subptr-$ptr;
837 837
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
838 838
                     $ptr += $len;
839 839
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
         $compiled .= $this->removeBlock('TopLevelBlock');
848 848
 
849 849
         if ($this->debug) {
850
-            echo 'PROCESSING POSTPROCESSORS' . "\n";
850
+            echo 'PROCESSING POSTPROCESSORS'."\n";
851 851
         }
852 852
 
853 853
         foreach ($this->processors['post'] as $postProc) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         unset($postProc);
864 864
 
865 865
         if ($this->debug) {
866
-            echo 'COMPILATION COMPLETE : MEM USAGE : ' . memory_get_usage() . "\n";
866
+            echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage()."\n";
867 867
         }
868 868
 
869 869
         $output = "<?php\n/* template head */\n";
@@ -877,20 +877,20 @@  discard block
 block discarded – undo
877 877
             switch ($type) {
878 878
                 case Core::BLOCK_PLUGIN:
879 879
                 case Core::CLASS_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
880
+                    if (class_exists('Plugin'.$plugin) !== false) {
881
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
882 882
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883 883
                     } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
884
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_BLOCKS."Plugin".$plugin."')===false)".
885 885
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886 886
                     }
887 887
                     break;
888 888
                 case Core::FUNC_PLUGIN:
889
-                    if (function_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
889
+                    if (function_exists('Plugin'.$plugin) !== false) {
890
+                        $output .= "if (function_exists('"."Plugin".$plugin."')===false)".
891 891
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892 892
                     } else {
893
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
893
+                        $output .= "if (function_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
894 894
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895 895
                     }
896 896
                     break;
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
                     $output .= $this->getDwoo()->getPluginProxy()->getLoader($plugin);
911 911
                     break;
912 912
                 default:
913
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
913
+                    throw new CompilationException($this, 'Type error for '.$plugin.' with type'.$type);
914 914
             }
915 915
         }
916 916
 
@@ -921,30 +921,30 @@  discard block
 block discarded – undo
921 921
         }
922 922
         foreach ($this->templatePlugins as $function) {
923 923
             if (isset($function['called']) && $function['called'] === true) {
924
-                $output .= $function['body'] . PHP_EOL;
924
+                $output .= $function['body'].PHP_EOL;
925 925
             }
926 926
         }
927 927
 
928
-        $output .= $compiled . "\n?>";
928
+        $output .= $compiled."\n?>";
929 929
 
930
-        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*' . preg_quote(self::PHP_CLOSE, '/') . preg_quote(self::PHP_OPEN, '/') . ')/', ";\n", $output);
931
-        $output = str_replace(self::PHP_CLOSE . self::PHP_OPEN, "\n", $output);
930
+        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*'.preg_quote(self::PHP_CLOSE, '/').preg_quote(self::PHP_OPEN, '/').')/', ";\n", $output);
931
+        $output = str_replace(self::PHP_CLOSE.self::PHP_OPEN, "\n", $output);
932 932
 
933 933
         // handle <?xml tag at the beginning
934 934
         $output = preg_replace('#(/\* template body \*/ \?>\s*)<\?xml#is', '$1<?php echo \'<?xml\'; ?>', $output);
935 935
 
936 936
         // add another line break after PHP closing tags that have a line break following,
937 937
         // as we do not know whether it's intended, and PHP will strip it otherwise
938
-        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0' . "\n", $output);
938
+        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0'."\n", $output);
939 939
 
940 940
         if ($this->debug) {
941
-            echo '=============================================================================================' . "\n";
941
+            echo '============================================================================================='."\n";
942 942
             $lines = preg_split('{\r\n|\n|<br />}', $output);
943 943
             array_shift($lines);
944 944
             foreach ($lines as $i => $line) {
945
-                echo ($i + 1) . '. ' . $line . "\r\n";
945
+                echo ($i+1).'. '.$line."\r\n";
946 946
             }
947
-            echo '=============================================================================================' . "\n";
947
+            echo '============================================================================================='."\n";
948 948
         }
949 949
 
950 950
         $this->template = $this->dwoo = null;
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
     protected function resolveSubTemplateDependencies($function)
962 962
     {
963 963
         if ($this->debug) {
964
-            echo 'Compiler::' . __FUNCTION__ . "\n";
964
+            echo 'Compiler::'.__FUNCTION__."\n";
965 965
         }
966 966
 
967 967
         $body = $this->templatePlugins[$function]['body'];
968 968
         foreach ($this->templatePlugins as $func => $attr) {
969
-            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
970
-            'Plugin' . Core::toCamelCase($func)) !== false) {
969
+            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS.
970
+            'Plugin'.Core::toCamelCase($func)) !== false) {
971 971
                 $this->templatePlugins[$func]['called'] = true;
972 972
                 $this->resolveSubTemplateDependencies($func);
973 973
             }
@@ -991,14 +991,14 @@  discard block
 block discarded – undo
991 991
 
992 992
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
993 993
             // buffer is not initialized yet (the block has just been created)
994
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content;
994
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
995 995
             $this->curBlock['buffer'] = '';
996 996
         } else {
997 997
             if (!isset($this->curBlock['buffer'])) {
998 998
                 throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere');
999 999
             }
1000 1000
             // append current content to current block's buffer
1001
-            $this->curBlock['buffer'] .= (string)$content;
1001
+            $this->curBlock['buffer'] .= (string) $content;
1002 1002
         }
1003 1003
         $this->line += $lineCount;
1004 1004
     }
@@ -1068,23 +1068,23 @@  discard block
 block discarded – undo
1068 1068
     public function addBlock($type, array $params, $paramtype)
1069 1069
     {
1070 1070
         if ($this->debug) {
1071
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1071
+            echo 'Compiler::'.__FUNCTION__."\n";
1072 1072
         }
1073 1073
 
1074
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1074
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1075 1075
         if (class_exists($class) === false) {
1076 1076
             $this->getDwoo()->getLoader()->loadPlugin($type);
1077 1077
         }
1078 1078
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1079 1079
 
1080
-        $this->stack[]  = array(
1080
+        $this->stack[] = array(
1081 1081
             'type'   => $type,
1082 1082
             'params' => $params,
1083 1083
             'custom' => false,
1084 1084
             'class'  => $class,
1085 1085
             'buffer' => null
1086 1086
         );
1087
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1087
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1088 1088
 
1089 1089
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1090 1090
     }
@@ -1109,14 +1109,14 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1111 1111
 
1112
-        $this->stack[]  = array(
1112
+        $this->stack[] = array(
1113 1113
             'type'   => $type,
1114 1114
             'params' => $params,
1115 1115
             'custom' => true,
1116 1116
             'class'  => $class,
1117 1117
             'buffer' => null
1118 1118
         );
1119
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1119
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1120 1120
 
1121 1121
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1122 1122
     }
@@ -1131,21 +1131,21 @@  discard block
 block discarded – undo
1131 1131
     public function injectBlock($type, array $params)
1132 1132
     {
1133 1133
         if ($this->debug) {
1134
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1134
+            echo 'Compiler::'.__FUNCTION__."\n";
1135 1135
         }
1136 1136
 
1137
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1137
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1138 1138
         if (class_exists($class) === false) {
1139 1139
             $this->getDwoo()->getLoader()->loadPlugin($type);
1140 1140
         }
1141
-        $this->stack[]  = array(
1141
+        $this->stack[] = array(
1142 1142
             'type'   => $type,
1143 1143
             'params' => $params,
1144 1144
             'custom' => false,
1145 1145
             'class'  => $class,
1146 1146
             'buffer' => null
1147 1147
         );
1148
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1148
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1149 1149
     }
1150 1150
 
1151 1151
     /**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
     public function removeBlock($type)
1161 1161
     {
1162 1162
         if ($this->debug) {
1163
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1163
+            echo 'Compiler::'.__FUNCTION__."\n";
1164 1164
         }
1165 1165
 
1166 1166
         $output = '';
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
                 if ($top['custom']) {
1175 1175
                     $class = $top['class'];
1176 1176
                 } else {
1177
-                    $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type']);
1177
+                    $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($top['type']);
1178 1178
                 }
1179 1179
                 if (count($this->stack)) {
1180
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1180
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1181 1181
                     $this->push(call_user_func(array(
1182 1182
                         $class,
1183 1183
                         'postProcessing'
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
                 }
1199 1199
             }
1200 1200
 
1201
-            throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened');
1201
+            throw new CompilationException($this, 'Syntax malformation, a block of type "'.$type.'" was closed but was not opened');
1202 1202
             break;
1203 1203
         }
1204 1204
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
             }
1238 1238
         }
1239 1239
 
1240
-        throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found');
1240
+        throw new CompilationException($this, 'A parent block of type "'.$type.'" is required and can not be found');
1241 1241
     }
1242 1242
 
1243 1243
     /**
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
     public function removeTopBlock()
1261 1261
     {
1262 1262
         if ($this->debug) {
1263
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1263
+            echo 'Compiler::'.__FUNCTION__."\n";
1264 1264
         }
1265 1265
 
1266 1266
         $o = array_pop($this->stack);
@@ -1270,10 +1270,10 @@  discard block
 block discarded – undo
1270 1270
         if ($o['custom']) {
1271 1271
             $class = $o['class'];
1272 1272
         } else {
1273
-            $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']);
1273
+            $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($o['type']);
1274 1274
         }
1275 1275
 
1276
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1276
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1277 1277
 
1278 1278
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1279 1279
     }
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
     protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1353 1353
     {
1354 1354
         if ($this->debug) {
1355
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1355
+            echo 'Compiler::'.__FUNCTION__."\n";
1356 1356
         }
1357 1357
 
1358 1358
         if ($to === null) {
@@ -1369,14 +1369,14 @@  discard block
 block discarded – undo
1369 1369
                 // end template tag
1370 1370
                 $pointer += strlen($this->rd);
1371 1371
                 if ($this->debug) {
1372
-                    echo 'TEMPLATE PARSING ENDED' . "\n";
1372
+                    echo 'TEMPLATE PARSING ENDED'."\n";
1373 1373
                 }
1374 1374
 
1375 1375
                 return false;
1376 1376
             }
1377
-            ++ $from;
1377
+            ++$from;
1378 1378
             if ($pointer !== null) {
1379
-                ++ $pointer;
1379
+                ++$pointer;
1380 1380
             }
1381 1381
             if ($from >= $to) {
1382 1382
                 if (is_array($parsingParams)) {
@@ -1388,22 +1388,22 @@  discard block
 block discarded – undo
1388 1388
             $first = $in[$from];
1389 1389
         }
1390 1390
 
1391
-        $substr = substr($in, $from, $to - $from);
1391
+        $substr = substr($in, $from, $to-$from);
1392 1392
 
1393 1393
         if ($this->debug) {
1394
-            echo 'PARSE CALL : PARSING "' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n";
1394
+            echo 'PARSE CALL : PARSING "'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1395 1395
         }
1396 1396
         $parsed = '';
1397 1397
 
1398 1398
         if ($curBlock === 'root' && $first === '*') {
1399 1399
             $src      = $this->getTemplateSource();
1400
-            $startpos = $this->getPointer() - strlen($this->ld);
1400
+            $startpos = $this->getPointer()-strlen($this->ld);
1401 1401
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1402 1402
                 if ($startpos > 0) {
1403 1403
                     do {
1404 1404
                         $char = substr($src, -- $startpos, 1);
1405 1405
                         if ($char == "\n") {
1406
-                            ++ $startpos;
1406
+                            ++$startpos;
1407 1407
                             $whitespaceStart = true;
1408 1408
                             break;
1409 1409
                         }
@@ -1414,12 +1414,12 @@  discard block
 block discarded – undo
1414 1414
                 if (!isset($whitespaceStart)) {
1415 1415
                     $startpos = $this->getPointer();
1416 1416
                 } else {
1417
-                    $pointer -= $this->getPointer() - $startpos;
1417
+                    $pointer -= $this->getPointer()-$startpos;
1418 1418
                 }
1419 1419
 
1420
-                if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) {
1421
-                    $comOpen  = $this->ld . '*';
1422
-                    $comClose = '*' . $this->rd;
1420
+                if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
1421
+                    $comOpen  = $this->ld.'*';
1422
+                    $comClose = '*'.$this->rd;
1423 1423
                     $level    = 1;
1424 1424
                     $ptr      = $this->getPointer();
1425 1425
 
@@ -1429,33 +1429,33 @@  discard block
 block discarded – undo
1429 1429
 
1430 1430
                         if ($open !== false && $close !== false) {
1431 1431
                             if ($open < $close) {
1432
-                                $ptr = $open + strlen($comOpen);
1433
-                                ++ $level;
1432
+                                $ptr = $open+strlen($comOpen);
1433
+                                ++$level;
1434 1434
                             } else {
1435
-                                $ptr = $close + strlen($comClose);
1436
-                                -- $level;
1435
+                                $ptr = $close+strlen($comClose);
1436
+                                --$level;
1437 1437
                             }
1438 1438
                         } elseif ($open !== false) {
1439
-                            $ptr = $open + strlen($comOpen);
1440
-                            ++ $level;
1439
+                            $ptr = $open+strlen($comOpen);
1440
+                            ++$level;
1441 1441
                         } elseif ($close !== false) {
1442
-                            $ptr = $close + strlen($comClose);
1443
-                            -- $level;
1442
+                            $ptr = $close+strlen($comClose);
1443
+                            --$level;
1444 1444
                         } else {
1445 1445
                             $ptr = strlen($src);
1446 1446
                         }
1447 1447
                     }
1448
-                    $endpos = $ptr - strlen('*' . $this->rd);
1448
+                    $endpos = $ptr-strlen('*'.$this->rd);
1449 1449
                 } else {
1450
-                    $endpos = strpos($src, '*' . $this->rd, $startpos);
1450
+                    $endpos = strpos($src, '*'.$this->rd, $startpos);
1451 1451
                     if ($endpos == false) {
1452 1452
                         throw new CompilationException($this, 'Un-ended comment');
1453 1453
                     }
1454 1454
                 }
1455
-                $pointer += $endpos - $startpos + strlen('*' . $this->rd);
1456
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) {
1455
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1456
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1457 1457
                     $pointer += strlen($m[0]);
1458
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1458
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1459 1459
                 }
1460 1460
 
1461 1461
                 return false;
@@ -1472,20 +1472,20 @@  discard block
 block discarded – undo
1472 1472
         } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) {
1473 1473
             // string
1474 1474
             $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer);
1475
-        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?(' . (is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|') . '\s*\(|\s*' . $this->rdr . '|\s*;)/i', $substr)) {
1475
+        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?('.(is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|').'\s*\(|\s*'.$this->rdr.'|\s*;)/i', $substr)) {
1476 1476
             // func
1477 1477
             $out    = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer);
1478 1478
             $parsed = 'func';
1479 1479
         } elseif ($first === ';') {
1480 1480
             // instruction end
1481 1481
             if ($this->debug) {
1482
-                echo 'END OF INSTRUCTION' . "\n";
1482
+                echo 'END OF INSTRUCTION'."\n";
1483 1483
             }
1484 1484
             if ($pointer !== null) {
1485
-                ++ $pointer;
1485
+                ++$pointer;
1486 1486
             }
1487 1487
 
1488
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1488
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1489 1489
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1490 1490
             // close block
1491 1491
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1502,13 +1502,13 @@  discard block
 block discarded – undo
1502 1502
                     $pointer -= strlen($match[0]);
1503 1503
                 }
1504 1504
                 if ($this->debug) {
1505
-                    echo 'TOP BLOCK CLOSED' . "\n";
1505
+                    echo 'TOP BLOCK CLOSED'."\n";
1506 1506
                 }
1507 1507
 
1508 1508
                 return $this->removeTopBlock();
1509 1509
             } else {
1510 1510
                 if ($this->debug) {
1511
-                    echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n";
1511
+                    echo 'BLOCK OF TYPE '.$match[1].' CLOSED'."\n";
1512 1512
                 }
1513 1513
 
1514 1514
                 return $this->removeBlock($match[1]);
@@ -1516,19 +1516,19 @@  discard block
 block discarded – undo
1516 1516
         } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) {
1517 1517
             // end template tag
1518 1518
             if ($this->debug) {
1519
-                echo 'TAG PARSING ENDED' . "\n";
1519
+                echo 'TAG PARSING ENDED'."\n";
1520 1520
             }
1521 1521
             $pointer += strlen($this->rd);
1522 1522
 
1523 1523
             return false;
1524
-        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) {
1524
+        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?' : '').')(?:\s+|[^=]).*#i', $substr, $match)) {
1525 1525
             // named parameter
1526 1526
             if ($this->debug) {
1527
-                echo 'NAMED PARAM FOUND' . "\n";
1527
+                echo 'NAMED PARAM FOUND'."\n";
1528 1528
             }
1529 1529
             $len = strlen($match[1]);
1530
-            while (substr($in, $from + $len, 1) === ' ') {
1531
-                ++ $len;
1530
+            while (substr($in, $from+$len, 1) === ' ') {
1531
+                ++$len;
1532 1532
             }
1533 1533
             if ($pointer !== null) {
1534 1534
                 $pointer += $len;
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
             $output = array(
1538 1538
                 trim($match[1], " \t\r\n=>'\""),
1539
-                $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer)
1539
+                $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer)
1540 1540
             );
1541 1541
 
1542 1542
             $parsingParams[] = $output;
@@ -1557,31 +1557,31 @@  discard block
 block discarded – undo
1557 1557
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1558 1558
         } else {
1559 1559
             // parse error
1560
-            throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"');
1560
+            throw new CompilationException($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1561 1561
         }
1562 1562
 
1563 1563
         if (empty($out)) {
1564 1564
             return '';
1565 1565
         }
1566 1566
 
1567
-        $substr = substr($in, $pointer, $to - $pointer);
1567
+        $substr = substr($in, $pointer, $to-$pointer);
1568 1568
 
1569 1569
         // var parsed, check if any var-extension applies
1570 1570
         if ($parsed === 'var') {
1571 1571
             if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) {
1572 1572
                 if ($this->debug) {
1573
-                    echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n";
1573
+                    echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1574 1574
                 }
1575 1575
                 // parse expressions
1576
-                $pointer += strlen($match[0]) - 1;
1576
+                $pointer += strlen($match[0])-1;
1577 1577
                 if (is_array($parsingParams)) {
1578 1578
                     if ($match[2] == '$') {
1579 1579
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1580 1580
                     } else {
1581 1581
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1582 1582
                     }
1583
-                    $out[count($out) - 1][0] .= $match[1] . $expr[0][0];
1584
-                    $out[count($out) - 1][1] .= $match[1] . $expr[0][1];
1583
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1584
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1585 1585
                 } else {
1586 1586
                     if ($match[2] == '$') {
1587 1587
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1589,26 +1589,26 @@  discard block
 block discarded – undo
1589 1589
                         $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer);
1590 1590
                     }
1591 1591
                     if (is_array($out) && is_array($expr)) {
1592
-                        $out[0] .= $match[1] . $expr[0];
1593
-                        $out[1] .= $match[1] . $expr[1];
1592
+                        $out[0] .= $match[1].$expr[0];
1593
+                        $out[1] .= $match[1].$expr[1];
1594 1594
                     } elseif (is_array($out)) {
1595
-                        $out[0] .= $match[1] . $expr;
1596
-                        $out[1] .= $match[1] . $expr;
1595
+                        $out[0] .= $match[1].$expr;
1596
+                        $out[1] .= $match[1].$expr;
1597 1597
                     } elseif (is_array($expr)) {
1598
-                        $out .= $match[1] . $expr[0];
1598
+                        $out .= $match[1].$expr[0];
1599 1599
                     } else {
1600
-                        $out .= $match[1] . $expr;
1600
+                        $out .= $match[1].$expr;
1601 1601
                     }
1602 1602
                 }
1603 1603
             } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) {
1604 1604
                 if ($this->debug) {
1605
-                    echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n";
1605
+                    echo 'PARSING POST-VAR ASSIGNMENT '.$substr."\n";
1606 1606
                 }
1607 1607
                 // parse assignment
1608 1608
                 $value    = $match[2];
1609 1609
                 $operator = trim($match[1]);
1610 1610
                 if (substr($value, 0, 1) == '=') {
1611
-                    throw new CompilationException($this, 'Unexpected "=" in <em>' . $substr . '</em>');
1611
+                    throw new CompilationException($this, 'Unexpected "=" in <em>'.$substr.'</em>');
1612 1612
                 }
1613 1613
 
1614 1614
                 if ($pointer !== null) {
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
                         throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible');
1630 1630
                     }
1631 1631
 
1632
-                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1);
1632
+                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf', 'init'), 1);
1633 1633
                     $tokens = $this->getParamTokens($parts);
1634 1634
                     $parts  = $this->getCompiledParams($parts);
1635 1635
 
@@ -1643,14 +1643,14 @@  discard block
 block discarded – undo
1643 1643
                 if ($this->autoEscape) {
1644 1644
                     $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out);
1645 1645
                 }
1646
-                $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE;
1646
+                $out = self::PHP_OPEN.$echo.$out.$operator.implode(' ', $value).self::PHP_CLOSE;
1647 1647
             } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) {
1648 1648
                 // parse namedparam with var as name (only for array)
1649 1649
                 if ($this->debug) {
1650
-                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n";
1650
+                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1651 1651
                 }
1652 1652
                 $len = strlen($match[1]);
1653
-                $var = $out[count($out) - 1];
1653
+                $var = $out[count($out)-1];
1654 1654
                 $pointer += $len;
1655 1655
 
1656 1656
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1665,16 +1665,16 @@  discard block
 block discarded – undo
1665 1665
             // parse modifier on funcs or vars
1666 1666
             $srcPointer = $pointer;
1667 1667
             if (is_array($parsingParams)) {
1668
-                $tmp                     = $this->replaceModifiers(
1668
+                $tmp = $this->replaceModifiers(
1669 1669
                     array(
1670 1670
                     null,
1671 1671
                     null,
1672
-                    $out[count($out) - 1][0],
1672
+                    $out[count($out)-1][0],
1673 1673
                     $match[0]
1674 1674
                     ), $curBlock, $pointer
1675 1675
                 );
1676
-                $out[count($out) - 1][0] = $tmp;
1677
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1676
+                $out[count($out)-1][0] = $tmp;
1677
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1678 1678
             } else {
1679 1679
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1680 1680
             }
@@ -1686,10 +1686,10 @@  discard block
 block discarded – undo
1686 1686
             $ptr = 0;
1687 1687
 
1688 1688
             if (is_array($parsingParams)) {
1689
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1689
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1690 1690
 
1691
-                $out[count($out) - 1][0] = $output;
1692
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1691
+                $out[count($out)-1][0] = $output;
1692
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1693 1693
             } else {
1694 1694
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1695 1695
             }
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
         }
1699 1699
 
1700 1700
         if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) {
1701
-            return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE;
1701
+            return self::PHP_OPEN.'echo '.$out.';'.self::PHP_CLOSE;
1702 1702
         } else {
1703 1703
             return $out;
1704 1704
         }
@@ -1724,11 +1724,11 @@  discard block
 block discarded – undo
1724 1724
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1725 1725
     {
1726 1726
         $output = '';
1727
-        $cmdstr = substr($in, $from, $to - $from);
1728
-        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match);
1727
+        $cmdstr = substr($in, $from, $to-$from);
1728
+        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1729 1729
 
1730 1730
         if (empty($match[1])) {
1731
-            throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15));
1731
+            throw new CompilationException($this, 'Parse error, invalid function name : '.substr($cmdstr, 0, 15));
1732 1732
         }
1733 1733
 
1734 1734
         $func = $match[1];
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
         }
1739 1739
 
1740 1740
         if ($this->debug) {
1741
-            echo 'FUNC FOUND (' . $func . ')' . "\n";
1741
+            echo 'FUNC FOUND ('.$func.')'."\n";
1742 1742
         }
1743 1743
 
1744 1744
         $paramsep = '';
@@ -1750,11 +1750,11 @@  discard block
 block discarded – undo
1750 1750
             $paramspos = $match[1][0][1];
1751 1751
             $paramsep  = substr($match[1][0][0], - 1) === '(' ? ')' : '';
1752 1752
             if ($paramsep === ')') {
1753
-                $paramspos += strlen($match[1][0][0]) - 1;
1753
+                $paramspos += strlen($match[1][0][0])-1;
1754 1754
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1755 1755
                     $paramsep = '';
1756 1756
                     if (strlen($match[1][0][0]) > 1) {
1757
-                        -- $paramspos;
1757
+                        --$paramspos;
1758 1758
                     }
1759 1759
                 }
1760 1760
             }
@@ -1779,8 +1779,8 @@  discard block
 block discarded – undo
1779 1779
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1780 1780
                 }
1781 1781
             }
1782
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1783
-            $paramstr   = substr($cmdstr, $paramspos + 1);
1782
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1783
+            $paramstr   = substr($cmdstr, $paramspos+1);
1784 1784
             if (substr($paramstr, - 1, 1) === $paramsep) {
1785 1785
                 $paramstr = substr($paramstr, 0, - 1);
1786 1786
             }
@@ -1802,36 +1802,36 @@  discard block
 block discarded – undo
1802 1802
 
1803 1803
                             if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') {
1804 1804
                                 if ($this->debug) {
1805
-                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT ' . $ptr . "\n";
1805
+                                    echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT '.$ptr."\n";
1806 1806
                                 }
1807 1807
                                 break 2;
1808 1808
                             } elseif ($paramstr[$ptr] === ';') {
1809
-                                ++ $ptr;
1809
+                                ++$ptr;
1810 1810
                                 if ($this->debug) {
1811
-                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n";
1811
+                                    echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT '.$ptr."\n";
1812 1812
                                 }
1813 1813
                                 break 2;
1814 1814
                             } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') {
1815 1815
                                 if ($this->debug) {
1816
-                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT ' . $ptr . "\n";
1816
+                                    echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT '.$ptr."\n";
1817 1817
                                 }
1818 1818
                                 break 2;
1819 1819
                             } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
1820 1820
                                 if ($this->debug) {
1821
-                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT ' . $ptr . "\n";
1821
+                                    echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT '.$ptr."\n";
1822 1822
                                 }
1823 1823
                                 break 2;
1824 1824
                             }
1825 1825
 
1826 1826
                             if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") {
1827
-                                ++ $ptr;
1827
+                                ++$ptr;
1828 1828
                             } else {
1829 1829
                                 break;
1830 1830
                             }
1831 1831
                         }
1832 1832
 
1833 1833
                         if ($this->debug) {
1834
-                            echo 'FUNC START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
1834
+                            echo 'FUNC START PARAM PARSING WITH POINTER AT '.$ptr."\n";
1835 1835
                         }
1836 1836
 
1837 1837
                         if ($func === 'if' || $func === 'elseif' || $func === 'tif') {
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
                         }
1844 1844
 
1845 1845
                         if ($this->debug) {
1846
-                            echo 'PARAM PARSED, POINTER AT ' . $ptr . ' (' . substr($paramstr, $ptr - 1, 3) . ')' . "\n";
1846
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1847 1847
                         }
1848 1848
                     }
1849 1849
                 }
@@ -1867,16 +1867,16 @@  discard block
 block discarded – undo
1867 1867
         }
1868 1868
 
1869 1869
         if ($pointer !== null) {
1870
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1870
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1871 1871
             if ($this->debug) {
1872
-                echo 'FUNC ADDS ' . ((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)) . ' TO POINTER' . "\n";
1872
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1873 1873
             }
1874 1874
         }
1875 1875
 
1876 1876
         if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) {
1877 1877
             // handle static method calls with security policy
1878 1878
             if (strstr($func, '::') !== false && $this->securityPolicy !== null && $this->securityPolicy->isMethodAllowed(explode('::', strtolower($func))) !== true) {
1879
-                throw new SecurityException('Call to a disallowed php function : ' . $func);
1879
+                throw new SecurityException('Call to a disallowed php function : '.$func);
1880 1880
             }
1881 1881
             $pluginType = Core::NATIVE_PLUGIN;
1882 1882
         } else {
@@ -1920,14 +1920,14 @@  discard block
 block discarded – undo
1920 1920
                     $this->customPlugins[$func]['function']
1921 1921
                 ), $state);
1922 1922
             } else {
1923
-                if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
1923
+                if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
1924 1924
                     $params = $this->mapParams($params, array(
1925
-                        'Plugin' . Core::toCamelCase($func),
1925
+                        'Plugin'.Core::toCamelCase($func),
1926 1926
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1927 1927
                     ), $state);
1928 1928
                 } else {
1929 1929
                     $params = $this->mapParams($params, array(
1930
-                        Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
1930
+                        Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
1931 1931
                         ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'
1932 1932
                     ), $state);
1933 1933
                 }
@@ -1937,23 +1937,21 @@  discard block
 block discarded – undo
1937 1937
                 $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state);
1938 1938
             } else {
1939 1939
                 // Custom plugin
1940
-                if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ?
1940
+                if (function_exists('Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ?
1941 1941
                         'Compile' : '')) !== false) {
1942
-                    $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType &
1942
+                    $params = $this->mapParams($params, 'Plugin'.Core::toCamelCase($func).(($pluginType &
1943 1943
                             Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1944 1944
                 } // Builtin helper plugin
1945
-                elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . (
1945
+                elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(
1946 1946
                     ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) {
1947
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase
1948
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1947
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1949 1948
                 } // Builtin function plugin
1950 1949
                 else {
1951
-                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
1952
-                        ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1950
+                    $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state);
1953 1951
                 }
1954 1952
             }
1955 1953
         } elseif ($pluginType & Core::SMARTY_MODIFIER) {
1956
-            $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')';
1954
+            $output = 'smarty_modifier_'.$func.'('.implode(', ', $params).')';
1957 1955
         } elseif ($pluginType & Core::PROXY_PLUGIN) {
1958 1956
             $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
1959 1957
         } elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
@@ -1988,7 +1986,7 @@  discard block
 block discarded – undo
1988 1986
         if ($pluginType & Core::NATIVE_PLUGIN) {
1989 1987
             if ($func === 'do') {
1990 1988
                 if (isset($params['*'])) {
1991
-                    $output = implode(';', $params['*']) . ';';
1989
+                    $output = implode(';', $params['*']).';';
1992 1990
                 } else {
1993 1991
                     $output = '';
1994 1992
                 }
@@ -1996,13 +1994,13 @@  discard block
 block discarded – undo
1996 1994
                 if (is_array($parsingParams) || $curBlock !== 'root') {
1997 1995
                     throw new CompilationException($this, 'Do can not be used inside another function or block');
1998 1996
                 } else {
1999
-                    return self::PHP_OPEN . $output . self::PHP_CLOSE;
1997
+                    return self::PHP_OPEN.$output.self::PHP_CLOSE;
2000 1998
                 }
2001 1999
             } else {
2002 2000
                 if (isset($params['*'])) {
2003
-                    $output = $func . '(' . implode(', ', $params['*']) . ')';
2001
+                    $output = $func.'('.implode(', ', $params['*']).')';
2004 2002
                 } else {
2005
-                    $output = $func . '()';
2003
+                    $output = $func.'()';
2006 2004
                 }
2007 2005
             }
2008 2006
         } elseif ($pluginType & Core::FUNC_PLUGIN) {
@@ -2011,16 +2009,16 @@  discard block
 block discarded – undo
2011 2009
                     $funcCompiler = $this->customPlugins[$func]['callback'];
2012 2010
                 } else {
2013 2011
                     // Custom plugin
2014
-                    if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
2015
-                        $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
2012
+                    if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
2013
+                        $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
2016 2014
                     } // Builtin helper plugin
2017
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2015
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2018 2016
                             'Compile') !== false) {
2019
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) .
2017
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).
2020 2018
                             'Compile';
2021 2019
                     } // Builtin function plugin
2022 2020
                     else {
2023
-                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
2021
+                        $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
2024 2022
                             'Compile';
2025 2023
                     }
2026 2024
                 }
@@ -2035,24 +2033,24 @@  discard block
 block discarded – undo
2035 2033
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
2036 2034
                     $callback = $this->customPlugins[$func]['callback'];
2037 2035
                     if ($callback instanceof Closure) {
2038
-                        $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')';
2036
+                        $output = 'call_user_func($this->getCustomPlugin(\''.$func.'\'), '.$params.')';
2039 2037
                     } else {
2040
-                        $output = 'call_user_func(\'' . $callback . '\', ' . $params . ')';
2038
+                        $output = 'call_user_func(\''.$callback.'\', '.$params.')';
2041 2039
                     }
2042 2040
                 } else {
2043 2041
                     // Custom plugin
2044
-                    if (function_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2045
-                        $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params .
2042
+                    if (function_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2043
+                        $output = 'Plugin'.Core::toCamelCase($func).'('.$params.
2046 2044
                             ')';
2047 2045
                     } // Builtin helper plugin
2048
-                    elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !==
2046
+                    elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func)) !==
2049 2047
                         false) {
2050
-                        $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' .
2051
-                            $params . ')';
2048
+                        $output = Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($func).'('.
2049
+                            $params.')';
2052 2050
                     } // Builtin function plugin
2053 2051
                     else {
2054
-                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '(' .
2055
-                            $params . ')';
2052
+                        $output = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'('.
2053
+                            $params.')';
2056 2054
                     }
2057 2055
                 }
2058 2056
             }
@@ -2062,7 +2060,7 @@  discard block
 block discarded – undo
2062 2060
                     $callback = $this->customPlugins[$func]['callback'];
2063 2061
                     if (!is_array($callback)) {
2064 2062
                         if (!method_exists($callback, 'compile')) {
2065
-                            throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
2063
+                            throw new Exception('Custom plugin '.$func.' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
2066 2064
                         }
2067 2065
                         if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
2068 2066
                             $funcCompiler = array($callback, 'compile');
@@ -2073,11 +2071,11 @@  discard block
 block discarded – undo
2073 2071
                         $funcCompiler = $callback;
2074 2072
                     }
2075 2073
                 } else {
2076
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2077
-                        $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
2074
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2075
+                        $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
2078 2076
                     } else {
2079 2077
                         $funcCompiler = array(
2080
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
2078
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
2081 2079
                             'compile'
2082 2080
                         );
2083 2081
                     }
@@ -2090,32 +2088,32 @@  discard block
 block discarded – undo
2090 2088
                     $callback = $this->customPlugins[$func]['callback'];
2091 2089
                     if (!is_array($callback)) {
2092 2090
                         if (!method_exists($callback, 'process')) {
2093
-                            throw new Exception('Custom plugin ' . $func . ' must implement the "process" method to be usable, or you should provide a full callback to the method to use');
2091
+                            throw new Exception('Custom plugin '.$func.' must implement the "process" method to be usable, or you should provide a full callback to the method to use');
2094 2092
                         }
2095 2093
                         if (($ref = new ReflectionMethod($callback, 'process')) && $ref->isStatic()) {
2096
-                            $output = 'call_user_func(array(\'' . $callback . '\', \'process\'), ' . $params . ')';
2094
+                            $output = 'call_user_func(array(\''.$callback.'\', \'process\'), '.$params.')';
2097 2095
                         } else {
2098
-                            $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback . '\'), \'process\'), ' . $params . ')';
2096
+                            $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback.'\'), \'process\'), '.$params.')';
2099 2097
                         }
2100 2098
                     } elseif (is_object($callback[0])) {
2101
-                        $output = 'call_user_func(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), ' . $params . ')';
2099
+                        $output = 'call_user_func(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), '.$params.')';
2102 2100
                     } elseif (($ref = new ReflectionMethod($callback[0], $callback[1])) && $ref->isStatic()) {
2103
-                        $output = 'call_user_func(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), ' . $params . ')';
2101
+                        $output = 'call_user_func(array(\''.$callback[0].'\', \''.$callback[1].'\'), '.$params.')';
2104 2102
                     } else {
2105
-                        $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback[0] . '\'), \'' . $callback[1] . '\'), ' . $params . ')';
2103
+                        $output = 'call_user_func(array($this->getObjectPlugin(\''.$callback[0].'\'), \''.$callback[1].'\'), '.$params.')';
2106 2104
                     }
2107 2105
                     if (empty($params)) {
2108
-                        $output = substr($output, 0, - 3) . ')';
2106
+                        $output = substr($output, 0, - 3).')';
2109 2107
                     }
2110 2108
                 } else {
2111
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2112
-                        $output = '$this->classCall(\'Plugin' . $func . '\', array(' . $params . '))';
2113
-                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !==
2109
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
2110
+                        $output = '$this->classCall(\'Plugin'.$func.'\', array('.$params.'))';
2111
+                    } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func)) !==
2114 2112
                     false) {
2115
-                        $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', 
2116
-                        array(' . $params . '))';
2117
-                    } else{
2118
-                        $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
2113
+                        $output = '$this->classCall(\''.Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.$func.'\', 
2114
+                        array(' . $params.'))';
2115
+                    } else {
2116
+                        $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
2119 2117
                     }
2120 2118
                 }
2121 2119
             }
@@ -2132,21 +2130,21 @@  discard block
 block discarded – undo
2132 2130
                 $callback = $this->customPlugins[$func]['callback'];
2133 2131
                 if (is_array($callback)) {
2134 2132
                     if (is_object($callback[0])) {
2135
-                        $output = 'call_user_func_array(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2133
+                        $output = 'call_user_func_array(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array(array('.$params.'), $this))';
2136 2134
                     } else {
2137
-                        $output = 'call_user_func_array(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(array(' . $params . '), $this))';
2135
+                        $output = 'call_user_func_array(array(\''.$callback[0].'\', \''.$callback[1].'\'), array(array('.$params.'), $this))';
2138 2136
                     }
2139 2137
                 } else {
2140
-                    $output = $callback . '(array(' . $params . '), $this)';
2138
+                    $output = $callback.'(array('.$params.'), $this)';
2141 2139
                 }
2142 2140
             } else {
2143
-                $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)';
2141
+                $output = 'smarty_function_'.$func.'(array('.$params.'), $this)';
2144 2142
             }
2145 2143
         } elseif ($pluginType & Core::TEMPLATE_PLUGIN) {
2146 2144
             array_unshift($params, '$this');
2147 2145
             $params                                 = self::implode_r($params);
2148
-            $output                                 = 'Plugin' . Core::toCamelCase($func) .
2149
-                $this->templatePlugins[$func]['uuid'] . '(' . $params . ')';
2146
+            $output                                 = 'Plugin'.Core::toCamelCase($func).
2147
+                $this->templatePlugins[$func]['uuid'].'('.$params.')';
2150 2148
             $this->templatePlugins[$func]['called'] = true;
2151 2149
         }
2152 2150
 
@@ -2178,29 +2176,29 @@  discard block
 block discarded – undo
2178 2176
      */
2179 2177
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2180 2178
     {
2181
-        $substr = substr($in, $from, $to - $from);
2179
+        $substr = substr($in, $from, $to-$from);
2182 2180
         $first  = $substr[0];
2183 2181
 
2184 2182
         if ($this->debug) {
2185
-            echo 'STRING FOUND (in ' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . ')' . "\n";
2183
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2186 2184
         }
2187 2185
         $strend = false;
2188
-        $o      = $from + 1;
2186
+        $o      = $from+1;
2189 2187
         while ($strend === false) {
2190 2188
             $strend = strpos($in, $first, $o);
2191 2189
             if ($strend === false) {
2192
-                throw new CompilationException($this, 'Unfinished string, started with ' . substr($in, $from, $to - $from));
2190
+                throw new CompilationException($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2193 2191
             }
2194
-            if (substr($in, $strend - 1, 1) === '\\') {
2195
-                $o      = $strend + 1;
2192
+            if (substr($in, $strend-1, 1) === '\\') {
2193
+                $o      = $strend+1;
2196 2194
                 $strend = false;
2197 2195
             }
2198 2196
         }
2199 2197
         if ($this->debug) {
2200
-            echo 'STRING DELIMITED: ' . substr($in, $from, $strend + 1 - $from) . "\n";
2198
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2201 2199
         }
2202 2200
 
2203
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2201
+        $srcOutput = substr($in, $from, $strend+1-$from);
2204 2202
 
2205 2203
         if ($pointer !== null) {
2206 2204
             $pointer += strlen($srcOutput);
@@ -2209,13 +2207,13 @@  discard block
 block discarded – undo
2209 2207
         $output = $this->replaceStringVars($srcOutput, $first);
2210 2208
 
2211 2209
         // handle modifiers
2212
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2210
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2213 2211
             $modstr = $match[1];
2214 2212
 
2215 2213
             if ($curBlock === 'root' && substr($modstr, - 1) === '}') {
2216 2214
                 $modstr = substr($modstr, 0, - 1);
2217 2215
             }
2218
-            $modstr = str_replace('\\' . $first, $first, $modstr);
2216
+            $modstr = str_replace('\\'.$first, $first, $modstr);
2219 2217
             $ptr    = 0;
2220 2218
             $output = $this->replaceModifiers(array(null, null, $output, $modstr), 'string', $ptr);
2221 2219
 
@@ -2223,7 +2221,7 @@  discard block
 block discarded – undo
2223 2221
             if ($pointer !== null) {
2224 2222
                 $pointer += $ptr;
2225 2223
             }
2226
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2224
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2227 2225
         }
2228 2226
 
2229 2227
         if (is_array($parsingParams)) {
@@ -2254,10 +2252,10 @@  discard block
 block discarded – undo
2254 2252
      */
2255 2253
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2256 2254
     {
2257
-        $substr = substr($in, $from, $to - $from);
2255
+        $substr = substr($in, $from, $to-$from);
2258 2256
 
2259 2257
         if ($this->debug) {
2260
-            echo 'CONST FOUND : ' . $substr . "\n";
2258
+            echo 'CONST FOUND : '.$substr."\n";
2261 2259
         }
2262 2260
 
2263 2261
         if (!preg_match('#^%([\\\\a-z0-9_:]+)#i', $substr, $m)) {
@@ -2296,7 +2294,7 @@  discard block
 block discarded – undo
2296 2294
         }
2297 2295
 
2298 2296
         if ($curBlock !== 'root') {
2299
-            $output = '(defined("' . $key . '") ? ' . $key . ' : null)';
2297
+            $output = '(defined("'.$key.'") ? '.$key.' : null)';
2300 2298
         } else {
2301 2299
             $output = $key;
2302 2300
         }
@@ -2321,7 +2319,7 @@  discard block
 block discarded – undo
2321 2319
      */
2322 2320
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2323 2321
     {
2324
-        $substr = substr($in, $from, $to - $from);
2322
+        $substr = substr($in, $from, $to-$from);
2325 2323
 
2326 2324
         // var key
2327 2325
         $varRegex = '(\\$?\\.?[a-z0-9\\\\_:]*(?:(?:(?:\\.|->)(?:[a-z0-9\\\\_:]+|(?R))|\\[(?:[a-z0-9\\\\_:]+|(?R)|(["\'])[^\\2]*?\\2)\\]))*)';
@@ -2349,13 +2347,13 @@  discard block
 block discarded – undo
2349 2347
 
2350 2348
             if (substr($key, - 1) == '.') {
2351 2349
                 $key = substr($key, 0, - 1);
2352
-                -- $matchedLength;
2350
+                --$matchedLength;
2353 2351
             }
2354 2352
 
2355 2353
             if ($hasMethodCall) {
2356
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2357
-                $key        = substr($match[1], 1, strrpos($match[1], '->') - 1);
2358
-                $methodCall = substr($match[1], strrpos($match[1], '->')) . $match[3];
2354
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2355
+                $key        = substr($match[1], 1, strrpos($match[1], '->')-1);
2356
+                $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2359 2357
             }
2360 2358
 
2361 2359
             if ($hasModifiers) {
@@ -2371,9 +2369,9 @@  discard block
 block discarded – undo
2371 2369
 
2372 2370
             if ($this->debug) {
2373 2371
                 if ($hasMethodCall) {
2374
-                    echo 'METHOD CALL FOUND : $' . $key . substr($methodCall, 0, 30) . "\n";
2372
+                    echo 'METHOD CALL FOUND : $'.$key.substr($methodCall, 0, 30)."\n";
2375 2373
                 } else {
2376
-                    echo 'VAR FOUND : $' . $key . "\n";
2374
+                    echo 'VAR FOUND : $'.$key."\n";
2377 2375
                 }
2378 2376
             }
2379 2377
 
@@ -2384,7 +2382,7 @@  discard block
 block discarded – undo
2384 2382
                 $uid           = 0;
2385 2383
                 $parsed        = array($uid => '');
2386 2384
                 $current       = &$parsed;
2387
-                $curTxt        = &$parsed[$uid ++];
2385
+                $curTxt        = &$parsed[$uid++];
2388 2386
                 $tree          = array();
2389 2387
                 $chars         = str_split($key, 1);
2390 2388
                 $inSplittedVar = false;
@@ -2393,33 +2391,33 @@  discard block
 block discarded – undo
2393 2391
                 while (($char = array_shift($chars)) !== null) {
2394 2392
                     if ($char === '[') {
2395 2393
                         if (count($tree) > 0) {
2396
-                            ++ $bracketCount;
2394
+                            ++$bracketCount;
2397 2395
                         } else {
2398 2396
                             $tree[]        = &$current;
2399
-                            $current[$uid] = array($uid + 1 => '');
2400
-                            $current       = &$current[$uid ++];
2401
-                            $curTxt        = &$current[$uid ++];
2397
+                            $current[$uid] = array($uid+1 => '');
2398
+                            $current       = &$current[$uid++];
2399
+                            $curTxt        = &$current[$uid++];
2402 2400
                             continue;
2403 2401
                         }
2404 2402
                     } elseif ($char === ']') {
2405 2403
                         if ($bracketCount > 0) {
2406
-                            -- $bracketCount;
2404
+                            --$bracketCount;
2407 2405
                         } else {
2408
-                            $current = &$tree[count($tree) - 1];
2406
+                            $current = &$tree[count($tree)-1];
2409 2407
                             array_pop($tree);
2410 2408
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2411 2409
                                 $current[$uid] = '';
2412
-                                $curTxt        = &$current[$uid ++];
2410
+                                $curTxt        = &$current[$uid++];
2413 2411
                             }
2414 2412
                             continue;
2415 2413
                         }
2416 2414
                     } elseif ($char === '$') {
2417 2415
                         if (count($tree) == 0) {
2418
-                            $curTxt        = &$current[$uid ++];
2416
+                            $curTxt        = &$current[$uid++];
2419 2417
                             $inSplittedVar = true;
2420 2418
                         }
2421 2419
                     } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) {
2422
-                        $curTxt        = &$current[$uid ++];
2420
+                        $curTxt        = &$current[$uid++];
2423 2421
                         $inSplittedVar = false;
2424 2422
                     }
2425 2423
 
@@ -2428,16 +2426,16 @@  discard block
 block discarded – undo
2428 2426
                 unset($uid, $current, $curTxt, $tree, $chars);
2429 2427
 
2430 2428
                 if ($this->debug) {
2431
-                    echo 'RECURSIVE VAR REPLACEMENT : ' . $key . "\n";
2429
+                    echo 'RECURSIVE VAR REPLACEMENT : '.$key."\n";
2432 2430
                 }
2433 2431
 
2434 2432
                 $key = $this->flattenVarTree($parsed);
2435 2433
 
2436 2434
                 if ($this->debug) {
2437
-                    echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2435
+                    echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2438 2436
                 }
2439 2437
 
2440
-                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("' . $key . '")');
2438
+                $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("'.$key.'")');
2441 2439
             } else {
2442 2440
                 $output = $this->parseVarKey($key, $hasModifiers ? 'modifier' : $curBlock);
2443 2441
             }
@@ -2462,10 +2460,10 @@  discard block
 block discarded – undo
2462 2460
                     if (substr($expMatch[2][$k], 0, 1) === '=') {
2463 2461
                         $assign = true;
2464 2462
                         if ($operator === '=') {
2465
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, can not use "==" in expressions');
2463
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, can not use "==" in expressions');
2466 2464
                         }
2467 2465
                         if ($curBlock !== 'root') {
2468
-                            throw new CompilationException($this, 'Invalid expression <em>' . $substr . '</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2466
+                            throw new CompilationException($this, 'Invalid expression <em>'.$substr.'</em>, assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}');
2469 2467
                         }
2470 2468
                         $operator .= '=';
2471 2469
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
@@ -2476,22 +2474,22 @@  discard block
 block discarded – undo
2476 2474
                         $expMatch[2][$k] = substr($expMatch[2][$k], 1);
2477 2475
                     }
2478 2476
                     if (($operator === '+' || $operator === '-') && $expMatch[2][$k] === $operator) {
2479
-                        $output = '(' . $output . $operator . $operator . ')';
2477
+                        $output = '('.$output.$operator.$operator.')';
2480 2478
                         break;
2481 2479
                     } elseif (substr($expMatch[2][$k], 0, 1) === '$') {
2482
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2480
+                        $output = '('.$output.' '.$operator.' '.$this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2483 2481
                     } elseif (substr($expMatch[2][$k], 0, 1) === '%') {
2484
-                        $output = '(' . $output . ' ' . $operator . ' ' . $this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')';
2482
+                        $output = '('.$output.' '.$operator.' '.$this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression').')';
2485 2483
                     } elseif (!empty($expMatch[2][$k])) {
2486
-                        $output = '(' . $output . ' ' . $operator . ' ' . str_replace(',', '.', $expMatch[2][$k]) . ')';
2484
+                        $output = '('.$output.' '.$operator.' '.str_replace(',', '.', $expMatch[2][$k]).')';
2487 2485
                     } else {
2488
-                        throw new CompilationException($this, 'Unfinished expression <em>' . $substr . '</em>, missing var or number after math operator');
2486
+                        throw new CompilationException($this, 'Unfinished expression <em>'.$substr.'</em>, missing var or number after math operator');
2489 2487
                     }
2490 2488
                 }
2491 2489
             }
2492 2490
 
2493 2491
             if ($this->autoEscape === true && $curBlock !== 'condition') {
2494
-                $output = '(is_string($tmp=' . $output . ') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2492
+                $output = '(is_string($tmp='.$output.') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
2495 2493
             }
2496 2494
 
2497 2495
             // handle modifiers
@@ -2515,7 +2513,7 @@  discard block
 block discarded – undo
2515 2513
             } elseif ($curBlock === 'expression' || $curBlock === 'variable') {
2516 2514
                 return $output;
2517 2515
             } elseif (isset($assign)) {
2518
-                return self::PHP_OPEN . $output . ';' . self::PHP_CLOSE;
2516
+                return self::PHP_OPEN.$output.';'.self::PHP_CLOSE;
2519 2517
             } else {
2520 2518
                 return $output;
2521 2519
             }
@@ -2523,7 +2521,7 @@  discard block
 block discarded – undo
2523 2521
             if ($curBlock === 'string' || $curBlock === 'delimited_string') {
2524 2522
                 return array(0, '');
2525 2523
             } else {
2526
-                throw new CompilationException($this, 'Invalid variable name <em>' . $substr . '</em>');
2524
+                throw new CompilationException($this, 'Invalid variable name <em>'.$substr.'</em>');
2527 2525
             }
2528 2526
         }
2529 2527
     }
@@ -2578,16 +2576,16 @@  discard block
 block discarded – undo
2578 2576
             if (empty($methMatch[2])) {
2579 2577
                 // property
2580 2578
                 if ($curBlock === 'root') {
2581
-                    $output .= '->' . $methMatch[1];
2579
+                    $output .= '->'.$methMatch[1];
2582 2580
                 } else {
2583
-                    $output = '(($tmp = ' . $output . ') ? $tmp->' . $methMatch[1] . ' : null)';
2581
+                    $output = '(($tmp = '.$output.') ? $tmp->'.$methMatch[1].' : null)';
2584 2582
                 }
2585 2583
                 $ptr += strlen($methMatch[1]);
2586 2584
             } else {
2587 2585
                 // method
2588 2586
                 if (substr($methMatch[2], 0, 2) === '()') {
2589
-                    $parsedCall = $methMatch[1] . '()';
2590
-                    $ptr += strlen($methMatch[1]) + 2;
2587
+                    $parsedCall = $methMatch[1].'()';
2588
+                    $ptr += strlen($methMatch[1])+2;
2591 2589
                 } else {
2592 2590
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2593 2591
                 }
@@ -2596,15 +2594,15 @@  discard block
 block discarded – undo
2596 2594
                     $method = strtolower(substr($parsedCall, 0, $argPos));
2597 2595
                     $args   = substr($parsedCall, $argPos);
2598 2596
                     if ($curBlock === 'root') {
2599
-                        $output = '$this->getSecurityPolicy()->callMethod($this, ' . $output . ', ' . var_export($method, true) . ', array' . $args . ')';
2597
+                        $output = '$this->getSecurityPolicy()->callMethod($this, '.$output.', '.var_export($method, true).', array'.$args.')';
2600 2598
                     } else {
2601
-                        $output = '(($tmp = ' . $output . ') ? $this->getSecurityPolicy()->callMethod($this, $tmp, ' . var_export($method, true) . ', array' . $args . ') : null)';
2599
+                        $output = '(($tmp = '.$output.') ? $this->getSecurityPolicy()->callMethod($this, $tmp, '.var_export($method, true).', array'.$args.') : null)';
2602 2600
                     }
2603 2601
                 } else {
2604 2602
                     if ($curBlock === 'root') {
2605
-                        $output .= '->' . $parsedCall;
2603
+                        $output .= '->'.$parsedCall;
2606 2604
                     } else {
2607
-                        $output = '(($tmp = ' . $output . ') ? $tmp->' . $parsedCall . ' : null)';
2605
+                        $output = '(($tmp = '.$output.') ? $tmp->'.$parsedCall.' : null)';
2608 2606
                     }
2609 2607
                 }
2610 2608
             }
@@ -2630,21 +2628,21 @@  discard block
 block discarded – undo
2630 2628
             return '$this->scope';
2631 2629
         }
2632 2630
         if (substr($key, 0, 1) === '.') {
2633
-            $key = 'dwoo' . $key;
2631
+            $key = 'dwoo'.$key;
2634 2632
         }
2635 2633
         if (preg_match('#dwoo\.(get|post|server|cookies|session|env|request)((?:\.[a-z0-9_-]+)+)#i', $key, $m)) {
2636 2634
             $global = strtoupper($m[1]);
2637 2635
             if ($global === 'COOKIES') {
2638 2636
                 $global = 'COOKIE';
2639 2637
             }
2640
-            $key = '$_' . $global;
2638
+            $key = '$_'.$global;
2641 2639
             foreach (explode('.', ltrim($m[2], '.')) as $part) {
2642
-                $key .= '[' . var_export($part, true) . ']';
2640
+                $key .= '['.var_export($part, true).']';
2643 2641
             }
2644 2642
             if ($curBlock === 'root') {
2645 2643
                 $output = $key;
2646 2644
             } else {
2647
-                $output = '(isset(' . $key . ')?' . $key . ':null)';
2645
+                $output = '(isset('.$key.')?'.$key.':null)';
2648 2646
             }
2649 2647
         } elseif (preg_match('#dwoo\\.const\\.([a-z0-9\\\\_:]+)#i', $key, $m)) {
2650 2648
             return $this->parseConstKey($m[1], $curBlock);
@@ -2660,9 +2658,9 @@  discard block
 block discarded – undo
2660 2658
                     $output = '$tmp_key';
2661 2659
                 } else {
2662 2660
                     if ($curBlock === 'root') {
2663
-                        $output = '$this->scope["' . $key . '"]';
2661
+                        $output = '$this->scope["'.$key.'"]';
2664 2662
                     } else {
2665
-                        $output = '(isset($this->scope["' . $key . '"]) ? $this->scope["' . $key . '"] : null)';
2663
+                        $output = '(isset($this->scope["'.$key.'"]) ? $this->scope["'.$key.'"] : null)';
2666 2664
                     }
2667 2665
                 }
2668 2666
             } else {
@@ -2673,7 +2671,7 @@  discard block
 block discarded – undo
2673 2671
                     $parentCnt = 0;
2674 2672
 
2675 2673
                     while (true) {
2676
-                        ++ $parentCnt;
2674
+                        ++$parentCnt;
2677 2675
                         array_shift($m[2]);
2678 2676
                         array_shift($m[1]);
2679 2677
                         if (current($m[2]) === '_parent') {
@@ -2682,7 +2680,7 @@  discard block
 block discarded – undo
2682 2680
                         break;
2683 2681
                     }
2684 2682
 
2685
-                    $output = '$this->readParentVar(' . $parentCnt . ')';
2683
+                    $output = '$this->readParentVar('.$parentCnt.')';
2686 2684
                 } else {
2687 2685
                     if ($i === 'dwoo') {
2688 2686
                         $output = '$this->globals';
@@ -2701,28 +2699,28 @@  discard block
 block discarded – undo
2701 2699
                     while (count($m[1]) && $m[1][0] !== '->') {
2702 2700
                         $m[2][0] = preg_replace('/(^\\\([\'"])|\\\([\'"])$)/x', '$2$3', $m[2][0]);
2703 2701
                         if (substr($m[2][0], 0, 1) == '"' || substr($m[2][0], 0, 1) == "'") {
2704
-                            $output .= '[' . $m[2][0] . ']';
2702
+                            $output .= '['.$m[2][0].']';
2705 2703
                         } else {
2706
-                            $output .= '["' . $m[2][0] . '"]';
2704
+                            $output .= '["'.$m[2][0].'"]';
2707 2705
                         }
2708 2706
                         array_shift($m[2]);
2709 2707
                         array_shift($m[1]);
2710 2708
                     }
2711 2709
 
2712 2710
                     if ($curBlock !== 'root') {
2713
-                        $output = '(isset(' . $output . ') ? ' . $output . ':null)';
2711
+                        $output = '(isset('.$output.') ? '.$output.':null)';
2714 2712
                     }
2715 2713
                 }
2716 2714
 
2717 2715
                 if (count($m[2])) {
2718 2716
                     unset($m[0]);
2719
-                    $output = '$this->readVarInto(' . str_replace("\n", '', var_export($m, true)) . ', ' . $output . ', ' . ($curBlock == 'root' ? 'false' : 'true') . ')';
2717
+                    $output = '$this->readVarInto('.str_replace("\n", '', var_export($m, true)).', '.$output.', '.($curBlock == 'root' ? 'false' : 'true').')';
2720 2718
                 }
2721 2719
             }
2722 2720
         } else {
2723 2721
             preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+)\]?#i', $key, $m);
2724 2722
             unset($m[0]);
2725
-            $output = '$this->readVar(' . str_replace("\n", '', var_export($m, true)) . ')';
2723
+            $output = '$this->readVar('.str_replace("\n", '', var_export($m, true)).')';
2726 2724
         }
2727 2725
 
2728 2726
         return $output;
@@ -2742,38 +2740,38 @@  discard block
 block discarded – undo
2742 2740
         $out = $recursed ? '".$this->readVarInto(' : '';
2743 2741
         foreach ($tree as $bit) {
2744 2742
             if (is_array($bit)) {
2745
-                $out .= '.' . $this->flattenVarTree($bit, false);
2743
+                $out .= '.'.$this->flattenVarTree($bit, false);
2746 2744
             } else {
2747 2745
                 $key = str_replace('"', '\\"', $bit);
2748 2746
 
2749 2747
                 if (substr($key, 0, 1) === '$') {
2750
-                    $out .= '".' . $this->parseVar($key, 0, strlen($key), false, 'variable') . '."';
2748
+                    $out .= '".'.$this->parseVar($key, 0, strlen($key), false, 'variable').'."';
2751 2749
                 } else {
2752 2750
                     $cnt = substr_count($key, '$');
2753 2751
 
2754 2752
                     if ($this->debug) {
2755
-                        echo 'PARSING SUBVARS IN : ' . $key . "\n";
2753
+                        echo 'PARSING SUBVARS IN : '.$key."\n";
2756 2754
                     }
2757 2755
                     if ($cnt > 0) {
2758
-                        while (-- $cnt >= 0) {
2756
+                        while (--$cnt >= 0) {
2759 2757
                             if (isset($last)) {
2760
-                                $last = strrpos($key, '$', - (strlen($key) - $last + 1));
2758
+                                $last = strrpos($key, '$', - (strlen($key)-$last+1));
2761 2759
                             } else {
2762 2760
                                 $last = strrpos($key, '$');
2763 2761
                             }
2764
-                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2762
+                            preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch);
2765 2763
 
2766 2764
                             $len = strlen($submatch[0]);
2767 2765
                             $key = substr_replace(
2768 2766
                                 $key, preg_replace_callback(
2769
-                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2767
+                                    '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)'.'((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array(
2770 2768
                                         $this,
2771 2769
                                         'replaceVarKeyHelper'
2772 2770
                                     ), substr($key, $last, $len)
2773 2771
                                 ), $last, $len
2774 2772
                             );
2775 2773
                             if ($this->debug) {
2776
-                                echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n";
2774
+                                echo 'RECURSIVE VAR REPLACEMENT DONE : '.$key."\n";
2777 2775
                             }
2778 2776
                         }
2779 2777
                         unset($last);
@@ -2799,7 +2797,7 @@  discard block
 block discarded – undo
2799 2797
      */
2800 2798
     protected function replaceVarKeyHelper($match)
2801 2799
     {
2802
-        return '".' . $this->parseVar($match[0], 0, strlen($match[0]), false, 'variable') . '."';
2800
+        return '".'.$this->parseVar($match[0], 0, strlen($match[0]), false, 'variable').'."';
2803 2801
     }
2804 2802
 
2805 2803
     /**
@@ -2819,7 +2817,7 @@  discard block
 block discarded – undo
2819 2817
      */
2820 2818
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2821 2819
     {
2822
-        $substr = substr($in, $from, $to - $from);
2820
+        $substr = substr($in, $from, $to-$from);
2823 2821
 
2824 2822
         $end = strlen($substr);
2825 2823
 
@@ -2893,48 +2891,48 @@  discard block
 block discarded – undo
2893 2891
 
2894 2892
         if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') {
2895 2893
             if ($this->debug) {
2896
-                echo 'BOOLEAN(FALSE) PARSED' . "\n";
2894
+                echo 'BOOLEAN(FALSE) PARSED'."\n";
2897 2895
             }
2898 2896
             $substr = 'false';
2899 2897
             $type   = self::T_BOOL;
2900 2898
         } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') {
2901 2899
             if ($this->debug) {
2902
-                echo 'BOOLEAN(TRUE) PARSED' . "\n";
2900
+                echo 'BOOLEAN(TRUE) PARSED'."\n";
2903 2901
             }
2904 2902
             $substr = 'true';
2905 2903
             $type   = self::T_BOOL;
2906 2904
         } elseif ($substr === 'null' || $substr === 'NULL') {
2907 2905
             if ($this->debug) {
2908
-                echo 'NULL PARSED' . "\n";
2906
+                echo 'NULL PARSED'."\n";
2909 2907
             }
2910 2908
             $substr = 'null';
2911 2909
             $type   = self::T_NULL;
2912 2910
         } elseif (is_numeric($substr)) {
2913
-            $substr = (float)$substr;
2914
-            if ((int)$substr == $substr) {
2915
-                $substr = (int)$substr;
2911
+            $substr = (float) $substr;
2912
+            if ((int) $substr == $substr) {
2913
+                $substr = (int) $substr;
2916 2914
             }
2917 2915
             $type = self::T_NUMERIC;
2918 2916
             if ($this->debug) {
2919
-                echo 'NUMBER (' . $substr . ') PARSED' . "\n";
2917
+                echo 'NUMBER ('.$substr.') PARSED'."\n";
2920 2918
             }
2921 2919
         } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) {
2922 2920
             if ($this->debug) {
2923 2921
                 echo 'SIMPLE MATH PARSED . "\n"';
2924 2922
             }
2925 2923
             $type   = self::T_MATH;
2926
-            $substr = '(' . $substr . ')';
2924
+            $substr = '('.$substr.')';
2927 2925
         } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) {
2928 2926
             if ($this->debug) {
2929
-                echo 'BREAKCHAR (' . $substr . ') PARSED' . "\n";
2927
+                echo 'BREAKCHAR ('.$substr.') PARSED'."\n";
2930 2928
             }
2931 2929
             $type = self::T_BREAKCHAR;
2932 2930
             //$substr = '"'.$substr.'"';
2933 2931
         } else {
2934
-            $substr = $this->replaceStringVars('\'' . str_replace('\'', '\\\'', $substr) . '\'', '\'', $curBlock);
2932
+            $substr = $this->replaceStringVars('\''.str_replace('\'', '\\\'', $substr).'\'', '\'', $curBlock);
2935 2933
             $type   = self::T_UNQUOTED_STRING;
2936 2934
             if ($this->debug) {
2937
-                echo 'BLABBER (' . $substr . ') CASTED AS STRING' . "\n";
2935
+                echo 'BLABBER ('.$substr.') CASTED AS STRING'."\n";
2938 2936
             }
2939 2937
         }
2940 2938
 
@@ -2964,28 +2962,28 @@  discard block
 block discarded – undo
2964 2962
     {
2965 2963
         $pos = 0;
2966 2964
         if ($this->debug) {
2967
-            echo 'STRING VAR REPLACEMENT : ' . $string . "\n";
2965
+            echo 'STRING VAR REPLACEMENT : '.$string."\n";
2968 2966
         }
2969 2967
         // replace vars
2970 2968
         while (($pos = strpos($string, '$', $pos)) !== false) {
2971
-            $prev = substr($string, $pos - 1, 1);
2969
+            $prev = substr($string, $pos-1, 1);
2972 2970
             if ($prev === '\\') {
2973
-                ++ $pos;
2971
+                ++$pos;
2974 2972
                 continue;
2975 2973
             }
2976 2974
 
2977 2975
             $var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2978 2976
             $len = $var[0];
2979
-            $var = $this->parse(str_replace('\\' . $first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2977
+            $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2980 2978
 
2981
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
2982
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos - 1, $len + 2);
2979
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
2980
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
2983 2981
             } else {
2984
-                $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos, $len);
2982
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
2985 2983
             }
2986
-            $pos += strlen($var[1]) + 2;
2984
+            $pos += strlen($var[1])+2;
2987 2985
             if ($this->debug) {
2988
-                echo 'STRING VAR REPLACEMENT DONE : ' . $string . "\n";
2986
+                echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
2989 2987
             }
2990 2988
         }
2991 2989
 
@@ -3021,7 +3019,7 @@  discard block
 block discarded – undo
3021 3019
     protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null)
3022 3020
     {
3023 3021
         if ($this->debug) {
3024
-            echo 'PARSING MODIFIERS : ' . $m[3] . "\n";
3022
+            echo 'PARSING MODIFIERS : '.$m[3]."\n";
3025 3023
         }
3026 3024
 
3027 3025
         if ($pointer !== null) {
@@ -3045,7 +3043,7 @@  discard block
 block discarded – undo
3045 3043
             }
3046 3044
             if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) {
3047 3045
                 if ($this->debug) {
3048
-                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND' . "\n";
3046
+                    echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND'."\n";
3049 3047
                 }
3050 3048
                 $continue = false;
3051 3049
                 if ($pointer !== null) {
@@ -3056,7 +3054,7 @@  discard block
 block discarded – undo
3056 3054
             $cmdstr   = $cmdstrsrc;
3057 3055
             $paramsep = ':';
3058 3056
             if (!preg_match('/^(@{0,2}[a-z_][a-z0-9_]*)(:)?/i', $cmdstr, $match)) {
3059
-                throw new CompilationException($this, 'Invalid modifier name, started with : ' . substr($cmdstr, 0, 10));
3057
+                throw new CompilationException($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
3060 3058
             }
3061 3059
             $paramspos = !empty($match[2]) ? strlen($match[1]) : false;
3062 3060
             $func      = $match[1];
@@ -3066,10 +3064,10 @@  discard block
 block discarded – undo
3066 3064
                 $cmdstrsrc = substr($cmdstrsrc, strlen($func));
3067 3065
                 $params    = array();
3068 3066
                 if ($this->debug) {
3069
-                    echo 'MODIFIER (' . $func . ') CALLED WITH NO PARAMS' . "\n";
3067
+                    echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
3070 3068
                 }
3071 3069
             } else {
3072
-                $paramstr = substr($cmdstr, $paramspos + 1);
3070
+                $paramstr = substr($cmdstr, $paramspos+1);
3073 3071
                 if (substr($paramstr, - 1, 1) === $paramsep) {
3074 3072
                     $paramstr = substr($paramstr, 0, - 1);
3075 3073
                 }
@@ -3078,41 +3076,41 @@  discard block
 block discarded – undo
3078 3076
                 $params = array();
3079 3077
                 while ($ptr < strlen($paramstr)) {
3080 3078
                     if ($this->debug) {
3081
-                        echo 'MODIFIER (' . $func . ') START PARAM PARSING WITH POINTER AT ' . $ptr . "\n";
3079
+                        echo 'MODIFIER ('.$func.') START PARAM PARSING WITH POINTER AT '.$ptr."\n";
3082 3080
                     }
3083 3081
                     if ($this->debug) {
3084
-                        echo $paramstr . '--' . $ptr . '--' . strlen($paramstr) . '--modifier' . "\n";
3082
+                        echo $paramstr.'--'.$ptr.'--'.strlen($paramstr).'--modifier'."\n";
3085 3083
                     }
3086 3084
                     $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr);
3087 3085
                     if ($this->debug) {
3088
-                        echo 'PARAM PARSED, POINTER AT ' . $ptr . "\n";
3086
+                        echo 'PARAM PARSED, POINTER AT '.$ptr."\n";
3089 3087
                     }
3090 3088
 
3091 3089
                     if ($ptr >= strlen($paramstr)) {
3092 3090
                         if ($this->debug) {
3093
-                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED' . "\n";
3091
+                            echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED'."\n";
3094 3092
                         }
3095 3093
                         break;
3096 3094
                     }
3097 3095
 
3098 3096
                     if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) {
3099 3097
                         if ($this->debug) {
3100
-                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT ' . $ptr . "\n";
3098
+                            echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT '.$ptr."\n";
3101 3099
                         }
3102 3100
                         if ($paramstr[$ptr] !== '|') {
3103 3101
                             $continue = false;
3104 3102
                             if ($pointer !== null) {
3105
-                                $pointer -= strlen($paramstr) - $ptr;
3103
+                                $pointer -= strlen($paramstr)-$ptr;
3106 3104
                             }
3107 3105
                         }
3108
-                        ++ $ptr;
3106
+                        ++$ptr;
3109 3107
                         break;
3110 3108
                     }
3111 3109
                     if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') {
3112
-                        ++ $ptr;
3110
+                        ++$ptr;
3113 3111
                     }
3114 3112
                 }
3115
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
3113
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
3116 3114
                 foreach ($params as $k => $p) {
3117 3115
                     if (is_array($p) && is_array($p[1])) {
3118 3116
                         $state |= 2;
@@ -3152,9 +3150,9 @@  discard block
 block discarded – undo
3152 3150
                 $params = self::implode_r($params);
3153 3151
 
3154 3152
                 if ($mapped) {
3155
-                    $output = '$this->arrayMap(\'' . $func . '\', array(' . $params . '))';
3153
+                    $output = '$this->arrayMap(\''.$func.'\', array('.$params.'))';
3156 3154
                 } else {
3157
-                    $output = $func . '(' . $params . ')';
3155
+                    $output = $func.'('.$params.')';
3158 3156
                 }
3159 3157
             } elseif ($pluginType & Core::PROXY_PLUGIN) {
3160 3158
                 $params = $this->mapParams($params, $this->getDwoo()->getPluginProxy()->getCallback($func), $state);
@@ -3172,36 +3170,36 @@  discard block
 block discarded – undo
3172 3170
                     $callback = $this->customPlugins[$func]['callback'];
3173 3171
                     if (is_array($callback)) {
3174 3172
                         if (is_object($callback[0])) {
3175
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3173
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3176 3174
                         } else {
3177
-                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3175
+                            $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3178 3176
                         }
3179 3177
                     } elseif ($mapped) {
3180
-                        $output = '$this->arrayMap(\'' . $callback . '\', array(' . $params . '))';
3178
+                        $output = '$this->arrayMap(\''.$callback.'\', array('.$params.'))';
3181 3179
                     } else {
3182
-                        $output = $callback . '(' . $params . ')';
3180
+                        $output = $callback.'('.$params.')';
3183 3181
                     }
3184 3182
                 } elseif ($mapped) {
3185
-                    $output = '$this->arrayMap(\'smarty_modifier_' . $func . '\', array(' . $params . '))';
3183
+                    $output = '$this->arrayMap(\'smarty_modifier_'.$func.'\', array('.$params.'))';
3186 3184
                 } else {
3187
-                    $output = 'smarty_modifier_' . $func . '(' . $params . ')';
3185
+                    $output = 'smarty_modifier_'.$func.'('.$params.')';
3188 3186
                 }
3189 3187
             } else {
3190 3188
                 if ($pluginType & Core::CUSTOM_PLUGIN) {
3191 3189
                     $callback   = $this->customPlugins[$func]['callback'];
3192 3190
                     $pluginName = $callback;
3193 3191
                 } else {
3194
-                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' .
3195
-                            Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3192
+                    if (class_exists('Plugin'.Core::toCamelCase($func)) !== false || function_exists('Plugin'.
3193
+                            Core::toCamelCase($func).(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''))
3196 3194
                         !== false) {
3197
-                        $pluginName = 'Plugin' . Core::toCamelCase($func);
3195
+                        $pluginName = 'Plugin'.Core::toCamelCase($func);
3198 3196
                     } else {
3199
-                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func);
3197
+                        $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func);
3200 3198
                     }
3201 3199
                     if ($pluginType & Core::CLASS_PLUGIN) {
3202 3200
                         $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process');
3203 3201
                     } else {
3204
-                        $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3202
+                        $callback = $pluginName.(($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '');
3205 3203
                     }
3206 3204
                 }
3207 3205
                 $params = $this->mapParams($params, $callback, $state);
@@ -3218,10 +3216,10 @@  discard block
 block discarded – undo
3218 3216
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3219 3217
                             $funcCompiler = $this->customPlugins[$func]['callback'];
3220 3218
                         } else {
3221
-                            if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) {
3222
-                                $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile';
3219
+                            if (function_exists('Plugin'.Core::toCamelCase($func).'Compile') !== false) {
3220
+                                $funcCompiler = 'Plugin'.Core::toCamelCase($func).'Compile';
3223 3221
                             } else {
3224
-                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) .
3222
+                                $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).
3225 3223
                                     'Compile';
3226 3224
                             }
3227 3225
                         }
@@ -3232,9 +3230,9 @@  discard block
 block discarded – undo
3232 3230
 
3233 3231
                         $params = self::implode_r($params);
3234 3232
                         if ($mapped) {
3235
-                            $output = '$this->arrayMap(\'' . $pluginName . '\', array(' . $params . '))';
3233
+                            $output = '$this->arrayMap(\''.$pluginName.'\', array('.$params.'))';
3236 3234
                         } else {
3237
-                            $output = $pluginName . '(' . $params . ')';
3235
+                            $output = $pluginName.'('.$params.')';
3238 3236
                         }
3239 3237
                     }
3240 3238
                 } else {
@@ -3246,7 +3244,7 @@  discard block
 block discarded – undo
3246 3244
                             $callback = $this->customPlugins[$func]['callback'];
3247 3245
                             if (!is_array($callback)) {
3248 3246
                                 if (!method_exists($callback, 'compile')) {
3249
-                                    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');
3247
+                                    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');
3250 3248
                                 }
3251 3249
                                 if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
3252 3250
                                     $funcCompiler = array($callback, 'compile');
@@ -3257,11 +3255,11 @@  discard block
 block discarded – undo
3257 3255
                                 $funcCompiler = $callback;
3258 3256
                             }
3259 3257
                         } else {
3260
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3261
-                                $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
3258
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3259
+                                $funcCompiler = array('Plugin'.Core::toCamelCase($func), 'compile');
3262 3260
                             } else {
3263 3261
                                 $funcCompiler = array(
3264
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
3262
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func),
3265 3263
                                     'compile'
3266 3264
                                 );
3267 3265
                             }
@@ -3273,19 +3271,19 @@  discard block
 block discarded – undo
3273 3271
 
3274 3272
                         if ($pluginType & Core::CUSTOM_PLUGIN) {
3275 3273
                             if (is_object($callback[0])) {
3276
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))';
3274
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array($this->plugins[\''.$func.'\'][\'callback\'][0], \''.$callback[1].'\'), array('.$params.'))';
3277 3275
                             } else {
3278
-                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))';
3276
+                                $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array').'(array(\''.$callback[0].'\', \''.$callback[1].'\'), array('.$params.'))';
3279 3277
                             }
3280 3278
                         } elseif ($mapped) {
3281 3279
                             $output = '$this->arrayMap(array($this->getObjectPlugin(\''.
3282
-                                Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), 
3283
-                            \'process\'), array(' . $params . '))';
3280
+                                Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($func).'\'), 
3281
+                            \'process\'), array(' . $params.'))';
3284 3282
                         } else {
3285
-                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3286
-                                $output = '$this->classCall(\'Plugin' . Core::toCamelCase($func) . '\', array(' . $params . '))';
3283
+                            if (class_exists('Plugin'.Core::toCamelCase($func)) !== false) {
3284
+                                $output = '$this->classCall(\'Plugin'.Core::toCamelCase($func).'\', array('.$params.'))';
3287 3285
                             } else {
3288
-                                $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))';
3286
+                                $output = '$this->classCall(\''.$func.'\', array('.$params.'))';
3289 3287
                             }
3290 3288
                         }
3291 3289
                     }
@@ -3298,7 +3296,7 @@  discard block
 block discarded – undo
3298 3296
         } elseif ($curBlock === 'var' || $m[1] === null) {
3299 3297
             return $output;
3300 3298
         } elseif ($curBlock === 'string' || $curBlock === 'root') {
3301
-            return $m[1] . '.' . $output . '.' . $m[1] . (isset($add) ? $add : null);
3299
+            return $m[1].'.'.$output.'.'.$m[1].(isset($add) ? $add : null);
3302 3300
         }
3303 3301
 
3304 3302
         return '';
@@ -3321,14 +3319,14 @@  discard block
 block discarded – undo
3321 3319
             if (is_array($p)) {
3322 3320
                 $out2 = 'array(';
3323 3321
                 foreach ($p as $k2 => $v) {
3324
-                    $out2 .= var_export($k2, true) . ' => ' . (is_array($v) ? 'array(' . self::implode_r($v, true) . ')' : $v) . ', ';
3322
+                    $out2 .= var_export($k2, true).' => '.(is_array($v) ? 'array('.self::implode_r($v, true).')' : $v).', ';
3325 3323
                 }
3326
-                $p = rtrim($out2, ', ') . ')';
3324
+                $p = rtrim($out2, ', ').')';
3327 3325
             }
3328 3326
             if ($recursiveCall) {
3329
-                $out .= var_export($k, true) . ' => ' . $p . ', ';
3327
+                $out .= var_export($k, true).' => '.$p.', ';
3330 3328
             } else {
3331
-                $out .= $p . ', ';
3329
+                $out .= $p.', ';
3332 3330
             }
3333 3331
         }
3334 3332
 
@@ -3352,7 +3350,7 @@  discard block
 block discarded – undo
3352 3350
         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)) {
3353 3351
             $phpFunc = true;
3354 3352
         } elseif ($this->securityPolicy !== null && function_exists($name) && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) === false) {
3355
-            throw new SecurityException('Call to a disallowed php function : ' . $name);
3353
+            throw new SecurityException('Call to a disallowed php function : '.$name);
3356 3354
         }
3357 3355
 
3358 3356
         while ($pluginType <= 0) {
@@ -3363,61 +3361,60 @@  discard block
 block discarded – undo
3363 3361
             elseif (isset($this->customPlugins[$name])) {
3364 3362
                 $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN;
3365 3363
             } // Class blocks plugin
3366
-            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), false) !==
3364
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), false) !==
3367 3365
                 false) {
3368
-                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3366
+                if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name), 'Dwoo\Block\Plugin')) {
3369 3367
                     $pluginType = Core::BLOCK_PLUGIN;
3370 3368
                 } else {
3371 3369
                     $pluginType = Core::CLASS_PLUGIN;
3372 3370
                 }
3373
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name));
3371
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($name));
3374 3372
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3375 3373
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3376 3374
                 }
3377 3375
             } // Class functions plugin
3378
-            elseif(class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name), false) !==
3376
+            elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name), false) !==
3379 3377
                 false) {
3380 3378
                 $pluginType = Core::CLASS_PLUGIN;
3381
-                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name));
3379
+                $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name));
3382 3380
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3383 3381
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3384 3382
                 }
3385 3383
             } // Class without namespace
3386
-            elseif(class_exists('Plugin' . Core::toCamelCase($name), false) !== false) {
3384
+            elseif (class_exists('Plugin'.Core::toCamelCase($name), false) !== false) {
3387 3385
                 $pluginType = Core::CLASS_PLUGIN;
3388
-                $interfaces = class_implements('Plugin' . Core::toCamelCase($name));
3386
+                $interfaces = class_implements('Plugin'.Core::toCamelCase($name));
3389 3387
                 if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) {
3390 3388
                     $pluginType |= Core::COMPILABLE_PLUGIN;
3391 3389
                 }
3392 3390
             } // Function plugin (with/without namespaces)
3393
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase
3394
-                    ($name)) !==
3395
-                false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) {
3391
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name)) !==
3392
+                false || function_exists('Plugin'.Core::toCamelCase($name)) !== false) {
3396 3393
                 $pluginType = Core::FUNC_PLUGIN;
3397 3394
             } // Function plugin compile (with/without namespaces)
3398
-            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) .
3399
-                    'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !==
3395
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin'.Core::toCamelCase($name).
3396
+                    'Compile') !== false || function_exists('Plugin'.Core::toCamelCase($name).'Compile') !==
3400 3397
                 false) {
3401 3398
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3402 3399
             } // Helper plugin compile
3403
-            elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile')
3400
+            elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS.'Plugin'.Core::toCamelCase($name).'Compile')
3404 3401
                 !== false) {
3405 3402
                 $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN;
3406 3403
             } // Smarty modifier
3407
-            elseif (function_exists('smarty_modifier_' . $name) !== false) {
3404
+            elseif (function_exists('smarty_modifier_'.$name) !== false) {
3408 3405
                 $pluginType = Core::SMARTY_MODIFIER;
3409 3406
             } // Smarty function
3410
-            elseif (function_exists('smarty_function_' . $name) !== false) {
3407
+            elseif (function_exists('smarty_function_'.$name) !== false) {
3411 3408
                 $pluginType = Core::SMARTY_FUNCTION;
3412 3409
             } // Smarty block
3413
-            elseif (function_exists('smarty_block_' . $name) !== false) {
3410
+            elseif (function_exists('smarty_block_'.$name) !== false) {
3414 3411
                 $pluginType = Core::SMARTY_BLOCK;
3415 3412
             } // Everything else
3416 3413
             else {
3417 3414
                 if ($pluginType === - 1) {
3418 3415
                     try {
3419 3416
                         $this->getDwoo()->getLoader()->loadPlugin(
3420
-                            'Plugin' . Core::toCamelCase($name));
3417
+                            'Plugin'.Core::toCamelCase($name));
3421 3418
                     }
3422 3419
                     catch (Exception $e) {
3423 3420
                         if (isset($phpFunc)) {
@@ -3430,9 +3427,9 @@  discard block
 block discarded – undo
3430 3427
                         }
3431 3428
                     }
3432 3429
                 } else {
3433
-                    throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType);
3430
+                    throw new Exception('Plugin "'.$name.'" could not be found, type:'.$pluginType);
3434 3431
                 }
3435
-                ++ $pluginType;
3432
+                ++$pluginType;
3436 3433
             }
3437 3434
         }
3438 3435
 
@@ -3507,9 +3504,9 @@  discard block
 block discarded – undo
3507 3504
                 if (count($ps) === 0) {
3508 3505
                     if ($v[1] === false) {
3509 3506
                         throw new CompilationException(
3510
-                            $this, 'Rest argument missing for ' . str_replace(
3507
+                            $this, 'Rest argument missing for '.str_replace(
3511 3508
                                 array(
3512
-                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3509
+                                    Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3513 3510
                                 'Compile'
3514 3511
                                 ), '', (is_array($callback) ? $callback[0] : $callback)
3515 3512
                             )
@@ -3542,7 +3539,7 @@  discard block
 block discarded – undo
3542 3539
                 // parameter is not defined and not optional, throw error
3543 3540
                 if (is_array($callback)) {
3544 3541
                     if (is_object($callback[0])) {
3545
-                        $name = get_class($callback[0]) . '::' . $callback[1];
3542
+                        $name = get_class($callback[0]).'::'.$callback[1];
3546 3543
                     } else {
3547 3544
                         $name = $callback[0];
3548 3545
                     }
@@ -3551,9 +3548,9 @@  discard block
 block discarded – undo
3551 3548
                 }
3552 3549
 
3553 3550
                 throw new CompilationException(
3554
-                    $this, 'Argument ' . $k . '/' . $v[0] . ' missing for ' . str_replace(
3551
+                    $this, 'Argument '.$k.'/'.$v[0].' missing for '.str_replace(
3555 3552
                         array(
3556
-                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin',
3553
+                            Core::NAMESPACE_PLUGINS_FUNCTIONS.'Plugin',
3557 3554
                         'Compile'
3558 3555
                         ), '', $name
3559 3556
                     )
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/Processors/PluginSmartyCompatible.php 1 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/Plugins/Functions/PluginCapitalize.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 function PluginCapitalize(Core $dwoo, $value, $numwords = false)
31 31
 {
32 32
     if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
33
-        return mb_convert_case((string)$value, MB_CASE_TITLE, $dwoo->getCharset());
33
+        return mb_convert_case((string) $value, MB_CASE_TITLE, $dwoo->getCharset());
34 34
     } else {
35
-        $bits = explode(' ', (string)$value);
35
+        $bits = explode(' ', (string) $value);
36 36
         $out  = '';
37 37
         while (list(, $v) = each($bits)) {
38 38
             if (preg_match('#^[^0-9]+$#', $v)) {
39
-                $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset());
39
+                $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset());
40 40
             } else {
41
-                $out .= ' ' . $v;
41
+                $out .= ' '.$v;
42 42
             }
43 43
         }
44 44
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginInclude.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
         $include = $dwoo->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
55 55
     }
56 56
     catch (SecurityException $e) {
57
-        $dwoo->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
57
+        $dwoo->triggerError('Include : Security restriction : '.$e->getMessage(), E_USER_WARNING);
58 58
     }
59 59
     catch (Exception $e) {
60
-        $dwoo->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
60
+        $dwoo->triggerError('Include : '.$e->getMessage(), E_USER_WARNING);
61 61
     }
62 62
 
63 63
     if ($include === null) {
64
-        $dwoo->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', E_USER_WARNING);
64
+        $dwoo->triggerError('Include : Resource "'.$resource.':'.$identifier.'" not found.', E_USER_WARNING);
65 65
     } elseif ($include === false) {
66
-        $dwoo->triggerError('Include : Resource "' . $resource . '" does not support includes.', E_USER_WARNING);
66
+        $dwoo->triggerError('Include : Resource "'.$resource.'" does not support includes.', E_USER_WARNING);
67 67
     }
68 68
 
69 69
     if (is_string($data)) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     if (count($rest)) {
76
-        $vars = $rest + $vars;
76
+        $vars = $rest+$vars;
77 77
     }
78 78
 
79 79
     $clone = clone $dwoo;
Please login to merge, or discard this patch.