Completed
Push — developer ( f9e515...68a04b )
by Błażej
506:11 queued 468:51
created
libraries/Smarty/libs/sysplugins/smarty_internal_configfileparser.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     /**
181
-     * @param null $new_instance
181
+     * @param Smarty_Internal_Configfileparser $new_instance
182 182
      *
183 183
      * @return null
184 184
      */
@@ -949,6 +949,9 @@  discard block
 block discarded – undo
949 949
         $this->retvalue = $this->_retvalue;
950 950
     }
951 951
 
952
+    /**
953
+     * @param integer $yymajor
954
+     */
952 955
     public function doParse($yymajor, $yytokenvalue)
953 956
     {
954 957
         $yyerrorhit = 0;   /* True if yymajor has invoked an error */
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function offsetExists($offset)
30 30
     {
31
-        return isset($this->metadata[ $offset ]);
31
+        return isset($this->metadata[$offset]);
32 32
     }
33 33
 
34 34
     public function offsetGet($offset)
35 35
     {
36
-        return $this->metadata[ $offset ];
36
+        return $this->metadata[$offset];
37 37
     }
38 38
 
39 39
     public function offsetSet($offset, $value)
40 40
     {
41 41
         if ($offset === null) {
42
-            if (isset($value[ 0 ])) {
42
+            if (isset($value[0])) {
43 43
                 $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value;
44 44
                 $this->metadata = array_merge($this->metadata, $x);
45 45
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
         }
53 53
         if ($value instanceof TPC_yyToken) {
54 54
             if ($value->metadata) {
55
-                $this->metadata[ $offset ] = $value->metadata;
55
+                $this->metadata[$offset] = $value->metadata;
56 56
             }
57 57
         } elseif ($value) {
58
-            $this->metadata[ $offset ] = $value;
58
+            $this->metadata[$offset] = $value;
59 59
         }
60 60
     }
61 61
 
62 62
     public function offsetUnset($offset)
63 63
     {
64
-        unset($this->metadata[ $offset ]);
64
+        unset($this->metadata[$offset]);
65 65
     }
66 66
 }
67 67
 
68 68
 class TPC_yyStackEntry
69 69
 {
70
-    public $stateno;       /* The state-number */
71
-    public $major;         /* The major token value.  This is the code
70
+    public $stateno; /* The state-number */
71
+    public $major; /* The major token value.  This is the code
72 72
                      ** number for the token at this stack level */
73 73
     public $minor; /* The user-supplied minor token value.  This
74 74
                      ** is the value of the token  */
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 
227 227
         $str = "";
228 228
         foreach ($ss as $s) {
229
-            if (strlen($s) === 2 && $s[ 0 ] === '\\') {
230
-                if (isset(self::$escapes_single[ $s[ 1 ] ])) {
231
-                    $s = self::$escapes_single[ $s[ 1 ] ];
229
+            if (strlen($s) === 2 && $s[0] === '\\') {
230
+                if (isset(self::$escapes_single[$s[1]])) {
231
+                    $s = self::$escapes_single[$s[1]];
232 232
                 }
233 233
             }
234 234
             $str .= $s;
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
      */
270 270
     private function set_var(Array $var, Array &$target_array)
271 271
     {
272
-        $key = $var[ "key" ];
273
-        $value = $var[ "value" ];
272
+        $key = $var["key"];
273
+        $value = $var["value"];
274 274
 
275
-        if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) {
276
-            $target_array[ 'vars' ][ $key ] = $value;
275
+        if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
276
+            $target_array['vars'][$key] = $value;
277 277
         } else {
278
-            settype($target_array[ 'vars' ][ $key ], 'array');
279
-            $target_array[ 'vars' ][ $key ][] = $value;
278
+            settype($target_array['vars'][$key], 'array');
279
+            $target_array['vars'][$key][] = $value;
280 280
         }
281 281
     }
282 282
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
      */
288 288
     private function add_global_vars(Array $vars)
289 289
     {
290
-        if (!isset($this->compiler->config_data[ 'vars' ])) {
291
-            $this->compiler->config_data[ 'vars' ] = Array();
290
+        if (!isset($this->compiler->config_data['vars'])) {
291
+            $this->compiler->config_data['vars'] = Array();
292 292
         }
293 293
         foreach ($vars as $var) {
294 294
             $this->set_var($var, $this->compiler->config_data);
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
      */
304 304
     private function add_section_vars($section_name, Array $vars)
305 305
     {
306
-        if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) {
307
-            $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array();
306
+        if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
307
+            $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
308 308
         }
309 309
         foreach ($vars as $var) {
310
-            $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]);
310
+            $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
311 311
         }
312 312
     }
313 313
 
@@ -365,14 +365,14 @@  discard block
 block discarded – undo
365 365
 
366 366
     const YY_SHIFT_MAX = 19;
367 367
 
368
-    static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
368
+    static public $yy_shift_ofst = array(-8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
369 369
                                          20,);
370 370
 
371 371
     const YY_REDUCE_USE_DFLT = - 21;
372 372
 
373 373
     const YY_REDUCE_MAX = 10;
374 374
 
375
-    static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
375
+    static public $yy_reduce_ofst = array(-10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
376 376
 
377 377
     static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
378 378
                                             array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,),
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 
423 423
     public $yyTracePrompt;
424 424
 
425
-    public $yyidx;                    /* Index of top element in stack */
426
-    public $yyerrcnt;                 /* Shifts left before out of the error */
427
-    public $yystack = array();  /* The parser's stack */
425
+    public $yyidx; /* Index of top element in stack */
426
+    public $yyerrcnt; /* Shifts left before out of the error */
427
+    public $yystack = array(); /* The parser's stack */
428 428
 
429 429
     public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
430 430
                                 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT',
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             return 'End of Input';
450 450
         }
451 451
         if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
452
-            return $this->yyTokenName[ $tokenType ];
452
+            return $this->yyTokenName[$tokenType];
453 453
         } else {
454 454
             return "Unknown";
455 455
         }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
     {
460 460
         switch ($yymajor) {
461 461
             default:
462
-                break;   /* If no destructor action specified: do nothing */
462
+                break; /* If no destructor action specified: do nothing */
463 463
         }
464 464
     }
465 465
 
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
         }
471 471
         $yytos = array_pop($this->yystack);
472 472
         if ($this->yyTraceFILE && $this->yyidx >= 0) {
473
-            fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n");
473
+            fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] . "\n");
474 474
         }
475 475
         $yymajor = $yytos->major;
476 476
         self::yy_destructor($yymajor, $yytos->minor);
477
-        $this->yyidx --;
477
+        $this->yyidx--;
478 478
 
479 479
         return $yymajor;
480 480
     }
@@ -493,14 +493,14 @@  discard block
 block discarded – undo
493 493
     {
494 494
         static $res3 = array();
495 495
         static $res4 = array();
496
-        $state = $this->yystack[ $this->yyidx ]->stateno;
497
-        $expected = self::$yyExpectedTokens[ $state ];
498
-        if (isset($res3[ $state ][ $token ])) {
499
-            if ($res3[ $state ][ $token ]) {
496
+        $state = $this->yystack[$this->yyidx]->stateno;
497
+        $expected = self::$yyExpectedTokens[$state];
498
+        if (isset($res3[$state][$token])) {
499
+            if ($res3[$state][$token]) {
500 500
                 return $expected;
501 501
             }
502 502
         } else {
503
-            if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
503
+            if ($res3[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) {
504 504
                 return $expected;
505 505
             }
506 506
         }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                 // reduce action
513 513
                 $done = 0;
514 514
                 do {
515
-                    if ($done ++ == 100) {
515
+                    if ($done++ == 100) {
516 516
                         $this->yyidx = $yyidx;
517 517
                         $this->yystack = $stack;
518 518
                         // too much recursion prevents proper detection
@@ -520,20 +520,20 @@  discard block
 block discarded – undo
520 520
                         return array_unique($expected);
521 521
                     }
522 522
                     $yyruleno = $yyact - self::YYNSTATE;
523
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
524
-                    $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
525
-                                                              self::$yyRuleInfo[ $yyruleno ][ 0 ]);
526
-                    if (isset(self::$yyExpectedTokens[ $nextstate ])) {
527
-                        $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
528
-                        if (isset($res4[ $nextstate ][ $token ])) {
529
-                            if ($res4[ $nextstate ][ $token ]) {
523
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno][1];
524
+                    $nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno,
525
+                                                              self::$yyRuleInfo[$yyruleno][0]);
526
+                    if (isset(self::$yyExpectedTokens[$nextstate])) {
527
+                        $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
528
+                        if (isset($res4[$nextstate][$token])) {
529
+                            if ($res4[$nextstate][$token]) {
530 530
                                 $this->yyidx = $yyidx;
531 531
                                 $this->yystack = $stack;
532 532
                                 return array_unique($expected);
533 533
                             }
534 534
                         } else {
535
-                            if ($res4[ $nextstate ][ $token ] =
536
-                                in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
535
+                            if ($res4[$nextstate][$token] =
536
+                                in_array($token, self::$yyExpectedTokens[$nextstate], true)
537 537
                             ) {
538 538
                                 $this->yyidx = $yyidx;
539 539
                                 $this->yystack = $stack;
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
                     }
544 544
                     if ($nextstate < self::YYNSTATE) {
545 545
                         // we need to shift a non-terminal
546
-                        $this->yyidx ++;
546
+                        $this->yyidx++;
547 547
                         $x = new TPC_yyStackEntry;
548 548
                         $x->stateno = $nextstate;
549
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
550
-                        $this->yystack[ $this->yyidx ] = $x;
549
+                        $x->major = self::$yyRuleInfo[$yyruleno][0];
550
+                        $this->yystack[$this->yyidx] = $x;
551 551
                         continue 2;
552 552
                     } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
553 553
                         $this->yyidx = $yyidx;
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
         if ($token === 0) {
584 584
             return true; // 0 is not part of this
585 585
         }
586
-        $state = $this->yystack[ $this->yyidx ]->stateno;
587
-        if (isset($res[ $state ][ $token ])) {
588
-            if ($res[ $state ][ $token ]) {
586
+        $state = $this->yystack[$this->yyidx]->stateno;
587
+        if (isset($res[$state][$token])) {
588
+            if ($res[$state][$token]) {
589 589
                 return true;
590 590
             }
591 591
         } else {
592
-            if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
592
+            if ($res[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) {
593 593
                 return true;
594 594
             }
595 595
         }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
                 // reduce action
602 602
                 $done = 0;
603 603
                 do {
604
-                    if ($done ++ == 100) {
604
+                    if ($done++ == 100) {
605 605
                         $this->yyidx = $yyidx;
606 606
                         $this->yystack = $stack;
607 607
                         // too much recursion prevents proper detection
@@ -609,18 +609,18 @@  discard block
 block discarded – undo
609 609
                         return true;
610 610
                     }
611 611
                     $yyruleno = $yyact - self::YYNSTATE;
612
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
613
-                    $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
614
-                                                              self::$yyRuleInfo[ $yyruleno ][ 0 ]);
615
-                    if (isset($res2[ $nextstate ][ $token ])) {
616
-                        if ($res2[ $nextstate ][ $token ]) {
612
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno][1];
613
+                    $nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno,
614
+                                                              self::$yyRuleInfo[$yyruleno][0]);
615
+                    if (isset($res2[$nextstate][$token])) {
616
+                        if ($res2[$nextstate][$token]) {
617 617
                             $this->yyidx = $yyidx;
618 618
                             $this->yystack = $stack;
619 619
                             return true;
620 620
                         }
621 621
                     } else {
622
-                        if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
623
-                                                             in_array($token, self::$yyExpectedTokens[ $nextstate ],
622
+                        if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) &&
623
+                                                             in_array($token, self::$yyExpectedTokens[$nextstate],
624 624
                                                                       true))
625 625
                         ) {
626 626
                             $this->yyidx = $yyidx;
@@ -630,11 +630,11 @@  discard block
 block discarded – undo
630 630
                     }
631 631
                     if ($nextstate < self::YYNSTATE) {
632 632
                         // we need to shift a non-terminal
633
-                        $this->yyidx ++;
633
+                        $this->yyidx++;
634 634
                         $x = new TPC_yyStackEntry;
635 635
                         $x->stateno = $nextstate;
636
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
637
-                        $this->yystack[ $this->yyidx ] = $x;
636
+                        $x->major = self::$yyRuleInfo[$yyruleno][0];
637
+                        $this->yystack[$this->yyidx] = $x;
638 638
                         continue 2;
639 639
                     } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
640 640
                         $this->yyidx = $yyidx;
@@ -669,37 +669,37 @@  discard block
 block discarded – undo
669 669
 
670 670
     public function yy_find_shift_action($iLookAhead)
671 671
     {
672
-        $stateno = $this->yystack[ $this->yyidx ]->stateno;
672
+        $stateno = $this->yystack[$this->yyidx]->stateno;
673 673
 
674 674
         /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
675
-        if (!isset(self::$yy_shift_ofst[ $stateno ])) {
675
+        if (!isset(self::$yy_shift_ofst[$stateno])) {
676 676
             // no shift actions
677
-            return self::$yy_default[ $stateno ];
677
+            return self::$yy_default[$stateno];
678 678
         }
679
-        $i = self::$yy_shift_ofst[ $stateno ];
679
+        $i = self::$yy_shift_ofst[$stateno];
680 680
         if ($i === self::YY_SHIFT_USE_DFLT) {
681
-            return self::$yy_default[ $stateno ];
681
+            return self::$yy_default[$stateno];
682 682
         }
683 683
         if ($iLookAhead == self::YYNOCODE) {
684 684
             return self::YY_NO_ACTION;
685 685
         }
686 686
         $i += $iLookAhead;
687
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
687
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) {
688 688
             if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) &&
689
-                ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
689
+                ($iFallback = self::$yyFallback[$iLookAhead]) != 0
690 690
             ) {
691 691
                 if ($this->yyTraceFILE) {
692 692
                     fwrite($this->yyTraceFILE,
693
-                           $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " .
694
-                           $this->yyTokenName[ $iFallback ] . "\n");
693
+                           $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[$iLookAhead] . " => " .
694
+                           $this->yyTokenName[$iFallback] . "\n");
695 695
                 }
696 696
 
697 697
                 return $this->yy_find_shift_action($iFallback);
698 698
             }
699 699
 
700
-            return self::$yy_default[ $stateno ];
700
+            return self::$yy_default[$stateno];
701 701
         } else {
702
-            return self::$yy_action[ $i ];
702
+            return self::$yy_action[$i];
703 703
         }
704 704
     }
705 705
 
@@ -707,29 +707,29 @@  discard block
 block discarded – undo
707 707
     {
708 708
         /* $stateno = $this->yystack[$this->yyidx]->stateno; */
709 709
 
710
-        if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
711
-            return self::$yy_default[ $stateno ];
710
+        if (!isset(self::$yy_reduce_ofst[$stateno])) {
711
+            return self::$yy_default[$stateno];
712 712
         }
713
-        $i = self::$yy_reduce_ofst[ $stateno ];
713
+        $i = self::$yy_reduce_ofst[$stateno];
714 714
         if ($i == self::YY_REDUCE_USE_DFLT) {
715
-            return self::$yy_default[ $stateno ];
715
+            return self::$yy_default[$stateno];
716 716
         }
717 717
         if ($iLookAhead == self::YYNOCODE) {
718 718
             return self::YY_NO_ACTION;
719 719
         }
720 720
         $i += $iLookAhead;
721
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
722
-            return self::$yy_default[ $stateno ];
721
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) {
722
+            return self::$yy_default[$stateno];
723 723
         } else {
724
-            return self::$yy_action[ $i ];
724
+            return self::$yy_action[$i];
725 725
         }
726 726
     }
727 727
 
728 728
     public function yy_shift($yyNewState, $yyMajor, $yypMinor)
729 729
     {
730
-        $this->yyidx ++;
730
+        $this->yyidx++;
731 731
         if ($this->yyidx >= self::YYSTACKDEPTH) {
732
-            $this->yyidx --;
732
+            $this->yyidx--;
733 733
             if ($this->yyTraceFILE) {
734 734
                 fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
735 735
             }
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
         if ($this->yyTraceFILE && $this->yyidx > 0) {
752 752
             fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState);
753 753
             fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
754
-            for ($i = 1; $i <= $this->yyidx; $i ++) {
755
-                fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]);
754
+            for ($i = 1; $i <= $this->yyidx; $i++) {
755
+                fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[$this->yystack[$i]->major]);
756 756
             }
757 757
             fwrite($this->yyTraceFILE, "\n");
758 758
         }
@@ -780,14 +780,14 @@  discard block
 block discarded – undo
780 780
     #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
781 781
     function yy_r1()
782 782
     {
783
-        $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
783
+        $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor);
784 784
         $this->_retvalue = null;
785 785
     }
786 786
 
787 787
     #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
788 788
     function yy_r4()
789 789
     {
790
-        $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
790
+        $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
791 791
         $this->_retvalue = null;
792 792
     }
793 793
 
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
     function yy_r5()
796 796
     {
797 797
         if ($this->configReadHidden) {
798
-            $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor,
799
-                                    $this->yystack[ $this->yyidx + 0 ]->minor);
798
+            $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor,
799
+                                    $this->yystack[$this->yyidx + 0]->minor);
800 800
         }
801 801
         $this->_retvalue = null;
802 802
     }
@@ -804,14 +804,14 @@  discard block
 block discarded – undo
804 804
     #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
805 805
     function yy_r6()
806 806
     {
807
-        $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor;
807
+        $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
808 808
     }
809 809
 
810 810
     #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
811 811
     function yy_r7()
812 812
     {
813 813
         $this->_retvalue =
814
-            array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor));
814
+            array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
815 815
     }
816 816
 
817 817
     #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
@@ -823,44 +823,44 @@  discard block
 block discarded – undo
823 823
     #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
824 824
     function yy_r9()
825 825
     {
826
-        $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor,
827
-                                 "value" => $this->yystack[ $this->yyidx + 0 ]->minor);
826
+        $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor,
827
+                                 "value" => $this->yystack[$this->yyidx + 0]->minor);
828 828
     }
829 829
 
830 830
     #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
831 831
     function yy_r10()
832 832
     {
833
-        $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor;
833
+        $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
834 834
     }
835 835
 
836 836
     #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
837 837
     function yy_r11()
838 838
     {
839
-        $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor;
839
+        $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
840 840
     }
841 841
 
842 842
     #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
843 843
     function yy_r12()
844 844
     {
845
-        $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
845
+        $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
846 846
     }
847 847
 
848 848
     #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
849 849
     function yy_r13()
850 850
     {
851
-        $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
851
+        $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
852 852
     }
853 853
 
854 854
     #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
855 855
     function yy_r14()
856 856
     {
857
-        $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
857
+        $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
858 858
     }
859 859
 
860 860
     #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
861 861
     function yy_r15()
862 862
     {
863
-        $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor);
863
+        $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + - 1]->minor);
864 864
     }
865 865
 
866 866
     #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
     #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
873 873
     function yy_r17()
874 874
     {
875
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
875
+        $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
876 876
     }
877 877
 
878 878
     private $_retvalue;
@@ -881,32 +881,32 @@  discard block
 block discarded – undo
881 881
     {
882 882
         if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) {
883 883
             fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
884
-                    self::$yyRuleName[ $yyruleno ]);
884
+                    self::$yyRuleName[$yyruleno]);
885 885
         }
886 886
 
887 887
         $this->_retvalue = $yy_lefthand_side = null;
