Completed
Push — developer ( e7ef61...437bc9 )
by Błażej
353:55 queued 313:46
created
libraries/Smarty/libs/sysplugins/smarty_internal_block.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,82 +9,82 @@
 block discarded – undo
9 9
  */
10 10
 class Smarty_Internal_Block
11 11
 {
12
-    /**
13
-     * Block name
14
-     *
15
-     * @var string
16
-     */
17
-    public $name = '';
12
+	/**
13
+	 * Block name
14
+	 *
15
+	 * @var string
16
+	 */
17
+	public $name = '';
18 18
 
19
-    /**
20
-     * Hide attribute
21
-     *
22
-     * @var bool
23
-     */
24
-    public $hide = false;
19
+	/**
20
+	 * Hide attribute
21
+	 *
22
+	 * @var bool
23
+	 */
24
+	public $hide = false;
25 25
 
26
-    /**
27
-     * Append attribute
28
-     *
29
-     * @var bool
30
-     */
31
-    public $append = false;
26
+	/**
27
+	 * Append attribute
28
+	 *
29
+	 * @var bool
30
+	 */
31
+	public $append = false;
32 32
 
33
-    /**
34
-     * prepend attribute
35
-     *
36
-     * @var bool
37
-     */
38
-    public $prepend = false;
33
+	/**
34
+	 * prepend attribute
35
+	 *
36
+	 * @var bool
37
+	 */
38
+	public $prepend = false;
39 39
 
40
-    /**
41
-     * Block calls {$smarty.block.child}
42
-     *
43
-     * @var bool
44
-     */
45
-    public $callsChild = false;
40
+	/**
41
+	 * Block calls {$smarty.block.child}
42
+	 *
43
+	 * @var bool
44
+	 */
45
+	public $callsChild = false;
46 46
 
47
-    /**
48
-     * Inheritance child block
49
-     *
50
-     * @var Smarty_Internal_Block|null
51
-     */
52
-    public $child = null;
47
+	/**
48
+	 * Inheritance child block
49
+	 *
50
+	 * @var Smarty_Internal_Block|null
51
+	 */
52
+	public $child = null;
53 53
 
54
-    /**
55
-     * Inheritance calling parent block
56
-     *
57
-     * @var Smarty_Internal_Block|null
58
-     */
59
-    public $parent = null;
54
+	/**
55
+	 * Inheritance calling parent block
56
+	 *
57
+	 * @var Smarty_Internal_Block|null
58
+	 */
59
+	public $parent = null;
60 60
 
61
-    /**
62
-     * Inheritance Template index
63
-     *
64
-     * @var int
65
-     */
66
-    public $tplIndex = 0;
61
+	/**
62
+	 * Inheritance Template index
63
+	 *
64
+	 * @var int
65
+	 */
66
+	public $tplIndex = 0;
67 67
 
68
-    /**
69
-     * Smarty_Internal_Block constructor.
70
-     * - if outer level {block} of child template ($state == 1) save it as child root block
71
-     * - otherwise process inheritance and render
72
-     *
73
-     * @param string   $name     block name
74
-     * @param int|null $tplIndex index of outer level {block} if nested
75
-     */
76
-    public function __construct($name, $tplIndex)
77
-    {
78
-        $this->name = $name;
79
-        $this->tplIndex = $tplIndex;
80
-    }
68
+	/**
69
+	 * Smarty_Internal_Block constructor.
70
+	 * - if outer level {block} of child template ($state == 1) save it as child root block
71
+	 * - otherwise process inheritance and render
72
+	 *
73
+	 * @param string   $name     block name
74
+	 * @param int|null $tplIndex index of outer level {block} if nested
75
+	 */
76
+	public function __construct($name, $tplIndex)
77
+	{
78
+		$this->name = $name;
79
+		$this->tplIndex = $tplIndex;
80
+	}
81 81
 
82
-    /**
83
-     * Compiled block code overloaded by {block} class
84
-     *
85
-     * @param \Smarty_Internal_Template $tpl
86
-     */
87
-    public function callBlock(Smarty_Internal_Template $tpl)
88
-    {
89
-    }
82
+	/**
83
+	 * Compiled block code overloaded by {block} class
84
+	 *
85
+	 * @param \Smarty_Internal_Template $tpl
86
+	 */
87
+	public function callBlock(Smarty_Internal_Template $tpl)
88
+	{
89
+	}
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_for.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -16,90 +16,90 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
18 18
 {
19
-    /**
20
-     * Compiles code for the {for} tag
21
-     * Smarty 3 does implement two different syntax's:
22
-     * - {for $var in $array}
23
-     * For looping over arrays or iterators
24
-     * - {for $x=0; $x<$y; $x++}
25
-     * For general loops
26
-     * The parser is generating different sets of attribute by which this compiler can
27
-     * determine which syntax is used.
28
-     *
29
-     * @param  array  $args      array with attributes from parser
30
-     * @param  object $compiler  compiler object
31
-     * @param  array  $parameter array with compilation parameter
32
-     *
33
-     * @return string compiled code
34
-     */
35
-    public function compile($args, $compiler, $parameter)
36
-    {
37
-        $compiler->loopNesting ++;
38
-        if ($parameter == 0) {
39
-            $this->required_attributes = array('start', 'to');
40
-            $this->optional_attributes = array('max', 'step');
41
-        } else {
42
-            $this->required_attributes = array('start', 'ifexp', 'var', 'step');
43
-            $this->optional_attributes = array();
44
-        }
45
-        $this->mapCache = array();
46
-        // check and get attributes
47
-        $_attr = $this->getAttributes($compiler, $args);
19
+	/**
20
+	 * Compiles code for the {for} tag
21
+	 * Smarty 3 does implement two different syntax's:
22
+	 * - {for $var in $array}
23
+	 * For looping over arrays or iterators
24
+	 * - {for $x=0; $x<$y; $x++}
25
+	 * For general loops
26
+	 * The parser is generating different sets of attribute by which this compiler can
27
+	 * determine which syntax is used.
28
+	 *
29
+	 * @param  array  $args      array with attributes from parser
30
+	 * @param  object $compiler  compiler object
31
+	 * @param  array  $parameter array with compilation parameter
32
+	 *
33
+	 * @return string compiled code
34
+	 */
35
+	public function compile($args, $compiler, $parameter)
36
+	{
37
+		$compiler->loopNesting ++;
38
+		if ($parameter == 0) {
39
+			$this->required_attributes = array('start', 'to');
40
+			$this->optional_attributes = array('max', 'step');
41
+		} else {
42
+			$this->required_attributes = array('start', 'ifexp', 'var', 'step');
43
+			$this->optional_attributes = array();
44
+		}
45
+		$this->mapCache = array();
46
+		// check and get attributes
47
+		$_attr = $this->getAttributes($compiler, $args);
48 48
 
49
-        $output = "<?php\n";
50
-        if ($parameter == 1) {
51
-            foreach ($_attr[ 'start' ] as $_statement) {
52
-                if (is_array($_statement[ 'var' ])) {
53
-                    $var = $_statement[ 'var' ][ 'var' ];
54
-                    $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
55
-                } else {
56
-                    $var = $_statement[ 'var' ];
57
-                    $index = '';
58
-                }
59
-                $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);\n";
60
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n";
61
-            }
62
-            if (is_array($_attr[ 'var' ])) {
63
-                $var = $_attr[ 'var' ][ 'var' ];
64
-                $index = $_attr[ 'var' ][ 'smarty_internal_index' ];
65
-            } else {
66
-                $var = $_attr[ 'var' ];
67
-                $index = '';
68
-            }
69
-            $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n";
70
-        } else {
71
-            $_statement = $_attr[ 'start' ];
72
-            if (is_array($_statement[ 'var' ])) {
73
-                $var = $_statement[ 'var' ][ 'var' ];
74
-                $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
75
-            } else {
76
-                $var = $_statement[ 'var' ];
77
-                $index = '';
78
-            }
79
-            $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);";
80
-            if (isset($_attr[ 'step' ])) {
81
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];";
82
-            } else {
83
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->step = 1;";
84
-            }
85
-            if (isset($_attr[ 'max' ])) {
86
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n";
87
-            } else {
88
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n";
89
-            }
90
-            $output .= "if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n";
91
-            $output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n";
92
-            $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration == 1;";
93
-            $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration == \$_smarty_tpl->tpl_vars[$var]->total;";
94
-        }
95
-        $output .= "?>";
49
+		$output = "<?php\n";
50
+		if ($parameter == 1) {
51
+			foreach ($_attr[ 'start' ] as $_statement) {
52
+				if (is_array($_statement[ 'var' ])) {
53
+					$var = $_statement[ 'var' ][ 'var' ];
54
+					$index = $_statement[ 'var' ][ 'smarty_internal_index' ];
55
+				} else {
56
+					$var = $_statement[ 'var' ];
57
+					$index = '';
58
+				}
59
+				$output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);\n";
60
+				$output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n";
61
+			}
62
+			if (is_array($_attr[ 'var' ])) {
63
+				$var = $_attr[ 'var' ][ 'var' ];
64
+				$index = $_attr[ 'var' ][ 'smarty_internal_index' ];
65
+			} else {
66
+				$var = $_attr[ 'var' ];
67
+				$index = '';
68
+			}
69
+			$output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n";
70
+		} else {
71
+			$_statement = $_attr[ 'start' ];
72
+			if (is_array($_statement[ 'var' ])) {
73
+				$var = $_statement[ 'var' ][ 'var' ];
74
+				$index = $_statement[ 'var' ][ 'smarty_internal_index' ];
75
+			} else {
76
+				$var = $_statement[ 'var' ];
77
+				$index = '';
78
+			}
79
+			$output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);";
80
+			if (isset($_attr[ 'step' ])) {
81
+				$output .= "\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];";
82
+			} else {
83
+				$output .= "\$_smarty_tpl->tpl_vars[$var]->step = 1;";
84
+			}
85
+			if (isset($_attr[ 'max' ])) {
86
+				$output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n";
87
+			} else {
88
+				$output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n";
89
+			}
90
+			$output .= "if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n";
91
+			$output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n";
92
+			$output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration == 1;";
93
+			$output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration == \$_smarty_tpl->tpl_vars[$var]->total;";
94
+		}
95
+		$output .= "?>";
96 96
 
97
-        $this->openTag($compiler, 'for', array('for', $compiler->nocache));
98
-        // maybe nocache because of nocache variables
99
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
100
-        // return compiled code
101
-        return $output;
102
-    }
97
+		$this->openTag($compiler, 'for', array('for', $compiler->nocache));
98
+		// maybe nocache because of nocache variables
99
+		$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
100
+		// return compiled code
101
+		return $output;
102
+	}
103 103
 }
104 104
 
105 105
 /**
@@ -110,25 +110,25 @@  discard block
 block discarded – undo
110 110
  */
111 111
 class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase
112 112
 {
113
-    /**
114
-     * Compiles code for the {forelse} tag
115
-     *
116
-     * @param  array  $args      array with attributes from parser
117
-     * @param  object $compiler  compiler object
118
-     * @param  array  $parameter array with compilation parameter
119
-     *
120
-     * @return string compiled code
121
-     */
122
-    public function compile($args, $compiler, $parameter)
123
-    {
124
-        // check and get attributes
125
-        $_attr = $this->getAttributes($compiler, $args);
113
+	/**
114
+	 * Compiles code for the {forelse} tag
115
+	 *
116
+	 * @param  array  $args      array with attributes from parser
117
+	 * @param  object $compiler  compiler object
118
+	 * @param  array  $parameter array with compilation parameter
119
+	 *
120
+	 * @return string compiled code
121
+	 */
122
+	public function compile($args, $compiler, $parameter)
123
+	{
124
+		// check and get attributes
125
+		$_attr = $this->getAttributes($compiler, $args);
126 126
 
127
-        list($openTag, $nocache) = $this->closeTag($compiler, array('for'));
128
-        $this->openTag($compiler, 'forelse', array('forelse', $nocache));
127
+		list($openTag, $nocache) = $this->closeTag($compiler, array('for'));
128
+		$this->openTag($compiler, 'forelse', array('forelse', $nocache));
129 129
 
130
-        return "<?php }} else { ?>";
131
-    }
130
+		return "<?php }} else { ?>";
131
+	}
132 132
 }
133 133
 
134 134
 /**
@@ -139,32 +139,32 @@  discard block
 block discarded – undo
139 139
  */
140 140
 class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