888
-        if (isset(self::$yyReduceMap[ $yyruleno ])) {
888
+        if (isset(self::$yyReduceMap[$yyruleno])) {
889 889
             // call the action
890 890
             $this->_retvalue = null;
891
-            $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
891
+            $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
892 892
             $yy_lefthand_side = $this->_retvalue;
893 893
         }
894
-        $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
895
-        $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
894
+        $yygoto = self::$yyRuleInfo[$yyruleno][0];
895
+        $yysize = self::$yyRuleInfo[$yyruleno][1];
896 896
         $this->yyidx -= $yysize;
897
-        for ($i = $yysize; $i; $i --) {
897
+        for ($i = $yysize; $i; $i--) {
898 898
             // pop all of the right-hand side parameters
899 899
             array_pop($this->yystack);
900 900
         }
901
-        $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
901
+        $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
902 902
         if ($yyact < self::YYNSTATE) {
903 903
             if (!$this->yyTraceFILE && $yysize) {
904
-                $this->yyidx ++;
904
+                $this->yyidx++;
905 905
                 $x = new TPC_yyStackEntry;
906 906
                 $x->stateno = $yyact;
907 907
                 $x->major = $yygoto;
908 908
                 $x->minor = $yy_lefthand_side;
909
-                $this->yystack[ $this->yyidx ] = $x;
909
+                $this->yystack[$this->yyidx] = $x;
910 910
             } else {
911 911
                 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
912 912
             }
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
     public function doParse($yymajor, $yytokenvalue)
953 953
     {
954
-        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
954
+        $yyerrorhit = 0; /* True if yymajor has invoked an error */
955 955
 
956 956
         if ($this->yyidx === null || $this->yyidx < 0) {
957 957
             $this->yyidx = 0;
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
         $yyendofinput = ($yymajor == 0);
966 966
 
967 967
         if ($this->yyTraceFILE) {
968
-            fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
968
+            fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
969 969
         }
970 970
 
971 971
         do {
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
             }
977 977
             if ($yyact < self::YYNSTATE) {
978 978
                 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
979
-                $this->yyerrcnt --;
979
+                $this->yyerrcnt--;
980 980
                 if ($yyendofinput && $this->yyidx >= 0) {
981 981
                     $yymajor = 0;
982 982
                 } else {
@@ -992,11 +992,11 @@  discard block
 block discarded – undo
992 992
                     if ($this->yyerrcnt < 0) {
993 993
                         $this->yy_syntax_error($yymajor, $yytokenvalue);
994 994
                     }
995
-                    $yymx = $this->yystack[ $this->yyidx ]->major;
995
+                    $yymx = $this->yystack[$this->yyidx]->major;
996 996
                     if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
997 997
                         if ($this->yyTraceFILE) {
998 998
                             fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt,
999
-                                    $this->yyTokenName[ $yymajor ]);
999
+                                    $this->yyTokenName[$yymajor]);
1000 1000
                         }
1001 1001
                         $this->yy_destructor($yymajor, $yytokenvalue);
1002 1002
                         $yymajor = self::YYNOCODE;
Please login to merge, or discard this patch.
Indentation   +959 added lines, -959 removed lines patch added patch discarded remove patch
@@ -2,75 +2,75 @@  discard block
 block discarded – undo
2 2
 
3 3
 class TPC_yyToken implements ArrayAccess
4 4
 {
5
-    public $string = '';
6
-
7
-    public $metadata = array();
8
-
9
-    public function __construct($s, $m = array())
10
-    {
11
-        if ($s instanceof TPC_yyToken) {
12
-            $this->string = $s->string;
13
-            $this->metadata = $s->metadata;
14
-        } else {
15
-            $this->string = (string) $s;
16
-            if ($m instanceof TPC_yyToken) {
17
-                $this->metadata = $m->metadata;
18
-            } elseif (is_array($m)) {
19
-                $this->metadata = $m;
20
-            }
21
-        }
22
-    }
23
-
24
-    public function __toString()
25
-    {
26
-        return $this->string;
27
-    }
28
-
29
-    public function offsetExists($offset)
30
-    {
31
-        return isset($this->metadata[ $offset ]);
32
-    }
33
-
34
-    public function offsetGet($offset)
35
-    {
36
-        return $this->metadata[ $offset ];
37
-    }
38
-
39
-    public function offsetSet($offset, $value)
40
-    {
41
-        if ($offset === null) {
42
-            if (isset($value[ 0 ])) {
43
-                $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value;
44
-                $this->metadata = array_merge($this->metadata, $x);
45
-
46
-                return;
47
-            }
48
-            $offset = count($this->metadata);
49
-        }
50
-        if ($value === null) {
51
-            return;
52
-        }
53
-        if ($value instanceof TPC_yyToken) {
54
-            if ($value->metadata) {
55
-                $this->metadata[ $offset ] = $value->metadata;
56
-            }
57
-        } elseif ($value) {
58
-            $this->metadata[ $offset ] = $value;
59
-        }
60
-    }
61
-
62
-    public function offsetUnset($offset)
63
-    {
64
-        unset($this->metadata[ $offset ]);
65
-    }
5
+	public $string = '';
6
+
7
+	public $metadata = array();
8
+
9
+	public function __construct($s, $m = array())
10
+	{
11
+		if ($s instanceof TPC_yyToken) {
12
+			$this->string = $s->string;
13
+			$this->metadata = $s->metadata;
14
+		} else {
15
+			$this->string = (string) $s;
16
+			if ($m instanceof TPC_yyToken) {
17
+				$this->metadata = $m->metadata;
18
+			} elseif (is_array($m)) {
19
+				$this->metadata = $m;
20
+			}
21
+		}
22
+	}
23
+
24
+	public function __toString()
25
+	{
26
+		return $this->string;
27
+	}
28
+
29
+	public function offsetExists($offset)
30
+	{
31
+		return isset($this->metadata[ $offset ]);
32
+	}
33
+
34
+	public function offsetGet($offset)
35
+	{
36
+		return $this->metadata[ $offset ];
37
+	}
38
+
39
+	public function offsetSet($offset, $value)
40
+	{
41
+		if ($offset === null) {
42
+			if (isset($value[ 0 ])) {
43
+				$x = ($value instanceof TPC_yyToken) ? $value->metadata : $value;
44
+				$this->metadata = array_merge($this->metadata, $x);
45
+
46
+				return;
47
+			}
48
+			$offset = count($this->metadata);
49
+		}
50
+		if ($value === null) {
51
+			return;
52
+		}
53
+		if ($value instanceof TPC_yyToken) {
54
+			if ($value->metadata) {
55
+				$this->metadata[ $offset ] = $value->metadata;
56
+			}
57
+		} elseif ($value) {
58
+			$this->metadata[ $offset ] = $value;
59
+		}
60
+	}
61
+
62
+	public function offsetUnset($offset)
63
+	{
64
+		unset($this->metadata[ $offset ]);
65
+	}
66 66
 }
67 67
 
68 68
 class TPC_yyStackEntry
69 69
 {
70
-    public $stateno;       /* The state-number */
71
-    public $major;         /* The major token value.  This is the code
70
+	public $stateno;       /* The state-number */
71
+	public $major;         /* The major token value.  This is the code
72 72
                      ** number for the token at this stack level */
73
-    public $minor; /* The user-supplied minor token value.  This
73
+	public $minor; /* The user-supplied minor token value.  This
74 74
                      ** is the value of the token  */
75 75
 }
76 76
 
@@ -90,950 +90,950 @@  discard block
 block discarded – undo
90 90
  */
91 91
 class Smarty_Internal_Configfileparser
92 92
 {
93
-    #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
94
-
95
-    /**
96
-     * result status
97
-     *
98
-     * @var bool
99
-     */
100
-    public $successful = true;
101
-
102
-    /**
103
-     * return value
104
-     *
105
-     * @var mixed
106
-     */
107
-    public $retvalue = 0;
108
-
109
-    /**
110
-     * @var
111
-     */
112
-    public $yymajor;
113
-
114
-    /**
115
-     * lexer object
116
-     *
117
-     * @var Smarty_Internal_Configfilelexer
118
-     */
119
-    private $lex;
120
-
121
-    /**
122
-     * internal error flag
123
-     *
124
-     * @var bool
125
-     */
126
-    private $internalError = false;
127
-
128
-    /**
129
-     * compiler object
130
-     *
131
-     * @var Smarty_Internal_Config_File_Compiler
132
-     */
133
-    public $compiler = null;
134
-
135
-    /**
136
-     * smarty object
137
-     *
138
-     * @var Smarty
139
-     */
140
-    public $smarty = null;
141
-
142
-    /**
143
-     * copy of config_overwrite property
144
-     *
145
-     * @var bool
146
-     */
147
-    private $configOverwrite = false;
148
-
149
-    /**
150
-     * copy of config_read_hidden property
151
-     *
152
-     * @var bool
153
-     */
154
-    private $configReadHidden = false;
155
-
156
-    /**
157
-     * helper map
158
-     *
159
-     * @var array
160
-     */
161
-    private static $escapes_single = Array('\\' => '\\', '\'' => '\'');
162
-
163
-    /**
164
-     * constructor
165
-     *
166
-     * @param Smarty_Internal_Configfilelexer      $lex
167
-     * @param Smarty_Internal_Config_File_Compiler $compiler
168
-     */
169
-    public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
170
-    {
171
-        // set instance object
172
-        self::instance($this);
173
-        $this->lex = $lex;
174
-        $this->smarty = $compiler->smarty;
175
-        $this->compiler = $compiler;
176
-        $this->configOverwrite = $this->smarty->config_overwrite;
177
-        $this->configReadHidden = $this->smarty->config_read_hidden;
178
-    }
179
-
180
-    /**
181
-     * @param null $new_instance
182
-     *
183
-     * @return null
184
-     */
185
-    public static function &instance($new_instance = null)
186
-    {
187
-        static $instance = null;
188
-        if (isset($new_instance) && is_object($new_instance)) {
189
-            $instance = $new_instance;
190
-        }
191
-        return $instance;
192
-    }
193
-
194
-    /**
195
-     * parse optional boolean keywords
196
-     *
197
-     * @param string $str
198
-     *
199
-     * @return bool
200
-     */
201
-    private function parse_bool($str)
202
-    {
203
-        $str = strtolower($str);
204
-        if (in_array($str, array('on', 'yes', 'true'))) {
205
-            $res = true;
206
-        } else {
207
-            $res = false;
208
-        }
209
-        return $res;
210
-    }
211
-
212
-    /**
213
-     * parse single quoted string
214
-     *  remove outer quotes
215
-     *  unescape inner quotes
216
-     *
217
-     * @param string $qstr
218
-     *
219
-     * @return string
220
-     */
221
-    private static function parse_single_quoted_string($qstr)
222
-    {
223
-        $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
224
-
225
-        $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
226
-
227
-        $str = "";
228
-        foreach ($ss as $s) {
229
-            if (strlen($s) === 2 && $s[ 0 ] === '\\') {
230
-                if (isset(self::$escapes_single[ $s[ 1 ] ])) {
231
-                    $s = self::$escapes_single[ $s[ 1 ] ];
232
-                }
233
-            }
234
-            $str .= $s;
235
-        }
236
-        return $str;
237
-    }
238
-
239
-    /**
240
-     * parse double quoted string
241
-     *
242
-     * @param string $qstr
243
-     *
244
-     * @return string
245
-     */
246
-    private static function parse_double_quoted_string($qstr)
247
-    {
248
-        $inner_str = substr($qstr, 1, strlen($qstr) - 2);
249
-        return stripcslashes($inner_str);
250
-    }
251
-
252
-    /**
253
-     * parse triple quoted string
254
-     *
255
-     * @param string $qstr
256
-     *
257
-     * @return string
258
-     */
259
-    private static function parse_tripple_double_quoted_string($qstr)
260
-    {
261
-        return stripcslashes($qstr);
262
-    }
263
-
264
-    /**
265
-     * set a config variable in target array
266
-     *
267
-     * @param array $var
268
-     * @param array $target_array
269
-     */
270
-    private function set_var(Array $var, Array &$target_array)
271
-    {
272
-        $key = $var[ "key" ];
273
-        $value = $var[ "value" ];
274
-
275
-        if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) {
276
-            $target_array[ 'vars' ][ $key ] = $value;
277
-        } else {
278
-            settype($target_array[ 'vars' ][ $key ], 'array');
279
-            $target_array[ 'vars' ][ $key ][] = $value;
280
-        }
281
-    }
282
-
283
-    /**
284
-     * add config variable to global vars
285
-     *
286
-     * @param array $vars
287
-     */
288
-    private function add_global_vars(Array $vars)
289
-    {
290
-        if (!isset($this->compiler->config_data[ 'vars' ])) {
291
-            $this->compiler->config_data[ 'vars' ] = Array();
292
-        }
293
-        foreach ($vars as $var) {
294
-            $this->set_var($var, $this->compiler->config_data);
295
-        }
296
-    }
297
-
298
-    /**
299
-     * add config variable to section
300
-     *
301
-     * @param string $section_name
302
-     * @param array  $vars
303
-     */
304
-    private function add_section_vars($section_name, Array $vars)
305
-    {
306
-        if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) {
307
-            $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array();
308
-        }
309
-        foreach ($vars as $var) {
310
-            $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]);
311
-        }
312
-    }
313
-
314
-    const TPC_OPENB = 1;
93
+	#line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
94
+
95
+	/**
96
+	 * result status
97
+	 *
98
+	 * @var bool
99
+	 */
100
+	public $successful = true;
101
+
102
+	/**
103
+	 * return value
104
+	 *
105
+	 * @var mixed
106
+	 */
107
+	public $retvalue = 0;
108
+
109
+	/**
110
+	 * @var
111
+	 */
112
+	public $yymajor;
113
+
114
+	/**
115
+	 * lexer object
116
+	 *
117
+	 * @var Smarty_Internal_Configfilelexer
118
+	 */
119
+	private $lex;
120
+
121
+	/**
122
+	 * internal error flag
123
+	 *
124
+	 * @var bool
125
+	 */
126
+	private $internalError = false;
127
+
128
+	/**
129
+	 * compiler object
130
+	 *
131
+	 * @var Smarty_Internal_Config_File_Compiler
132
+	 */
133
+	public $compiler = null;
134
+
135
+	/**
136
+	 * smarty object
137
+	 *
138
+	 * @var Smarty
139
+	 */
140
+	public $smarty = null;
141
+
142
+	/**
143
+	 * copy of config_overwrite property
144
+	 *
145
+	 * @var bool
146
+	 */
147
+	private $configOverwrite = false;
148
+
149
+	/**
150
+	 * copy of config_read_hidden property
151
+	 *
152
+	 * @var bool
153
+	 */
154
+	private $configReadHidden = false;
155
+
156
+	/**
157
+	 * helper map
158
+	 *
159
+	 * @var array
160
+	 */
161
+	private static $escapes_single = Array('\\' => '\\', '\'' => '\'');
162
+
163
+	/**
164
+	 * constructor
165
+	 *
166
+	 * @param Smarty_Internal_Configfilelexer      $lex
167
+	 * @param Smarty_Internal_Config_File_Compiler $compiler
168
+	 */
169
+	public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
170
+	{
171
+		// set instance object
172
+		self::instance($this);
173
+		$this->lex = $lex;
174
+		$this->smarty = $compiler->smarty;
175
+		$this->compiler = $compiler;
176
+		$this->configOverwrite = $this->smarty->config_overwrite;
177
+		$this->configReadHidden = $this->smarty->config_read_hidden;
178
+	}
179
+
180
+	/**
181
+	 * @param null $new_instance
182
+	 *
183
+	 * @return null
184
+	 */
185
+	public static function &instance($new_instance = null)
186
+	{
187
+		static $instance = null;
188
+		if (isset($new_instance) && is_object($new_instance)) {
189
+			$instance = $new_instance;
190
+		}
191
+		return $instance;
192
+	}
193
+
194
+	/**
195
+	 * parse optional boolean keywords
196
+	 *
197
+	 * @param string $str
198
+	 *
199
+	 * @return bool
200
+	 */
201
+	private function parse_bool($str)
202
+	{
203
+		$str = strtolower($str);
204
+		if (in_array($str, array('on', 'yes', 'true'))) {
205
+			$res = true;
206
+		} else {
207
+			$res = false;
208
+		}
209
+		return $res;
210
+	}
211
+
212
+	/**
213
+	 * parse single quoted string
214
+	 *  remove outer quotes
215
+	 *  unescape inner quotes
216
+	 *
217
+	 * @param string $qstr
218
+	 *
219
+	 * @return string
220
+	 */
221
+	private static function parse_single_quoted_string($qstr)
222
+	{
223
+		$escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
224
+
225
+		$ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
226
+
227
+		$str = "";
228
+		foreach ($ss as $s) {
229
+			if (strlen($s) === 2 && $s[ 0 ] === '\\') {
230
+				if (isset(self::$escapes_single[ $s[ 1 ] ])) {
231
+					$s = self::$escapes_single[ $s[ 1 ] ];
232
+				}
233
+			}
234
+			$str .= $s;
235
+		}
236
+		return $str;
237
+	}
238
+
239
+	/**
240
+	 * parse double quoted string
241
+	 *
242
+	 * @param string $qstr
243
+	 *
244
+	 * @return string
245
+	 */
246
+	private static function parse_double_quoted_string($qstr)
247
+	{
248
+		$inner_str = substr($qstr, 1, strlen($qstr) - 2);
249
+		return stripcslashes($inner_str);
250
+	}
251
+
252
+	/**
253
+	 * parse triple quoted string
254
+	 *
255
+	 * @param string $qstr
256
+	 *
257
+	 * @return string
258
+	 */
259
+	private static function parse_tripple_double_quoted_string($qstr)
260
+	{
261
+		return stripcslashes($qstr);
262
+	}
263
+
264
+	/**
265
+	 * set a config variable in target array
266
+	 *
267
+	 * @param array $var
268
+	 * @param array $target_array
269
+	 */
270
+	private function set_var(Array $var, Array &$target_array)
271
+	{
272
+		$key = $var[ "key" ];
273
+		$value = $var[ "value" ];
274
+
275
+		if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) {
276
+			$target_array[ 'vars' ][ $key ] = $value;
277
+		} else {
278
+			settype($target_array[ 'vars' ][ $key ], 'array');
279
+			$target_array[ 'vars' ][ $key ][] = $value;
280
+		}
281
+	}
282
+
283
+	/**
284
+	 * add config variable to global vars
285
+	 *
286
+	 * @param array $vars
287
+	 */
288
+	private function add_global_vars(Array $vars)
289
+	{
290
+		if (!isset($this->compiler->config_data[ 'vars' ])) {
291
+			$this->compiler->config_data[ 'vars' ] = Array();
292
+		}
293
+		foreach ($vars as $var) {
294
+			$this->set_var($var, $this->compiler->config_data);
295
+		}
296
+	}
297
+
298
+	/**
299
+	 * add config variable to section
300
+	 *
301
+	 * @param string $section_name
302
+	 * @param array  $vars
303
+	 */
304
+	private function add_section_vars($section_name, Array $vars)
305
+	{
306
+		if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) {
307
+			$this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array();
308
+		}
309
+		foreach ($vars as $var) {
310
+			$this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]);
311
+		}
312
+	}
313
+
314
+	const TPC_OPENB = 1;
315 315
 
316
-    const TPC_SECTION = 2;
316
+	const TPC_SECTION = 2;
317 317
 
318
-    const TPC_CLOSEB = 3;
318
+	const TPC_CLOSEB = 3;
319 319
 
320
-    const TPC_DOT = 4;
320
+	const TPC_DOT = 4;
321 321
 
322
-    const TPC_ID = 5;
322
+	const TPC_ID = 5;
323 323
 
324
-    const TPC_EQUAL = 6;
324
+	const TPC_EQUAL = 6;
325 325
 
326
-    const TPC_FLOAT = 7;
326
+	const TPC_FLOAT = 7;
327 327
 
328
-    const TPC_INT = 8;
328
+	const TPC_INT = 8;
329 329
 
330
-    const TPC_BOOL = 9;
330
+	const TPC_BOOL = 9;
331 331
 
332
-    const TPC_SINGLE_QUOTED_STRING = 10;
332
+	const TPC_SINGLE_QUOTED_STRING = 10;
333 333
 
334
-    const TPC_DOUBLE_QUOTED_STRING = 11;
334
+	const TPC_DOUBLE_QUOTED_STRING = 11;
335 335
 
336
-    const TPC_TRIPPLE_QUOTES = 12;
336
+	const TPC_TRIPPLE_QUOTES = 12;
337 337
 
338
-    const TPC_TRIPPLE_TEXT = 13;
338
+	const TPC_TRIPPLE_TEXT = 13;
339 339
 
340
-    const TPC_TRIPPLE_QUOTES_END = 14;
340
+	const TPC_TRIPPLE_QUOTES_END = 14;
341 341
 
342
-    const TPC_NAKED_STRING = 15;
342
+	const TPC_NAKED_STRING = 15;
343 343
 
344
-    const TPC_OTHER = 16;
344
+	const TPC_OTHER = 16;
345 345
 
346
-    const TPC_NEWLINE = 17;
346
+	const TPC_NEWLINE = 17;
347 347
 
348
-    const TPC_COMMENTSTART = 18;
348
+	const TPC_COMMENTSTART = 18;
349 349
 
350
-    const YY_NO_ACTION = 60;
350
+	const YY_NO_ACTION = 60;
351 351
 
352
-    const YY_ACCEPT_ACTION = 59;
352
+	const YY_ACCEPT_ACTION = 59;
353 353
 
354
-    const YY_ERROR_ACTION = 58;
354
+	const YY_ERROR_ACTION = 58;
355 355
 
356
-    const YY_SZ_ACTTAB = 38;
356
+	const YY_SZ_ACTTAB = 38;
357 357
 
358
-    static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15,
359
-                                     17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
358
+	static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15,
359
+									 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
360 360
 
361
-    static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15,
362
-                                        2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
361
+	static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15,
362
+										2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
363 363
 
364
-    const YY_SHIFT_USE_DFLT = - 8;
364
+	const YY_SHIFT_USE_DFLT = - 8;
365 365
 
366
-    const YY_SHIFT_MAX = 19;
366
+	const YY_SHIFT_MAX = 19;
367 367
 
368
-    static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
369
-                                         20,);
368
+	static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
369
+										 20,);
370 370
 
371
-    const YY_REDUCE_USE_DFLT = - 21;
371
+	const YY_REDUCE_USE_DFLT = - 21;
372 372
 
373
-    const YY_REDUCE_MAX = 10;
373
+	const YY_REDUCE_MAX = 10;
374 374
 
375
-    static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
375
+	static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
376 376
 
377
-    static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
378
-                                            array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,),
379
-                                            array(1,), array(), array(), array(), array(2, 4,), array(15, 17,),
380
-                                            array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
381
-                                            array(6,), array(), array(), array(), array(), array(), array(), array(),
382
-                                            array(), array(), array(), array(), array(), array(), array(), array(),
383
-                                            array(),);
377
+	static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
378
+											array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,),
379
+											array(1,), array(), array(), array(), array(2, 4,), array(15, 17,),
380
+											array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
381
+											array(6,), array(), array(), array(), array(), array(), array(), array(),
382
+											array(), array(), array(), array(), array(), array(), array(), array(),
383
+											array(),);
384 384
 
385
-    static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
386
-                                      55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
385
+	static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
386
+									  55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
387 387
 
388
-    const YYNOCODE = 29;
388
+	const YYNOCODE = 29;
389 389
 
390
-    const YYSTACKDEPTH = 100;
390
+	const YYSTACKDEPTH = 100;
391 391
 
392
-    const YYNSTATE = 36;
392
+	const YYNSTATE = 36;
393 393
 
394
-    const YYNRULE = 22;
394
+	const YYNRULE = 22;
395 395
 
396
-    const YYERRORSYMBOL = 19;
396
+	const YYERRORSYMBOL = 19;
397 397
 
398
-    const YYERRSYMDT = 'yy0';
398
+	const YYERRSYMDT = 'yy0';
399 399
 
400
-    const YYFALLBACK = 0;
400
+	const YYFALLBACK = 0;
401 401
 
402
-    public static $yyFallback = array();
402
+	public static $yyFallback = array();
403 403
 
404
-    public function Trace($TraceFILE, $zTracePrompt)
405
-    {
406
-        if (!$TraceFILE) {
407
-            $zTracePrompt = 0;
408
-        } elseif (!$zTracePrompt) {
409
-            $TraceFILE = 0;
410
-        }
411
-        $this->yyTraceFILE = $TraceFILE;
412
-        $this->yyTracePrompt = $zTracePrompt;
413
-    }
404
+	public function Trace($TraceFILE, $zTracePrompt)
405
+	{
406
+		if (!$TraceFILE) {
407
+			$zTracePrompt = 0;
408
+		} elseif (!$zTracePrompt) {
409
+			$TraceFILE = 0;
410
+		}
411
+		$this->yyTraceFILE = $TraceFILE;
412
+		$this->yyTracePrompt = $zTracePrompt;
413
+	}
414 414
 
415
-    public function PrintTrace()
416
-    {
417
-        $this->yyTraceFILE = fopen('php://output', 'w');
418
-        $this->yyTracePrompt = '<br>';
419
-    }
415
+	public function PrintTrace()
416
+	{
417
+		$this->yyTraceFILE = fopen('php://output', 'w');
418
+		$this->yyTracePrompt = '<br>';
419
+	}
420 420
 
421
-    public $yyTraceFILE;
421
+	public $yyTraceFILE;
422 422
 
423
-    public $yyTracePrompt;
423
+	public $yyTracePrompt;
424 424
 
425
-    public $yyidx;                    /* Index of top element in stack */
426
-    public $yyerrcnt;                 /* Shifts left before out of the error */
427
-    public $yystack = array();  /* The parser's stack */
425
+	public $yyidx;                    /* Index of top element in stack */
426
+	public $yyerrcnt;                 /* Shifts left before out of the error */
427
+	public $yystack = array();  /* The parser's stack */
428 428
 
429
-    public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
430
-                                'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT',
431
-                                'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
432
-                                'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
429
+	public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
430
+								'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT',
431
+								'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
432
+								'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
433 433
 
434
-    public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list',
435
-                                      'sections ::= sections section', 'sections ::=',
436
-                                      'section ::= OPENB SECTION CLOSEB newline var_list',
437
-                                      'section ::= OPENB DOT SECTION CLOSEB newline var_list',
438
-                                      'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=',
439
-                                      'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL',
440
-                                      'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
441
-                                      'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
442
-                                      'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING',
443
-                                      'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
444
-                                      'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
434
+	public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list',
435
+									  'sections ::= sections section', 'sections ::=',
436
+									  'section ::= OPENB SECTION CLOSEB newline var_list',
437
+									  'section ::= OPENB DOT SECTION CLOSEB newline var_list',
438
+									  'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=',
439
+									  'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL',
440
+									  'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
441
+									  'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
442
+									  'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING',
443
+									  'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
444
+									  'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
445 445
 
446
-    public function tokenName($tokenType)
447
-    {
448
-        if ($tokenType === 0) {
449
-            return 'End of Input';
450
-        }
446
+	public function tokenName($tokenType)
447
+	{
448
+		if ($tokenType === 0) {
449
+			return 'End of Input';
450
+		}
451 451
 		$countYyTokenName = count($this->yyTokenName);
452
-        if ($tokenType > 0 && $tokenType < $countYyTokenName) {
453
-            return $this->yyTokenName[ $tokenType ];
454
-        } else {
455
-            return "Unknown";
456
-        }
457
-    }
458
-
459
-    public static function yy_destructor($yymajor, $yypminor)
460
-    {
461
-        switch ($yymajor) {
462
-            default:
463
-                break;   /* If no destructor action specified: do nothing */
464
-        }
465
-    }
466
-
467
-    public function yy_pop_parser_stack()
468
-    {
469
-        if (empty($this->yystack)) {
470
-            return;
471
-        }
472
-        $yytos = array_pop($this->yystack);
473
-        if ($this->yyTraceFILE && $this->yyidx >= 0) {
474
-            fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n");
475
-        }
476
-        $yymajor = $yytos->major;
477
-        self::yy_destructor($yymajor, $yytos->minor);
478
-        $this->yyidx --;
479
-
480
-        return $yymajor;
481
-    }
482
-
483
-    public function __destruct()
484
-    {
485
-        while ($this->yystack !== Array()) {
486
-            $this->yy_pop_parser_stack();
487
-        }
488
-        if (is_resource($this->yyTraceFILE)) {
489
-            fclose($this->yyTraceFILE);
490
-        }
491
-    }
492
-
493
-    public function yy_get_expected_tokens($token)
494
-    {
495
-        static $res3 = array();
496
-        static $res4 = array();
497
-        $state = $this->yystack[ $this->yyidx ]->stateno;
498
-        $expected = self::$yyExpectedTokens[ $state ];
499
-        if (isset($res3[ $state ][ $token ])) {
500
-            if ($res3[ $state ][ $token ]) {
501
-                return $expected;
502
-            }
503
-        } else {
504
-            if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
505
-                return $expected;
506
-            }
507
-        }
508
-        $stack = $this->yystack;
509
-        $yyidx = $this->yyidx;
510
-        do {
511
-            $yyact = $this->yy_find_shift_action($token);
512
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
513
-                // reduce action
514
-                $done = 0;
515
-                do {
516
-                    if ($done ++ == 100) {
517
-                        $this->yyidx = $yyidx;
518
-                        $this->yystack = $stack;
519
-                        // too much recursion prevents proper detection
520
-                        // so give up
521
-                        return array_unique($expected);
522
-                    }
523
-                    $yyruleno = $yyact - self::YYNSTATE;
524
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
525
-                    $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
526
-                                                              self::$yyRuleInfo[ $yyruleno ][ 0 ]);
527
-                    if (isset(self::$yyExpectedTokens[ $nextstate ])) {
528
-                        $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
529
-                        if (isset($res4[ $nextstate ][ $token ])) {
530
-                            if ($res4[ $nextstate ][ $token ]) {
531
-                                $this->yyidx = $yyidx;
532
-                                $this->yystack = $stack;
533
-                                return array_unique($expected);
534
-                            }
535
-                        } else {
536
-                            if ($res4[ $nextstate ][ $token ] =
537
-                                in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
538
-                            ) {
539
-                                $this->yyidx = $yyidx;
540
-                                $this->yystack = $stack;
541
-                                return array_unique($expected);
542
-                            }
543
-                        }
544
-                    }
545
-                    if ($nextstate < self::YYNSTATE) {
546
-                        // we need to shift a non-terminal
547
-                        $this->yyidx ++;
548
-                        $x = new TPC_yyStackEntry;
549
-                        $x->stateno = $nextstate;
550
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
551
-                        $this->yystack[ $this->yyidx ] = $x;
552
-                        continue 2;
553
-                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
554
-                        $this->yyidx = $yyidx;
555
-                        $this->yystack = $stack;
556
-                        // the last token was just ignored, we can't accept
557
-                        // by ignoring input, this is in essence ignoring a
558
-                        // syntax error!
559
-                        return array_unique($expected);
560
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
561
-                        $this->yyidx = $yyidx;
562
-                        $this->yystack = $stack;
563
-                        // input accepted, but not shifted (I guess)
564
-                        return $expected;
565
-                    } else {
566
-                        $yyact = $nextstate;
567
-                    }
568
-                }
569
-                while (true);
570
-            }
571
-            break;
572
-        }
573
-        while (true);
574
-        $this->yyidx = $yyidx;
575
-        $this->yystack = $stack;
576
-
577
-        return array_unique($expected);
578
-    }
579
-
580
-    public function yy_is_expected_token($token)
581
-    {
582
-        static $res = array();
583
-        static $res2 = array();
584
-        if ($token === 0) {
585
-            return true; // 0 is not part of this
586
-        }
587
-        $state = $this->yystack[ $this->yyidx ]->stateno;
588
-        if (isset($res[ $state ][ $token ])) {
589
-            if ($res[ $state ][ $token ]) {
590
-                return true;
591
-            }
592
-        } else {
593
-            if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
594
-                return true;
595
-            }
596
-        }
597
-        $stack = $this->yystack;
598
-        $yyidx = $this->yyidx;
599
-        do {
600
-            $yyact = $this->yy_find_shift_action($token);
601
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
602
-                // reduce action
603
-                $done = 0;
604
-                do {
605
-                    if ($done ++ == 100) {
606
-                        $this->yyidx = $yyidx;
607
-                        $this->yystack = $stack;
608
-                        // too much recursion prevents proper detection
609
-                        // so give up
610
-                        return true;
611
-                    }
612
-                    $yyruleno = $yyact - self::YYNSTATE;
613
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
614
-                    $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
615
-                                                              self::$yyRuleInfo[ $yyruleno ][ 0 ]);
616
-                    if (isset($res2[ $nextstate ][ $token ])) {
617
-                        if ($res2[ $nextstate ][ $token ]) {
618
-                            $this->yyidx = $yyidx;
619
-                            $this->yystack = $stack;
620
-                            return true;
621
-                        }
622
-                    } else {
623
-                        if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
624
-                                                             in_array($token, self::$yyExpectedTokens[ $nextstate ],
625
-                                                                      true))
626
-                        ) {
627
-                            $this->yyidx = $yyidx;
628
-                            $this->yystack = $stack;
629
-                            return true;
630
-                        }
631
-                    }
632
-                    if ($nextstate < self::YYNSTATE) {
633
-                        // we need to shift a non-terminal
634
-                        $this->yyidx ++;
635
-                        $x = new TPC_yyStackEntry;
636
-                        $x->stateno = $nextstate;
637
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
638
-                        $this->yystack[ $this->yyidx ] = $x;
639
-                        continue 2;
640
-                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
641
-                        $this->yyidx = $yyidx;
642
-                        $this->yystack = $stack;
643
-                        if (!$token) {
644
-                            // end of input: this is valid
645
-                            return true;
646
-                        }
647
-                        // the last token was just ignored, we can't accept
648
-                        // by ignoring input, this is in essence ignoring a
649
-                        // syntax error!
650
-                        return false;
651
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
652
-                        $this->yyidx = $yyidx;
653
-                        $this->yystack = $stack;
654
-                        // input accepted, but not shifted (I guess)
655
-                        return true;
656
-                    } else {
657
-                        $yyact = $nextstate;
658
-                    }
659
-                }
660
-                while (true);
661
-            }
662
-            break;
663
-        }
664
-        while (true);
665
-        $this->yyidx = $yyidx;
666
-        $this->yystack = $stack;
667
-
668
-        return true;
669
-    }
670
-
671
-    public function yy_find_shift_action($iLookAhead)
672
-    {
673
-        $stateno = $this->yystack[ $this->yyidx ]->stateno;
674
-
675
-        if (!isset(self::$yy_shift_ofst[ $stateno ])) {
676
-            // no shift actions
677
-            return self::$yy_default[ $stateno ];
678
-        }
679
-        $i = self::$yy_shift_ofst[ $stateno ];
680
-        if ($i === self::YY_SHIFT_USE_DFLT) {
681
-            return self::$yy_default[ $stateno ];
682
-        }
683
-        if ($iLookAhead == self::YYNOCODE) {
684
-            return self::YY_NO_ACTION;
685
-        }
686
-        $i += $iLookAhead;
687
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
452
+		if ($tokenType > 0 && $tokenType < $countYyTokenName) {
453
+			return $this->yyTokenName[ $tokenType ];
454
+		} else {
455
+			return "Unknown";
456
+		}
457
+	}
458
+
459
+	public static function yy_destructor($yymajor, $yypminor)
460
+	{
461
+		switch ($yymajor) {
462
+			default:
463
+				break;   /* If no destructor action specified: do nothing */
464
+		}
465
+	}
466
+
467
+	public function yy_pop_parser_stack()
468
+	{
469
+		if (empty($this->yystack)) {
470
+			return;
471
+		}
472
+		$yytos = array_pop($this->yystack);
473
+		if ($this->yyTraceFILE && $this->yyidx >= 0) {
474
+			fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n");
475
+		}
476
+		$yymajor = $yytos->major;
477
+		self::yy_destructor($yymajor, $yytos->minor);
478
+		$this->yyidx --;
479
+
480
+		return $yymajor;
481
+	}
482
+
483
+	public function __destruct()
484
+	{
485
+		while ($this->yystack !== Array()) {
486
+			$this->yy_pop_parser_stack();
487
+		}
488
+		if (is_resource($this->yyTraceFILE)) {
489
+			fclose($this->yyTraceFILE);
490
+		}
491
+	}
492
+
493
+	public function yy_get_expected_tokens($token)
494
+	{
495
+		static $res3 = array();
496
+		static $res4 = array();
497
+		$state = $this->yystack[ $this->yyidx ]->stateno;
498
+		$expected = self::$yyExpectedTokens[ $state ];
499
+		if (isset($res3[ $state ][ $token ])) {
500
+			if ($res3[ $state ][ $token ]) {
501
+				return $expected;
502
+			}
503
+		} else {
504
+			if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
505
+				return $expected;
506
+			}
507
+		}
508
+		$stack = $this->yystack;
509
+		$yyidx = $this->yyidx;
510
+		do {
511
+			$yyact = $this->yy_find_shift_action($token);
512
+			if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
513
+				// reduce action
514
+				$done = 0;
515
+				do {
516
+					if ($done ++ == 100) {
517
+						$this->yyidx = $yyidx;
518
+						$this->yystack = $stack;
519
+						// too much recursion prevents proper detection
520
+						// so give up
521
+						return array_unique($expected);
522
+					}
523
+					$yyruleno = $yyact - self::YYNSTATE;
524
+					$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
525
+					$nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
526
+															  self::$yyRuleInfo[ $yyruleno ][ 0 ]);
527
+					if (isset(self::$yyExpectedTokens[ $nextstate ])) {
528
+						$expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
529
+						if (isset($res4[ $nextstate ][ $token ])) {
530
+							if ($res4[ $nextstate ][ $token ]) {
531
+								$this->yyidx = $yyidx;
532
+								$this->yystack = $stack;
533
+								return array_unique($expected);
534
+							}
535
+						} else {
536
+							if ($res4[ $nextstate ][ $token ] =
537
+								in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
538
+							) {
539
+								$this->yyidx = $yyidx;
540
+								$this->yystack = $stack;
541
+								return array_unique($expected);
542
+							}
543
+						}
544
+					}
545
+					if ($nextstate < self::YYNSTATE) {
546
+						// we need to shift a non-terminal
547
+						$this->yyidx ++;
548
+						$x = new TPC_yyStackEntry;
549
+						$x->stateno = $nextstate;
550
+						$x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
551
+						$this->yystack[ $this->yyidx ] = $x;
552
+						continue 2;
553
+					} elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
554
+						$this->yyidx = $yyidx;
555
+						$this->yystack = $stack;
556
+						// the last token was just ignored, we can't accept
557
+						// by ignoring input, this is in essence ignoring a
558
+						// syntax error!
559
+						return array_unique($expected);
560
+					} elseif ($nextstate === self::YY_NO_ACTION) {
561
+						$this->yyidx = $yyidx;
562
+						$this->yystack = $stack;
563
+						// input accepted, but not shifted (I guess)
564
+						return $expected;
565
+					} else {
566
+						$yyact = $nextstate;
567
+					}
568
+				}
569
+				while (true);
570
+			}
571
+			break;
572
+		}
573
+		while (true);
574
+		$this->yyidx = $yyidx;
575
+		$this->yystack = $stack;
576
+
577
+		return array_unique($expected);
578
+	}
579
+
580
+	public function yy_is_expected_token($token)
581
+	{
582
+		static $res = array();
583
+		static $res2 = array();
584
+		if ($token === 0) {
585
+			return true; // 0 is not part of this
586
+		}
587
+		$state = $this->yystack[ $this->yyidx ]->stateno;
588
+		if (isset($res[ $state ][ $token ])) {
589
+			if ($res[ $state ][ $token ]) {
590
+				return true;
591
+			}
592
+		} else {
593
+			if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
594
+				return true;
595
+			}
596
+		}
597
+		$stack = $this->yystack;
598
+		$yyidx = $this->yyidx;
599
+		do {
600
+			$yyact = $this->yy_find_shift_action($token);
601
+			if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
602
+				// reduce action
603
+				$done = 0;
604
+				do {
605
+					if ($done ++ == 100) {
606
+						$this->yyidx = $yyidx;
607
+						$this->yystack = $stack;
608
+						// too much recursion prevents proper detection
609
+						// so give up
610
+						return true;
611
+					}
612
+					$yyruleno = $yyact - self::YYNSTATE;
613
+					$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
614
+					$nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
615
+															  self::$yyRuleInfo[ $yyruleno ][ 0 ]);
616
+					if (isset($res2[ $nextstate ][ $token ])) {
617
+						if ($res2[ $nextstate ][ $token ]) {
618
+							$this->yyidx = $yyidx;
619
+							$this->yystack = $stack;
620
+							return true;
621
+						}
622
+					} else {
623
+						if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
624
+															 in_array($token, self::$yyExpectedTokens[ $nextstate ],
625
+																	  true))
626
+						) {
627
+							$this->yyidx = $yyidx;
628
+							$this->yystack = $stack;
629
+							return true;
630
+						}
631
+					}
632
+					if ($nextstate < self::YYNSTATE) {
633
+						// we need to shift a non-terminal
634
+						$this->yyidx ++;
635
+						$x = new TPC_yyStackEntry;
636
+						$x->stateno = $nextstate;
637
+						$x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
638
+						$this->yystack[ $this->yyidx ] = $x;
639
+						continue 2;
640
+					} elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
641
+						$this->yyidx = $yyidx;
642
+						$this->yystack = $stack;
643
+						if (!$token) {
644
+							// end of input: this is valid
645
+							return true;
646
+						}
647
+						// the last token was just ignored, we can't accept
648
+						// by ignoring input, this is in essence ignoring a
649
+						// syntax error!
650
+						return false;
651
+					} elseif ($nextstate === self::YY_NO_ACTION) {
652
+						$this->yyidx = $yyidx;
653
+						$this->yystack = $stack;
654
+						// input accepted, but not shifted (I guess)
655
+						return true;
656
+					} else {
657
+						$yyact = $nextstate;
658
+					}
659
+				}
660
+				while (true);
661
+			}
662
+			break;
663
+		}
664
+		while (true);
665
+		$this->yyidx = $yyidx;
666
+		$this->yystack = $stack;
667
+
668
+		return true;
669
+	}
670
+
671
+	public function yy_find_shift_action($iLookAhead)
672
+	{
673
+		$stateno = $this->yystack[ $this->yyidx ]->stateno;
674
+
675
+		if (!isset(self::$yy_shift_ofst[ $stateno ])) {
676
+			// no shift actions
677
+			return self::$yy_default[ $stateno ];
678
+		}
679
+		$i = self::$yy_shift_ofst[ $stateno ];
680
+		if ($i === self::YY_SHIFT_USE_DFLT) {
681
+			return self::$yy_default[ $stateno ];
682
+		}
683
+		if ($iLookAhead == self::YYNOCODE) {
684
+			return self::YY_NO_ACTION;
685
+		}
686
+		$i += $iLookAhead;
687
+		if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
688 688
 			$countYyFallback = count(self::$yyFallback);
689
-            if (count(self::$yyFallback) && $iLookAhead < $countYyFallback &&
690
-                ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
691
-            ) {
692
-                if ($this->yyTraceFILE) {
693
-                    fwrite($this->yyTraceFILE,
694
-                           $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " .
695
-                           $this->yyTokenName[ $iFallback ] . "\n");
696
-                }
697
-
698
-                return $this->yy_find_shift_action($iFallback);
699
-            }
700
-
701
-            return self::$yy_default[ $stateno ];
702
-        } else {
703
-            return self::$yy_action[ $i ];
704
-        }
705
-    }
706
-
707
-    public function yy_find_reduce_action($stateno, $iLookAhead)
708
-    {
709
-
710
-        if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
711
-            return self::$yy_default[ $stateno ];
712
-        }
713
-        $i = self::$yy_reduce_ofst[ $stateno ];
714
-        if ($i == self::YY_REDUCE_USE_DFLT) {
715
-            return self::$yy_default[ $stateno ];
716
-        }
717
-        if ($iLookAhead == self::YYNOCODE) {
718
-            return self::YY_NO_ACTION;
719
-        }
720
-        $i += $iLookAhead;
721
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
722
-            return self::$yy_default[ $stateno ];
723
-        } else {
724
-            return self::$yy_action[ $i ];
725
-        }
726
-    }
727
-
728
-    public function yy_shift($yyNewState, $yyMajor, $yypMinor)
729
-    {
730
-        $this->yyidx ++;
731
-        if ($this->yyidx >= self::YYSTACKDEPTH) {
732
-            $this->yyidx --;
733
-            if ($this->yyTraceFILE) {
734
-                fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
735
-            }
736
-            while ($this->yyidx >= 0) {
737
-                $this->yy_pop_parser_stack();
738
-            }
739
-            #line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
740
-
741
-            $this->internalError = true;
742
-            $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
743
-
744
-            return;
745
-        }
746
-        $yytos = new TPC_yyStackEntry;
747
-        $yytos->stateno = $yyNewState;
748
-        $yytos->major = $yyMajor;
749
-        $yytos->minor = $yypMinor;
750
-        $this->yystack[] = $yytos;
751
-        if ($this->yyTraceFILE && $this->yyidx > 0) {
752
-            fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState);
753
-            fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
754
-            for ($i = 1; $i <= $this->yyidx; $i ++) {
755
-                fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]);
756
-            }
757
-            fwrite($this->yyTraceFILE, "\n");
758
-        }
759
-    }
760
-
761
-    public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
762
-                                      array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6),
763
-                                      array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0),
764
-                                      array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
765
-                                      array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
766
-                                      array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1),
767
-                                      array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2),
768
-                                      array(0 => 25, 1 => 3),);
769
-
770
-    public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
771
-                                       6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14,
772
-                                       15 => 15, 16 => 16, 17 => 17, 18 => 17,);
773
-
774
-    #line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
775
-    public function yy_r0()
776
-    {
777
-        $this->_retvalue = null;
778
-    }
779
-
780
-    #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
781
-    public function yy_r1()
782
-    {
783
-        $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
784
-        $this->_retvalue = null;
785
-    }
786
-
787
-    #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
788
-    public function yy_r4()
789
-    {
790
-        $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
791
-        $this->_retvalue = null;
792
-    }
793
-
794
-    #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
795
-    public function yy_r5()
796
-    {
797
-        if ($this->configReadHidden) {
798
-            $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor,
799
-                                    $this->yystack[ $this->yyidx + 0 ]->minor);
800
-        }
801
-        $this->_retvalue = null;
802
-    }
803
-
804
-    #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
805
-    public function yy_r6()
806
-    {
807
-        $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor;
808
-    }
809
-
810
-    #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
811
-    public function yy_r7()
812
-    {
813
-        $this->_retvalue =
814
-            array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor));
815
-    }
816
-
817
-    #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
818
-    public function yy_r8()
819
-    {
820
-        $this->_retvalue = Array();
821
-    }
822
-
823
-    #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
824
-    public function yy_r9()
825
-    {
826
-        $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor,
827
-                                 "value" => $this->yystack[ $this->yyidx + 0 ]->minor);
828
-    }
829
-
830
-    #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
831
-    public function yy_r10()
832
-    {
833
-        $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor;
834
-    }
835
-
836
-    #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
837
-    public function yy_r11()
838
-    {
839
-        $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor;
840
-    }
841
-
842
-    #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
843
-    public function yy_r12()
844
-    {
845
-        $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
846
-    }
847
-
848
-    #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
849
-    public function yy_r13()
850
-    {
851
-        $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
852
-    }
853
-
854
-    #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
855
-    public function yy_r14()
856
-    {
857
-        $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
858
-    }
859
-
860
-    #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
861
-    public function yy_r15()
862
-    {
863
-        $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor);
864
-    }
865
-
866
-    #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
867
-    public function yy_r16()
868
-    {
869
-        $this->_retvalue = '';
870
-    }
871
-
872
-    #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
873
-    public function yy_r17()
874
-    {
875
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
876
-    }
877
-
878
-    private $_retvalue;
879
-
880
-    public function yy_reduce($yyruleno)
881
-    {
689
+			if (count(self::$yyFallback) && $iLookAhead < $countYyFallback &&
690
+				($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
691
+			) {
692
+				if ($this->yyTraceFILE) {
693
+					fwrite($this->yyTraceFILE,
694
+						   $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " .
695
+						   $this->yyTokenName[ $iFallback ] . "\n");
696
+				}
697
+
698
+				return $this->yy_find_shift_action($iFallback);
699
+			}
700
+
701
+			return self::$yy_default[ $stateno ];
702
+		} else {
703
+			return self::$yy_action[ $i ];
704
+		}
705
+	}
706
+
707
+	public function yy_find_reduce_action($stateno, $iLookAhead)
708
+	{
709
+
710
+		if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
711
+			return self::$yy_default[ $stateno ];
712
+		}
713
+		$i = self::$yy_reduce_ofst[ $stateno ];
714
+		if ($i == self::YY_REDUCE_USE_DFLT) {
715
+			return self::$yy_default[ $stateno ];
716
+		}
717
+		if ($iLookAhead == self::YYNOCODE) {
718
+			return self::YY_NO_ACTION;
719
+		}
720
+		$i += $iLookAhead;
721
+		if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
722
+			return self::$yy_default[ $stateno ];
723
+		} else {
724
+			return self::$yy_action[ $i ];
725
+		}
726
+	}
727
+
728
+	public function yy_shift($yyNewState, $yyMajor, $yypMinor)
729
+	{
730
+		$this->yyidx ++;
731
+		if ($this->yyidx >= self::YYSTACKDEPTH) {
732
+			$this->yyidx --;
733
+			if ($this->yyTraceFILE) {
734
+				fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
735
+			}
736
+			while ($this->yyidx >= 0) {
737
+				$this->yy_pop_parser_stack();
738
+			}
739
+			#line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
740
+
741
+			$this->internalError = true;
742
+			$this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
743
+
744
+			return;
745
+		}
746
+		$yytos = new TPC_yyStackEntry;
747
+		$yytos->stateno = $yyNewState;
748
+		$yytos->major = $yyMajor;
749
+		$yytos->minor = $yypMinor;
750
+		$this->yystack[] = $yytos;
751
+		if ($this->yyTraceFILE && $this->yyidx > 0) {
752
+			fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState);
753
+			fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
754
+			for ($i = 1; $i <= $this->yyidx; $i ++) {
755
+				fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]);
756
+			}
757
+			fwrite($this->yyTraceFILE, "\n");
758
+		}
759
+	}
760
+
761
+	public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
762
+									  array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6),
763
+									  array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0),
764
+									  array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
765
+									  array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
766
+									  array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1),
767
+									  array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2),
768
+									  array(0 => 25, 1 => 3),);
769
+
770
+	public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
771
+									   6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14,
772
+									   15 => 15, 16 => 16, 17 => 17, 18 => 17,);
773
+
774
+	#line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
775
+	public function yy_r0()
776
+	{
777
+		$this->_retvalue = null;
778
+	}
779
+
780
+	#line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
781
+	public function yy_r1()
782
+	{
783
+		$this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
784
+		$this->_retvalue = null;
785
+	}
786
+
787
+	#line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
788
+	public function yy_r4()
789
+	{
790
+		$this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
791
+		$this->_retvalue = null;
792
+	}
793
+
794
+	#line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
795
+	public function yy_r5()
796
+	{
797
+		if ($this->configReadHidden) {
798
+			$this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor,
799
+									$this->yystack[ $this->yyidx + 0 ]->minor);
800
+		}
801
+		$this->_retvalue = null;
802
+	}
803
+
804
+	#line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
805
+	public function yy_r6()
806
+	{
807
+		$this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor;
808
+	}
809
+
810
+	#line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
811
+	public function yy_r7()
812
+	{
813
+		$this->_retvalue =
814
+			array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor));
815
+	}
816
+
817
+	#line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
818
+	public function yy_r8()
819
+	{
820
+		$this->_retvalue = Array();
821
+	}
822
+
823
+	#line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
824
+	public function yy_r9()
825
+	{
826
+		$this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor,
827
+								 "value" => $this->yystack[ $this->yyidx + 0 ]->minor);
828
+	}
829
+
830
+	#line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
831
+	public function yy_r10()
832
+	{
833
+		$this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor;
834
+	}
835
+
836
+	#line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
837
+	public function yy_r11()
838
+	{
839
+		$this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor;
840
+	}
841
+
842
+	#line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
843
+	public function yy_r12()
844
+	{
845
+		$this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
846
+	}
847
+
848
+	#line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
849
+	public function yy_r13()
850
+	{
851
+		$this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
852
+	}
853
+
854
+	#line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
855
+	public function yy_r14()
856
+	{
857
+		$this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
858
+	}
859
+
860
+	#line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
861
+	public function yy_r15()
862
+	{
863
+		$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor);
864
+	}
865
+
866
+	#line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
867
+	public function yy_r16()
868
+	{
869
+		$this->_retvalue = '';
870
+	}
871
+
872
+	#line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
873
+	public function yy_r17()
874
+	{
875
+		$this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
876
+	}
877
+
878
+	private $_retvalue;
879
+
880
+	public function yy_reduce($yyruleno)
881
+	{
882 882
 		$countYyRuleName = count(self::$yyRuleName);
883
-        if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < $countYyRuleName) {
884
-            fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
885
-                    self::$yyRuleName[ $yyruleno ]);
886
-        }
887
-
888
-        $this->_retvalue = $yy_lefthand_side = null;
889
-        if (isset(self::$yyReduceMap[ $yyruleno ])) {
890
-            // call the action
891
-            $this->_retvalue = null;
892
-            $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
893
-            $yy_lefthand_side = $this->_retvalue;
894
-        }
895
-        $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
896
-        $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
897
-        $this->yyidx -= $yysize;
898
-        for ($i = $yysize; $i; $i --) {
899
-            // pop all of the right-hand side parameters
900
-            array_pop($this->yystack);
901
-        }
902
-        $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
903
-        if ($yyact < self::YYNSTATE) {
904
-            if (!$this->yyTraceFILE && $yysize) {
905
-                $this->yyidx ++;
906
-                $x = new TPC_yyStackEntry;
907
-                $x->stateno = $yyact;
908
-                $x->major = $yygoto;
909
-                $x->minor = $yy_lefthand_side;
910
-                $this->yystack[ $this->yyidx ] = $x;
911
-            } else {
912
-                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
913
-            }
914
-        } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
915
-            $this->yy_accept();
916
-        }
917
-    }
918
-
919
-    public function yy_parse_failed()
920
-    {
921
-        if ($this->yyTraceFILE) {
922
-            fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
923
-        }
924
-        while ($this->yyidx >= 0) {
925
-            $this->yy_pop_parser_stack();
926
-        }
927
-    }
928
-
929
-    public function yy_syntax_error($yymajor, $TOKEN)
930
-    {
931
-        #line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
932
-
933
-        $this->internalError = true;
934
-        $this->yymajor = $yymajor;
935
-        $this->compiler->trigger_config_file_error();
936
-    }
937
-
938
-    public function yy_accept()
939
-    {
940
-        if ($this->yyTraceFILE) {
941
-            fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
942
-        }
943
-        while ($this->yyidx >= 0) {
944
-            $this->yy_pop_parser_stack();
945
-        }
946
-        #line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
947
-
948
-        $this->successful = !$this->internalError;
949
-        $this->internalError = false;
950
-        $this->retvalue = $this->_retvalue;
951
-    }
952
-
953
-    public function doParse($yymajor, $yytokenvalue)
954
-    {
955
-        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
956
-
957
-        if ($this->yyidx === null || $this->yyidx < 0) {
958
-            $this->yyidx = 0;
959
-            $this->yyerrcnt = - 1;
960
-            $x = new TPC_yyStackEntry;
961
-            $x->stateno = 0;
962
-            $x->major = 0;
963
-            $this->yystack = array();
964
-            $this->yystack[] = $x;
965
-        }
966
-        $yyendofinput = ($yymajor == 0);
967
-
968
-        if ($this->yyTraceFILE) {
969
-            fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
970
-        }
971
-
972
-        do {
973
-            $yyact = $this->yy_find_shift_action($yymajor);
974
-            if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) {
975
-                // force a syntax error
976
-                $yyact = self::YY_ERROR_ACTION;
977
-            }
978
-            if ($yyact < self::YYNSTATE) {
979
-                $this->yy_shift($yyact, $yymajor, $yytokenvalue);
980
-                $this->yyerrcnt --;
981
-                if ($yyendofinput && $this->yyidx >= 0) {
982
-                    $yymajor = 0;
983
-                } else {
984
-                    $yymajor = self::YYNOCODE;
985
-                }
986
-            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
987
-                $this->yy_reduce($yyact - self::YYNSTATE);
988
-            } elseif ($yyact == self::YY_ERROR_ACTION) {
989
-                if ($this->yyTraceFILE) {
990
-                    fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt);
991
-                }
992
-                if (self::YYERRORSYMBOL) {
993
-                    if ($this->yyerrcnt < 0) {
994
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
995
-                    }
996
-                    $yymx = $this->yystack[ $this->yyidx ]->major;
997
-                    if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
998
-                        if ($this->yyTraceFILE) {
999
-                            fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt,
1000
-                                    $this->yyTokenName[ $yymajor ]);
1001
-                        }
1002
-                        $this->yy_destructor($yymajor, $yytokenvalue);
1003
-                        $yymajor = self::YYNOCODE;
1004
-                    } else {
1005
-                        while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL &&
1006
-                               ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
1007
-                            $this->yy_pop_parser_stack();
1008
-                        }
1009
-                        if ($this->yyidx < 0 || $yymajor == 0) {
1010
-                            $this->yy_destructor($yymajor, $yytokenvalue);
1011
-                            $this->yy_parse_failed();
1012
-                            $yymajor = self::YYNOCODE;
1013
-                        } elseif ($yymx != self::YYERRORSYMBOL) {
1014
-                            $u2 = 0;
1015
-                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
1016
-                        }
1017
-                    }
1018
-                    $this->yyerrcnt = 3;
1019
-                    $yyerrorhit = 1;
1020
-                } else {
1021
-                    if ($this->yyerrcnt <= 0) {
1022
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
1023
-                    }
1024
-                    $this->yyerrcnt = 3;
1025
-                    $this->yy_destructor($yymajor, $yytokenvalue);
1026
-                    if ($yyendofinput) {
1027
-                        $this->yy_parse_failed();
1028
-                    }
1029
-                    $yymajor = self::YYNOCODE;
1030
-                }
1031
-            } else {
1032
-                $this->yy_accept();
1033
-                $yymajor = self::YYNOCODE;
1034
-            }
1035
-        }
1036
-        while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
1037
-    }
883
+		if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < $countYyRuleName) {
884
+			fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
885
+					self::$yyRuleName[ $yyruleno ]);
886
+		}
887
+
888
+		$this->_retvalue = $yy_lefthand_side = null;
889
+		if (isset(self::$yyReduceMap[ $yyruleno ])) {
890
+			// call the action
891
+			$this->_retvalue = null;
892
+			$this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
893
+			$yy_lefthand_side = $this->_retvalue;
894
+		}
895
+		$yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
896
+		$yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
897
+		$this->yyidx -= $yysize;
898
+		for ($i = $yysize; $i; $i --) {
899
+			// pop all of the right-hand side parameters
900
+			array_pop($this->yystack);
901
+		}
902
+		$yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
903
+		if ($yyact < self::YYNSTATE) {
904
+			if (!$this->yyTraceFILE && $yysize) {
905
+				$this->yyidx ++;
906
+				$x = new TPC_yyStackEntry;
907
+				$x->stateno = $yyact;
908
+				$x->major = $yygoto;
909
+				$x->minor = $yy_lefthand_side;
910
+				$this->yystack[ $this->yyidx ] = $x;
911
+			} else {
912
+				$this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
913
+			}
914
+		} elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
915
+			$this->yy_accept();
916
+		}
917
+	}
918
+
919
+	public function yy_parse_failed()
920
+	{
921
+		if ($this->yyTraceFILE) {
922
+			fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
923
+		}
924
+		while ($this->yyidx >= 0) {
925
+			$this->yy_pop_parser_stack();
926
+		}
927
+	}
928
+
929
+	public function yy_syntax_error($yymajor, $TOKEN)
930
+	{
931
+		#line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
932
+
933
+		$this->internalError = true;
934
+		$this->yymajor = $yymajor;
935
+		$this->compiler->trigger_config_file_error();
936
+	}
937
+
938
+	public function yy_accept()
939
+	{
940
+		if ($this->yyTraceFILE) {
941
+			fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
942
+		}
943
+		while ($this->yyidx >= 0) {
944
+			$this->yy_pop_parser_stack();
945
+		}
946
+		#line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
947
+
948
+		$this->successful = !$this->internalError;
949
+		$this->internalError = false;
950
+		$this->retvalue = $this->_retvalue;
951
+	}
952
+
953
+	public function doParse($yymajor, $yytokenvalue)
954
+	{
955
+		$yyerrorhit = 0;   /* True if yymajor has invoked an error */
956
+
957
+		if ($this->yyidx === null || $this->yyidx < 0) {
958
+			$this->yyidx = 0;
959
+			$this->yyerrcnt = - 1;
960
+			$x = new TPC_yyStackEntry;
961
+			$x->stateno = 0;
962
+			$x->major = 0;
963
+			$this->yystack = array();
964
+			$this->yystack[] = $x;
965
+		}
966
+		$yyendofinput = ($yymajor == 0);
967
+
968
+		if ($this->yyTraceFILE) {
969
+			fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
970
+		}
971
+
972
+		do {
973
+			$yyact = $this->yy_find_shift_action($yymajor);
974
+			if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) {
975
+				// force a syntax error
976
+				$yyact = self::YY_ERROR_ACTION;
977
+			}
978
+			if ($yyact < self::YYNSTATE) {
979
+				$this->yy_shift($yyact, $yymajor, $yytokenvalue);
980
+				$this->yyerrcnt --;
981
+				if ($yyendofinput && $this->yyidx >= 0) {
982
+					$yymajor = 0;
983
+				} else {
984
+					$yymajor = self::YYNOCODE;
985
+				}
986
+			} elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
987
+				$this->yy_reduce($yyact - self::YYNSTATE);
988
+			} elseif ($yyact == self::YY_ERROR_ACTION) {
989
+				if ($this->yyTraceFILE) {
990
+					fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt);
991
+				}
992
+				if (self::YYERRORSYMBOL) {
993
+					if ($this->yyerrcnt < 0) {
994
+						$this->yy_syntax_error($yymajor, $yytokenvalue);
995
+					}
996
+					$yymx = $this->yystack[ $this->yyidx ]->major;
997
+					if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
998
+						if ($this->yyTraceFILE) {
999
+							fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt,
1000
+									$this->yyTokenName[ $yymajor ]);
1001
+						}
1002
+						$this->yy_destructor($yymajor, $yytokenvalue);
1003
+						$yymajor = self::YYNOCODE;
1004
+					} else {
1005
+						while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL &&
1006
+							   ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
1007
+							$this->yy_pop_parser_stack();
1008
+						}
1009
+						if ($this->yyidx < 0 || $yymajor == 0) {
1010
+							$this->yy_destructor($yymajor, $yytokenvalue);
1011
+							$this->yy_parse_failed();
1012
+							$yymajor = self::YYNOCODE;
1013
+						} elseif ($yymx != self::YYERRORSYMBOL) {
1014
+							$u2 = 0;
1015
+							$this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
1016
+						}
1017
+					}
1018
+					$this->yyerrcnt = 3;
1019
+					$yyerrorhit = 1;
1020
+				} else {
1021
+					if ($this->yyerrcnt <= 0) {
1022
+						$this->yy_syntax_error($yymajor, $yytokenvalue);
1023
+					}
1024
+					$this->yyerrcnt = 3;
1025
+					$this->yy_destructor($yymajor, $yytokenvalue);
1026
+					if ($yyendofinput) {
1027
+						$this->yy_parse_failed();
1028
+					}
1029
+					$yymajor = self::YYNOCODE;
1030
+				}
1031
+			} else {
1032
+				$this->yy_accept();
1033
+				$yymajor = self::YYNOCODE;
1034
+			}
1035
+		}
1036
+		while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
1037
+	}
1038 1038
 }