141 141
 {
142
-    /**
143
-     * Compiles code for the {/for} tag
144
-     *
145
-     * @param  array  $args      array with attributes from parser
146
-     * @param  object $compiler  compiler object
147
-     * @param  array  $parameter array with compilation parameter
148
-     *
149
-     * @return string compiled code
150
-     */
151
-    public function compile($args, $compiler, $parameter)
152
-    {
153
-        $compiler->loopNesting --;
154
-        // check and get attributes
155
-        $_attr = $this->getAttributes($compiler, $args);
156
-        // must endblock be nocache?
157
-        if ($compiler->nocache) {
158
-            $compiler->tag_nocache = true;
159
-        }
142
+	/**
143
+	 * Compiles code for the {/for} tag
144
+	 *
145
+	 * @param  array  $args      array with attributes from parser
146
+	 * @param  object $compiler  compiler object
147
+	 * @param  array  $parameter array with compilation parameter
148
+	 *
149
+	 * @return string compiled code
150
+	 */
151
+	public function compile($args, $compiler, $parameter)
152
+	{
153
+		$compiler->loopNesting --;
154
+		// check and get attributes
155
+		$_attr = $this->getAttributes($compiler, $args);
156
+		// must endblock be nocache?
157
+		if ($compiler->nocache) {
158
+			$compiler->tag_nocache = true;
159
+		}
160 160
 
161
-        list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse'));
161
+		list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse'));
162 162
 
163
-        $output = "<?php }\n";
164
-        if ($openTag != 'forelse') {
165
-            $output .= "}\n";
166
-        }
167
-        $output .= "?>\n";
168
-        return $output;
169
-    }
163
+		$output = "<?php }\n";
164
+		if ($openTag != 'forelse') {
165
+			$output .= "}\n";
166
+		}
167
+		$output .= "?>\n";
168
+		return $output;
169
+	}
170 170
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function compile($args, $compiler, $parameter)
36 36
     {
37
-        $compiler->loopNesting ++;
37
+        $compiler->loopNesting++;
38 38
         if ($parameter == 0) {
39 39
             $this->required_attributes = array('start', 'to');
40 40
             $this->optional_attributes = array('max', 'step');
@@ -48,41 +48,41 @@  discard block
 block discarded – undo
48 48
 
49 49
         $output = "<?php\n";
50 50
         if ($parameter == 1) {
51
-            foreach ($_attr[ 'start' ] as $_statement) {
52
-                if (is_array($_statement[ 'var' ])) {
53
-                    $var = $_statement[ 'var' ][ 'var' ];
54
-                    $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
51
+            foreach ($_attr['start'] as $_statement) {
52
+                if (is_array($_statement['var'])) {
53
+                    $var = $_statement['var']['var'];
54
+                    $index = $_statement['var']['smarty_internal_index'];
55 55
                 } else {
56
-                    $var = $_statement[ 'var' ];
56
+                    $var = $_statement['var'];
57 57
                     $index = '';
58 58
                 }
59 59
                 $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);\n";
60 60
                 $output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n";
61 61
             }
62
-            if (is_array($_attr[ 'var' ])) {
63
-                $var = $_attr[ 'var' ][ 'var' ];
64
-                $index = $_attr[ 'var' ][ 'smarty_internal_index' ];
62
+            if (is_array($_attr['var'])) {
63
+                $var = $_attr['var']['var'];
64
+                $index = $_attr['var']['smarty_internal_index'];
65 65
             } else {
66
-                $var = $_attr[ 'var' ];
66
+                $var = $_attr['var'];
67 67
                 $index = '';
68 68
             }
69 69
             $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n";
70 70
         } else {
71
-            $_statement = $_attr[ 'start' ];
72
-            if (is_array($_statement[ 'var' ])) {
73
-                $var = $_statement[ 'var' ][ 'var' ];
74
-                $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
71
+            $_statement = $_attr['start'];
72
+            if (is_array($_statement['var'])) {
73
+                $var = $_statement['var']['var'];
74
+                $index = $_statement['var']['smarty_internal_index'];
75 75
             } else {
76
-                $var = $_statement[ 'var' ];
76
+                $var = $_statement['var'];
77 77
                 $index = '';
78 78
             }
79 79
             $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);";
80
-            if (isset($_attr[ 'step' ])) {
80
+            if (isset($_attr['step'])) {
81 81
                 $output .= "\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];";
82 82
             } else {
83 83
                 $output .= "\$_smarty_tpl->tpl_vars[$var]->step = 1;";
84 84
             }
85
-            if (isset($_attr[ 'max' ])) {
85
+            if (isset($_attr['max'])) {
86 86
                 $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n";
87 87
             } else {
88 88
                 $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n";
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function compile($args, $compiler, $parameter)
152 152
     {
153
-        $compiler->loopNesting --;
153
+        $compiler->loopNesting--;
154 154
         // check and get attributes
155 155
         $_attr = $this->getAttributes($compiler, $args);
156 156
         // must endblock be nocache?
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php 2 patches
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -11,212 +11,212 @@
 block discarded – undo
11 11
 class Smarty_Internal_Runtime_Inheritance
12 12
 {
13 13
 
14
-    /**
15
-     * State machine
16
-     * - 0 idle next extends will create a new inheritance tree
17
-     * - 1 processing child template
18
-     * - 2 wait for next inheritance template
19
-     * - 3 assume parent template, if child will loaded goto state 1
20
-     *     a call to a sub template resets the state to 0
21
-     *
22
-     * @var int
23
-     */
24
-    public $state = 0;
14
+	/**
15
+	 * State machine
16
+	 * - 0 idle next extends will create a new inheritance tree
17
+	 * - 1 processing child template
18
+	 * - 2 wait for next inheritance template
19
+	 * - 3 assume parent template, if child will loaded goto state 1
20
+	 *     a call to a sub template resets the state to 0
21
+	 *
22
+	 * @var int
23
+	 */
24
+	public $state = 0;
25 25
 
26
-    /**
27
-     * Array of root child {block} objects
28
-     *
29
-     * @var Smarty_Internal_Block[]
30
-     */
31
-    public $childRoot = array();
26
+	/**
27
+	 * Array of root child {block} objects
28
+	 *
29
+	 * @var Smarty_Internal_Block[]
30
+	 */
31
+	public $childRoot = array();
32 32
 
33
-    /**
34
-     * inheritance template nesting level
35
-     *
36
-     * @var int
37
-     */
38
-    public $inheritanceLevel = 0;
33
+	/**
34
+	 * inheritance template nesting level
35
+	 *
36
+	 * @var int
37
+	 */
38
+	public $inheritanceLevel = 0;
39 39
 
40
-    /**
41
-     * inheritance template index
42
-     *
43
-     * @var int
44
-     */
45
-    public $tplIndex = - 1;
40
+	/**
41
+	 * inheritance template index
42
+	 *
43
+	 * @var int
44
+	 */
45
+	public $tplIndex = - 1;
46 46
 
47
-    /**
48
-     * Array of template source objects
49
-     * - key template index
50
-     *
51
-     * @var Smarty_Template_Source[]
52
-     */
53
-    public $sources = array();
47
+	/**
48
+	 * Array of template source objects
49
+	 * - key template index
50
+	 *
51
+	 * @var Smarty_Template_Source[]
52
+	 */
53
+	public $sources = array();
54 54
 
55
-    /**
56
-     * Stack of source objects while executing block code
57
-     *
58
-     * @var Smarty_Template_Source[]
59
-     */
60
-    public $sourceStack = array();
55
+	/**
56
+	 * Stack of source objects while executing block code
57
+	 *
58
+	 * @var Smarty_Template_Source[]
59
+	 */
60
+	public $sourceStack = array();
61 61
 
62
-    /**
63
-     * Initialize inheritance
64
-     *
65
-     * @param \Smarty_Internal_Template $tpl        template object of caller
66
-     * @param bool                      $initChild  if true init for child template
67
-     * @param array                     $blockNames outer level block name
68
-     *
69
-     */
70
-    public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
71
-    {
72
-        // if called while executing parent template it must be a sub-template with new inheritance root
73
-        if ($initChild && $this->state == 3 && (strpos($tpl->template_resource, 'extendsall') === false)) {
74
-            $tpl->inheritance = new Smarty_Internal_Runtime_Inheritance();
75
-            $tpl->inheritance->init($tpl, $initChild, $blockNames);
76
-            return;
77
-        }
78
-        $this->tplIndex ++;
79
-        $this->sources[ $this->tplIndex ] = $tpl->source;
62
+	/**
63
+	 * Initialize inheritance
64
+	 *
65
+	 * @param \Smarty_Internal_Template $tpl        template object of caller
66
+	 * @param bool                      $initChild  if true init for child template
67
+	 * @param array                     $blockNames outer level block name
68
+	 *
69
+	 */
70
+	public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
71
+	{
72
+		// if called while executing parent template it must be a sub-template with new inheritance root
73
+		if ($initChild && $this->state == 3 && (strpos($tpl->template_resource, 'extendsall') === false)) {
74
+			$tpl->inheritance = new Smarty_Internal_Runtime_Inheritance();
75
+			$tpl->inheritance->init($tpl, $initChild, $blockNames);
76
+			return;
77
+		}
78
+		$this->tplIndex ++;
79
+		$this->sources[ $this->tplIndex ] = $tpl->source;
80 80
 
81
-        // start of child sub template(s)
82
-        if ($initChild) {
83
-            $this->state = 1;
84
-            if (!$this->inheritanceLevel) {
85
-                //grab any output of child templates
86
-                ob_start();
87
-            }
88
-            $this->inheritanceLevel ++;
89
-            //           $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart');
90
-            //           $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd');
91
-        }
92
-        // if state was waiting for parent change state to parent
93
-        if ($this->state == 2) {
94
-            $this->state = 3;
95
-        }
96
-    }
81
+		// start of child sub template(s)
82
+		if ($initChild) {
83
+			$this->state = 1;
84
+			if (!$this->inheritanceLevel) {
85
+				//grab any output of child templates
86
+				ob_start();
87
+			}
88
+			$this->inheritanceLevel ++;
89
+			//           $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart');
90
+			//           $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd');
91
+		}
92
+		// if state was waiting for parent change state to parent
93
+		if ($this->state == 2) {
94
+			$this->state = 3;
95
+		}
96
+	}
97 97
 
98
-    /**
99
-     * End of child template(s)
100
-     * - if outer level is reached flush output buffer and switch to wait for parent template state
101
-     *
102
-     */
103
-    public function endChild()
104
-    {
105
-        $this->inheritanceLevel --;
106
-        if (!$this->inheritanceLevel) {
107
-            ob_end_clean();
108
-            $this->state = 2;
109
-        }
110
-    }
98
+	/**
99
+	 * End of child template(s)
100
+	 * - if outer level is reached flush output buffer and switch to wait for parent template state
101
+	 *
102
+	 */
103
+	public function endChild()
104
+	{
105
+		$this->inheritanceLevel --;
106
+		if (!$this->inheritanceLevel) {
107
+			ob_end_clean();
108
+			$this->state = 2;
109
+		}
110
+	}
111 111
 
112
-    /**
113
-     * Smarty_Internal_Block constructor.
114
-     * - if outer level {block} of child template ($state == 1) save it as child root block
115
-     * - otherwise process inheritance and render
116
-     *
117
-     * @param \Smarty_Internal_Template $tpl
118
-     * @param                           $className
119
-     * @param string                    $name
120
-     * @param int|null                  $tplIndex index of outer level {block} if nested
121
-     */
122
-    public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
123
-    {
124
-        $block = new $className($name, $tplIndex ? $tplIndex : $this->tplIndex);
125
-        if (isset($this->childRoot[ $name ])) {
126
-            $block->child = $this->childRoot[ $name ];
127
-        }
128
-        if ($this->state == 1) {
129
-            $this->childRoot[ $name ] = $block;
130
-            return;
131
-        }
132
-        // make sure we got child block of child template of current block
133
-        while ($block->child && $block->tplIndex <= $block->child->tplIndex) {
134
-            $block->child = $block->child->child;
135
-        }
136
-        $this->process($tpl, $block);
137
-    }
112
+	/**
113
+	 * Smarty_Internal_Block constructor.
114
+	 * - if outer level {block} of child template ($state == 1) save it as child root block
115
+	 * - otherwise process inheritance and render
116
+	 *
117
+	 * @param \Smarty_Internal_Template $tpl
118
+	 * @param                           $className
119
+	 * @param string                    $name
120
+	 * @param int|null                  $tplIndex index of outer level {block} if nested
121
+	 */
122
+	public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
123
+	{
124
+		$block = new $className($name, $tplIndex ? $tplIndex : $this->tplIndex);
125
+		if (isset($this->childRoot[ $name ])) {
126
+			$block->child = $this->childRoot[ $name ];
127
+		}
128
+		if ($this->state == 1) {
129
+			$this->childRoot[ $name ] = $block;
130
+			return;
131
+		}
132
+		// make sure we got child block of child template of current block
133
+		while ($block->child && $block->tplIndex <= $block->child->tplIndex) {
134
+			$block->child = $block->child->child;
135
+		}
136
+		$this->process($tpl, $block);
137
+	}
138 138
 
139
-    /**
140
-     * Goto child block or render this
141
-     *
142
-     * @param \Smarty_Internal_Template   $tpl
143
-     * @param \Smarty_Internal_Block      $block
144
-     * @param \Smarty_Internal_Block|null $parent
145
-     *
146
-     * @throws \SmartyException
147
-     */
148
-    public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block,
149
-                            Smarty_Internal_Block $parent = null)
150
-    {
151
-        if ($block->hide && !isset($block->child)) {
152
-            return;
153
-        }
154
-        if (isset($block->child) && $block->child->hide && !isset($block->child->child)) {
155
-            $block->child = null;
156
-        }
157
-        $block->parent = $parent;
158
-        if ($block->append && !$block->prepend && isset($parent)) {
159
-            $this->callParent($tpl, $block);
160
-        }
161
-        if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) {
162
-            $this->callBlock($block, $tpl);
163
-        } else {
164
-            $this->process($tpl, $block->child, $block);
165
-        }
166
-        if ($block->prepend && isset($parent)) {
167
-            $this->callParent($tpl, $block);
168
-            if ($block->append) {
169
-                if ($block->callsChild || !isset($block->child) ||
170
-                    ($block->child->hide && !isset($block->child->child))
171
-                ) {
172
-                    $this->callBlock($block, $tpl);
173
-                } else {
174
-                    $this->process($tpl, $block->child, $block);
175
-                }
176
-            }
177
-        }
178
-        $block->parent = null;
179
-    }
139
+	/**
140
+	 * Goto child block or render this
141
+	 *
142
+	 * @param \Smarty_Internal_Template   $tpl
143
+	 * @param \Smarty_Internal_Block      $block
144
+	 * @param \Smarty_Internal_Block|null $parent
145
+	 *
146
+	 * @throws \SmartyException
147
+	 */
148
+	public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block,
149
+							Smarty_Internal_Block $parent = null)
150
+	{
151
+		if ($block->hide && !isset($block->child)) {
152
+			return;
153
+		}
154
+		if (isset($block->child) && $block->child->hide && !isset($block->child->child)) {
155
+			$block->child = null;
156
+		}
157
+		$block->parent = $parent;
158
+		if ($block->append && !$block->prepend && isset($parent)) {
159
+			$this->callParent($tpl, $block);
160
+		}
161
+		if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) {
162
+			$this->callBlock($block, $tpl);
163
+		} else {
164
+			$this->process($tpl, $block->child, $block);
165
+		}
166
+		if ($block->prepend && isset($parent)) {
167
+			$this->callParent($tpl, $block);
168
+			if ($block->append) {
169
+				if ($block->callsChild || !isset($block->child) ||
170
+					($block->child->hide && !isset($block->child->child))
171
+				) {
172
+					$this->callBlock($block, $tpl);
173
+				} else {
174
+					$this->process($tpl, $block->child, $block);
175
+				}
176
+			}
177
+		}
178
+		$block->parent = null;
179
+	}
180 180
 
181
-    /**
182
-     * Render child on {$smarty.block.child}
183
-     *
184
-     * @param \Smarty_Internal_Template $tpl
185
-     * @param \Smarty_Internal_Block    $block
186
-     */
187
-    public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
188
-    {
189
-        if (isset($block->child)) {
190
-            $this->process($tpl, $block->child, $block);
191
-        }
192
-    }
181
+	/**
182
+	 * Render child on {$smarty.block.child}
183
+	 *
184
+	 * @param \Smarty_Internal_Template $tpl
185
+	 * @param \Smarty_Internal_Block    $block
186
+	 */
187
+	public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
188
+	{
189
+		if (isset($block->child)) {
190
+			$this->process($tpl, $block->child, $block);
191
+		}
192
+	}
193 193
 
194
-    /**
195
-     * Render parent on {$smarty.block.parent} or {block append/prepend}     *
196
-     *
197
-     * @param \Smarty_Internal_Template $tpl
198
-     * @param \Smarty_Internal_Block    $block
199
-     *
200
-     * @throws \SmartyException
201
-     */
202
-    public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
203
-    {
204
-        if (isset($block->parent)) {
205
-            $this->callBlock($block->parent, $tpl);
206
-        } else {
207
-            throw new SmartyException("inheritance: illegal {\$smarty.block.parent} or {block append/prepend} used in parent template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'");
208
-        }
209
-    }
194
+	/**
195
+	 * Render parent on {$smarty.block.parent} or {block append/prepend}     *
196
+	 *
197
+	 * @param \Smarty_Internal_Template $tpl
198
+	 * @param \Smarty_Internal_Block    $block
199
+	 *
200
+	 * @throws \SmartyException
201
+	 */
202
+	public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
203
+	{
204
+		if (isset($block->parent)) {
205
+			$this->callBlock($block->parent, $tpl);
206
+		} else {
207
+			throw new SmartyException("inheritance: illegal {\$smarty.block.parent} or {block append/prepend} used in parent template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'");
208
+		}
209
+	}
210 210
 
211
-    /**
212
-     * @param \Smarty_Internal_Block    $block
213
-     * @param \Smarty_Internal_Template $tpl
214
-     */
215
-    public function callBlock(Smarty_Internal_Block $block, Smarty_Internal_Template $tpl)
216
-    {
217
-        $this->sourceStack[] = $tpl->source;
218
-        $tpl->source = $this->sources[ $block->tplIndex ];
219
-        $block->callBlock($tpl);
220
-        $tpl->source = array_pop($this->sourceStack);
221
-    }
211
+	/**
212
+	 * @param \Smarty_Internal_Block    $block
213
+	 * @param \Smarty_Internal_Template $tpl
214
+	 */
215
+	public function callBlock(Smarty_Internal_Block $block, Smarty_Internal_Template $tpl)
216
+	{
217
+		$this->sourceStack[] = $tpl->source;
218
+		$tpl->source = $this->sources[ $block->tplIndex ];
219
+		$block->callBlock($tpl);
220
+		$tpl->source = array_pop($this->sourceStack);
221
+	}
222 222
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
             $tpl->inheritance->init($tpl, $initChild, $blockNames);
76 76
             return;
77 77
         }
78
-        $this->tplIndex ++;
79
-        $this->sources[ $this->tplIndex ] = $tpl->source;
78
+        $this->tplIndex++;
79
+        $this->sources[$this->tplIndex] = $tpl->source;
80 80
 
81 81
         // start of child sub template(s)
82 82
         if ($initChild) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 //grab any output of child templates
86 86
                 ob_start();
87 87
             }
88
-            $this->inheritanceLevel ++;
88
+            $this->inheritanceLevel++;
89 89
             //           $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart');
90 90
             //           $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd');
91 91
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function endChild()
104 104
     {
105
-        $this->inheritanceLevel --;
105
+        $this->inheritanceLevel--;
106 106
         if (!$this->inheritanceLevel) {
107 107
             ob_end_clean();
108 108
             $this->state = 2;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
     public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
123 123
     {
124 124
         $block = new $className($name, $tplIndex ? $tplIndex : $this->tplIndex);
125
-        if (isset($this->childRoot[ $name ])) {
126
-            $block->child = $this->childRoot[ $name ];
125
+        if (isset($this->childRoot[$name])) {
126
+            $block->child = $this->childRoot[$name];
127 127
         }
128 128
         if ($this->state == 1) {
129
-            $this->childRoot[ $name ] = $block;
129
+            $this->childRoot[$name] = $block;
130 130
             return;
131 131
         }
132 132
         // make sure we got child block of child template of current block
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     public function callBlock(Smarty_Internal_Block $block, Smarty_Internal_Template $tpl)
216 216
     {
217 217
         $this->sourceStack[] = $tpl->source;
218
-        $tpl->source = $this->sources[ $block->tplIndex ];
218
+        $tpl->source = $this->sources[$block->tplIndex];
219 219
         $block->callBlock($tpl);
220 220
         $tpl->source = array_pop($this->sourceStack);
221 221
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_tag.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -19,51 +19,51 @@
 block discarded – undo
19 19
 class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree
20 20
 {
21 21
 
22
-    /**
23
-     * Saved block nesting level
24
-     *
25
-     * @var int
26
-     */
27
-    public $saved_block_nesting;
22
+	/**
23
+	 * Saved block nesting level
24
+	 *
25
+	 * @var int
26
+	 */
27
+	public $saved_block_nesting;
28 28
 
29
-    /**
30
-     * Create parse tree buffer for Smarty tag
31
-     *
32
-     * @param \Smarty_Internal_Templateparser $parser parser object
33
-     * @param string                          $data   content
34
-     */
35
-    public function __construct(Smarty_Internal_Templateparser $parser, $data)
36
-    {
37
-        $this->data = $data;
38
-        $this->saved_block_nesting = $parser->block_nesting_level;
39
-    }
29
+	/**
30
+	 * Create parse tree buffer for Smarty tag
31
+	 *
32
+	 * @param \Smarty_Internal_Templateparser $parser parser object
33
+	 * @param string                          $data   content
34
+	 */
35
+	public function __construct(Smarty_Internal_Templateparser $parser, $data)
36
+	{
37
+		$this->data = $data;
38
+		$this->saved_block_nesting = $parser->block_nesting_level;
39
+	}
40 40
 
41
-    /**
42
-     * Return buffer content
43
-     *
44
-     * @param \Smarty_Internal_Templateparser $parser
45
-     *
46
-     * @return string content
47
-     */
48
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
49
-    {
50
-        return $this->data;
51
-    }
41
+	/**
42
+	 * Return buffer content
43
+	 *
44
+	 * @param \Smarty_Internal_Templateparser $parser
45
+	 *
46
+	 * @return string content
47
+	 */
48
+	public function to_smarty_php(Smarty_Internal_Templateparser $parser)
49
+	{
50
+		return $this->data;
51
+	}
52 52
 
53
-    /**
54
-     * Return complied code that loads the evaluated output of buffer content into a temporary variable
55
-     *
56
-     * @param \Smarty_Internal_Templateparser $parser
57
-     *
58
-     * @return string template code
59
-     */
60
-    public function assign_to_var(Smarty_Internal_Templateparser $parser)
61
-    {
62
-        $var = $parser->compiler->getNewPrefixVariable();
63
-        $tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data);
64
-        $tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
65
-        $parser->compiler->prefix_code[] = sprintf("%s", $tmp);
53
+	/**
54
+	 * Return complied code that loads the evaluated output of buffer content into a temporary variable
55
+	 *
56
+	 * @param \Smarty_Internal_Templateparser $parser
57
+	 *
58
+	 * @return string template code
59
+	 */
60
+	public function assign_to_var(Smarty_Internal_Templateparser $parser)
61
+	{
62
+		$var = $parser->compiler->getNewPrefixVariable();
63
+		$tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data);
64
+		$tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
65
+		$parser->compiler->prefix_code[] = sprintf("%s", $tmp);
66 66
 
67
-        return $var;
68
-    }
67
+		return $var;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -14,85 +14,85 @@
 block discarded – undo
14 14
  */
15 15
 class Smarty_Internal_Runtime_CodeFrame
16 16
 {
17
-    /**
18
-     * Create code frame for compiled and cached templates
19
-     *
20
-     * @param Smarty_Internal_Template              $_template
21
-     * @param string                                $content   optional template content
22
-     * @param string                                $functions compiled template function and block code
23
-     * @param bool                                  $cache     flag for cache file
24
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
25
-     *
26
-     * @return string
27
-     */
28
-    public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false,
29
-                           Smarty_Internal_TemplateCompilerBase $compiler = null)
30
-    {
31
-        // build property code
32
-        $properties[ 'version' ] = Smarty::SMARTY_VERSION;
33
-        $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
34
-        if (!$cache) {
35
-            $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code;
36
-            $properties[ 'file_dependency' ] = $_template->compiled->file_dependency;
37
-            $properties[ 'includes' ] = $_template->compiled->includes;
38
-         } else {
39
-            $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code;
40
-            $properties[ 'file_dependency' ] = $_template->cached->file_dependency;
41
-            $properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
42
-        }
43
-        $output = "<?php\n";
44
-        $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
45
-                   "\n  from \"" . $_template->source->filepath . "\" */\n\n";
46
-        $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
47
-        $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
48
-               ($cache ? 'true' : 'false') . ")";
49
-        $output .= "if ({$dec}) {\n";
50
-        $output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n";
51
-        if (!$cache && !empty($compiler->tpl_function)) {
52
-            $output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
53
-                       var_export($compiler->tpl_function, true) . ");\n";
54
-        }
55
-        if ($cache && isset($_template->ext->_tplFunction)) {
56
-            $output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
57
-                       var_export($_template->ext->_tplFunction->getTplFunction(), true) . ");\n";
17
+	/**
18
+	 * Create code frame for compiled and cached templates
19
+	 *
20
+	 * @param Smarty_Internal_Template              $_template
21
+	 * @param string                                $content   optional template content
22
+	 * @param string                                $functions compiled template function and block code
23
+	 * @param bool                                  $cache     flag for cache file
24
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
25
+	 *
26
+	 * @return string
27
+	 */
28
+	public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false,
29
+						   Smarty_Internal_TemplateCompilerBase $compiler = null)
30
+	{
31
+		// build property code
32
+		$properties[ 'version' ] = Smarty::SMARTY_VERSION;
33
+		$properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
34
+		if (!$cache) {
35
+			$properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code;
36
+			$properties[ 'file_dependency' ] = $_template->compiled->file_dependency;
37
+			$properties[ 'includes' ] = $_template->compiled->includes;
38
+		 } else {
39
+			$properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code;
40
+			$properties[ 'file_dependency' ] = $_template->cached->file_dependency;
41
+			$properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
42
+		}
43
+		$output = "<?php\n";
44
+		$output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
45
+				   "\n  from \"" . $_template->source->filepath . "\" */\n\n";
46
+		$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
47
+		$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
48
+			   ($cache ? 'true' : 'false') . ")";
49
+		$output .= "if ({$dec}) {\n";
50
+		$output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n";
51
+		if (!$cache && !empty($compiler->tpl_function)) {
52
+			$output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
53
+					   var_export($compiler->tpl_function, true) . ");\n";
54
+		}
55
+		if ($cache && isset($_template->ext->_tplFunction)) {
56
+			$output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
57
+					   var_export($_template->ext->_tplFunction->getTplFunction(), true) . ");\n";
58 58
 
59
-        }
60
-        // include code for plugins
61
-        if (!$cache) {
62
-            if (!empty($_template->compiled->required_plugins[ 'compiled' ])) {
63
-                foreach ($_template->compiled->required_plugins[ 'compiled' ] as $tmp) {
64
-                    foreach ($tmp as $data) {
65
-                        $file = addslashes($data[ 'file' ]);
66
-                        if (is_array($data[ 'function' ])) {
67
-                            $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
68
-                        } else {
69
-                            $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
70
-                        }
71
-                    }
72
-                }
73
-            }
74
-            if ($_template->caching && !empty($_template->compiled->required_plugins[ 'nocache' ])) {
75
-                $_template->compiled->has_nocache_code = true;
76
-                $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
77
-                foreach ($_template->compiled->required_plugins[ 'nocache' ] as $tmp) {
78
-                    foreach ($tmp as $data) {
79
-                        $file = addslashes($data[ 'file' ]);
80
-                        if (is_array($data[ 'function' ])) {
81
-                            $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
82
-                        } else {
83
-                            $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
84
-                        }
85
-                    }
86
-                }
87
-                $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
88
-            }
89
-        }
90
-        $output .= "?>\n";
91
-        $output .= $content;
92
-        $output .= "<?php }\n?>";
93
-        $output .= $functions;
94
-        $output .= "<?php }\n";
95
-        // remove unneeded PHP tags
96
-        return preg_replace(array('/\s*\?>[\n]?<\?php\s*/', '/\?>\s*$/'), array("\n", ''), $output);
97
-    }
59
+		}
60
+		// include code for plugins
61
+		if (!$cache) {
62
+			if (!empty($_template->compiled->required_plugins[ 'compiled' ])) {
63
+				foreach ($_template->compiled->required_plugins[ 'compiled' ] as $tmp) {
64
+					foreach ($tmp as $data) {
65
+						$file = addslashes($data[ 'file' ]);
66
+						if (is_array($data[ 'function' ])) {
67
+							$output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
68
+						} else {
69
+							$output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
70
+						}
71
+					}
72
+				}
73
+			}
74
+			if ($_template->caching && !empty($_template->compiled->required_plugins[ 'nocache' ])) {
75
+				$_template->compiled->has_nocache_code = true;
76
+				$output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
77
+				foreach ($_template->compiled->required_plugins[ 'nocache' ] as $tmp) {
78
+					foreach ($tmp as $data) {
79
+						$file = addslashes($data[ 'file' ]);
80
+						if (is_array($data[ 'function' ])) {
81
+							$output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
82
+						} else {
83
+							$output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
84
+						}
85
+					}
86
+				}
87
+				$output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
88
+			}
89
+		}
90
+		$output .= "?>\n";
91
+		$output .= $content;
92
+		$output .= "<?php }\n?>";
93
+		$output .= $functions;
94
+		$output .= "<?php }\n";
95
+		// remove unneeded PHP tags
96
+		return preg_replace(array('/\s*\?>[\n]?<\?php\s*/', '/\?>\s*$/'), array("\n", ''), $output);
97
+	}
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
                            Smarty_Internal_TemplateCompilerBase $compiler = null)
30 30
     {
31 31
         // build property code
32
-        $properties[ 'version' ] = Smarty::SMARTY_VERSION;
33
-        $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
32
+        $properties['version'] = Smarty::SMARTY_VERSION;
33
+        $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
34 34
         if (!$cache) {
35
-            $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code;
36
-            $properties[ 'file_dependency' ] = $_template->compiled->file_dependency;
37
-            $properties[ 'includes' ] = $_template->compiled->includes;
35
+            $properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
36
+            $properties['file_dependency'] = $_template->compiled->file_dependency;
37
+            $properties['includes'] = $_template->compiled->includes;
38 38
          } else {
39
-            $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code;
40
-            $properties[ 'file_dependency' ] = $_template->cached->file_dependency;
41
-            $properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
39
+            $properties['has_nocache_code'] = $_template->cached->has_nocache_code;
40
+            $properties['file_dependency'] = $_template->cached->file_dependency;
41
+            $properties['cache_lifetime'] = $_template->cache_lifetime;
42 42
         }
43 43
         $output = "<?php\n";
44 44
         $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
         }
60 60
         // include code for plugins
61 61
         if (!$cache) {
62
-            if (!empty($_template->compiled->required_plugins[ 'compiled' ])) {
63
-                foreach ($_template->compiled->required_plugins[ 'compiled' ] as $tmp) {
62
+            if (!empty($_template->compiled->required_plugins['compiled'])) {
63
+                foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
64 64
                     foreach ($tmp as $data) {
65
-                        $file = addslashes($data[ 'file' ]);
66
-                        if (is_array($data[ 'function' ])) {
65
+                        $file = addslashes($data['file']);
66
+                        if (is_array($data['function'])) {
67 67
                             $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
68 68
                         } else {
69 69
                             $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
                     }
72 72
                 }
73 73
             }
74
-            if ($_template->caching && !empty($_template->compiled->required_plugins[ 'nocache' ])) {
74
+            if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
75 75
                 $_template->compiled->has_nocache_code = true;
76 76
                 $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
77
-                foreach ($_template->compiled->required_plugins[ 'nocache' ] as $tmp) {
77
+                foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
78 78
                     foreach ($tmp as $data) {
79
-                        $file = addslashes($data[ 'file' ]);
80
-                        if (is_array($data[ 'function' ])) {
79
+                        $file = addslashes($data['file']);
80
+                        if (is_array($data['function'])) {
81 81
                             $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
82 82
                         } else {
83 83
                             $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_config_file_compiler.php 3 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -17,183 +17,183 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_Config_File_Compiler
19 19
 {
20
-    /**
21
-     * Lexer class name
22
-     *
23
-     * @var string
24
-     */
25
-    public $lexer_class;
20
+	/**
21
+	 * Lexer class name
22
+	 *
23
+	 * @var string
24
+	 */
25
+	public $lexer_class;
26 26
 
27
-    /**
28
-     * Parser class name
29
-     *
30
-     * @var string
31
-     */
32
-    public $parser_class;
27
+	/**
28
+	 * Parser class name
29
+	 *
30
+	 * @var string
31
+	 */
32
+	public $parser_class;
33 33
 
34
-    /**
35
-     * Lexer object
36
-     *
37
-     * @var object
38
-     */
39
-    public $lex;
34
+	/**
35
+	 * Lexer object
36
+	 *
37
+	 * @var object
38
+	 */
39
+	public $lex;
40 40
 
41
-    /**
42
-     * Parser object
43
-     *
44
-     * @var object
45
-     */
46
-    public $parser;
41
+	/**
42
+	 * Parser object
43
+	 *
44
+	 * @var object
45
+	 */
46
+	public $parser;
47 47
 
48
-    /**
49
-     * Smarty object
50
-     *
51
-     * @var Smarty object
52
-     */
53
-    public $smarty;
48
+	/**
49
+	 * Smarty object
50
+	 *
51
+	 * @var Smarty object
52
+	 */
53
+	public $smarty;
54 54
 
55
-    /**
56
-     * Smarty object
57
-     *
58
-     * @var Smarty_Internal_Template object
59
-     */
60
-    public $template;
55
+	/**
56
+	 * Smarty object
57
+	 *
58
+	 * @var Smarty_Internal_Template object
59
+	 */
60
+	public $template;
61 61
 
62
-    /**
63
-     * Compiled config data sections and variables
64
-     *
65
-     * @var array
66
-     */
67
-    public $config_data = array();
62
+	/**
63
+	 * Compiled config data sections and variables
64
+	 *
65
+	 * @var array
66
+	 */
67
+	public $config_data = array();
68 68
 
69
-    /**
70
-     * compiled config data must always be written
71
-     *
72
-     * @var bool
73
-     */
74
-    public $write_compiled_code = true;
69
+	/**
70
+	 * compiled config data must always be written
71
+	 *
72
+	 * @var bool
73
+	 */
74
+	public $write_compiled_code = true;
75 75
 
76
-    /**
77
-     * Initialize compiler
78
-     *
79
-     * @param string $lexer_class  class name
80
-     * @param string $parser_class class name
81
-     * @param Smarty $smarty       global instance
82
-     */
83
-    public function __construct($lexer_class, $parser_class, Smarty $smarty)
84
-    {
85
-        $this->smarty = $smarty;
86
-        // get required plugins
87
-        $this->lexer_class = $lexer_class;
88
-        $this->parser_class = $parser_class;
89
-        $this->smarty = $smarty;
90
-        $this->config_data[ 'sections' ] = array();
91
-        $this->config_data[ 'vars' ] = array();
92
-    }
76
+	/**
77
+	 * Initialize compiler
78
+	 *
79
+	 * @param string $lexer_class  class name
80
+	 * @param string $parser_class class name
81
+	 * @param Smarty $smarty       global instance
82
+	 */
83
+	public function __construct($lexer_class, $parser_class, Smarty $smarty)
84
+	{
85
+		$this->smarty = $smarty;
86
+		// get required plugins
87
+		$this->lexer_class = $lexer_class;
88
+		$this->parser_class = $parser_class;
89
+		$this->smarty = $smarty;
90
+		$this->config_data[ 'sections' ] = array();
91
+		$this->config_data[ 'vars' ] = array();
92
+	}
93 93
 
94
-    /**
95
-     * Method to compile Smarty config source.
96
-     *
97
-     * @param Smarty_Internal_Template $template
98
-     *
99
-     * @return bool true if compiling succeeded, false if it failed
100
-     */
101
-    public function compileTemplate(Smarty_Internal_Template $template)
102
-    {
103
-        $this->template = $template;
104
-        $this->template->compiled->file_dependency[ $this->template->source->uid ] =
105
-            array($this->template->source->filepath, $this->template->source->getTimeStamp(),
106
-                  $this->template->source->type);
107
-        if ($this->smarty->debugging) {
108
-            if (!isset( $this->smarty->_debug)) {
109
-                $this->smarty->_debug  = new Smarty_Internal_Debug();
110
-            }
111
-            $this->smarty->_debug->start_compile($this->template);
112
-        }
113
-        // init the lexer/parser to compile the config file
114
-        /* @var Smarty_Internal_ConfigFileLexer $lex */
115
-        $lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . "\n",
116
-                                      $this);
117
-        /* @var Smarty_Internal_ConfigFileParser $parser */
118
-        $parser = new $this->parser_class($lex, $this);
94
+	/**
95
+	 * Method to compile Smarty config source.
96
+	 *
97
+	 * @param Smarty_Internal_Template $template
98
+	 *
99
+	 * @return bool true if compiling succeeded, false if it failed
100
+	 */
101
+	public function compileTemplate(Smarty_Internal_Template $template)
102
+	{
103
+		$this->template = $template;
104
+		$this->template->compiled->file_dependency[ $this->template->source->uid ] =
105
+			array($this->template->source->filepath, $this->template->source->getTimeStamp(),
106
+				  $this->template->source->type);
107
+		if ($this->smarty->debugging) {
108
+			if (!isset( $this->smarty->_debug)) {
109
+				$this->smarty->_debug  = new Smarty_Internal_Debug();
110
+			}
111
+			$this->smarty->_debug->start_compile($this->template);
112
+		}
113
+		// init the lexer/parser to compile the config file
114
+		/* @var Smarty_Internal_ConfigFileLexer $lex */
115
+		$lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . "\n",
116
+									  $this);
117
+		/* @var Smarty_Internal_ConfigFileParser $parser */
118
+		$parser = new $this->parser_class($lex, $this);
119 119
 
120
-        if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
121
-            $mbEncoding = mb_internal_encoding();
122
-            mb_internal_encoding('ASCII');
123
-        } else {
124
-            $mbEncoding = null;
125
-        }
120
+		if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
121
+			$mbEncoding = mb_internal_encoding();
122
+			mb_internal_encoding('ASCII');
123
+		} else {
124
+			$mbEncoding = null;
125
+		}
126 126
 
127
-        if ($this->smarty->_parserdebug) {
128
-            $parser->PrintTrace();
129
-        }
130
-        // get tokens from lexer and parse them
131
-        while ($lex->yylex()) {
132
-            if ($this->smarty->_parserdebug) {
133
-                echo "<br>Parsing  {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n";
134
-            }
135
-            $parser->doParse($lex->token, $lex->value);
136
-        }
137
-        // finish parsing process
138
-        $parser->doParse(0, 0);
127
+		if ($this->smarty->_parserdebug) {
128
+			$parser->PrintTrace();
129
+		}
130
+		// get tokens from lexer and parse them
131
+		while ($lex->yylex()) {
132
+			if ($this->smarty->_parserdebug) {
133
+				echo "<br>Parsing  {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n";
134
+			}
135
+			$parser->doParse($lex->token, $lex->value);
136
+		}
137
+		// finish parsing process
138
+		$parser->doParse(0, 0);
139 139
 
140
-        if ($mbEncoding) {
141
-            mb_internal_encoding($mbEncoding);
142
-        }
143
-        if ($this->smarty->debugging) {
144
-            $this->smarty->_debug->end_compile($this->template);
145
-        }
146
-        // template header code
147
-        $template_header =
148
-            "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
149
-            "\n";
150
-        $template_header .= "         compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
140
+		if ($mbEncoding) {
141
+			mb_internal_encoding($mbEncoding);
142
+		}
143
+		if ($this->smarty->debugging) {
144
+			$this->smarty->_debug->end_compile($this->template);
145
+		}
146
+		// template header code
147
+		$template_header =
148
+			"<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
149
+			"\n";
150
+		$template_header .= "         compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
151 151
 
152
-        $code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' .
153
-                var_export($this->config_data, true) . '); ?>';
154
-        return $template_header . $this->template->smarty->ext->_codeFrame->create($this->template, $code);
155
-    }
152
+		$code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' .
153
+				var_export($this->config_data, true) . '); ?>';
154
+		return $template_header . $this->template->smarty->ext->_codeFrame->create($this->template, $code);
155
+	}
156 156
 
157
-    /**
158
-     * display compiler error messages without dying
159
-     * If parameter $args is empty it is a parser detected syntax error.
160
-     * In this case the parser is called to obtain information about expected tokens.
161
-     * If parameter $args contains a string this is used as error message
162
-     *
163
-     * @param string $args individual error message or null
164
-     *
165
-     * @throws SmartyCompilerException
166
-     */
167
-    public function trigger_config_file_error($args = null)
168
-    {
169
-        $this->lex = Smarty_Internal_Configfilelexer::instance();
170
-        $this->parser = Smarty_Internal_Configfileparser::instance();
171
-        // get config source line which has error
172
-        $line = $this->lex->line;
173
-        if (isset($args)) {
174
-            // $line--;
175
-        }
176
-        $match = preg_split("/\n/", $this->lex->data);
177
-        $error_text =
178
-            "Syntax error in config file '{$this->template->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
179
-        if (isset($args)) {
180
-            // individual error message
181
-            $error_text .= $args;
182
-        } else {
183
-            // expected token from parser
184
-            foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
185
-                $exp_token = $this->parser->yyTokenName[ $token ];
186
-                if (isset($this->lex->smarty_token_names[ $exp_token ])) {
187
-                    // token type from lexer
188
-                    $expect[] = '"' . $this->lex->smarty_token_names[ $exp_token ] . '"';
189
-                } else {
190
-                    // otherwise internal token name
191
-                    $expect[] = $this->parser->yyTokenName[ $token ];
192
-                }
193
-            }
194
-            // output parser error message
195
-            $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);
196
-        }
197
-        throw new SmartyCompilerException($error_text);
198
-    }
157
+	/**
158
+	 * display compiler error messages without dying
159
+	 * If parameter $args is empty it is a parser detected syntax error.
160
+	 * In this case the parser is called to obtain information about expected tokens.
161
+	 * If parameter $args contains a string this is used as error message
162
+	 *
163
+	 * @param string $args individual error message or null
164
+	 *
165
+	 * @throws SmartyCompilerException
166
+	 */
167
+	public function trigger_config_file_error($args = null)
168
+	{
169
+		$this->lex = Smarty_Internal_Configfilelexer::instance();
170
+		$this->parser = Smarty_Internal_Configfileparser::instance();
171
+		// get config source line which has error
172
+		$line = $this->lex->line;
173
+		if (isset($args)) {
174
+			// $line--;
175
+		}
176
+		$match = preg_split("/\n/", $this->lex->data);
177
+		$error_text =
178
+			"Syntax error in config file '{$this->template->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
179
+		if (isset($args)) {
180
+			// individual error message
181
+			$error_text .= $args;
182
+		} else {
183
+			// expected token from parser
184
+			foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
185
+				$exp_token = $this->parser->yyTokenName[ $token ];
186
+				if (isset($this->lex->smarty_token_names[ $exp_token ])) {
187
+					// token type from lexer
188
+					$expect[] = '"' . $this->lex->smarty_token_names[ $exp_token ] . '"';
189
+				} else {
190
+					// otherwise internal token name
191
+					$expect[] = $this->parser->yyTokenName[ $token ];
192
+				}
193
+			}
194
+			// output parser error message
195
+			$error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);
196
+		}
197
+		throw new SmartyCompilerException($error_text);
198
+	}
199 199
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
         $this->lexer_class = $lexer_class;
88 88
         $this->parser_class = $parser_class;
89 89
         $this->smarty = $smarty;
90
-        $this->config_data[ 'sections' ] = array();
91
-        $this->config_data[ 'vars' ] = array();
90
+        $this->config_data['sections'] = array();
91
+        $this->config_data['vars'] = array();
92 92
     }
93 93
 
94 94
     /**
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
     public function compileTemplate(Smarty_Internal_Template $template)
102 102
     {
103 103
         $this->template = $template;
104
-        $this->template->compiled->file_dependency[ $this->template->source->uid ] =
104
+        $this->template->compiled->file_dependency[$this->template->source->uid] =
105 105
             array($this->template->source->filepath, $this->template->source->getTimeStamp(),
106 106
                   $this->template->source->type);
107 107
         if ($this->smarty->debugging) {
108
-            if (!isset( $this->smarty->_debug)) {
109
-                $this->smarty->_debug  = new Smarty_Internal_Debug();
108
+            if (!isset($this->smarty->_debug)) {
109
+                $this->smarty->_debug = new Smarty_Internal_Debug();
110 110
             }
111 111
             $this->smarty->_debug->start_compile($this->template);
112 112
         }
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
         } else {
183 183
             // expected token from parser
184 184
             foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
185
-                $exp_token = $this->parser->yyTokenName[ $token ];
186
-                if (isset($this->lex->smarty_token_names[ $exp_token ])) {
185
+                $exp_token = $this->parser->yyTokenName[$token];
186
+                if (isset($this->lex->smarty_token_names[$exp_token])) {
187 187
                     // token type from lexer
188
-                    $expect[] = '"' . $this->lex->smarty_token_names[ $exp_token ] . '"';
188
+                    $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
189 189
                 } else {
190 190
                     // otherwise internal token name
191
-                    $expect[] = $this->parser->yyTokenName[ $token ];
191
+                    $expect[] = $this->parser->yyTokenName[$token];
192 192
                 }
193 193
             }
194 194
             // output parser error message
Please login to merge, or discard this patch.
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.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php 2 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -15,168 +15,168 @@
 block discarded – undo
15 15
  */
16 16
 class Smarty_Internal_Runtime_GetIncludePath
17 17
 {
18
-    /**
19
-     * include path cache
20
-     *
21
-     * @var string
22
-     */
23
-    public $_include_path = '';
18
+	/**
19
+	 * include path cache
20
+	 *
21
+	 * @var string
22
+	 */
23
+	public $_include_path = '';
24 24
 
25
-    /**
26
-     * include path directory cache
27
-     *
28
-     * @var array
29
-     */
30
-    public $_include_dirs = array();
25
+	/**
26
+	 * include path directory cache
27
+	 *
28
+	 * @var array
29
+	 */
30
+	public $_include_dirs = array();
31 31
 
32
-    /**
33
-     * include path directory cache
34
-     *
35
-     * @var array
36
-     */
37
-    public $_user_dirs = array();
32
+	/**
33
+	 * include path directory cache
34
+	 *
35
+	 * @var array
36
+	 */
37
+	public $_user_dirs = array();
38 38
 
39
-    /**
40
-     * stream cache
41
-     *
42
-     * @var string[]
43
-     */
44
-    public $isFile = array();
39
+	/**
40
+	 * stream cache
41
+	 *
42
+	 * @var string[]
43
+	 */
44
+	public $isFile = array();
45 45
 
46
-    /**
47
-     * stream cache
48
-     *
49
-     * @var string[]
50
-     */
51
-    public $isPath = array();
46
+	/**
47
+	 * stream cache
48
+	 *
49
+	 * @var string[]
50
+	 */
51
+	public $isPath = array();
52 52
 
53
-    /**
54
-     * stream cache
55
-     *
56
-     * @var int[]
57
-     */
58
-    public $number = array();
53
+	/**
54
+	 * stream cache
55
+	 *
56
+	 * @var int[]
57
+	 */
58
+	public $number = array();
59 59
 
60
-    /**
61
-     * status cache
62
-     *
63
-     * @var bool
64
-     */
65
-    public $_has_stream_include = null;
60
+	/**
61
+	 * status cache
62
+	 *
63
+	 * @var bool
64
+	 */
65
+	public $_has_stream_include = null;
66 66
 
67
-    /**
68
-     * Number for array index
69
-     *
70
-     * @var int
71
-     */
72
-    public $counter = 0;
67
+	/**
68
+	 * Number for array index
69
+	 *
70
+	 * @var int
71
+	 */
72
+	public $counter = 0;
73 73
 
74
-    /**
75
-     * Check if include path was updated
76
-     *
77
-     * @param \Smarty $smarty
78
-     *
79
-     * @return bool
80
-     */
81
-    public function isNewIncludePath(Smarty $smarty)
82
-    {
83
-        $_i_path = get_include_path();
84
-        if ($this->_include_path != $_i_path) {
85
-            $this->_include_dirs = array();
86
-            $this->_include_path = $_i_path;
87
-            $_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
88
-            foreach ($_dirs as $_path) {
89
-                if (is_dir($_path)) {
90
-                    $this->_include_dirs[] = $smarty->_realpath($_path . DS, true);
91
-                }
92
-            }
93
-            return true;
94
-        }
95
-        return false;
96
-    }
74
+	/**
75
+	 * Check if include path was updated
76
+	 *
77
+	 * @param \Smarty $smarty
78
+	 *
79
+	 * @return bool
80
+	 */
81
+	public function isNewIncludePath(Smarty $smarty)
82
+	{
83
+		$_i_path = get_include_path();
84
+		if ($this->_include_path != $_i_path) {
85
+			$this->_include_dirs = array();
86
+			$this->_include_path = $_i_path;
87
+			$_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
88
+			foreach ($_dirs as $_path) {
89
+				if (is_dir($_path)) {
90
+					$this->_include_dirs[] = $smarty->_realpath($_path . DS, true);
91
+				}
92
+			}
93
+			return true;
94
+		}
95
+		return false;
96
+	}
97 97
 
98
-    /**
99
-     * return array with include path directories
100
-     *
101
-     * @param \Smarty $smarty
102
-     *
103
-     * @return array
104
-     */
105
-    public function getIncludePathDirs(Smarty $smarty)
106
-    {
107
-        $this->isNewIncludePath($smarty);
108
-        return $this->_include_dirs;
109
-    }
98
+	/**
99
+	 * return array with include path directories
100
+	 *
101
+	 * @param \Smarty $smarty
102
+	 *
103
+	 * @return array
104
+	 */
105
+	public function getIncludePathDirs(Smarty $smarty)
106
+	{
107
+		$this->isNewIncludePath($smarty);
108
+		return $this->_include_dirs;
109
+	}
110 110
 
111
-    /**
112
-     * Return full file path from PHP include_path
113
-     *
114
-     * @param  string[] $dirs
115
-     * @param  string   $file
116
-     * @param \Smarty   $smarty
117
-     *
118
-     * @return bool|string full filepath or false
119
-     *
120
-     */
121
-    public function getIncludePath($dirs, $file, Smarty $smarty)
122
-    {
123
-        //if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
124
-        if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
125
-            $this->_has_stream_include = function_exists('stream_resolve_include_path'))
126
-        ) {
127
-            $this->isNewIncludePath($smarty);
128
-        }
129
-        // try PHP include_path
130
-        foreach ($dirs as $dir) {
131
-            $dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter ++;
132
-            if (isset($this->isFile[ $dir_n ][ $file ])) {
133
-                if ($this->isFile[ $dir_n ][ $file ]) {
134
-                    return $this->isFile[ $dir_n ][ $file ];
135
-                } else {
136
-                    continue;
137
-                }
138
-            }
139
-            if (isset($this->_user_dirs[ $dir_n ])) {
140
-                if (false === $this->_user_dirs[ $dir_n ]) {
141
-                    continue;
142
-                } else {
143
-                    $dir = $this->_user_dirs[ $dir_n ];
144
-                }
145
-            } else {
146
-                if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
147
-                    $dir = str_ireplace(getcwd(), '.', $dir);
148
-                    if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
149
-                        $this->_user_dirs[ $dir_n ] = false;
150
-                        continue;
151
-                    }
152
-                }
153
-                $dir = substr($dir, 2);
154
-                $this->_user_dirs[ $dir_n ] = $dir;
155
-            }
156
-            if ($this->_has_stream_include) {
157
-                $path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
158
-                if ($path) {
159
-                    return $this->isFile[ $dir_n ][ $file ] = $path;
160
-                }
161
-            } else {
162
-                foreach ($this->_include_dirs as $key => $_i_path) {
163
-                    $path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
164
-                        $this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
165
-                    if ($path === false) {
166
-                        continue;
167
-                    }
168
-                    if (isset($file)) {
169
-                        $_file = $this->isFile[ $dir_n ][ $file ] = (is_file($path . $file)) ? $path . $file : false;
170
-                        if ($_file) {
171
-                            return $_file;
172
-                        }
173
-                    } else {
174
-                        // no file was given return directory path
175
-                        return $path;
176
-                    }
177
-                }
178
-            }
179
-        }
180
-        return false;
181
-    }
111
+	/**
112
+	 * Return full file path from PHP include_path
113
+	 *
114
+	 * @param  string[] $dirs
115
+	 * @param  string   $file
116
+	 * @param \Smarty   $smarty
117
+	 *
118
+	 * @return bool|string full filepath or false
119
+	 *
120
+	 */
121
+	public function getIncludePath($dirs, $file, Smarty $smarty)
122
+	{
123
+		//if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
124
+		if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
125
+			$this->_has_stream_include = function_exists('stream_resolve_include_path'))
126
+		) {
127
+			$this->isNewIncludePath($smarty);
128
+		}
129
+		// try PHP include_path
130
+		foreach ($dirs as $dir) {
131
+			$dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter ++;
132
+			if (isset($this->isFile[ $dir_n ][ $file ])) {
133
+				if ($this->isFile[ $dir_n ][ $file ]) {
134
+					return $this->isFile[ $dir_n ][ $file ];
135
+				} else {
136
+					continue;
137
+				}
138
+			}
139
+			if (isset($this->_user_dirs[ $dir_n ])) {
140
+				if (false === $this->_user_dirs[ $dir_n ]) {
141
+					continue;
142
+				} else {
143
+					$dir = $this->_user_dirs[ $dir_n ];
144
+				}
145
+			} else {
146
+				if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
147
+					$dir = str_ireplace(getcwd(), '.', $dir);
148
+					if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
149
+						$this->_user_dirs[ $dir_n ] = false;
150
+						continue;
151
+					}
152
+				}
153
+				$dir = substr($dir, 2);
154
+				$this->_user_dirs[ $dir_n ] = $dir;
155
+			}
156
+			if ($this->_has_stream_include) {
157
+				$path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
158
+				if ($path) {
159
+					return $this->isFile[ $dir_n ][ $file ] = $path;
160
+				}
161
+			} else {
162
+				foreach ($this->_include_dirs as $key => $_i_path) {
163
+					$path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
164
+						$this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
165
+					if ($path === false) {
166
+						continue;
167
+					}
168
+					if (isset($file)) {
169
+						$_file = $this->isFile[ $dir_n ][ $file ] = (is_file($path . $file)) ? $path . $file : false;
170
+						if ($_file) {
171
+							return $_file;
172
+						}
173
+					} else {
174
+						// no file was given return directory path
175
+						return $path;
176
+					}
177
+				}
178
+			}
179
+		}
180
+		return false;
181
+	}
182 182
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -17 removed lines patch added patch discarded remove patch
@@ -121,52 +121,50 @@
 block discarded – undo
121 121
     public function getIncludePath($dirs, $file, Smarty $smarty)
122 122
     {
123 123
         //if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
124
-        if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
125
-            $this->_has_stream_include = function_exists('stream_resolve_include_path'))
124
+        if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = function_exists('stream_resolve_include_path'))
126 125
         ) {
127 126
             $this->isNewIncludePath($smarty);
128 127
         }