1039 1039
 
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_data.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
      * @link http://www.smarty.net/docs/en/api.append.tpl
118 118
      *
119 119
      * @param  array|string $tpl_var                                           the template variable name(s)
120
-     * @param  mixed        $value                                             the value to append
120
+     * @param  string        $value                                             the value to append
121 121
      * @param  bool         $merge                                             flag if array elements shall be merged
122 122
      * @param  bool         $nocache                                           if true any output of this variable will
123 123
      *                                                                         be not cached
Please login to merge, or discard this patch.
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -28,216 +28,216 @@
 block discarded – undo
28 28
  */
29 29
 class Smarty_Internal_Data
30 30
 {
31
-    /**
32
-     * This object type (Smarty = 1, template = 2, data = 4)
33
-     *
34
-     * @var int
35
-     */
36
-    public $_objType = 4;
37
-
38
-    /**
39
-     * name of class used for templates
40
-     *
41
-     * @var string
42
-     */
43
-    public $template_class = 'Smarty_Internal_Template';
44
-
45
-    /**
46
-     * template variables
47
-     *
48
-     * @var Smarty_Variable[]
49
-     */
50
-    public $tpl_vars = array();
51
-
52
-    /**
53
-     * parent template (if any)
54
-     *
55
-     * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data
56
-     */
57
-    public $parent = null;
58
-
59
-    /**
60
-     * configuration settings
61
-     *
62
-     * @var string[]
63
-     */
64
-    public $config_vars = array();
65
-
66
-    /**
67
-     * extension handler
68
-     *
69
-     * @var Smarty_Internal_Extension_Handler
70
-     */
71
-    public $ext = null;
72
-
73
-    /**
74
-     * Smarty_Internal_Data constructor.
75
-     *
76
-     * Install extension handler
77
-     */
78
-    public function __construct()
79
-    {
80
-        $this->ext = new Smarty_Internal_Extension_Handler();
81
-        $this->ext->objType = $this->_objType;
82
-    }
83
-
84
-    /**
85
-     * assigns a Smarty variable
86
-     *
87
-     * @param  array|string $tpl_var the template variable name(s)
88
-     * @param  mixed        $value   the value to assign
89
-     * @param  boolean      $nocache if true any output of this variable will be not cached
90
-     *
91
-     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
92
-     *                              chaining
93
-     */
94
-    public function assign($tpl_var, $value = null, $nocache = false)
95
-    {
96
-        if (is_array($tpl_var)) {
97
-            foreach ($tpl_var as $_key => $_val) {
98
-                $this->assign($_key, $_val, $nocache);
99
-            }
100
-        } else {
101
-            if ($tpl_var != '') {
102
-                if ($this->_objType == 2) {
103
-                    /** @var  Smarty_Internal_Template $this */
104
-                    $this->_assignInScope($tpl_var, $value, $nocache);
105
-                } else {
106
-                    $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
107
-                }
108
-            }
109
-        }
110
-        return $this;
111
-    }
112
-
113
-    /**
114
-     * appends values to template variables
115
-     *
116
-     * @api  Smarty::append()
117
-     * @link http://www.smarty.net/docs/en/api.append.tpl
118
-     *
119
-     * @param  array|string $tpl_var                                           the template variable name(s)
120
-     * @param  mixed        $value                                             the value to append
121
-     * @param  bool         $merge                                             flag if array elements shall be merged
122
-     * @param  bool         $nocache                                           if true any output of this variable will
123
-     *                                                                         be not cached
124
-     *
125
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
126
-     */
127
-    public function append($tpl_var, $value = null, $merge = false, $nocache = false)
128
-    {
129
-        return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache);
130
-    }
131
-
132
-    /**
133
-     * assigns a global Smarty variable
134
-     *
135
-     * @param  string  $varName the global variable name
136
-     * @param  mixed   $value   the value to assign
137
-     * @param  boolean $nocache if true any output of this variable will be not cached
138
-     *
139
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
140
-     */
141
-    public function assignGlobal($varName, $value = null, $nocache = false)
142
-    {
143
-        return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache);
144
-    }
145
-
146
-    /**
147
-     * appends values to template variables by reference
148
-     *
149
-     * @param  string  $tpl_var the template variable name
150
-     * @param  mixed   &$value  the referenced value to append
151
-     * @param  boolean $merge   flag if array elements shall be merged
152
-     *
153
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
154
-     */
155
-    public function appendByRef($tpl_var, &$value, $merge = false)
156
-    {
157
-        return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge);
158
-    }
159
-
160
-    /**
161
-     * assigns values to template variables by reference
162
-     *
163
-     * @param string   $tpl_var the template variable name
164
-     * @param          $value
165
-     * @param  boolean $nocache if true any output of this variable will be not cached
166
-     *
167
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
168
-     */
169
-    public function assignByRef($tpl_var, &$value, $nocache = false)
170
-    {
171
-        return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache);
172
-    }
173
-
174
-    /**
175
-     * Returns a single or all template variables
176
-     *
177
-     * @api  Smarty::getTemplateVars()
178
-     * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
179
-     *
180
-     * @param  string                                                 $varName       variable name or null
181
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
182
-     * @param  bool                                                   $searchParents include parent templates?
183
-     *
184
-     * @return mixed variable value or or array of variables
185
-     */
186
-    public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
187
-    {
188
-        return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
189
-    }
190
-
191
-    /**
192
-     * gets the object of a Smarty variable
193
-     *
194
-     * @param  string               $variable      the name of the Smarty variable
195
-     * @param  Smarty_Internal_Data $_ptr          optional pointer to data object
196
-     * @param  boolean              $searchParents search also in parent data
197
-     * @param bool                  $error_enable
198
-     *
199
-     * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable
200
-     * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
201
-     */
202
-    public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
203
-                                $error_enable = true)
204
-    {
205
-        return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
206
-    }
207
-
208
-    /**
209
-     * Follow the parent chain an merge template and config variables
210
-     *
211
-     * @param \Smarty_Internal_Data|null $data
212
-     */
213
-    public function _mergeVars(Smarty_Internal_Data $data = null)
214
-    {
215
-        if (isset($data)) {
216
-            if (!empty($this->tpl_vars)) {
217
-                $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars);
218
-            }
219
-            if (!empty($this->config_vars)) {
220
-                $data->config_vars = array_merge($this->config_vars, $data->config_vars);
221
-            }
222
-        } else {
223
-            $data = $this;
224
-        }
225
-        if (isset($this->parent)) {
226
-            $this->parent->_mergeVars($data);
227
-        }
228
-    }
229
-
230
-    /**
231
-     * Handle unknown class methods
232
-     *
233
-     * @param string $name unknown method-name
234
-     * @param array  $args argument array
235
-     *
236
-     * @return mixed
237
-     * @throws SmartyException
238
-     */
239
-    public function __call($name, $args)
240
-    {
241
-        return $this->ext->_callExternalMethod($this, $name, $args);
242
-    }
31
+	/**
32
+	 * This object type (Smarty = 1, template = 2, data = 4)
33
+	 *
34
+	 * @var int
35
+	 */
36
+	public $_objType = 4;
37
+
38
+	/**
39
+	 * name of class used for templates
40
+	 *
41
+	 * @var string
42
+	 */
43
+	public $template_class = 'Smarty_Internal_Template';
44
+
45
+	/**
46
+	 * template variables
47
+	 *
48
+	 * @var Smarty_Variable[]
49
+	 */
50
+	public $tpl_vars = array();
51
+
52
+	/**
53
+	 * parent template (if any)
54
+	 *
55
+	 * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data
56
+	 */
57
+	public $parent = null;
58
+
59
+	/**
60
+	 * configuration settings
61
+	 *
62
+	 * @var string[]
63
+	 */
64
+	public $config_vars = array();
65
+
66
+	/**
67
+	 * extension handler
68
+	 *
69
+	 * @var Smarty_Internal_Extension_Handler
70
+	 */
71
+	public $ext = null;
72
+
73
+	/**
74
+	 * Smarty_Internal_Data constructor.
75
+	 *
76
+	 * Install extension handler
77
+	 */
78
+	public function __construct()
79
+	{
80
+		$this->ext = new Smarty_Internal_Extension_Handler();
81
+		$this->ext->objType = $this->_objType;
82
+	}
83
+
84
+	/**
85
+	 * assigns a Smarty variable
86
+	 *
87
+	 * @param  array|string $tpl_var the template variable name(s)
88
+	 * @param  mixed        $value   the value to assign
89
+	 * @param  boolean      $nocache if true any output of this variable will be not cached
90
+	 *
91
+	 * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
92
+	 *                              chaining
93
+	 */
94
+	public function assign($tpl_var, $value = null, $nocache = false)
95
+	{
96
+		if (is_array($tpl_var)) {
97
+			foreach ($tpl_var as $_key => $_val) {
98
+				$this->assign($_key, $_val, $nocache);
99
+			}
100
+		} else {
101
+			if ($tpl_var != '') {
102
+				if ($this->_objType == 2) {
103
+					/** @var  Smarty_Internal_Template $this */
104
+					$this->_assignInScope($tpl_var, $value, $nocache);
105
+				} else {
106
+					$this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
107
+				}
108
+			}
109
+		}
110
+		return $this;
111
+	}
112
+
113
+	/**
114
+	 * appends values to template variables
115
+	 *
116
+	 * @api  Smarty::append()
117
+	 * @link http://www.smarty.net/docs/en/api.append.tpl
118
+	 *
119
+	 * @param  array|string $tpl_var                                           the template variable name(s)
120
+	 * @param  mixed        $value                                             the value to append
121
+	 * @param  bool         $merge                                             flag if array elements shall be merged
122
+	 * @param  bool         $nocache                                           if true any output of this variable will
123
+	 *                                                                         be not cached
124
+	 *
125
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
126
+	 */
127
+	public function append($tpl_var, $value = null, $merge = false, $nocache = false)
128
+	{
129
+		return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache);
130
+	}
131
+
132
+	/**
133
+	 * assigns a global Smarty variable
134
+	 *
135
+	 * @param  string  $varName the global variable name
136
+	 * @param  mixed   $value   the value to assign
137
+	 * @param  boolean $nocache if true any output of this variable will be not cached
138
+	 *
139
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
140
+	 */
141
+	public function assignGlobal($varName, $value = null, $nocache = false)
142
+	{
143
+		return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache);
144
+	}
145
+
146
+	/**
147
+	 * appends values to template variables by reference
148
+	 *
149
+	 * @param  string  $tpl_var the template variable name
150
+	 * @param  mixed   &$value  the referenced value to append
151
+	 * @param  boolean $merge   flag if array elements shall be merged
152
+	 *
153
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
154
+	 */
155
+	public function appendByRef($tpl_var, &$value, $merge = false)
156
+	{
157
+		return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge);
158
+	}
159
+
160
+	/**
161
+	 * assigns values to template variables by reference
162
+	 *
163
+	 * @param string   $tpl_var the template variable name
164
+	 * @param          $value
165
+	 * @param  boolean $nocache if true any output of this variable will be not cached
166
+	 *
167
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
168
+	 */
169
+	public function assignByRef($tpl_var, &$value, $nocache = false)
170
+	{
171
+		return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache);
172
+	}
173
+
174
+	/**
175
+	 * Returns a single or all template variables
176
+	 *
177
+	 * @api  Smarty::getTemplateVars()
178
+	 * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
179
+	 *
180
+	 * @param  string                                                 $varName       variable name or null
181
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
182
+	 * @param  bool                                                   $searchParents include parent templates?
183
+	 *
184
+	 * @return mixed variable value or or array of variables
185
+	 */
186
+	public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
187
+	{
188
+		return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
189
+	}
190
+
191
+	/**
192
+	 * gets the object of a Smarty variable
193
+	 *
194
+	 * @param  string               $variable      the name of the Smarty variable
195
+	 * @param  Smarty_Internal_Data $_ptr          optional pointer to data object
196
+	 * @param  boolean              $searchParents search also in parent data
197
+	 * @param bool                  $error_enable
198
+	 *
199
+	 * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable
200
+	 * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
201
+	 */
202
+	public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
203
+								$error_enable = true)
204
+	{
205
+		return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
206
+	}
207
+
208
+	/**
209
+	 * Follow the parent chain an merge template and config variables
210
+	 *
211
+	 * @param \Smarty_Internal_Data|null $data
212
+	 */
213
+	public function _mergeVars(Smarty_Internal_Data $data = null)
214
+	{
215
+		if (isset($data)) {
216
+			if (!empty($this->tpl_vars)) {
217
+				$data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars);
218
+			}
219
+			if (!empty($this->config_vars)) {
220
+				$data->config_vars = array_merge($this->config_vars, $data->config_vars);
221
+			}
222
+		} else {
223
+			$data = $this;
224
+		}
225
+		if (isset($this->parent)) {
226
+			$this->parent->_mergeVars($data);
227
+		}
228
+	}
229
+
230
+	/**
231
+	 * Handle unknown class methods
232
+	 *
233
+	 * @param string $name unknown method-name
234
+	 * @param array  $args argument array
235
+	 *
236
+	 * @return mixed
237
+	 * @throws SmartyException
238
+	 */
239
+	public function __call($name, $args)
240
+	{
241
+		return $this->ext->_callExternalMethod($this, $name, $args);
242
+	}
243 243
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
                     /** @var  Smarty_Internal_Template $this */
104 104
                     $this->_assignInScope($tpl_var, $value, $nocache);
105 105
                 } else {
106
-                    $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
106
+                    $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache);
107 107
                 }
108 108
             }
109 109
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_debug.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * Start logging template
49 49
      *
50 50
      * @param \Smarty_Internal_Template $template template
51
-     * @param null                      $mode     true: display   false: fetch  null: subtemplate
51
+     * @param null|boolean                      $mode     true: display   false: fetch  null: subtemplate
52 52
      */
53 53
     public function start_template(Smarty_Internal_Template $template, $mode = null)
54 54
     {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     /**
191 191
      * Opens a window for the Smarty Debugging Console and display the data
192 192
      *
193
-     * @param Smarty_Internal_Template|Smarty $obj object to debug
193
+     * @param Smarty_Internal_Template $obj object to debug
194 194
      * @param bool                            $full
195 195
      */
196 196
     public function display_debug($obj, $full = false)
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
     public function start_template(Smarty_Internal_Template $template, $mode = null)
54 54
     {
55 55
         if (isset($mode)) {
56
-            $this->index ++;
57
-            $this->offset ++;
58
-            $this->template_data[ $this->index ] = null;
56
+            $this->index++;
57
+            $this->offset++;
58
+            $this->template_data[$this->index] = null;
59 59
         }
60 60
         $key = $this->get_key($template);
61
-        $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
61
+        $this->template_data[$this->index][$key]['start_template_time'] = microtime(true);
62 62
     }
63 63
 
64 64
     /**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     public function end_template(Smarty_Internal_Template $template)
70 70
     {
71 71
         $key = $this->get_key($template);
72
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
72
+        $this->template_data[$this->index][$key]['total_time'] +=
73
+            microtime(true) - $this->template_data[$this->index][$key]['start_template_time'];
74 74
     }
75 75
 
76 76
     /**
@@ -83,24 +83,24 @@  discard block
 block discarded – undo
83 83
         static $_is_stringy = array('string' => true, 'eval' => true);
84 84
         if (!empty($template->compiler->trace_uid)) {
85 85
             $key = $template->compiler->trace_uid;
86
-            if (!isset($this->template_data[ $this->index ][ $key ])) {
87
-                if (isset($_is_stringy[ $template->source->type ])) {
88
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] =
86
+            if (!isset($this->template_data[$this->index][$key])) {
87
+                if (isset($_is_stringy[$template->source->type])) {
88
+                    $this->template_data[$this->index][$key]['name'] =
89 89
                         '\'' . substr($template->source->name, 0, 25) . '...\'';
90 90
                 } else {
91
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
91
+                    $this->template_data[$this->index][$key]['name'] = $template->source->filepath;
92 92
                 }
93
-                $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
-                $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
-                $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
93
+                $this->template_data[$this->index][$key]['compile_time'] = 0;
94
+                $this->template_data[$this->index][$key]['render_time'] = 0;
95
+                $this->template_data[$this->index][$key]['cache_time'] = 0;
96 96
             }
97 97
         } else {
98
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
98
+            if (isset($this->ignore_uid[$template->source->uid])) {
99 99
                 return;
100 100
             }
101 101
             $key = $this->get_key($template);
102 102
         }
103
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
103
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
104 104
     }
105 105
 
106 106
     /**
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
         if (!empty($template->compiler->trace_uid)) {
114 114
             $key = $template->compiler->trace_uid;
115 115
         } else {
116
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
116
+            if (isset($this->ignore_uid[$template->source->uid])) {
117 117
                 return;
118 118
             }
119 119
 
120 120
             $key = $this->get_key($template);
121 121
         }
122
-        $this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
122
+        $this->template_data[$this->index][$key]['compile_time'] +=
123
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
124 124
     }
125 125
 
126 126
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public function start_render(Smarty_Internal_Template $template)
132 132
     {
133 133
         $key = $this->get_key($template);
134
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
134
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
135 135
     }
136 136
 
137 137
     /**
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     public function end_render(Smarty_Internal_Template $template)
143 143
     {
144 144
         $key = $this->get_key($template);
145
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
145
+        $this->template_data[$this->index][$key]['render_time'] +=
146
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
147 147
     }
148 148
 
149 149
     /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function start_cache(Smarty_Internal_Template $template)
155 155
     {
156 156
         $key = $this->get_key($template);
157
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
157
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
158 158
     }
159 159
 
160 160
     /**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
     public function end_cache(Smarty_Internal_Template $template)
166 166
     {
167 167
         $key = $this->get_key($template);
168
-        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
168
+        $this->template_data[$this->index][$key]['cache_time'] +=
169
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
170 170
     }
171 171
 
172 172
     /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     public function display_debug($obj, $full = false)
197 197
     {
198 198
         if (!$full) {
199
-            $this->offset ++;
199
+            $this->offset++;
200 200
             $savedIndex = $this->index;
201 201
             $this->index = 9999;
202 202
         }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244 244
         }
245 245
         if ($obj->_objType == 1 || $full) {
246
-            $_template->assign('template_data', $this->template_data[ $this->index ]);
246
+            $_template->assign('template_data', $this->template_data[$this->index]);
247 247
         } else {
248 248
             $_template->assign('template_data', null);
249 249
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $_template->assign('offset', $this->offset * 50);
255 255
         echo $_template->fetch();
256 256
         if (isset($full)) {
257
-            $this->index --;
257
+            $this->index--;
258 258
         }
259 259
         if (!$full) {
260 260
             $this->index = $savedIndex;
@@ -272,53 +272,53 @@  discard block
 block discarded – undo
272 272
     {
273 273
         $config_vars = array();
274 274
         foreach ($obj->config_vars as $key => $var) {
275
-            $config_vars[ $key ][ 'value' ] = $var;
275
+            $config_vars[$key]['value'] = $var;
276 276
             if ($obj->_objType == 2) {
277
-                $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
277
+                $config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
278 278
             } elseif ($obj->_objType == 4) {
279
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
279
+                $tpl_vars[$key]['scope'] = $obj->dataObjectName;
280 280
             } else {
281
-                $config_vars[ $key ][ 'scope' ] = 'Smarty object';
281
+                $config_vars[$key]['scope'] = 'Smarty object';
282 282
             }
283 283
         }
284 284
         $tpl_vars = array();
285 285
         foreach ($obj->tpl_vars as $key => $var) {
286 286
             foreach ($var as $varkey => $varvalue) {
287 287
                 if ($varkey == 'value') {
288
-                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
288
+                    $tpl_vars[$key][$varkey] = $varvalue;
289 289
                 } else {
290 290
                     if ($varkey == 'nocache') {
291 291
                         if ($varvalue == true) {
292
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
292
+                            $tpl_vars[$key][$varkey] = $varvalue;
293 293
                         }
294 294
                     } else {
295 295
                         if ($varkey != 'scope' || $varvalue !== 0) {
296
-                            $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
296
+                            $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
297 297
                         }
298 298
                     }
299 299
                 }
300 300
             }
301 301
             if ($obj->_objType == 2) {
302
-                $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
302
+                $tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
303 303
             } elseif ($obj->_objType == 4) {
304
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
304
+                $tpl_vars[$key]['scope'] = $obj->dataObjectName;
305 305
             } else {
306
-                $tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
306
+                $tpl_vars[$key]['scope'] = 'Smarty object';
307 307
             }
308 308
         }
309 309
 
310 310
         if (isset($obj->parent)) {
311 311
             $parent = $this->get_debug_vars($obj->parent);
312 312
             foreach ($parent->tpl_vars as $name => $pvar) {
313
-                if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
-                    $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
313
+                if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
314
+                    $tpl_vars[$name]['scope'] = $pvar['scope'];
315 315
                 }
316 316
             }
317 317
             $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
318 318
 
319 319
             foreach ($parent->config_vars as $name => $pvar) {
320
-                if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
-                    $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
320
+                if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
321
+                    $config_vars[$name]['scope'] = $pvar['scope'];
322 322
                 }
323 323
             }
324 324
             $config_vars = array_merge($parent->config_vars, $config_vars);
@@ -327,20 +327,20 @@  discard block
 block discarded – undo
327 327
                 if (!array_key_exists($key, $tpl_vars)) {
328 328
                     foreach ($var as $varkey => $varvalue) {
329 329
                         if ($varkey == 'value') {
330
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
330
+                            $tpl_vars[$key][$varkey] = $varvalue;
331 331
                         } else {
332 332
                             if ($varkey == 'nocache') {
333 333
                                 if ($varvalue == true) {
334
-                                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
334
+                                    $tpl_vars[$key][$varkey] = $varvalue;
335 335
                                 }
336 336
                             } else {
337 337
                                 if ($varkey != 'scope' || $varvalue !== 0) {
338
-                                    $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
338
+                                    $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
339 339
                                 }
340 340
                             }
341 341
                         }
342 342
                     }
343
-                    $tpl_vars[ $key ][ 'scope' ] = 'Global';
343
+                    $tpl_vars[$key]['scope'] = 'Global';
344 344
                 }
345 345
             }
346 346
         }
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
             $template->source->filepath;
364 364
         }
365 365
         $key = $template->source->uid;
366
-        if (isset($this->template_data[ $this->index ][ $key ])) {
366
+        if (isset($this->template_data[$this->index][$key])) {
367 367
             return $key;
368 368
         } else {
369
-            if (isset($_is_stringy[ $template->source->type ])) {
370
-                $this->template_data[ $this->index ][ $key ][ 'name' ] =
369
+            if (isset($_is_stringy[$template->source->type])) {
370
+                $this->template_data[$this->index][$key]['name'] =
371 371
                     '\'' . substr($template->source->name, 0, 25) . '...\'';
372 372
             } else {
373
-                $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
373
+                $this->template_data[$this->index][$key]['name'] = $template->source->filepath;
374 374
             }
375
-            $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
-            $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
-            $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
-            $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
375
+            $this->template_data[$this->index][$key]['compile_time'] = 0;
376
+            $this->template_data[$this->index][$key]['render_time'] = 0;
377
+            $this->template_data[$this->index][$key]['cache_time'] = 0;
378
+            $this->template_data[$this->index][$key]['total_time'] = 0;
379 379
 
380 380
             return $key;
381 381
         }
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         if ($template->source->uid == '') {
393 393
             $template->source->filepath;
394 394
         }
395
-        $this->ignore_uid[ $template->source->uid ] = true;
395
+        $this->ignore_uid[$template->source->uid] = true;
396 396
     }
397 397
 
398 398
     /**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
      */
403 403
     public function debugUrl(Smarty $smarty)
404 404
     {
405
-        if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
-            $_query_string = $_SERVER[ 'QUERY_STRING' ];
405
+        if (isset($_SERVER['QUERY_STRING'])) {
406
+            $_query_string = $_SERVER['QUERY_STRING'];
407 407
         } else {
408 408
             $_query_string = '';
409 409
         }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                 $smarty->debugging = true;
422 422
             }
423 423
         } else {
424
-            if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
424
+            if (isset($_COOKIE['SMARTY_DEBUG'])) {
425 425
                 $smarty->debugging = true;
426 426
             }
427 427
         }
Please login to merge, or discard this patch.
Indentation   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -16,414 +16,414 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Debug extends Smarty_Internal_Data
18 18
 {
19
-    /**
20
-     * template data
21
-     *
22
-     * @var array
23
-     */
24
-    public $template_data = array();
19
+	/**
20
+	 * template data
21
+	 *
22
+	 * @var array
23
+	 */
24
+	public $template_data = array();
25 25
 
26
-    /**
27
-     * List of uid's which shall be ignored
28
-     *
29
-     * @var array
30
-     */
31
-    public $ignore_uid = array();
26
+	/**
27
+	 * List of uid's which shall be ignored
28
+	 *
29
+	 * @var array
30
+	 */
31
+	public $ignore_uid = array();
32 32
 
33
-    /**
34
-     * Index of display() and fetch() calls
35
-     *
36
-     * @var int
37
-     */
38
-    public $index = 0;
33
+	/**
34
+	 * Index of display() and fetch() calls
35
+	 *
36
+	 * @var int
37
+	 */
38
+	public $index = 0;
39 39
 
40
-    /**
41
-     * Counter for window offset
42
-     *
43
-     * @var int
44
-     */
45
-    public $offset = 0;
40
+	/**
41
+	 * Counter for window offset
42
+	 *
43
+	 * @var int
44
+	 */
45
+	public $offset = 0;
46 46
 
47
-    /**
48
-     * Start logging template
49
-     *
50
-     * @param \Smarty_Internal_Template $template template
51
-     * @param null                      $mode     true: display   false: fetch  null: subtemplate
52
-     */
53
-    public function start_template(Smarty_Internal_Template $template, $mode = null)
54
-    {
55
-        if (isset($mode)) {
56
-            $this->index ++;
57
-            $this->offset ++;
58
-            $this->template_data[ $this->index ] = null;
59
-        }
60
-        $key = $this->get_key($template);
61
-        $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
62
-    }
47
+	/**
48
+	 * Start logging template
49
+	 *
50
+	 * @param \Smarty_Internal_Template $template template
51
+	 * @param null                      $mode     true: display   false: fetch  null: subtemplate
52
+	 */
53
+	public function start_template(Smarty_Internal_Template $template, $mode = null)
54
+	{
55
+		if (isset($mode)) {
56
+			$this->index ++;
57
+			$this->offset ++;
58
+			$this->template_data[ $this->index ] = null;
59
+		}
60
+		$key = $this->get_key($template);
61
+		$this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
62
+	}
63 63
 
64
-    /**
65
-     * End logging of cache time
66
-     *
67
-     * @param \Smarty_Internal_Template $template cached template
68
-     */
69
-    public function end_template(Smarty_Internal_Template $template)
70
-    {
71
-        $key = $this->get_key($template);
72
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
74
-    }
64
+	/**
65
+	 * End logging of cache time
66
+	 *
67
+	 * @param \Smarty_Internal_Template $template cached template
68
+	 */
69
+	public function end_template(Smarty_Internal_Template $template)
70
+	{
71
+		$key = $this->get_key($template);
72
+		$this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
74
+	}
75 75
 
76
-    /**
77
-     * Start logging of compile time
78
-     *
79
-     * @param \Smarty_Internal_Template $template
80
-     */
81
-    public function start_compile(Smarty_Internal_Template $template)
82
-    {
83
-        static $_is_stringy = array('string' => true, 'eval' => true);
84
-        if (!empty($template->compiler->trace_uid)) {
85
-            $key = $template->compiler->trace_uid;
86
-            if (!isset($this->template_data[ $this->index ][ $key ])) {
87
-                if (isset($_is_stringy[ $template->source->type ])) {
88
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] =
89
-                        '\'' . substr($template->source->name, 0, 25) . '...\'';
90
-                } else {
91
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
92
-                }
93
-                $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
-                $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
-                $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
96
-            }
97
-        } else {
98
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
99
-                return;
100
-            }
101
-            $key = $this->get_key($template);
102
-        }
103
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
104
-    }
76
+	/**
77
+	 * Start logging of compile time
78
+	 *
79
+	 * @param \Smarty_Internal_Template $template
80
+	 */
81
+	public function start_compile(Smarty_Internal_Template $template)
82
+	{
83
+		static $_is_stringy = array('string' => true, 'eval' => true);
84
+		if (!empty($template->compiler->trace_uid)) {
85
+			$key = $template->compiler->trace_uid;
86
+			if (!isset($this->template_data[ $this->index ][ $key ])) {
87
+				if (isset($_is_stringy[ $template->source->type ])) {
88
+					$this->template_data[ $this->index ][ $key ][ 'name' ] =
89
+						'\'' . substr($template->source->name, 0, 25) . '...\'';
90
+				} else {
91
+					$this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
92
+				}
93
+				$this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
+				$this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
+				$this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
96
+			}
97
+		} else {
98
+			if (isset($this->ignore_uid[ $template->source->uid ])) {
99
+				return;
100
+			}
101
+			$key = $this->get_key($template);
102
+		}
103
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
104
+	}
105 105
 
106
-    /**
107
-     * End logging of compile time
108
-     *
109
-     * @param \Smarty_Internal_Template $template
110
-     */
111
-    public function end_compile(Smarty_Internal_Template $template)
112
-    {
113
-        if (!empty($template->compiler->trace_uid)) {
114
-            $key = $template->compiler->trace_uid;
115
-        } else {
116
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
117
-                return;
118
-            }
106
+	/**
107
+	 * End logging of compile time
108
+	 *
109
+	 * @param \Smarty_Internal_Template $template
110
+	 */
111
+	public function end_compile(Smarty_Internal_Template $template)
112
+	{
113
+		if (!empty($template->compiler->trace_uid)) {
114
+			$key = $template->compiler->trace_uid;
115
+		} else {
116
+			if (isset($this->ignore_uid[ $template->source->uid ])) {
117
+				return;
118
+			}
119 119
 
120
-            $key = $this->get_key($template);
121
-        }
122
-        $this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
124
-    }
120
+			$key = $this->get_key($template);
121
+		}
122
+		$this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
124
+	}
125 125
 
126
-    /**
127
-     * Start logging of render time
128
-     *
129
-     * @param \Smarty_Internal_Template $template
130
-     */
131
-    public function start_render(Smarty_Internal_Template $template)
132
-    {
133
-        $key = $this->get_key($template);
134
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
135
-    }
126
+	/**
127
+	 * Start logging of render time
128
+	 *
129
+	 * @param \Smarty_Internal_Template $template
130
+	 */
131
+	public function start_render(Smarty_Internal_Template $template)
132
+	{
133
+		$key = $this->get_key($template);
134
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
135
+	}
136 136
 
137
-    /**
138
-     * End logging of compile time
139
-     *
140
-     * @param \Smarty_Internal_Template $template
141
-     */
142
-    public function end_render(Smarty_Internal_Template $template)
143
-    {
144
-        $key = $this->get_key($template);
145
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
147
-    }
137
+	/**
138
+	 * End logging of compile time
139
+	 *
140
+	 * @param \Smarty_Internal_Template $template
141
+	 */
142
+	public function end_render(Smarty_Internal_Template $template)
143
+	{
144
+		$key = $this->get_key($template);
145
+		$this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
147
+	}
148 148
 
149
-    /**
150
-     * Start logging of cache time
151
-     *
152
-     * @param \Smarty_Internal_Template $template cached template
153
-     */
154
-    public function start_cache(Smarty_Internal_Template $template)
155
-    {
156
-        $key = $this->get_key($template);
157
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
158
-    }
149
+	/**
150
+	 * Start logging of cache time
151
+	 *
152
+	 * @param \Smarty_Internal_Template $template cached template
153
+	 */
154
+	public function start_cache(Smarty_Internal_Template $template)
155
+	{
156
+		$key = $this->get_key($template);
157
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
158
+	}
159 159
 
160
-    /**
161
-     * End logging of cache time
162
-     *
163
-     * @param \Smarty_Internal_Template $template cached template
164
-     */
165
-    public function end_cache(Smarty_Internal_Template $template)
166
-    {
167
-        $key = $this->get_key($template);
168
-        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
170
-    }
160
+	/**
161
+	 * End logging of cache time
162
+	 *
163
+	 * @param \Smarty_Internal_Template $template cached template
164
+	 */
165
+	public function end_cache(Smarty_Internal_Template $template)
166
+	{
167
+		$key = $this->get_key($template);
168
+		$this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
170
+	}
171 171
 