129 128
         // try PHP include_path
130 129
         foreach ($dirs as $dir) {
131
-            $dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter ++;
132
-            if (isset($this->isFile[ $dir_n ][ $file ])) {
133
-                if ($this->isFile[ $dir_n ][ $file ]) {
134
-                    return $this->isFile[ $dir_n ][ $file ];
130
+            $dir_n = isset($this->number[$dir]) ? $this->number[$dir] : $this->number[$dir] = $this->counter++;
131
+            if (isset($this->isFile[$dir_n][$file])) {
132
+                if ($this->isFile[$dir_n][$file]) {
133
+                    return $this->isFile[$dir_n][$file];
135 134
                 } else {
136 135
                     continue;
137 136
                 }
138 137
             }
139
-            if (isset($this->_user_dirs[ $dir_n ])) {
140
-                if (false === $this->_user_dirs[ $dir_n ]) {
138
+            if (isset($this->_user_dirs[$dir_n])) {
139
+                if (false === $this->_user_dirs[$dir_n]) {
141 140
                     continue;
142 141
                 } else {
143
-                    $dir = $this->_user_dirs[ $dir_n ];
142
+                    $dir = $this->_user_dirs[$dir_n];
144 143
                 }
145 144
             } else {
146
-                if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
145
+                if ($dir[0] == '/' || $dir[1] == ':') {
147 146
                     $dir = str_ireplace(getcwd(), '.', $dir);
148
-                    if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
149
-                        $this->_user_dirs[ $dir_n ] = false;
147
+                    if ($dir[0] == '/' || $dir[1] == ':') {
148
+                        $this->_user_dirs[$dir_n] = false;
150 149
                         continue;
151 150
                     }
152 151
                 }
153 152
                 $dir = substr($dir, 2);
154
-                $this->_user_dirs[ $dir_n ] = $dir;
153
+                $this->_user_dirs[$dir_n] = $dir;
155 154
             }
156 155
             if ($this->_has_stream_include) {
157 156
                 $path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
158 157
                 if ($path) {
159
-                    return $this->isFile[ $dir_n ][ $file ] = $path;
158
+                    return $this->isFile[$dir_n][$file] = $path;
160 159
                 }
161 160
             } else {
162 161
                 foreach ($this->_include_dirs as $key => $_i_path) {
163
-                    $path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
164
-                        $this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
162
+                    $path = isset($this->isPath[$key][$dir_n]) ? $this->isPath[$key][$dir_n] : $this->isPath[$key][$dir_n] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
165 163
                     if ($path === false) {
166 164
                         continue;
167 165
                     }
168 166
                     if (isset($file)) {
169
-                        $_file = $this->isFile[ $dir_n ][ $file ] = (is_file($path . $file)) ? $path . $file : false;
167
+                        $_file = $this->isFile[$dir_n][$file] = (is_file($path . $file)) ? $path . $file : false;
170 168
                         if ($_file) {
171 169
                             return $_file;
172 170
                         }
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php 3 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -11,110 +11,110 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_ClearCompiledTemplate
13 13
 {
14
-    /**
15
-     * Valid for Smarty object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 1;
14
+	/**
15
+	 * Valid for Smarty object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 1;
20 20
 
21
-    /**
22
-     * Delete compiled template file
23
-     *
24
-     * @api  Smarty::clearCompiledTemplate()
25
-     * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl
26
-     *
27
-     * @param \Smarty  $smarty
28
-     * @param  string  $resource_name template name
29
-     * @param  string  $compile_id    compile id
30
-     * @param  integer $exp_time      expiration time
31
-     *
32
-     * @return integer number of template files deleted
33
-     */
34
-    public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
35
-    {
36
-        // clear template objects cache
37
-        $smarty->_clearTemplateCache();
21
+	/**
22
+	 * Delete compiled template file
23
+	 *
24
+	 * @api  Smarty::clearCompiledTemplate()
25
+	 * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl
26
+	 *
27
+	 * @param \Smarty  $smarty
28
+	 * @param  string  $resource_name template name
29
+	 * @param  string  $compile_id    compile id
30
+	 * @param  integer $exp_time      expiration time
31
+	 *
32
+	 * @return integer number of template files deleted
33
+	 */
34
+	public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
35
+	{
36
+		// clear template objects cache
37
+		$smarty->_clearTemplateCache();
38 38
 
39
-        $_compile_dir = $smarty->getCompileDir();
40
-        if ($_compile_dir == '/') { //We should never want to delete this!
41
-            return 0;
42
-        }
43
-        $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
44
-        $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
45
-        if (isset($resource_name)) {
46
-            $_save_stat = $smarty->caching;
47
-            $smarty->caching = false;
48
-            /* @var Smarty_Internal_Template $tpl */
49
-            $tpl = new $smarty->template_class($resource_name, $smarty);
50
-            $smarty->caching = $_save_stat;
51
-            if (!$tpl->source->handler->uncompiled && !$tpl->source->handler->recompiled && $tpl->source->exists) {
52
-                $_resource_part_1 = basename(str_replace('^', DS, $tpl->compiled->filepath));
53
-                $_resource_part_1_length = strlen($_resource_part_1);
54
-            } else {
55
-                return 0;
56
-            }
57
-            $_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
58
-            $_resource_part_2_length = strlen($_resource_part_2);
59
-        }
60
-        $_dir = $_compile_dir;
61
-        if ($smarty->use_sub_dirs && isset($_compile_id)) {
62
-            $_dir .= $_compile_id . $_dir_sep;
63
-        }
64
-        if (isset($_compile_id)) {
65
-            $_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;
66
-            $_compile_id_part_length = strlen($_compile_id_part);
67
-        }
68
-        $_count = 0;
69
-        try {
70
-            $_compileDirs = new RecursiveDirectoryIterator($_dir);
71
-            // NOTE: UnexpectedValueException thrown for PHP >= 5.3
72
-        }
73
-        catch (Exception $e) {
74
-            return 0;
75
-        }
76
-        $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
77
-        foreach ($_compile as $_file) {
78
-            if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
79
-                continue;
80
-            }
39
+		$_compile_dir = $smarty->getCompileDir();
40
+		if ($_compile_dir == '/') { //We should never want to delete this!
41
+			return 0;
42
+		}
43
+		$_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
44
+		$_dir_sep = $smarty->use_sub_dirs ? DS : '^';
45
+		if (isset($resource_name)) {
46
+			$_save_stat = $smarty->caching;
47
+			$smarty->caching = false;
48
+			/* @var Smarty_Internal_Template $tpl */
49
+			$tpl = new $smarty->template_class($resource_name, $smarty);
50
+			$smarty->caching = $_save_stat;
51
+			if (!$tpl->source->handler->uncompiled && !$tpl->source->handler->recompiled && $tpl->source->exists) {
52
+				$_resource_part_1 = basename(str_replace('^', DS, $tpl->compiled->filepath));
53
+				$_resource_part_1_length = strlen($_resource_part_1);
54
+			} else {
55
+				return 0;
56
+			}
57
+			$_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
58
+			$_resource_part_2_length = strlen($_resource_part_2);
59
+		}
60
+		$_dir = $_compile_dir;
61
+		if ($smarty->use_sub_dirs && isset($_compile_id)) {
62
+			$_dir .= $_compile_id . $_dir_sep;
63
+		}
64
+		if (isset($_compile_id)) {
65
+			$_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;
66
+			$_compile_id_part_length = strlen($_compile_id_part);
67
+		}
68
+		$_count = 0;
69
+		try {
70
+			$_compileDirs = new RecursiveDirectoryIterator($_dir);
71
+			// NOTE: UnexpectedValueException thrown for PHP >= 5.3
72
+		}
73
+		catch (Exception $e) {
74
+			return 0;
75
+		}
76
+		$_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
77
+		foreach ($_compile as $_file) {
78
+			if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
79
+				continue;
80
+			}
81 81
 
82
-            $_filepath = (string) $_file;
82
+			$_filepath = (string) $_file;
83 83
 
84
-            if ($_file->isDir()) {
85
-                if (!$_compile->isDot()) {
86
-                    // delete folder if empty
87
-                    @rmdir($_file->getPathname());
88
-                }
89
-            } else {
90
-                $unlink = false;
91
-                if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =
92
-                                !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
93
-                    (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) &&
94
-                                                substr_compare($_filepath, $_resource_part_1,
95
-                                                               - $_resource_part_1_length, $_resource_part_1_length) ==
96
-                                                0) || (isset($_filepath[ $_resource_part_2_length ]) &&
97
-                                                       substr_compare($_filepath, $_resource_part_2,
98
-                                                                      - $_resource_part_2_length,
99
-                                                                      $_resource_part_2_length) == 0))
100
-                ) {
101
-                    if (isset($exp_time)) {
102
-                        if (time() - @filemtime($_filepath) >= $exp_time) {
103
-                            $unlink = true;
104
-                        }
105
-                    } else {
106
-                        $unlink = true;
107
-                    }
108
-                }
84
+			if ($_file->isDir()) {
85
+				if (!$_compile->isDot()) {
86
+					// delete folder if empty
87
+					@rmdir($_file->getPathname());
88
+				}
89
+			} else {
90
+				$unlink = false;
91
+				if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =
92
+								!strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
93
+					(!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) &&
94
+												substr_compare($_filepath, $_resource_part_1,
95
+															   - $_resource_part_1_length, $_resource_part_1_length) ==
96
+												0) || (isset($_filepath[ $_resource_part_2_length ]) &&
97
+													   substr_compare($_filepath, $_resource_part_2,
98
+																	  - $_resource_part_2_length,
99
+																	  $_resource_part_2_length) == 0))
100
+				) {
101
+					if (isset($exp_time)) {
102
+						if (time() - @filemtime($_filepath) >= $exp_time) {
103
+							$unlink = true;
104
+						}
105
+					} else {
106
+						$unlink = true;
107
+					}
108
+				}
109 109
 
110
-                if ($unlink && @unlink($_filepath)) {
111
-                    $_count ++;
112
-                    if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
113
-                        opcache_invalidate($_filepath, true);
114
-                    }
115
-                }
116
-            }
117
-        }
118
-        return $_count;
119
-    }
110
+				if ($unlink && @unlink($_filepath)) {
111
+					$_count ++;
112
+					if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
113
+						opcache_invalidate($_filepath, true);
114
+					}
115
+				}
116
+			}
117
+		}
118
+		return $_count;
119
+	}
120 120
 }