172
-    /**
173
-     * Register template object
174
-     *
175
-     * @param \Smarty_Internal_Template $template cached template
176
-     */
177
-    public function register_template(Smarty_Internal_Template $template)
178
-    {
179
-    }
172
+	/**
173
+	 * Register template object
174
+	 *
175
+	 * @param \Smarty_Internal_Template $template cached template
176
+	 */
177
+	public function register_template(Smarty_Internal_Template $template)
178
+	{
179
+	}
180 180
 
181
-    /**
182
-     * Register data object
183
-     *
184
-     * @param \Smarty_Data $data data object
185
-     */
186
-    public static function register_data(Smarty_Data $data)
187
-    {
188
-    }
181
+	/**
182
+	 * Register data object
183
+	 *
184
+	 * @param \Smarty_Data $data data object
185
+	 */
186
+	public static function register_data(Smarty_Data $data)
187
+	{
188
+	}
189 189
 
190
-    /**
191
-     * Opens a window for the Smarty Debugging Console and display the data
192
-     *
193
-     * @param Smarty_Internal_Template|Smarty $obj object to debug
194
-     * @param bool                            $full
195
-     */
196
-    public function display_debug($obj, $full = false)
197
-    {
198
-        if (!$full) {
199
-            $this->offset ++;
200
-            $savedIndex = $this->index;
201
-            $this->index = 9999;
202
-        }
203
-        if ($obj->_objType == 1) {
204
-            $smarty = $obj;
205
-        } else {
206
-            $smarty = $obj->smarty;
207
-        }
208
-        // create fresh instance of smarty for displaying the debug console
209
-        // to avoid problems if the application did overload the Smarty class
210
-        $debObj = new Smarty();
211
-        // copy the working dirs from application
212
-        $debObj->setCompileDir($smarty->getCompileDir());
213
-        // init properties by hand as user may have edited the original Smarty class
214
-        $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
215
-        $debObj->force_compile = false;
216
-        $debObj->compile_check = true;
217
-        $debObj->left_delimiter = '{';
218
-        $debObj->right_delimiter = '}';
219
-        $debObj->security_policy = null;
220
-        $debObj->debugging = false;
221
-        $debObj->debugging_ctrl = 'NONE';
222
-        $debObj->error_reporting = E_ALL & ~E_NOTICE;
223
-        $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
224
-        $debObj->registered_plugins = array();
225
-        $debObj->registered_resources = array();
226
-        $debObj->registered_filters = array();
227
-        $debObj->autoload_filters = array();
228
-        $debObj->default_modifiers = array();
229
-        $debObj->escape_html = true;
230
-        $debObj->caching = false;
231
-        $debObj->compile_id = null;
232
-        $debObj->cache_id = null;
233
-        // prepare information of assigned variables
234
-        $ptr = $this->get_debug_vars($obj);
235
-        $_assigned_vars = $ptr->tpl_vars;
236
-        ksort($_assigned_vars);
237
-        $_config_vars = $ptr->config_vars;
238
-        ksort($_config_vars);
239
-        $debugging = $smarty->debugging;
190
+	/**
191
+	 * Opens a window for the Smarty Debugging Console and display the data
192
+	 *
193
+	 * @param Smarty_Internal_Template|Smarty $obj object to debug
194
+	 * @param bool                            $full
195
+	 */
196
+	public function display_debug($obj, $full = false)
197
+	{
198
+		if (!$full) {
199
+			$this->offset ++;
200
+			$savedIndex = $this->index;
201
+			$this->index = 9999;
202
+		}
203
+		if ($obj->_objType == 1) {
204
+			$smarty = $obj;
205
+		} else {
206
+			$smarty = $obj->smarty;
207
+		}
208
+		// create fresh instance of smarty for displaying the debug console
209
+		// to avoid problems if the application did overload the Smarty class
210
+		$debObj = new Smarty();
211
+		// copy the working dirs from application
212
+		$debObj->setCompileDir($smarty->getCompileDir());
213
+		// init properties by hand as user may have edited the original Smarty class
214
+		$debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
215
+		$debObj->force_compile = false;
216
+		$debObj->compile_check = true;
217
+		$debObj->left_delimiter = '{';
218
+		$debObj->right_delimiter = '}';
219
+		$debObj->security_policy = null;
220
+		$debObj->debugging = false;
221
+		$debObj->debugging_ctrl = 'NONE';
222
+		$debObj->error_reporting = E_ALL & ~E_NOTICE;
223
+		$debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
224
+		$debObj->registered_plugins = array();
225
+		$debObj->registered_resources = array();
226
+		$debObj->registered_filters = array();
227
+		$debObj->autoload_filters = array();
228
+		$debObj->default_modifiers = array();
229
+		$debObj->escape_html = true;
230
+		$debObj->caching = false;
231
+		$debObj->compile_id = null;
232
+		$debObj->cache_id = null;
233
+		// prepare information of assigned variables
234
+		$ptr = $this->get_debug_vars($obj);
235
+		$_assigned_vars = $ptr->tpl_vars;
236
+		ksort($_assigned_vars);
237
+		$_config_vars = $ptr->config_vars;
238
+		ksort($_config_vars);
239
+		$debugging = $smarty->debugging;
240 240
 
241
-        $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
242
-        if ($obj->_objType == 2) {
243
-            $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244
-        }
245
-        if ($obj->_objType == 1 || $full) {
246
-            $_template->assign('template_data', $this->template_data[ $this->index ]);
247
-        } else {
248
-            $_template->assign('template_data', null);
249
-        }
250
-        $_template->assign('assigned_vars', $_assigned_vars);
251
-        $_template->assign('config_vars', $_config_vars);
252
-        $_template->assign('execution_time', microtime(true) - $smarty->start_time);
253
-        $_template->assign('display_mode', $debugging == 2 || !$full);
254
-        $_template->assign('offset', $this->offset * 50);
255
-        echo $_template->fetch();
256
-        if (isset($full)) {
257
-            $this->index --;
258
-        }
259
-        if (!$full) {
260
-            $this->index = $savedIndex;
261
-        }
262
-    }
241
+		$_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
242
+		if ($obj->_objType == 2) {
243
+			$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244
+		}
245
+		if ($obj->_objType == 1 || $full) {
246
+			$_template->assign('template_data', $this->template_data[ $this->index ]);
247
+		} else {
248
+			$_template->assign('template_data', null);
249
+		}
250
+		$_template->assign('assigned_vars', $_assigned_vars);
251
+		$_template->assign('config_vars', $_config_vars);
252
+		$_template->assign('execution_time', microtime(true) - $smarty->start_time);
253
+		$_template->assign('display_mode', $debugging == 2 || !$full);
254
+		$_template->assign('offset', $this->offset * 50);
255
+		echo $_template->fetch();
256
+		if (isset($full)) {
257
+			$this->index --;
258
+		}
259
+		if (!$full) {
260
+			$this->index = $savedIndex;
261
+		}
262
+	}
263 263
 
264
-    /**
265
-     * Recursively gets variables from all template/data scopes
266
-     *
267
-     * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug
268
-     *
269
-     * @return StdClass
270
-     */
271
-    public function get_debug_vars($obj)
272
-    {
273
-        $config_vars = array();
274
-        foreach ($obj->config_vars as $key => $var) {
275
-            $config_vars[ $key ][ 'value' ] = $var;
276
-            if ($obj->_objType == 2) {
277
-                $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
278
-            } elseif ($obj->_objType == 4) {
279
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
280
-            } else {
281
-                $config_vars[ $key ][ 'scope' ] = 'Smarty object';
282
-            }
283
-        }
284
-        $tpl_vars = array();
285
-        foreach ($obj->tpl_vars as $key => $var) {
286
-            foreach ($var as $varkey => $varvalue) {
287
-                if ($varkey == 'value') {
288
-                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
289
-                } else {
290
-                    if ($varkey == 'nocache') {
291
-                        if ($varvalue === true) {
292
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
293
-                        }
294
-                    } else {
295
-                        if ($varkey != 'scope' || $varvalue !== 0) {
296
-                            $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
297
-                        }
298
-                    }
299
-                }
300
-            }
301
-            if ($obj->_objType == 2) {
302
-                $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
303
-            } elseif ($obj->_objType == 4) {
304
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
305
-            } else {
306
-                $tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
307
-            }
308
-        }
264
+	/**
265
+	 * Recursively gets variables from all template/data scopes
266
+	 *
267
+	 * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug
268
+	 *
269
+	 * @return StdClass
270
+	 */
271
+	public function get_debug_vars($obj)
272
+	{
273
+		$config_vars = array();
274
+		foreach ($obj->config_vars as $key => $var) {
275
+			$config_vars[ $key ][ 'value' ] = $var;
276
+			if ($obj->_objType == 2) {
277
+				$config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
278
+			} elseif ($obj->_objType == 4) {
279
+				$tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
280
+			} else {
281
+				$config_vars[ $key ][ 'scope' ] = 'Smarty object';
282
+			}
283
+		}
284
+		$tpl_vars = array();
285
+		foreach ($obj->tpl_vars as $key => $var) {
286
+			foreach ($var as $varkey => $varvalue) {
287
+				if ($varkey == 'value') {
288
+					$tpl_vars[ $key ][ $varkey ] = $varvalue;
289
+				} else {
290
+					if ($varkey == 'nocache') {
291
+						if ($varvalue === true) {
292
+							$tpl_vars[ $key ][ $varkey ] = $varvalue;
293
+						}
294
+					} else {
295
+						if ($varkey != 'scope' || $varvalue !== 0) {
296
+							$tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
297
+						}
298
+					}
299
+				}
300
+			}
301
+			if ($obj->_objType == 2) {
302
+				$tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
303
+			} elseif ($obj->_objType == 4) {
304
+				$tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
305
+			} else {
306
+				$tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
307
+			}
308
+		}
309 309
 
310
-        if (isset($obj->parent)) {
311
-            $parent = $this->get_debug_vars($obj->parent);
312
-            foreach ($parent->tpl_vars as $name => $pvar) {
313
-                if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
-                    $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
315
-                }
316
-            }
317
-            $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
310
+		if (isset($obj->parent)) {
311
+			$parent = $this->get_debug_vars($obj->parent);
312
+			foreach ($parent->tpl_vars as $name => $pvar) {
313
+				if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
+					$tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
315
+				}
316
+			}
317
+			$tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
318 318
 
319
-            foreach ($parent->config_vars as $name => $pvar) {
320
-                if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
-                    $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
322
-                }
323
-            }
324
-            $config_vars = array_merge($parent->config_vars, $config_vars);
325
-        } else {
326
-            foreach (Smarty::$global_tpl_vars as $key => $var) {
327
-                if (!array_key_exists($key, $tpl_vars)) {
328
-                    foreach ($var as $varkey => $varvalue) {
329
-                        if ($varkey == 'value') {
330
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
331
-                        } else {
332
-                            if ($varkey == 'nocache') {
333
-                                if ($varvalue === true) {
334
-                                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
335
-                                }
336
-                            } else {
337
-                                if ($varkey != 'scope' || $varvalue !== 0) {
338
-                                    $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
339
-                                }
340
-                            }
341
-                        }
342
-                    }
343
-                    $tpl_vars[ $key ][ 'scope' ] = 'Global';
344
-                }
345
-            }
346
-        }
319
+			foreach ($parent->config_vars as $name => $pvar) {
320
+				if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
+					$config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
322
+				}
323
+			}
324
+			$config_vars = array_merge($parent->config_vars, $config_vars);
325
+		} else {
326
+			foreach (Smarty::$global_tpl_vars as $key => $var) {
327
+				if (!array_key_exists($key, $tpl_vars)) {
328
+					foreach ($var as $varkey => $varvalue) {
329
+						if ($varkey == 'value') {
330
+							$tpl_vars[ $key ][ $varkey ] = $varvalue;
331
+						} else {
332
+							if ($varkey == 'nocache') {
333
+								if ($varvalue === true) {
334
+									$tpl_vars[ $key ][ $varkey ] = $varvalue;
335
+								}
336
+							} else {
337
+								if ($varkey != 'scope' || $varvalue !== 0) {
338
+									$tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
339
+								}
340
+							}
341
+						}
342
+					}
343
+					$tpl_vars[ $key ][ 'scope' ] = 'Global';
344
+				}
345
+			}
346
+		}
347 347
 
348
-        return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
349
-    }
348
+		return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
349
+	}
350 350
 
351
-    /**
352
-     * Return key into $template_data for template
353
-     *
354
-     * @param \Smarty_Internal_Template $template template object
355
-     *
356
-     * @return string key into $template_data
357
-     */
358
-    private function get_key(Smarty_Internal_Template $template)
359
-    {
360
-        static $_is_stringy = array('string' => true, 'eval' => true);
361
-        // calculate Uid if not already done
362
-        if ($template->source->uid == '') {
363
-            $template->source->filepath;
364
-        }
365
-        $key = $template->source->uid;
366
-        if (isset($this->template_data[ $this->index ][ $key ])) {
367
-            return $key;
368
-        } else {
369
-            if (isset($_is_stringy[ $template->source->type ])) {
370
-                $this->template_data[ $this->index ][ $key ][ 'name' ] =
371
-                    '\'' . substr($template->source->name, 0, 25) . '...\'';
372
-            } else {
373
-                $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
374
-            }
375
-            $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
-            $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
-            $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
-            $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
351
+	/**
352
+	 * Return key into $template_data for template
353
+	 *
354
+	 * @param \Smarty_Internal_Template $template template object
355
+	 *
356
+	 * @return string key into $template_data
357
+	 */
358
+	private function get_key(Smarty_Internal_Template $template)
359
+	{
360
+		static $_is_stringy = array('string' => true, 'eval' => true);
361
+		// calculate Uid if not already done
362
+		if ($template->source->uid == '') {
363
+			$template->source->filepath;
364
+		}
365
+		$key = $template->source->uid;
366
+		if (isset($this->template_data[ $this->index ][ $key ])) {
367
+			return $key;
368
+		} else {
369
+			if (isset($_is_stringy[ $template->source->type ])) {
370
+				$this->template_data[ $this->index ][ $key ][ 'name' ] =
371
+					'\'' . substr($template->source->name, 0, 25) . '...\'';
372
+			} else {
373
+				$this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
374
+			}
375
+			$this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
+			$this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
+			$this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
+			$this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
379 379
 
380
-            return $key;
381
-        }
382
-    }
380
+			return $key;
381
+		}
382
+	}
383 383
 
384
-    /**
385
-     * Ignore template
386
-     *
387
-     * @param \Smarty_Internal_Template $template
388
-     */
389
-    public function ignore(Smarty_Internal_Template $template)
390
-    {
391
-        // calculate Uid if not already done
392
-        if ($template->source->uid == '') {
393
-            $template->source->filepath;
394
-        }
395
-        $this->ignore_uid[ $template->source->uid ] = true;
396
-    }
384
+	/**
385
+	 * Ignore template
386
+	 *
387
+	 * @param \Smarty_Internal_Template $template
388
+	 */
389
+	public function ignore(Smarty_Internal_Template $template)
390
+	{
391
+		// calculate Uid if not already done
392
+		if ($template->source->uid == '') {
393
+			$template->source->filepath;
394
+		}
395
+		$this->ignore_uid[ $template->source->uid ] = true;
396
+	}
397 397
 
398
-    /**
399
-     * handle 'URL' debugging mode
400
-     *
401
-     * @param Smarty $smarty
402
-     */
403
-    public function debugUrl(Smarty $smarty)
404
-    {
405
-        if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
-            $_query_string = $_SERVER[ 'QUERY_STRING' ];
407
-        } else {
408
-            $_query_string = '';
409
-        }
410
-        if (false !== strpos($_query_string, $smarty->smarty_debug_id)) {
411
-            if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) {
412
-                // enable debugging for this browser session
413
-                setcookie('SMARTY_DEBUG', true);
414
-                $smarty->debugging = true;
415
-            } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) {
416
-                // disable debugging for this browser session
417
-                setcookie('SMARTY_DEBUG', false);
418
-                $smarty->debugging = false;
419
-            } else {
420
-                // enable debugging for this page
421
-                $smarty->debugging = true;
422
-            }
423
-        } else {
424
-            if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
425
-                $smarty->debugging = true;
426
-            }
427
-        }
428
-    }
398
+	/**
399
+	 * handle 'URL' debugging mode
400
+	 *
401
+	 * @param Smarty $smarty
402
+	 */
403
+	public function debugUrl(Smarty $smarty)
404
+	{
405
+		if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
+			$_query_string = $_SERVER[ 'QUERY_STRING' ];
407
+		} else {
408
+			$_query_string = '';
409
+		}
410
+		if (false !== strpos($_query_string, $smarty->smarty_debug_id)) {
411
+			if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) {
412
+				// enable debugging for this browser session
413
+				setcookie('SMARTY_DEBUG', true);
414
+				$smarty->debugging = true;
415
+			} elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) {
416
+				// disable debugging for this browser session
417
+				setcookie('SMARTY_DEBUG', false);
418
+				$smarty->debugging = false;
419
+			} else {
420
+				// enable debugging for this page
421
+				$smarty->debugging = true;
422
+			}
423
+		} else {
424
+			if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
425
+				$smarty->debugging = true;
426
+			}
427
+		}
428
+	}
429 429
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
      * @param string                    $varName the name of the config variable
163 163
      * @param bool                      $errorEnable
164 164
      *
165
-     * @return mixed  the value of the config variable
165
+     * @return string|null  the value of the config variable
166 166
      */
167 167
     public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
168 168
     {
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -11,174 +11,174 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_ConfigLoad
13 13
 {
14
-    /**
15
-     * Valid for all objects
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 7;
14
+	/**
15
+	 * Valid for all objects
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 7;
20 20
 
21
-    /**
22
-     * load a config file, optionally load just selected sections
23
-     *
24
-     * @api  Smarty::configLoad()
25
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
26
-     *
27
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
-     * @param  string                                                 $config_file filename
29
-     * @param  mixed                                                  $sections    array of section names, single
30
-     *                                                                             section or null
31
-     *
32
-     * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
33
-     * @throws \SmartyException
34
-     */
35
-    public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
36
-    {
37
-        $this->_loadConfigFile($data, $config_file, $sections, null);
38
-        return $data;
39
-    }
21
+	/**
22
+	 * load a config file, optionally load just selected sections
23
+	 *
24
+	 * @api  Smarty::configLoad()
25
+	 * @link http://www.smarty.net/docs/en/api.config.load.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
+	 * @param  string                                                 $config_file filename
29
+	 * @param  mixed                                                  $sections    array of section names, single
30
+	 *                                                                             section or null
31
+	 *
32
+	 * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
33
+	 * @throws \SmartyException
34
+	 */
35
+	public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
36
+	{
37
+		$this->_loadConfigFile($data, $config_file, $sections, null);
38
+		return $data;
39
+	}
40 40
 
41
-    /**
42
-     * load a config file, optionally load just selected sections
43
-     *
44
-     * @api  Smarty::configLoad()
45
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
46
-     *
47
-     * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
48
-     * @param  string                                                 $config_file filename
49
-     * @param  mixed                                                  $sections    array of section names, single
50
-     *                                                                             section or null
51
-     * @param int                                                     $scope       scope into which config variables
52
-     *                                                                             shall be loaded
53
-     *
54
-     * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
55
-     * @throws \SmartyException
56
-     */
57
-    public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
58
-    {
59
-        /* @var \Smarty $smarty */
60
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
61
-        /* @var \Smarty_Internal_Template $confObj */
62
-        $confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
63
-        $confObj->caching = Smarty::CACHING_OFF;
64
-        $confObj->source = Smarty_Template_Config::load($confObj);
65
-        $confObj->source->config_sections = $sections;
66
-        $confObj->source->scope = $scope;
67
-        $confObj->compiled = Smarty_Template_Compiled::load($confObj);
68
-        $confObj->compiled->render($confObj);
69
-        if ($data->_objType == 2) {
70
-            $data->compiled->file_dependency[ $confObj->source->uid ] =
71
-                array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72
-        }
73
-    }
41
+	/**
42
+	 * load a config file, optionally load just selected sections
43
+	 *
44
+	 * @api  Smarty::configLoad()
45
+	 * @link http://www.smarty.net/docs/en/api.config.load.tpl
46
+	 *
47
+	 * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
48
+	 * @param  string                                                 $config_file filename
49
+	 * @param  mixed                                                  $sections    array of section names, single
50
+	 *                                                                             section or null
51
+	 * @param int                                                     $scope       scope into which config variables
52
+	 *                                                                             shall be loaded
53
+	 *
54
+	 * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
55
+	 * @throws \SmartyException
56
+	 */
57
+	public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
58
+	{
59
+		/* @var \Smarty $smarty */
60
+		$smarty = isset($data->smarty) ? $data->smarty : $data;
61
+		/* @var \Smarty_Internal_Template $confObj */
62
+		$confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
63
+		$confObj->caching = Smarty::CACHING_OFF;
64
+		$confObj->source = Smarty_Template_Config::load($confObj);
65
+		$confObj->source->config_sections = $sections;
66
+		$confObj->source->scope = $scope;
67
+		$confObj->compiled = Smarty_Template_Compiled::load($confObj);
68
+		$confObj->compiled->render($confObj);
69
+		if ($data->_objType == 2) {
70
+			$data->compiled->file_dependency[ $confObj->source->uid ] =
71
+				array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72
+		}
73
+	}
74 74
 
75
-    /**
76
-     * load config variables into template object
77
-     *
78
-     * @param \Smarty_Internal_Template $tpl
79
-     * @param  array                    $new_config_vars
80
-     *
81
-     */
82
-    public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
83
-    {
84
-        $this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars);
85
-        $tagScope = $tpl->source->scope;
86
-        if ($tagScope >= 0) {
87
-            if ($tagScope == Smarty::SCOPE_LOCAL) {
88
-                $this->_updateVarStack($tpl, $new_config_vars);
89
-                $tagScope = 0;
90
-                if (!$tpl->scope) {
91
-                    return;
92
-                }
93
-            }
94
-            if ($tpl->parent->_objType == 2 && ($tagScope || $tpl->parent->scope)) {
95
-                $mergedScope = $tagScope | $tpl->scope;
96
-                if ($mergedScope) {
97
-                    // update scopes
98
-                    foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99
-                        $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
-                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
101
-                            $this->_updateVarStack($tpl, $new_config_vars);
102
-                        }
103
-                    }
104
-                }
105
-            }
106
-        }
107
-    }
75
+	/**
76
+	 * load config variables into template object
77
+	 *
78
+	 * @param \Smarty_Internal_Template $tpl
79
+	 * @param  array                    $new_config_vars
80
+	 *
81
+	 */
82
+	public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
83
+	{
84
+		$this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars);
85
+		$tagScope = $tpl->source->scope;
86
+		if ($tagScope >= 0) {
87
+			if ($tagScope == Smarty::SCOPE_LOCAL) {
88
+				$this->_updateVarStack($tpl, $new_config_vars);
89
+				$tagScope = 0;
90
+				if (!$tpl->scope) {
91
+					return;
92
+				}
93
+			}
94
+			if ($tpl->parent->_objType == 2 && ($tagScope || $tpl->parent->scope)) {
95
+				$mergedScope = $tagScope | $tpl->scope;
96
+				if ($mergedScope) {
97
+					// update scopes
98
+					foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99
+						$this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
+						if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
101
+							$this->_updateVarStack($tpl, $new_config_vars);
102
+						}
103
+					}
104
+				}
105
+			}
106
+		}
107
+	}
108 108
 
109
-    /**
110
-     * Assign all config variables in given scope
111
-     *
112
-     * @param array    $config_vars config variables in scope
113
-     * @param \Smarty_Internal_Template $tpl
114
-     * @param  array                    $new_config_vars loaded config variables
115
-     */
116
-    public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117
-    {
118
-        // copy global config vars
119
-        foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
-            if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
-                $config_vars[ $variable ] = $value;
122
-            } else {
123
-                $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
124
-            }
125
-        }
126
-        // scan sections
127
-        $sections = $tpl->source->config_sections;
128
-        if (!empty($sections)) {
129
-            foreach ((array) $sections as $tpl_section) {
130
-                if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
-                    foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
-                        if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
-                            $config_vars[ $variable ] = $value;
134
-                        } else {
135
-                            $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
136
-                        }
137
-                    }
138
-                }
139
-            }
140
-        }
141
-    }
109
+	/**
110
+	 * Assign all config variables in given scope
111
+	 *
112
+	 * @param array    $config_vars config variables in scope
113
+	 * @param \Smarty_Internal_Template $tpl
114
+	 * @param  array                    $new_config_vars loaded config variables
115
+	 */
116
+	public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117
+	{
118
+		// copy global config vars
119
+		foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
+			if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
+				$config_vars[ $variable ] = $value;
122
+			} else {
123
+				$config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
124
+			}
125
+		}
126
+		// scan sections
127
+		$sections = $tpl->source->config_sections;
128
+		if (!empty($sections)) {
129
+			foreach ((array) $sections as $tpl_section) {
130
+				if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
+					foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
+						if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
+							$config_vars[ $variable ] = $value;
134
+						} else {
135
+							$config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
136
+						}
137
+					}
138
+				}
139
+			}
140
+		}
141
+	}
142 142
 
143
-    /**
144
-     * Update config variables in template local variable stack
145
-     *
146
-     * @param \Smarty_Internal_Template $tpl
147
-     * @param array                     $config_vars
148
-     */
149
-    public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150
-    {
151
-        $i = 0;
152
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
-            $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
-            $i ++;
155
-        }
156
-    }
143
+	/**
144
+	 * Update config variables in template local variable stack
145
+	 *
146
+	 * @param \Smarty_Internal_Template $tpl
147
+	 * @param array                     $config_vars
148
+	 */
149
+	public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150
+	{
151
+		$i = 0;
152
+		while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
+			$this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
+			$i ++;
155
+		}
156
+	}
157 157
 
158
-    /**
159
-     * gets  a config variable value
160
-     *
161
-     * @param \Smarty_Internal_Template $tpl     template object
162
-     * @param string                    $varName the name of the config variable
163
-     * @param bool                      $errorEnable
164
-     *
165
-     * @return mixed  the value of the config variable
166
-     */
167
-    public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
168
-    {
169
-        $_ptr = $tpl;
170
-        while ($_ptr !== null) {
171
-            if (isset($_ptr->config_vars[ $varName ])) {
172
-                // found it, return it
173
-                return $_ptr->config_vars[ $varName ];
174
-            }
175
-            // not found, try at parent
176
-            $_ptr = $_ptr->parent;
177
-        }
178
-        if ($tpl->smarty->error_unassigned && $errorEnable) {
179
-            // force a notice
180
-            $x = $$varName;
181
-        }
182
-        return null;
183
-    }
158
+	/**
159
+	 * gets  a config variable value
160
+	 *
161
+	 * @param \Smarty_Internal_Template $tpl     template object
162
+	 * @param string                    $varName the name of the config variable
163
+	 * @param bool                      $errorEnable
164
+	 *
165
+	 * @return mixed  the value of the config variable
166
+	 */
167
+	public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
168
+	{
169
+		$_ptr = $tpl;
170
+		while ($_ptr !== null) {
171
+			if (isset($_ptr->config_vars[ $varName ])) {
172
+				// found it, return it
173
+				return $_ptr->config_vars[ $varName ];
174
+			}
175
+			// not found, try at parent
176
+			$_ptr = $_ptr->parent;
177
+		}
178
+		if ($tpl->smarty->error_unassigned && $errorEnable) {
179
+			// force a notice
180
+			$x = $$varName;
181
+		}
182
+		return null;
183
+	}
184 184
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $confObj->compiled = Smarty_Template_Compiled::load($confObj);
68 68
         $confObj->compiled->render($confObj);
69 69
         if ($data->_objType == 2) {
70
-            $data->compiled->file_dependency[ $confObj->source->uid ] =
70
+            $data->compiled->file_dependency[$confObj->source->uid] =
71 71
                 array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72 72
         }
73 73
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                     // update scopes
98 98
                     foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99 99
                         $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
-                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
100
+                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache['varStack'])) {
101 101
                             $this->_updateVarStack($tpl, $new_config_vars);
102 102
                         }
103 103
                     }
@@ -116,23 +116,23 @@  discard block
 block discarded – undo