121 121
\ 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
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
                 }
89 89
             } else {
90 90
                 $unlink = false;
91
-                if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =
91
+                if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && $a =
92 92
                                 !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
93
-                    (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) &&
93
+                    (!isset($resource_name) || (isset($_filepath[$_resource_part_1_length]) &&
94 94
                                                 substr_compare($_filepath, $_resource_part_1,
95 95
                                                                - $_resource_part_1_length, $_resource_part_1_length) ==
96
-                                                0) || (isset($_filepath[ $_resource_part_2_length ]) &&
96
+                                                0) || (isset($_filepath[$_resource_part_2_length]) &&
97 97
                                                        substr_compare($_filepath, $_resource_part_2,
98 98
                                                                       - $_resource_part_2_length,
99 99
                                                                       $_resource_part_2_length) == 0))
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 }
109 109
 
110 110
                 if ($unlink && @unlink($_filepath)) {
111
-                    $_count ++;
111
+                    $_count++;
112 112
                     if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
113 113
                         opcache_invalidate($_filepath, true);
114 114
                     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,8 +213,7 @@
 block discarded – undo
213 213
                 error_reporting($_smarty_old_error_level);
214 214
             }
215 215
             return $result;
216
-        }
217
-        catch (Exception $e) {
216
+        } catch (Exception $e) {
218 217
             while (ob_get_level() > $level) {
219 218
                 ob_end_clean();
220 219
             }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_config_load.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -16,83 +16,83 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
18 18
 {
19
-    /**
20
-     * Attribute definition: Overwrites base class.
21
-     *
22
-     * @var array
23
-     * @see Smarty_Internal_CompileBase
24
-     */
25
-    public $required_attributes = array('file');
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $required_attributes = array('file');
26 26
 
27
-    /**
28
-     * Attribute definition: Overwrites base class.
29
-     *
30
-     * @var array
31
-     * @see Smarty_Internal_CompileBase
32
-     */
33
-    public $shorttag_order = array('file', 'section');
27
+	/**
28
+	 * Attribute definition: Overwrites base class.
29
+	 *
30
+	 * @var array
31
+	 * @see Smarty_Internal_CompileBase
32
+	 */
33
+	public $shorttag_order = array('file', 'section');
34 34
 
35
-    /**
36
-     * Attribute definition: Overwrites base class.
37
-     *
38
-     * @var array
39
-     * @see Smarty_Internal_CompileBase
40
-     */
41
-    public $optional_attributes = array('section', 'scope');
35
+	/**
36
+	 * Attribute definition: Overwrites base class.
37
+	 *
38
+	 * @var array
39
+	 * @see Smarty_Internal_CompileBase
40
+	 */
41
+	public $optional_attributes = array('section', 'scope');
42 42
 
43
-    /**
44
-     * Attribute definition: Overwrites base class.
45
-     *
46
-     * @var array
47
-     * @see Smarty_Internal_CompileBase
48
-     */
49
-    public $option_flags = array('nocache', 'noscope');
43
+	/**
44
+	 * Attribute definition: Overwrites base class.
45
+	 *
46
+	 * @var array
47
+	 * @see Smarty_Internal_CompileBase
48
+	 */
49
+	public $option_flags = array('nocache', 'noscope');
50 50
 
51
-    /**
52
-     * Valid scope names
53
-     *
54
-     * @var array
55
-     */
56
-    public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
57
-                                 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT,
58
-                                 'smarty' => Smarty::SCOPE_SMARTY);
51
+	/**
52
+	 * Valid scope names
53
+	 *
54
+	 * @var array
55
+	 */
56
+	public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
57
+								 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT,
58
+								 'smarty' => Smarty::SCOPE_SMARTY);
59 59
 