116 116
     public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117 117
     {
118 118
         // copy global config vars
119
-        foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
-            if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
-                $config_vars[ $variable ] = $value;
119
+        foreach ($new_config_vars['vars'] as $variable => $value) {
120
+            if ($tpl->smarty->config_overwrite || !isset($config_vars[$variable])) {
121
+                $config_vars[$variable] = $value;
122 122
             } else {
123
-                $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
123
+                $config_vars[$variable] = array_merge((array) $config_vars[$variable], (array) $value);
124 124
             }
125 125
         }
126 126
         // scan sections
127 127
         $sections = $tpl->source->config_sections;
128 128
         if (!empty($sections)) {
129 129
             foreach ((array) $sections as $tpl_section) {
130
-                if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
-                    foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
-                        if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
-                            $config_vars[ $variable ] = $value;
130
+                if (isset($new_config_vars['sections'][$tpl_section])) {
131
+                    foreach ($new_config_vars['sections'][$tpl_section]['vars'] as $variable => $value) {
132
+                        if ($tpl->smarty->config_overwrite || !isset($config_vars[$variable])) {
133
+                            $config_vars[$variable] = $value;
134 134
                         } else {
135
-                            $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
135
+                            $config_vars[$variable] = array_merge((array) $config_vars[$variable], (array) $value);
136 136
                         }
137 137
                     }
138 138
                 }
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150 150
     {
151 151
         $i = 0;
152
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
-            $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
-            $i ++;
152
+        while (isset($tpl->_cache['varStack'][$i])) {
153
+            $this->_assignConfigVars($tpl->_cache['varStack'][$i]['config'], $tpl, $config_vars);
154
+            $i++;
155 155
         }
156 156
     }
157 157
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $_ptr = $tpl;
170 170
         while ($_ptr !== null) {
171
-            if (isset($_ptr->config_vars[ $varName ])) {
171
+            if (isset($_ptr->config_vars[$varName])) {
172 172
                 // found it, return it
173
-                return $_ptr->config_vars[ $varName ];
173
+                return $_ptr->config_vars[$varName];
174 174
             }
175 175
             // not found, try at parent
176 176
             $_ptr = $_ptr->parent;
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
27 27
      * @param  string                                                 $variable the stream of the variable
28 28
      *
29
-     * @return mixed
29
+     * @return string|null
30 30
      * @throws \SmartyException
31 31
      */
32 32
     public function getStreamVariable(Smarty_Internal_Data $data, $variable)
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_GetStreamVariable
13 13
 {
14
-    /**
15
-     * Valid for all objects
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 7;
14
+	/**
15
+	 * Valid for all objects
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 7;
20 20
 
21
-    /**
22
-     * gets  a stream variable
23
-     *
24
-     * @api Smarty::getStreamVariable()
25
-     *
26
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
27
-     * @param  string                                                 $variable the stream of the variable
28
-     *
29
-     * @return mixed
30
-     * @throws \SmartyException
31
-     */
32
-    public function getStreamVariable(Smarty_Internal_Data $data, $variable)
33
-    {
34
-        $_result = '';
35
-        $fp = fopen($variable, 'r+');
36
-        if ($fp) {
37
-            while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
38
-                $_result .= $current_line;
39
-            }
40
-            fclose($fp);
21
+	/**
22
+	 * gets  a stream variable
23
+	 *
24
+	 * @api Smarty::getStreamVariable()
25
+	 *
26
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
27
+	 * @param  string                                                 $variable the stream of the variable
28
+	 *
29
+	 * @return mixed
30
+	 * @throws \SmartyException
31
+	 */
32
+	public function getStreamVariable(Smarty_Internal_Data $data, $variable)
33
+	{
34
+		$_result = '';
35
+		$fp = fopen($variable, 'r+');
36
+		if ($fp) {
37
+			while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
38
+				$_result .= $current_line;
39
+			}
40
+			fclose($fp);
41 41
 
42
-            return $_result;
43
-        }
44
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
45
-        if ($smarty->error_unassigned) {
46
-            throw new SmartyException('Undefined stream variable "' . $variable . '"');
47
-        } else {
48
-            return null;
49
-        }
50
-    }
42
+			return $_result;
43
+		}
44
+		$smarty = isset($data->smarty) ? $data->smarty : $data;
45
+		if ($smarty->error_unassigned) {
46
+			throw new SmartyException('Undefined stream variable "' . $variable . '"');
47
+		} else {
48
+			return null;
49
+		}
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      * @param  string                                                         $type filter type
23 23
      * @param  string                                                         $name filter name
24 24
      *
25
-     * @return bool
25
+     * @return Smarty_Internal_TemplateBase
26 26
      */
27 27
     public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
28 28
     {
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -11,32 +11,32 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
13 13
 {
14
-    /**
15
-     * load a filter of specified type and name
16
-     *
17
-     * @api  Smarty::unloadFilter()
18
-     *
19
-     * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
20
-     *
21
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
22
-     * @param  string                                                         $type filter type
23
-     * @param  string                                                         $name filter name
24
-     *
25
-     * @return bool
26
-     */
27
-    public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
28
-    {
29
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
30
-        $this->_checkFilterType($type);
31
-        if (isset($smarty->registered_filters[ $type ])) {
32
-            $_filter_name = "smarty_{$type}filter_{$name}";
33
-            if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
34
-                unset ($smarty->registered_filters[ $type ][ $_filter_name ]);
35
-                if (empty($smarty->registered_filters[ $type ])) {
36
-                    unset($smarty->registered_filters[ $type ]);
37
-                }
38
-            }
39
-        }
40
-        return $obj;
41
-    }
14
+	/**
15
+	 * load a filter of specified type and name
16
+	 *
17
+	 * @api  Smarty::unloadFilter()
18
+	 *
19
+	 * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
20
+	 *
21
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
22
+	 * @param  string                                                         $type filter type
23
+	 * @param  string                                                         $name filter name
24
+	 *
25
+	 * @return bool
26
+	 */
27
+	public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
28
+	{
29
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
30
+		$this->_checkFilterType($type);
31
+		if (isset($smarty->registered_filters[ $type ])) {
32
+			$_filter_name = "smarty_{$type}filter_{$name}";
33
+			if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
34
+				unset ($smarty->registered_filters[ $type ][ $_filter_name ]);
35
+				if (empty($smarty->registered_filters[ $type ])) {
36
+					unset($smarty->registered_filters[ $type ]);
37
+				}
38
+			}
39
+		}
40
+		return $obj;
41
+	}
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
     {
29 29
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
30 30
         $this->_checkFilterType($type);
31
-        if (isset($smarty->registered_filters[ $type ])) {
31
+        if (isset($smarty->registered_filters[$type])) {
32 32
             $_filter_name = "smarty_{$type}filter_{$name}";
33
-            if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
34
-                unset ($smarty->registered_filters[ $type ][ $_filter_name ]);
35
-                if (empty($smarty->registered_filters[ $type ])) {
36
-                    unset($smarty->registered_filters[ $type ]);
33
+            if (isset($smarty->registered_filters[$type][$_filter_name])) {
34
+                unset ($smarty->registered_filters[$type][$_filter_name]);
35
+                if (empty($smarty->registered_filters[$type])) {
36
+                    unset($smarty->registered_filters[$type]);
37 37
                 }
38 38
             }
39 39
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_capture.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
      * @param \Smarty_Internal_Template $_template
136 136
      * @param                           $name
137 137
      *
138
-     * @return null
138
+     * @return string|null
139 139
      */
140 140
     public function getBuffer(Smarty_Internal_Template $_template, $name)
141 141
     {
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -9,153 +9,153 @@
 block discarded – undo
9 9
  */
10 10
 class Smarty_Internal_Runtime_Capture
11 11
 {
12
-    /**
13
-     * Flag that this instance  will not be cached
14
-     *
15
-     * @var bool
16
-     */
17
-    public $isPrivateExtension = true;
12
+	/**
13
+	 * Flag that this instance  will not be cached
14
+	 *
15
+	 * @var bool
16
+	 */
17
+	public $isPrivateExtension = true;
18 18
 
19
-    /**
20
-     * Stack of capture parameter
21
-     *
22
-     * @var array
23
-     */
24
-    private $captureStack = array();
19
+	/**
20
+	 * Stack of capture parameter
21
+	 *
22
+	 * @var array
23
+	 */
24
+	private $captureStack = array();
25 25
 
26
-    /**
27
-     * Current open capture sections
28
-     *
29
-     * @var int
30
-     */
31
-    private $captureCount = 0;
26
+	/**
27
+	 * Current open capture sections
28
+	 *
29
+	 * @var int
30
+	 */
31
+	private $captureCount = 0;
32 32
 
33
-    /**
34
-     * Count stack
35
-     *
36
-     * @var int[]
37
-     */
38
-    private $countStack = array();
33
+	/**
34
+	 * Count stack
35
+	 *
36
+	 * @var int[]
37
+	 */
38
+	private $countStack = array();
39 39
 
40
-    /**
41
-     * Named buffer
42
-     *
43
-     * @var string[]
44
-     */
45
-    private $namedBuffer = array();
40
+	/**
41
+	 * Named buffer
42
+	 *
43
+	 * @var string[]
44
+	 */
45
+	private $namedBuffer = array();
46 46
 
47
-    /**
48
-     * Flag if callbacks are registered
49
-     *
50
-     * @var bool
51
-     */
52
-    private $isRegistered = false;
47
+	/**
48
+	 * Flag if callbacks are registered
49
+	 *
50
+	 * @var bool
51
+	 */
52
+	private $isRegistered = false;
53 53
 
54
-    /**
55
-     * Open capture section
56
-     *
57
-     * @param \Smarty_Internal_Template $_template
58
-     * @param string                    $buffer capture name
59
-     * @param string                    $assign variable name
60
-     * @param string                    $append variable name
61
-     */
62
-    public function open(Smarty_Internal_Template $_template, $buffer, $assign, $append)
63
-    {
64
-        if (!$this->isRegistered) {
65
-            $this->register($_template);
66
-        }
67
-        $this->captureStack[] = array($buffer, $assign, $append);
68
-        $this->captureCount ++;
69
-        ob_start();
70
-    }
54
+	/**
55
+	 * Open capture section
56
+	 *
57
+	 * @param \Smarty_Internal_Template $_template
58
+	 * @param string                    $buffer capture name
59
+	 * @param string                    $assign variable name
60
+	 * @param string                    $append variable name
61
+	 */
62
+	public function open(Smarty_Internal_Template $_template, $buffer, $assign, $append)
63
+	{
64
+		if (!$this->isRegistered) {
65
+			$this->register($_template);
66
+		}
67
+		$this->captureStack[] = array($buffer, $assign, $append);
68
+		$this->captureCount ++;
69
+		ob_start();
70
+	}
71 71
 
72
-    /**
73
-     * Register callbacks in template class
74
-     *
75
-     * @param \Smarty_Internal_Template $_template
76
-     */
77
-    private function register(Smarty_Internal_Template $_template)
78
-    {
79
-        $_template->startRenderCallbacks[] = array($this, 'startRender');
80
-        $_template->endRenderCallbacks[] = array($this, 'endRender');
81
-        $this->startRender($_template);
82
-        $this->isRegistered = true;
83
-    }
72
+	/**
73
+	 * Register callbacks in template class
74
+	 *
75
+	 * @param \Smarty_Internal_Template $_template
76
+	 */
77
+	private function register(Smarty_Internal_Template $_template)
78
+	{
79
+		$_template->startRenderCallbacks[] = array($this, 'startRender');
80
+		$_template->endRenderCallbacks[] = array($this, 'endRender');
81
+		$this->startRender($_template);
82
+		$this->isRegistered = true;
83
+	}
84 84
 
85
-    /**
86
-     * Start render callback
87
-     *
88
-     * @param \Smarty_Internal_Template $_template
89
-     */
90
-    public function startRender(Smarty_Internal_Template $_template)
91
-    {
92
-        $this->countStack[] = $this->captureCount;
93
-        $this->captureCount = 0;
94
-    }
85
+	/**
86
+	 * Start render callback
87
+	 *
88
+	 * @param \Smarty_Internal_Template $_template
89
+	 */
90
+	public function startRender(Smarty_Internal_Template $_template)
91
+	{
92
+		$this->countStack[] = $this->captureCount;
93
+		$this->captureCount = 0;
94
+	}
95 95
 
96
-    /**
97
-     * Close capture section
98
-     *
99
-     * @param \Smarty_Internal_Template $_template
100
-     *
101
-     * @throws \SmartyException
102
-     */
103
-    public function close(Smarty_Internal_Template $_template)
104
-    {
105
-        if ($this->captureCount) {
106
-            list($buffer, $assign, $append) = array_pop($this->captureStack);
107
-            $this->captureCount --;
108
-            if (isset($assign)) {
109
-                $_template->assign($assign, ob_get_contents());
110
-            }
111
-            if (isset($append)) {
112
-                $_template->append($append, ob_get_contents());
113
-            }
114
-            $this->namedBuffer[ $buffer ] = ob_get_clean();
115
-        } else {
116
-            $this->error($_template);
117
-        }
118
-    }
96
+	/**
97
+	 * Close capture section
98
+	 *
99
+	 * @param \Smarty_Internal_Template $_template
100
+	 *
101
+	 * @throws \SmartyException
102
+	 */
103
+	public function close(Smarty_Internal_Template $_template)
104
+	{
105
+		if ($this->captureCount) {
106
+			list($buffer, $assign, $append) = array_pop($this->captureStack);
107
+			$this->captureCount --;
108
+			if (isset($assign)) {
109
+				$_template->assign($assign, ob_get_contents());
110
+			}
111
+			if (isset($append)) {
112
+				$_template->append($append, ob_get_contents());
113
+			}
114
+			$this->namedBuffer[ $buffer ] = ob_get_clean();
115
+		} else {
116
+			$this->error($_template);
117
+		}
118
+	}
119 119
 
120
-    /**
121
-     * Error exception on not matching {capture}{/capture}
122
-     *
123
-     * @param \Smarty_Internal_Template $_template
124
-     *
125
-     * @throws \SmartyException
126
-     */
127
-    public function error(Smarty_Internal_Template $_template)
128
-    {
129
-        throw new SmartyException("Not matching {capture}{/capture} in \"{$_template->template_resource}\"");
130
-    }
120
+	/**
121
+	 * Error exception on not matching {capture}{/capture}
122
+	 *
123
+	 * @param \Smarty_Internal_Template $_template
124
+	 *
125
+	 * @throws \SmartyException
126
+	 */
127
+	public function error(Smarty_Internal_Template $_template)
128
+	{
129
+		throw new SmartyException("Not matching {capture}{/capture} in \"{$_template->template_resource}\"");
130
+	}
131 131
 
132
-    /**
133
-     * Return content of named capture buffer
134
-     *
135
-     * @param \Smarty_Internal_Template $_template
136
-     * @param                           $name
137
-     *
138
-     * @return null
139
-     */
140
-    public function getBuffer(Smarty_Internal_Template $_template, $name)
141
-    {
142
-        return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
143
-    }
132
+	/**
133
+	 * Return content of named capture buffer
134
+	 *
135
+	 * @param \Smarty_Internal_Template $_template
136
+	 * @param                           $name
137
+	 *
138
+	 * @return null
139
+	 */
140
+	public function getBuffer(Smarty_Internal_Template $_template, $name)
141
+	{
142
+		return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
143
+	}
144 144
 
145
-    /**
146
-     * End render callback
147
-     *
148
-     * @param \Smarty_Internal_Template $_template
149
-     *
150
-     * @throws \SmartyException
151
-     */
152
-    public function endRender(Smarty_Internal_Template $_template)
153
-    {
154
-        if ($this->captureCount) {
155
-            $this->error($_template);
156
-        } else {
157
-            $this->captureCount = array_pop($this->countStack);
158
-        }
159
-    }
145
+	/**
146
+	 * End render callback
147
+	 *
148
+	 * @param \Smarty_Internal_Template $_template
149
+	 *
150
+	 * @throws \SmartyException
151
+	 */
152
+	public function endRender(Smarty_Internal_Template $_template)
153
+	{
154
+		if ($this->captureCount) {
155
+			$this->error($_template);
156
+		} else {
157
+			$this->captureCount = array_pop($this->countStack);
158
+		}
159
+	}
160 160
 
161 161
 }
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             $this->register($_template);
66 66
         }
67 67
         $this->captureStack[] = array($buffer, $assign, $append);
68
-        $this->captureCount ++;
68
+        $this->captureCount++;
69 69
         ob_start();
70 70
     }
71 71
 
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
     {
105 105
         if ($this->captureCount) {
106 106
             list($buffer, $assign, $append) = array_pop($this->captureStack);
107
-            $this->captureCount --;
107
+            $this->captureCount--;
108 108
             if (isset($assign)) {
109 109
                 $_template->assign($assign, ob_get_contents());
110 110
             }
111 111
             if (isset($append)) {
112 112
                 $_template->append($append, ob_get_contents());
113 113
             }
114
-            $this->namedBuffer[ $buffer ] = ob_get_clean();
114
+            $this->namedBuffer[$buffer] = ob_get_clean();
115 115
         } else {
116 116
             $this->error($_template);
117 117
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function getBuffer(Smarty_Internal_Template $_template, $name)
141 141
     {
142
-        return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
142
+        return isset($this->namedBuffer[$name]) ? $this->namedBuffer[$name] : null;
143 143
     }
144 144
 
145 145
     /**
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
      *
77 77
      * @param \Smarty_Template_Cached   $cached
78 78
      * @param \Smarty_Internal_Template $_template
79
-     * @param                           $no_output_filter
79
+     * @param                           boolean $no_output_filter
80 80
      *
81 81
      * @throws \Exception
82 82
      */
Please login to merge, or discard this patch.
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -10,156 +10,156 @@
 block discarded – undo
10 10
  **/
11 11
 class Smarty_Internal_Runtime_UpdateCache
12 12
 {
13
-    /**
14
-     * check client side cache
15
-     *
16
-     * @param \Smarty_Template_Cached  $cached
17
-     * @param Smarty_Internal_Template $_template
18
-     * @param  string                  $content
19
-     */
20
-    public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
21
-    {
22
-    }
13
+	/**
14
+	 * check client side cache
15
+	 *
16
+	 * @param \Smarty_Template_Cached  $cached
17
+	 * @param Smarty_Internal_Template $_template
18
+	 * @param  string                  $content
19
+	 */
20
+	public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
21
+	{
22
+	}
23 23
 
24
-    /**
25
-     * Sanitize content and write it to cache resource
26
-     *
27
-     * @param \Smarty_Template_Cached  $cached
28
-     * @param Smarty_Internal_Template $_template
29
-     * @param bool                     $no_output_filter
30
-     *
31
-     * @throws \SmartyException
32
-     */
33
-    public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
34
-                                      $no_output_filter)
35
-    {
36
-        $content = ob_get_clean();
37
-        unset($cached->hashes[ $_template->compiled->nocache_hash ]);
38
-        if (!empty($cached->hashes)) {
39
-            $hash_array = array();
40
-            foreach ($cached->hashes as $hash => $foo) {
41
-                $hash_array[] = "/{$hash}/";
42
-            }
43
-            $content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
44
-        }
45
-        $_template->cached->has_nocache_code = false;
46
-        // get text between non-cached items
47
-        $cache_split =
48
-            preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
49
-                       $content);
50
-        // get non-cached items
51
-        preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
52
-                       $content, $cache_parts);
53
-        $content = '';
54
-        // loop over items, stitch back together
55
-        foreach ($cache_split as $curr_idx => $curr_split) {
56
-            // escape PHP tags in template content
57
-            $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
58
-                                     "<?php echo '\$1'; ?>\n", $curr_split);
59
-            if (isset($cache_parts[ 0 ][ $curr_idx ])) {
60
-                $_template->cached->has_nocache_code = true;
61
-                $content .= $cache_parts[ 1 ][ $curr_idx ];
62
-            }
63
-        }
64
-        if (!$no_output_filter && !$_template->cached->has_nocache_code &&
65
-            (isset($_template->smarty->autoload_filters[ 'output' ]) ||
66
-             isset($_template->smarty->registered_filters[ 'output' ]))
67
-        ) {
68
-            $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
69
-        }
70
-        // write cache file content
71
-        $this->writeCachedContent($cached, $_template, $content);
72
-    }
24
+	/**
25
+	 * Sanitize content and write it to cache resource
26
+	 *
27
+	 * @param \Smarty_Template_Cached  $cached
28
+	 * @param Smarty_Internal_Template $_template
29
+	 * @param bool                     $no_output_filter
30
+	 *
31
+	 * @throws \SmartyException
32
+	 */
33
+	public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
34
+									  $no_output_filter)
35
+	{
36
+		$content = ob_get_clean();
37
+		unset($cached->hashes[ $_template->compiled->nocache_hash ]);
38
+		if (!empty($cached->hashes)) {
39
+			$hash_array = array();
40
+			foreach ($cached->hashes as $hash => $foo) {
41
+				$hash_array[] = "/{$hash}/";
42
+			}
43
+			$content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
44
+		}
45
+		$_template->cached->has_nocache_code = false;
46
+		// get text between non-cached items
47
+		$cache_split =
48
+			preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
49
+					   $content);
50
+		// get non-cached items
51
+		preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
52
+					   $content, $cache_parts);
53
+		$content = '';
54
+		// loop over items, stitch back together
55
+		foreach ($cache_split as $curr_idx => $curr_split) {
56
+			// escape PHP tags in template content
57
+			$content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
58
+									 "<?php echo '\$1'; ?>\n", $curr_split);
59
+			if (isset($cache_parts[ 0 ][ $curr_idx ])) {
60
+				$_template->cached->has_nocache_code = true;
61
+				$content .= $cache_parts[ 1 ][ $curr_idx ];
62
+			}
63
+		}
64
+		if (!$no_output_filter && !$_template->cached->has_nocache_code &&
65
+			(isset($_template->smarty->autoload_filters[ 'output' ]) ||
66
+			 isset($_template->smarty->registered_filters[ 'output' ]))
67
+		) {
68
+			$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
69
+		}
70
+		// write cache file content
71
+		$this->writeCachedContent($cached, $_template, $content);
72
+	}
73 73
 
74
-    /**
75
-     * Cache was invalid , so render from compiled and write to cache
76
-     *
77
-     * @param \Smarty_Template_Cached   $cached
78
-     * @param \Smarty_Internal_Template $_template
79
-     * @param                           $no_output_filter
80
-     *
81
-     * @throws \Exception
82
-     */
83
-    public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
84
-    {
85
-        ob_start();
86
-        if (!isset($_template->compiled)) {
87
-            $_template->loadCompiled();
88
-        }
89
-        $_template->compiled->render($_template);
90
-        if ($_template->smarty->debugging) {
91
-            $_template->smarty->_debug->start_cache($_template);
92
-        }
93
-        $this->removeNoCacheHash($cached, $_template, $no_output_filter);
94
-        $compile_check = $_template->smarty->compile_check;
95
-        $_template->smarty->compile_check = false;
96
-        if (isset($_template->parent) && $_template->parent->_objType == 2) {
97
-            $_template->compiled->unifunc = $_template->parent->compiled->unifunc;
98
-        }
99
-        if (!$_template->cached->processed) {
100
-            $_template->cached->process($_template, true);
101
-        }
102
-        $_template->smarty->compile_check = $compile_check;
103
-        $cached->getRenderedTemplateCode($_template);
104
-        if ($_template->smarty->debugging) {
105
-            $_template->smarty->_debug->end_cache($_template);
106
-        }
107
-    }
74
+	/**
75
+	 * Cache was invalid , so render from compiled and write to cache
76
+	 *
77
+	 * @param \Smarty_Template_Cached   $cached
78
+	 * @param \Smarty_Internal_Template $_template
79
+	 * @param                           $no_output_filter
80
+	 *
81
+	 * @throws \Exception
82
+	 */
83
+	public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
84
+	{
85
+		ob_start();
86
+		if (!isset($_template->compiled)) {
87
+			$_template->loadCompiled();
88
+		}
89
+		$_template->compiled->render($_template);
90
+		if ($_template->smarty->debugging) {
91
+			$_template->smarty->_debug->start_cache($_template);
92
+		}
93
+		$this->removeNoCacheHash($cached, $_template, $no_output_filter);
94
+		$compile_check = $_template->smarty->compile_check;
95
+		$_template->smarty->compile_check = false;
96
+		if (isset($_template->parent) && $_template->parent->_objType == 2) {
97
+			$_template->compiled->unifunc = $_template->parent->compiled->unifunc;
98
+		}
99
+		if (!$_template->cached->processed) {
100
+			$_template->cached->process($_template, true);
101
+		}
102
+		$_template->smarty->compile_check = $compile_check;
103
+		$cached->getRenderedTemplateCode($_template);
104
+		if ($_template->smarty->debugging) {
105
+			$_template->smarty->_debug->end_cache($_template);
106
+		}
107
+	}
108 108
 
109
-    /**
110
-     * Writes the content to cache resource
111
-     *
112
-     * @param \Smarty_Template_Cached  $cached
113
-     * @param Smarty_Internal_Template $_template
114
-     * @param string                   $content
115
-     *
116
-     * @return bool
117
-     */
118
-    public function writeCachedContent(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
119
-    {
120
-        if ($_template->source->handler->recompiled || !($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
121
-                                                         $_template->caching == Smarty::CACHING_LIFETIME_SAVED)
122
-        ) {
123
-            // don't write cache file
124
-            return false;
125
-        }
126
-        $content = $_template->smarty->ext->_codeFrame->create($_template, $content, '', true);
127
-        return $this->write($cached, $_template, $content);
128
-    }
109
+	/**
110
+	 * Writes the content to cache resource
111
+	 *
112
+	 * @param \Smarty_Template_Cached  $cached
113
+	 * @param Smarty_Internal_Template $_template
114
+	 * @param string                   $content
115
+	 *
116
+	 * @return bool
117
+	 */
118
+	public function writeCachedContent(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
119
+	{
120
+		if ($_template->source->handler->recompiled || !($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
121
+														 $_template->caching == Smarty::CACHING_LIFETIME_SAVED)
122
+		) {
123
+			// don't write cache file
124
+			return false;
125
+		}
126
+		$content = $_template->smarty->ext->_codeFrame->create($_template, $content, '', true);
127
+		return $this->write($cached, $_template, $content);
128
+	}
129 129
 
130
-    /**
131
-     * Write this cache object to handler
132
-     *
133
-     * @param \Smarty_Template_Cached  $cached
134
-     * @param Smarty_Internal_Template $_template template object
135
-     * @param string                   $content   content to cache
136
-     *
137
-     * @return bool success
138
-     */
139
-    public function write(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
140
-    {
141
-        if (!$_template->source->handler->recompiled) {
142
-            if ($cached->handler->writeCachedContent($_template, $content)) {
143
-                $cached->content = null;
144
-                $cached->timestamp = time();
145
-                $cached->exists = true;
146
-                $cached->valid = true;
147
-                $cached->cache_lifetime = $_template->cache_lifetime;
148
-                $cached->processed = false;
149
-                if ($_template->smarty->cache_locking) {
150
-                    $cached->handler->releaseLock($_template->smarty, $cached);
151
-                }
130
+	/**
131
+	 * Write this cache object to handler
132
+	 *
133
+	 * @param \Smarty_Template_Cached  $cached
134
+	 * @param Smarty_Internal_Template $_template template object
135
+	 * @param string                   $content   content to cache
136
+	 *
137
+	 * @return bool success
138
+	 */
139
+	public function write(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
140
+	{
141
+		if (!$_template->source->handler->recompiled) {
142
+			if ($cached->handler->writeCachedContent($_template, $content)) {
143
+				$cached->content = null;
144
+				$cached->timestamp = time();
145
+				$cached->exists = true;
146
+				$cached->valid = true;
147
+				$cached->cache_lifetime = $_template->cache_lifetime;
148
+				$cached->processed = false;
149
+				if ($_template->smarty->cache_locking) {
150
+					$cached->handler->releaseLock($_template->smarty, $cached);
151
+				}
152 152
 
153
-                return true;
154
-            }
155
-            $cached->content = null;
156
-            $cached->timestamp = false;
157
-            $cached->exists = false;
158
-            $cached->valid = false;
159
-            $cached->processed = false;
160
-        }
153
+				return true;
154
+			}
155
+			$cached->content = null;
156
+			$cached->timestamp = false;
157
+			$cached->exists = false;
158
+			$cached->valid = false;
159
+			$cached->processed = false;
160
+		}
161 161
 
162
-        return false;
163
-    }
162
+		return false;
163
+	}
164 164
 
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                                       $no_output_filter)
35 35
     {
36 36
         $content = ob_get_clean();
37
-        unset($cached->hashes[ $_template->compiled->nocache_hash ]);
37
+        unset($cached->hashes[$_template->compiled->nocache_hash]);
38 38
         if (!empty($cached->hashes)) {
39 39
             $hash_array = array();
40 40
             foreach ($cached->hashes as $hash => $foo) {
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
             // escape PHP tags in template content
57 57
             $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
58 58
                                      "<?php echo '\$1'; ?>\n", $curr_split);
59
-            if (isset($cache_parts[ 0 ][ $curr_idx ])) {
59
+            if (isset($cache_parts[0][$curr_idx])) {
60 60
                 $_template->cached->has_nocache_code = true;
61
-                $content .= $cache_parts[ 1 ][ $curr_idx ];
61
+                $content .= $cache_parts[1][$curr_idx];
62 62
             }
63 63
         }
64 64
         if (!$no_output_filter && !$_template->cached->has_nocache_code &&
65
-            (isset($_template->smarty->autoload_filters[ 'output' ]) ||
66
-             isset($_template->smarty->registered_filters[ 'output' ]))
65
+            (isset($_template->smarty->autoload_filters['output']) ||
66
+             isset($_template->smarty->registered_filters['output']))
67 67
         ) {
68 68
             $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
69 69
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
      * @param  mixed $_content template source
80 80
      * @param bool   $isTemplateSource
81 81
      *
82
-     * @return bool true if compiling succeeded, false if it failed
82
+     * @return string true if compiling succeeded, false if it failed
83 83
      * @throws \SmartyCompilerException
84 84
      */
85 85
     protected function doCompile($_content, $isTemplateSource = false)
Please login to merge, or discard this patch.
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -16,155 +16,155 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase
18 18
 {
19
-    /**
20
-     * Lexer class name
21
-     *
22
-     * @var string
23
-     */
24
-    public $lexer_class;
19
+	/**
20
+	 * Lexer class name
21
+	 *
22
+	 * @var string
23
+	 */
24
+	public $lexer_class;
25 25
 
26
-    /**
27
-     * Parser class name
28
-     *
29
-     * @var string
30
-     */
31
-    public $parser_class;
26
+	/**
27
+	 * Parser class name
28
+	 *
29
+	 * @var string
30
+	 */
31
+	public $parser_class;
32 32
 
33
-    /**
34
-     * array of vars which can be compiled in local scope
35
-     *
36
-     * @var array
37
-     */
38
-    public $local_var = array();
33
+	/**
34
+	 * array of vars which can be compiled in local scope
35
+	 *
36
+	 * @var array
37
+	 */
38
+	public $local_var = array();
39 39
 
40
-    /**
41
-     * array of callbacks called when the normal compile process of template is finished
42
-     *
43
-     * @var array
44
-     */
45
-    public $postCompileCallbacks = array();
40
+	/**
41
+	 * array of callbacks called when the normal compile process of template is finished
42
+	 *
43
+	 * @var array
44
+	 */
45
+	public $postCompileCallbacks = array();
46 46
 
47
-    /**
48
-     * prefix code
49
-     *
50
-     * @var string
51
-     */
52
-    public $prefixCompiledCode = '';
47
+	/**
48
+	 * prefix code
49
+	 *
50
+	 * @var string
51
+	 */
52
+	public $prefixCompiledCode = '';
53 53
 
54
-    /**
55
-     * postfix code
56
-     *
57
-     * @var string
58
-     */
59
-    public $postfixCompiledCode = '';
54
+	/**
55
+	 * postfix code
56
+	 *
57
+	 * @var string
58
+	 */
59
+	public $postfixCompiledCode = '';
60 60
 
61
-    /**
62
-     * Initialize compiler
63
-     *
64
-     * @param string $lexer_class  class name
65
-     * @param string $parser_class class name
66
-     * @param Smarty $smarty       global instance
67
-     */
68
-    public function __construct($lexer_class, $parser_class, Smarty $smarty)
69
-    {
70
-        parent::__construct($smarty);
71
-        // get required plugins
72
-        $this->lexer_class = $lexer_class;
73
-        $this->parser_class = $parser_class;
74
-    }
61
+	/**
62
+	 * Initialize compiler
63
+	 *
64
+	 * @param string $lexer_class  class name
65
+	 * @param string $parser_class class name
66
+	 * @param Smarty $smarty       global instance
67
+	 */
68
+	public function __construct($lexer_class, $parser_class, Smarty $smarty)
69
+	{
70
+		parent::__construct($smarty);
71
+		// get required plugins
72
+		$this->lexer_class = $lexer_class;
73
+		$this->parser_class = $parser_class;
74
+	}
75 75
 
76
-    /**
77
-     * method to compile a Smarty template
78
-     *
79
-     * @param  mixed $_content template source
80
-     * @param bool   $isTemplateSource
81
-     *
82
-     * @return bool true if compiling succeeded, false if it failed
83
-     * @throws \SmartyCompilerException
84
-     */
85
-    protected function doCompile($_content, $isTemplateSource = false)
86
-    {
87
-        /* here is where the compiling takes place. Smarty
76
+	/**
77
+	 * method to compile a Smarty template
78
+	 *
79
+	 * @param  mixed $_content template source
80
+	 * @param bool   $isTemplateSource
81
+	 *
82
+	 * @return bool true if compiling succeeded, false if it failed
83
+	 * @throws \SmartyCompilerException
84
+	 */
85
+	protected function doCompile($_content, $isTemplateSource = false)
86
+	{
87
+		/* here is where the compiling takes place. Smarty
88 88
           tags in the templates are replaces with PHP code,
89 89
           then written to compiled files. */
90
-        // init the lexer/parser to compile the template
91
-        $this->parser =
92
-            new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $_content), $this),
93
-                                    $this);
94
-        if ($isTemplateSource && $this->template->caching) {
95
-            $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
96
-        }
97
-        if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
98
-            $mbEncoding = mb_internal_encoding();
99
-            mb_internal_encoding('ASCII');
100
-        } else {
101
-            $mbEncoding = null;
102
-        }
90
+		// init the lexer/parser to compile the template
91
+		$this->parser =
92
+			new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $_content), $this),
93
+									$this);
94
+		if ($isTemplateSource && $this->template->caching) {
95
+			$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
96
+		}
97
+		if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
98
+			$mbEncoding = mb_internal_encoding();
99
+			mb_internal_encoding('ASCII');
100
+		} else {
101
+			$mbEncoding = null;
102
+		}
103 103
 
104
-        if ($this->smarty->_parserdebug) {
105
-            $this->parser->PrintTrace();
106
-            $this->parser->lex->PrintTrace();
107
-        }
108
-        // get tokens from lexer and parse them
109
-        while ($this->parser->lex->yylex()) {
110
-            if ($this->smarty->_parserdebug) {
111
-                echo "<pre>Line {$this->parser->lex->line} Parsing  {$this->parser->yyTokenName[$this->parser->lex->token]} Token " .
112
-                     htmlentities($this->parser->lex->value) . "</pre>";
113
-            }
114
-            $this->parser->doParse($this->parser->lex->token, $this->parser->lex->value);
115
-        }
104
+		if ($this->smarty->_parserdebug) {
105
+			$this->parser->PrintTrace();
106
+			$this->parser->lex->PrintTrace();
107
+		}
108
+		// get tokens from lexer and parse them
109
+		while ($this->parser->lex->yylex()) {
110
+			if ($this->smarty->_parserdebug) {
111
+				echo "<pre>Line {$this->parser->lex->line} Parsing  {$this->parser->yyTokenName[$this->parser->lex->token]} Token " .
112
+					 htmlentities($this->parser->lex->value) . "</pre>";
113
+			}
114
+			$this->parser->doParse($this->parser->lex->token, $this->parser->lex->value);
115
+		}
116 116
 
117
-        // finish parsing process
118
-        $this->parser->doParse(0, 0);
119
-        if ($mbEncoding) {
120
-            mb_internal_encoding($mbEncoding);
121
-        }
122
-        // check for unclosed tags
123
-        if (count($this->_tag_stack) > 0) {
124
-            // get stacked info
125
-            list($openTag, $_data) = array_pop($this->_tag_stack);
126
-            $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag .
127
-                                          "{$this->smarty->right_delimiter} tag");
128
-        }
129
-        // call post compile callbacks
130
-        foreach ($this->postCompileCallbacks as $cb) {
131
-            $parameter = $cb;
132
-            $parameter[ 0 ] = $this;
133
-            call_user_func_array($cb[ 0 ], $parameter);
134
-        }
135
-        // return compiled code
136
-        return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
137
-    }
117
+		// finish parsing process
118
+		$this->parser->doParse(0, 0);
119
+		if ($mbEncoding) {
120
+			mb_internal_encoding($mbEncoding);
121
+		}
122
+		// check for unclosed tags
123
+		if (count($this->_tag_stack) > 0) {
124
+			// get stacked info
125
+			list($openTag, $_data) = array_pop($this->_tag_stack);
126
+			$this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag .
127
+										  "{$this->smarty->right_delimiter} tag");
128
+		}
129
+		// call post compile callbacks
130
+		foreach ($this->postCompileCallbacks as $cb) {
131
+			$parameter = $cb;
132
+			$parameter[ 0 ] = $this;
133
+			call_user_func_array($cb[ 0 ], $parameter);
134
+		}
135
+		// return compiled code
136
+		return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
137
+	}
138 138
 
139
-    /**
140
-     * Register a post compile callback
141
-     * - when the callback is called after template compiling the compiler object will be inserted as first parameter
142
-     *
143
-     * @param callback $callback
144
-     * @param array    $parameter optional parameter array
145
-     * @param string   $key       optional key for callback
146
-     * @param bool     $replace   if true replace existing keyed callback
147
-     *
148
-     */
149
-    public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
150
-    {
151
-        array_unshift($parameter, $callback);
152
-        if (isset($key)) {
153
-            if ($replace || !isset($this->postCompileCallbacks[ $key ])) {
154
-                $this->postCompileCallbacks[ $key ] = $parameter;
155
-            }
156
-        } else {
157
-            $this->postCompileCallbacks[] = $parameter;
158
-        }
159
-    }
139
+	/**
140
+	 * Register a post compile callback
141
+	 * - when the callback is called after template compiling the compiler object will be inserted as first parameter
142
+	 *
143
+	 * @param callback $callback
144
+	 * @param array    $parameter optional parameter array
145
+	 * @param string   $key       optional key for callback
146
+	 * @param bool     $replace   if true replace existing keyed callback
147
+	 *
148
+	 */
149
+	public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
150
+	{
151
+		array_unshift($parameter, $callback);
152
+		if (isset($key)) {
153
+			if ($replace || !isset($this->postCompileCallbacks[ $key ])) {
154
+				$this->postCompileCallbacks[ $key ] = $parameter;
155
+			}
156
+		} else {
157
+			$this->postCompileCallbacks[] = $parameter;
158
+		}
159
+	}
160 160
 
161
-    /**
162
-     * Remove a post compile callback
163
-     *
164
-     * @param string $key callback key
165
-     */
166
-    public function unregisterPostCompileCallback($key)
167
-    {
168
-        unset($this->postCompileCallbacks[ $key ]);
169
-    }
161
+	/**
162
+	 * Remove a post compile callback
163
+	 *
164
+	 * @param string $key callback key
165
+	 */
166
+	public function unregisterPostCompileCallback($key)
167
+	{
168
+		unset($this->postCompileCallbacks[ $key ]);
169
+	}
170 170
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
         // call post compile callbacks
130 130
         foreach ($this->postCompileCallbacks as $cb) {
131 131
             $parameter = $cb;
132
-            $parameter[ 0 ] = $this;
133
-            call_user_func_array($cb[ 0 ], $parameter);
132
+            $parameter[0] = $this;
133
+            call_user_func_array($cb[0], $parameter);
134 134
         }
135 135
         // return compiled code
136 136
         return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
     {
151 151
         array_unshift($parameter, $callback);
152 152
         if (isset($key)) {
153
-            if ($replace || !isset($this->postCompileCallbacks[ $key ])) {
154
-                $this->postCompileCallbacks[ $key ] = $parameter;
153
+            if ($replace || !isset($this->postCompileCallbacks[$key])) {
154
+                $this->postCompileCallbacks[$key] = $parameter;
155 155
             }
156 156
         } else {
157 157
             $this->postCompileCallbacks[] = $parameter;
@@ -165,6 +165,6 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function unregisterPostCompileCallback($key)
167 167
     {
168
-        unset($this->postCompileCallbacks[ $key ]);
168
+        unset($this->postCompileCallbacks[$key]);
169 169
     }
170 170
 }
Please login to merge, or discard this patch.