60
-    /**
61
-     * Compiles code for the {config_load} tag
62
-     *
63
-     * @param  array                                $args     array with attributes from parser
64
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
65
-     *
66
-     * @return string compiled code
67
-     * @throws \SmartyCompilerException
68
-     */
69
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
70
-    {
71
-        // check and get attributes
72
-        $_attr = $this->getAttributes($compiler, $args);
60
+	/**
61
+	 * Compiles code for the {config_load} tag
62
+	 *
63
+	 * @param  array                                $args     array with attributes from parser
64
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
65
+	 *
66
+	 * @return string compiled code
67
+	 * @throws \SmartyCompilerException
68
+	 */
69
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
70
+	{
71
+		// check and get attributes
72
+		$_attr = $this->getAttributes($compiler, $args);
73 73
 
74
-        if ($_attr[ 'nocache' ] === true) {
75
-            $compiler->trigger_template_error('nocache option not allowed', null, true);
76
-        }
74
+		if ($_attr[ 'nocache' ] === true) {
75
+			$compiler->trigger_template_error('nocache option not allowed', null, true);
76
+		}
77 77
 
78
-        // save possible attributes
79
-        $conf_file = $_attr[ 'file' ];
80
-        if (isset($_attr[ 'section' ])) {
81
-            $section = $_attr[ 'section' ];
82
-        } else {
83
-            $section = 'null';
84
-        }
85
-        // scope setup
86
-        if ($_attr[ 'noscope' ]) {
87
-            $_scope = - 1;
88
-        } else {
89
-            $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
90
-        }
78
+		// save possible attributes
79
+		$conf_file = $_attr[ 'file' ];
80
+		if (isset($_attr[ 'section' ])) {
81
+			$section = $_attr[ 'section' ];
82
+		} else {
83
+			$section = 'null';
84
+		}
85
+		// scope setup
86
+		if ($_attr[ 'noscope' ]) {
87
+			$_scope = - 1;
88
+		} else {
89
+			$_scope = $compiler->convertScope($_attr, $this->valid_scopes);
90
+		}
91 91
 
92
-        // create config object
93
-        $_output =
94
-            "<?php\n\$_smarty_tpl->smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n";
92
+		// create config object
93
+		$_output =
94
+			"<?php\n\$_smarty_tpl->smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n";
95 95
 
96
-        return $_output;
97
-    }
96
+		return $_output;
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,19 +71,19 @@
 block discarded – undo
71 71
         // check and get attributes
72 72
         $_attr = $this->getAttributes($compiler, $args);
73 73
 
74
-        if ($_attr[ 'nocache' ] === true) {
74
+        if ($_attr['nocache'] === true) {
75 75
             $compiler->trigger_template_error('nocache option not allowed', null, true);
76 76
         }
77 77
 
78 78
         // save possible attributes
79
-        $conf_file = $_attr[ 'file' ];
80
-        if (isset($_attr[ 'section' ])) {
81
-            $section = $_attr[ 'section' ];
79
+        $conf_file = $_attr['file'];
80
+        if (isset($_attr['section'])) {
81
+            $section = $_attr['section'];
82 82
         } else {
83 83
             $section = 'null';
84 84
         }
85 85
         // scope setup
86
-        if ($_attr[ 'noscope' ]) {
86
+        if ($_attr['noscope']) {
87 87
             $_scope = - 1;
88 88
         } else {
89 89
             $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
Please login to merge, or discard this patch.