Completed
Push — developer ( 67fdb5...f9e515 )
by Błażej
469:22 queued 431:37
created
Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -16,131 +16,131 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Private_Print_Expression 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 $optional_attributes = array('assign');
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $optional_attributes = array('assign');
26 26
 
27
-    /**
28
-     * Attribute definition: Overwrites base class.
29
-     *
30
-     * @var array
31
-     * @see Smarty_Internal_CompileBase
32
-     */
33
-    public $option_flags = array('nocache', 'nofilter');
27
+	/**
28
+	 * Attribute definition: Overwrites base class.
29
+	 *
30
+	 * @var array
31
+	 * @see Smarty_Internal_CompileBase
32
+	 */
33
+	public $option_flags = array('nocache', 'nofilter');
34 34
 
35
-    /**
36
-     * Compiles code for generating output from any expression
37
-     *
38
-     * @param array                                 $args      array with attributes from parser
39
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
40
-     * @param array                                 $parameter array with compilation parameter
41
-     *
42
-     * @return string
43
-     * @throws \SmartyException
44
-     */
45
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
46
-    {
47
-        // check and get attributes
48
-        $_attr = $this->getAttributes($compiler, $args);
49
-        $output = $parameter[ 'value' ];
50
-        // tag modifier
51
-        if (!empty($parameter[ 'modifierlist' ])) {
52
-            $output = $compiler->compileTag('private_modifier', array(),
53
-                                            array('modifierlist' => $parameter[ 'modifierlist' ],
54
-                                                  'value' => $output));
55
-        }
56
-        if (isset($_attr[ 'assign' ])) {
57
-            // assign output to variable
58
-            return "<?php \$_smarty_tpl->assign({$_attr['assign']},{$output});?>";
59
-        } else {
60
-            // display value
61
-            if (!$_attr[ 'nofilter' ]) {
62
-                // default modifier
63
-                if (!empty($compiler->smarty->default_modifiers)) {
64
-                    if (empty($compiler->default_modifier_list)) {
65
-                        $modifierlist = array();
66
-                        foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
67
-                            preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
68
-                                           $single_default_modifier, $mod_array);
69
-                            for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
70
-                                if ($mod_array[ 0 ][ $i ] != ':') {
71
-                                    $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
72
-                                }
73
-                            }
74
-                        }
75
-                        $compiler->default_modifier_list = $modifierlist;
76
-                    }
77
-                    $output = $compiler->compileTag('private_modifier', array(),
78
-                                                    array('modifierlist' => $compiler->default_modifier_list,
79
-                                                          'value' => $output));
80
-                }
81
-                // autoescape html
82
-                if ($compiler->template->smarty->escape_html) {
83
-                    $output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
84
-                }
85
-                // loop over registered filters
86
-                if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
87
-                    foreach ($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ] as $key =>
88
-                             $function) {
89
-                        if (!is_array($function)) {
90
-                            $output = "{$function}({$output},\$_smarty_tpl)";
91
-                        } elseif (is_object($function[ 0 ])) {
92
-                            $output =
93
-                                "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
94
-                        } else {
95
-                            $output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
96
-                        }
97
-                    }
98
-                }
99
-                // auto loaded filters
100
-                if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) {
101
-                    foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name)
102
-                    {
103
-                        $result = $this->compile_output_filter($compiler, $name, $output);
104
-                        if ($result !== false) {
105
-                            $output = $result;
106
-                        } else {
107
-                            // not found, throw exception
108
-                            throw new SmartyException("Unable to load filter '{$name}'");
109
-                        }
110
-                    }
111
-                }
112
-                foreach ($compiler->variable_filters as $filter) {
113
-                    if (count($filter) == 1 &&
114
-                        ($result = $this->compile_output_filter($compiler, $filter[ 0 ], $output)) !== false
115
-                    ) {
116
-                        $output = $result;
117
-                    } else {
118
-                        $output = $compiler->compileTag('private_modifier', array(),
119
-                                                        array('modifierlist' => array($filter), 'value' => $output));
120
-                    }
121
-                }
122
-            }
35
+	/**
36
+	 * Compiles code for generating output from any expression
37
+	 *
38
+	 * @param array                                 $args      array with attributes from parser
39
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
40
+	 * @param array                                 $parameter array with compilation parameter
41
+	 *
42
+	 * @return string
43
+	 * @throws \SmartyException
44
+	 */
45
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
46
+	{
47
+		// check and get attributes
48
+		$_attr = $this->getAttributes($compiler, $args);
49
+		$output = $parameter[ 'value' ];
50
+		// tag modifier
51
+		if (!empty($parameter[ 'modifierlist' ])) {
52
+			$output = $compiler->compileTag('private_modifier', array(),
53
+											array('modifierlist' => $parameter[ 'modifierlist' ],
54
+												  'value' => $output));
55
+		}
56
+		if (isset($_attr[ 'assign' ])) {
57
+			// assign output to variable
58
+			return "<?php \$_smarty_tpl->assign({$_attr['assign']},{$output});?>";
59
+		} else {
60
+			// display value
61
+			if (!$_attr[ 'nofilter' ]) {
62
+				// default modifier
63
+				if (!empty($compiler->smarty->default_modifiers)) {
64
+					if (empty($compiler->default_modifier_list)) {
65
+						$modifierlist = array();
66
+						foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
67
+							preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
68
+										   $single_default_modifier, $mod_array);
69
+							for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
70
+								if ($mod_array[ 0 ][ $i ] != ':') {
71
+									$modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
72
+								}
73
+							}
74
+						}
75
+						$compiler->default_modifier_list = $modifierlist;
76
+					}
77
+					$output = $compiler->compileTag('private_modifier', array(),
78
+													array('modifierlist' => $compiler->default_modifier_list,
79
+														  'value' => $output));
80
+				}
81
+				// autoescape html
82
+				if ($compiler->template->smarty->escape_html) {
83
+					$output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
84
+				}
85
+				// loop over registered filters
86
+				if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
87
+					foreach ($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ] as $key =>
88
+							 $function) {
89
+						if (!is_array($function)) {
90
+							$output = "{$function}({$output},\$_smarty_tpl)";
91
+						} elseif (is_object($function[ 0 ])) {
92
+							$output =
93
+								"\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
94
+						} else {
95
+							$output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
96
+						}
97
+					}
98
+				}
99
+				// auto loaded filters
100
+				if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) {
101
+					foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name)
102
+					{
103
+						$result = $this->compile_output_filter($compiler, $name, $output);
104
+						if ($result !== false) {
105
+							$output = $result;
106
+						} else {
107
+							// not found, throw exception
108
+							throw new SmartyException("Unable to load filter '{$name}'");
109
+						}
110
+					}
111
+				}
112
+				foreach ($compiler->variable_filters as $filter) {
113
+					if (count($filter) == 1 &&
114
+						($result = $this->compile_output_filter($compiler, $filter[ 0 ], $output)) !== false
115
+					) {
116
+						$output = $result;
117
+					} else {
118
+						$output = $compiler->compileTag('private_modifier', array(),
119
+														array('modifierlist' => array($filter), 'value' => $output));
120
+					}
121
+				}
122
+			}
123 123
 
124
-            $compiler->has_output = true;
125
-            $output = "<?php echo {$output};?>";
126
-        }
124
+			$compiler->has_output = true;
125
+			$output = "<?php echo {$output};?>";
126
+		}
127 127
 
128
-        return $output;
129
-    }
128
+		return $output;
129
+	}
130 130
 
131
-    /**
132
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
133
-     * @param string                                $name     name of variable filter
134
-     * @param string                                $output   embedded output
135
-     *
136
-     * @return string
137
-     */
138
-    private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output)
139
-    {
140
-        $plugin_name = "smarty_variablefilter_{$name}";
141
-        $path = $compiler->smarty->loadPlugin($plugin_name);
142
-        if ($path) {
143
-            /**
131
+	/**
132
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
133
+	 * @param string                                $name     name of variable filter
134
+	 * @param string                                $output   embedded output
135
+	 *
136
+	 * @return string
137
+	 */
138
+	private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output)
139
+	{
140
+		$plugin_name = "smarty_variablefilter_{$name}";
141
+		$path = $compiler->smarty->loadPlugin($plugin_name);
142
+		if ($path) {
143
+			/**
144 144
             if ($compiler->template->caching) {
145 145
                 $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] =
146 146
                     $path;
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
                 $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] =
153 153
                     $plugin_name;
154 154
             }
155
-             * */
156
-            return "{$plugin_name}({$output},\$_smarty_tpl)";
157
-        } else {
158
-            // not found
159
-            return false;
160
-        }
161
-    }
155
+			 * */
156
+			return "{$plugin_name}({$output},\$_smarty_tpl)";
157
+		} else {
158
+			// not found
159
+			return false;
160
+		}
161
+	}
162 162
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
     {
47 47
         // check and get attributes
48 48
         $_attr = $this->getAttributes($compiler, $args);
49
-        $output = $parameter[ 'value' ];
49
+        $output = $parameter['value'];
50 50
         // tag modifier
51
-        if (!empty($parameter[ 'modifierlist' ])) {
51
+        if (!empty($parameter['modifierlist'])) {
52 52
             $output = $compiler->compileTag('private_modifier', array(),
53
-                                            array('modifierlist' => $parameter[ 'modifierlist' ],
53
+                                            array('modifierlist' => $parameter['modifierlist'],
54 54
                                                   'value' => $output));
55 55
         }
56
-        if (isset($_attr[ 'assign' ])) {
56
+        if (isset($_attr['assign'])) {
57 57
             // assign output to variable
58 58
             return "<?php \$_smarty_tpl->assign({$_attr['assign']},{$output});?>";
59 59
         } else {
60 60
             // display value
61
-            if (!$_attr[ 'nofilter' ]) {
61
+            if (!$_attr['nofilter']) {
62 62
                 // default modifier
63 63
                 if (!empty($compiler->smarty->default_modifiers)) {
64 64
                     if (empty($compiler->default_modifier_list)) {
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
                         foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
67 67
                             preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
68 68
                                            $single_default_modifier, $mod_array);
69
-                            for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
70
-                                if ($mod_array[ 0 ][ $i ] != ':') {
71
-                                    $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
69
+                            for ($i = 0, $count = count($mod_array[0]); $i < $count; $i++) {
70
+                                if ($mod_array[0][$i] != ':') {
71
+                                    $modifierlist[$key][] = $mod_array[0][$i];
72 72
                                 }
73 73
                             }
74 74
                         }
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
                     $output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
84 84
                 }
85 85
                 // loop over registered filters
86
-                if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
87
-                    foreach ($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ] as $key =>
86
+                if (!empty($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE])) {
87
+                    foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key =>
88 88
                              $function) {
89 89
                         if (!is_array($function)) {
90 90
                             $output = "{$function}({$output},\$_smarty_tpl)";
91
-                        } elseif (is_object($function[ 0 ])) {
91
+                        } elseif (is_object($function[0])) {
92 92
                             $output =
93 93
                                 "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
94 94
                         } else {
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
                     }
98 98
                 }
99 99
                 // auto loaded filters
100
-                if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) {
101
-                    foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name)
100
+                if (isset($compiler->smarty->autoload_filters[Smarty::FILTER_VARIABLE])) {
101
+                    foreach ((array) $compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name)
102 102
                     {
103 103
                         $result = $this->compile_output_filter($compiler, $name, $output);
104 104
                         if ($result !== false) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 }
112 112
                 foreach ($compiler->variable_filters as $filter) {
113 113
                     if (count($filter) == 1 &&
114
-                        ($result = $this->compile_output_filter($compiler, $filter[ 0 ], $output)) !== false
114
+                        ($result = $this->compile_output_filter($compiler, $filter[0], $output)) !== false
115 115
                     ) {
116 116
                         $output = $result;
117 117
                     } else {
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_section.php 2 patches
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -16,386 +16,386 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_ForeachSection
18 18
 {
19
-    /**
20
-     * Attribute definition: Overwrites base class.
21
-     *
22
-     * @var array
23
-     * @see Smarty_Internal_CompileBase
24
-     */
25
-    public $required_attributes = array('name', 'loop');
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $required_attributes = array('name', 'loop');
26 26
 
27
-    /**
28
-     * Attribute definition: Overwrites base class.
29
-     *
30
-     * @var array
31
-     * @see Smarty_Internal_CompileBase
32
-     */
33
-    public $shorttag_order = array('name', 'loop');
27
+	/**
28
+	 * Attribute definition: Overwrites base class.
29
+	 *
30
+	 * @var array
31
+	 * @see Smarty_Internal_CompileBase
32
+	 */
33
+	public $shorttag_order = array('name', 'loop');
34 34
 
35
-    /**
36
-     * Attribute definition: Overwrites base class.
37
-     *
38
-     * @var array
39
-     * @see Smarty_Internal_CompileBase
40
-     */
41
-    public $optional_attributes = array('start', 'step', 'max', 'show', 'properties');
35
+	/**
36
+	 * Attribute definition: Overwrites base class.
37
+	 *
38
+	 * @var array
39
+	 * @see Smarty_Internal_CompileBase
40
+	 */
41
+	public $optional_attributes = array('start', 'step', 'max', 'show', 'properties');
42 42
 
43
-    /**
44
-     * counter
45
-     *
46
-     * @var int
47
-     */
48
-    public $counter = 0;
43
+	/**
44
+	 * counter
45
+	 *
46
+	 * @var int
47
+	 */
48
+	public $counter = 0;
49 49
 
50
-    /**
51
-     * Name of this tag
52
-     *
53
-     * @var string
54
-     */
55
-    public $tagName = 'section';
50
+	/**
51
+	 * Name of this tag
52
+	 *
53
+	 * @var string
54
+	 */
55
+	public $tagName = 'section';
56 56
 
57
-    /**
58
-     * Valid properties of $smarty.section.name.xxx variable
59
-     *
60
-     * @var array
61
-     */
62
-    public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev',
63
-                                   'index_next', 'loop');
57
+	/**
58
+	 * Valid properties of $smarty.section.name.xxx variable
59
+	 *
60
+	 * @var array
61
+	 */
62
+	public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev',
63
+								   'index_next', 'loop');
64 64
 
65
-    /**
66
-     * {section} tag has no item properties
67
-     *
68
-     * @var array
69
-     */
70
-    public $itemProperties = null;
65
+	/**
66
+	 * {section} tag has no item properties
67
+	 *
68
+	 * @var array
69
+	 */
70
+	public $itemProperties = null;
71 71
 
72
-    /**
73
-     * {section} tag has always name attribute
74
-     *
75
-     * @var bool
76
-     */
77
-    public $isNamed = true;
72
+	/**
73
+	 * {section} tag has always name attribute
74
+	 *
75
+	 * @var bool
76
+	 */
77
+	public $isNamed = true;
78 78
 
79
-    /**
80
-     * Compiles code for the {section} tag
81
-     *
82
-     * @param  array                                 $args     array with attributes from parser
83
-     * @param  \Smarty_Internal_TemplateCompilerBase $compiler compiler object
84
-     *
85
-     * @return string compiled code
86
-     * @throws \SmartyCompilerException
87
-     */
88
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
89
-    {
90
-        $compiler->loopNesting ++;
91
-        // check and get attributes
92
-        $_attr = $this->getAttributes($compiler, $args);
93
-        $attributes = array('name' => $compiler->getId($_attr[ 'name' ]));
94
-        unset($_attr[ 'name' ]);
95
-        foreach ($attributes as $a => $v) {
96
-            if ($v === false) {
97
-                $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true);
98
-            }
99
-        }
100
-        $local = "\$__section_{$attributes['name']}_" . $this->counter ++ . '_';
101
-        $sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']";
102
-        $this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar));
103
-        // maybe nocache because of nocache variables
104
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
79
+	/**
80
+	 * Compiles code for the {section} tag
81
+	 *
82
+	 * @param  array                                 $args     array with attributes from parser
83
+	 * @param  \Smarty_Internal_TemplateCompilerBase $compiler compiler object
84
+	 *
85
+	 * @return string compiled code
86
+	 * @throws \SmartyCompilerException
87
+	 */
88
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
89
+	{
90
+		$compiler->loopNesting ++;
91
+		// check and get attributes
92
+		$_attr = $this->getAttributes($compiler, $args);
93
+		$attributes = array('name' => $compiler->getId($_attr[ 'name' ]));
94
+		unset($_attr[ 'name' ]);
95
+		foreach ($attributes as $a => $v) {
96
+			if ($v === false) {
97
+				$compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true);
98
+			}
99
+		}
100
+		$local = "\$__section_{$attributes['name']}_" . $this->counter ++ . '_';
101
+		$sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']";
102
+		$this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar));
103
+		// maybe nocache because of nocache variables
104
+		$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
105 105
 
106
-        $initLocal =
107
-            array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",);
108
-        $initNamedProperty = array();
109
-        $initFor = array();
110
-        $incFor = array();
111
-        $cmpFor = array();
112
-        $propValue = array('index' => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1,
113
-                           'iteration' => "{$local}iteration",
106
+		$initLocal =
107
+			array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",);
108
+		$initNamedProperty = array();
109
+		$initFor = array();
110
+		$incFor = array();
111
+		$cmpFor = array();
112
+		$propValue = array('index' => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1,
113
+						   'iteration' => "{$local}iteration",
114 114
 
115
-        );
116
-        $propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,);
117
-        // search for used tag attributes
118
-        $this->scanForProperties($attributes, $compiler);
119
-        if (!empty($this->matchResults[ 'named' ])) {
120
-            $namedAttr = $this->matchResults[ 'named' ];
121
-        }
122
-        if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
123
-            foreach ($match[ 1 ] as $prop) {
124
-                if (in_array($prop, $this->nameProperties)) {
125
-                    $namedAttr[ $prop ] = true;
126
-                } else {
127
-                    $compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
128
-                }
129
-            }
130
-        }
131
-        $namedAttr[ 'index' ] = true;
132
-        $output = "<?php\n";
133
-        foreach ($_attr as $attr_name => $attr_value) {
134
-            switch ($attr_name) {
135
-                case 'loop':
136
-                    if (is_numeric($attr_value)) {
137
-                        $v = (int) $attr_value;
138
-                        $t = 0;
139
-                    } else {
140
-                        $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))";
141
-                        $t = 1;
142
-                    }
143
-                    if (isset($namedAttr[ 'loop' ])) {
144
-                        $initNamedProperty[ 'loop' ] = "'loop' => {$v}";
145
-                        if ($t == 1) {
146
-                            $v = "{$sectionVar}->value['loop']";
147
-                        }
148
-                    } elseif ($t == 1) {
149
-                        $initLocal[ 'loop' ] = $v;
150
-                        $v = "{$local}loop";
151
-                    }
152
-                    break;
153
-                case 'show':
154
-                    if (is_bool($attr_value)) {
155
-                        $v = $attr_value ? 'true' : 'false';
156
-                        $t = 0;
157
-                    } else {
158
-                        $v = "(bool) $attr_value";
159
-                        $t = 3;
160
-                    }
161
-                    break;
162
-                case 'step':
163
-                    if (is_numeric($attr_value)) {
164
-                        $v = (int) $attr_value;
165
-                        $v = ($v == 0) ? 1 : $v;
166
-                        $t = 0;
167
-                        break;
168
-                    }
169
-                    $initLocal[ 'step' ] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value";
170
-                    $v = "{$local}step";
171
-                    $t = 2;
172
-                    break;
115
+		);
116
+		$propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,);
117
+		// search for used tag attributes
118
+		$this->scanForProperties($attributes, $compiler);
119
+		if (!empty($this->matchResults[ 'named' ])) {
120
+			$namedAttr = $this->matchResults[ 'named' ];
121
+		}
122
+		if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
123
+			foreach ($match[ 1 ] as $prop) {
124
+				if (in_array($prop, $this->nameProperties)) {
125
+					$namedAttr[ $prop ] = true;
126
+				} else {
127
+					$compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
128
+				}
129
+			}
130
+		}
131
+		$namedAttr[ 'index' ] = true;
132
+		$output = "<?php\n";
133
+		foreach ($_attr as $attr_name => $attr_value) {
134
+			switch ($attr_name) {
135
+				case 'loop':
136
+					if (is_numeric($attr_value)) {
137
+						$v = (int) $attr_value;
138
+						$t = 0;
139
+					} else {
140
+						$v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))";
141
+						$t = 1;
142
+					}
143
+					if (isset($namedAttr[ 'loop' ])) {
144
+						$initNamedProperty[ 'loop' ] = "'loop' => {$v}";
145
+						if ($t == 1) {
146
+							$v = "{$sectionVar}->value['loop']";
147
+						}
148
+					} elseif ($t == 1) {
149
+						$initLocal[ 'loop' ] = $v;
150
+						$v = "{$local}loop";
151
+					}
152
+					break;
153
+				case 'show':
154
+					if (is_bool($attr_value)) {
155
+						$v = $attr_value ? 'true' : 'false';
156
+						$t = 0;
157
+					} else {
158
+						$v = "(bool) $attr_value";
159
+						$t = 3;
160
+					}
161
+					break;
162
+				case 'step':
163
+					if (is_numeric($attr_value)) {
164
+						$v = (int) $attr_value;
165
+						$v = ($v == 0) ? 1 : $v;
166
+						$t = 0;
167
+						break;
168
+					}
169
+					$initLocal[ 'step' ] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value";
170
+					$v = "{$local}step";
171
+					$t = 2;
172
+					break;
173 173
 
174
-                case 'max':
175
-                case 'start':
176
-                    if (is_numeric($attr_value)) {
177
-                        $v = (int) $attr_value;
178
-                        $t = 0;
179
-                        break;
180
-                    }
181
-                    $v = "(int)@$attr_value";
182
-                    $t = 3;
183
-                    break;
184
-            }
185
-            if ($t == 3 && $compiler->getId($attr_value)) {
186
-                $t = 1;
187
-            }
188
-            $propValue[ $attr_name ] = $v;
189
-            $propType[ $attr_name ] = $t;
190
-        }
174
+				case 'max':
175
+				case 'start':
176
+					if (is_numeric($attr_value)) {
177
+						$v = (int) $attr_value;
178
+						$t = 0;
179
+						break;
180
+					}
181
+					$v = "(int)@$attr_value";
182
+					$t = 3;
183
+					break;
184
+			}
185
+			if ($t == 3 && $compiler->getId($attr_value)) {
186
+				$t = 1;
187
+			}
188
+			$propValue[ $attr_name ] = $v;
189
+			$propType[ $attr_name ] = $t;
190
+		}
191 191
 
192
-        if (isset($namedAttr[ 'step' ])) {
193
-            $initNamedProperty[ 'step' ] = $propValue[ 'step' ];
194
-        }
195
-        if (isset($namedAttr[ 'iteration' ])) {
196
-            $propValue[ 'iteration' ] = "{$sectionVar}->value['iteration']";
197
-        }
198
-        $incFor[ 'iteration' ] = "{$propValue['iteration']}++";
199
-        $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1";
192
+		if (isset($namedAttr[ 'step' ])) {
193
+			$initNamedProperty[ 'step' ] = $propValue[ 'step' ];
194
+		}
195
+		if (isset($namedAttr[ 'iteration' ])) {
196
+			$propValue[ 'iteration' ] = "{$sectionVar}->value['iteration']";
197
+		}
198
+		$incFor[ 'iteration' ] = "{$propValue['iteration']}++";
199
+		$initFor[ 'iteration' ] = "{$propValue['iteration']} = 1";
200 200
 
201
-        if ($propType[ 'step' ] == 0) {
202
-            if ($propValue[ 'step' ] == 1) {
203
-                $incFor[ 'index' ] = "{$sectionVar}->value['index']++";
204
-            } elseif ($propValue[ 'step' ] > 1) {
205
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
206
-            } else {
207
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . - $propValue[ 'step' ];
208
-            }
209
-        } else {
210
-            $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
211
-        }
201
+		if ($propType[ 'step' ] == 0) {
202
+			if ($propValue[ 'step' ] == 1) {
203
+				$incFor[ 'index' ] = "{$sectionVar}->value['index']++";
204
+			} elseif ($propValue[ 'step' ] > 1) {
205
+				$incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
206
+			} else {
207
+				$incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . - $propValue[ 'step' ];
208
+			}
209
+		} else {
210
+			$incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
211
+		}
212 212
 
213
-        if (!isset($propValue[ 'max' ])) {
214
-            $propValue[ 'max' ] = $propValue[ 'loop' ];
215
-            $propType[ 'max' ] = $propType[ 'loop' ];
216
-        } elseif ($propType[ 'max' ] != 0) {
217
-            $propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}";
218
-            $propType[ 'max' ] = 1;
219
-        } else {
220
-            if ($propValue[ 'max' ] < 0) {
221
-                $propValue[ 'max' ] = $propValue[ 'loop' ];
222
-                $propType[ 'max' ] = $propType[ 'loop' ];
223
-            }
224
-        }
213
+		if (!isset($propValue[ 'max' ])) {
214
+			$propValue[ 'max' ] = $propValue[ 'loop' ];
215
+			$propType[ 'max' ] = $propType[ 'loop' ];
216
+		} elseif ($propType[ 'max' ] != 0) {
217
+			$propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}";
218
+			$propType[ 'max' ] = 1;
219
+		} else {
220
+			if ($propValue[ 'max' ] < 0) {
221
+				$propValue[ 'max' ] = $propValue[ 'loop' ];
222
+				$propType[ 'max' ] = $propType[ 'loop' ];
223
+			}
224
+		}
225 225
 
226
-        if (!isset($propValue[ 'start' ])) {
227
-            $start_code =
228
-                array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1');
229
-            if ($propType[ 'loop' ] == 0) {
230
-                $start_code[ 5 ] = '';
231
-                $start_code[ 4 ] = $propValue[ 'loop' ] - 1;
232
-            }
233
-            if ($propType[ 'step' ] == 0) {
234
-                if ($propValue[ 'step' ] > 0) {
235
-                    $start_code = array(1 => '0');
236
-                    $propType[ 'start' ] = 0;
237
-                } else {
238
-                    $start_code[ 1 ] = $start_code[ 2 ] = $start_code[ 3 ] = '';
239
-                    $propType[ 'start' ] = $propType[ 'loop' ];
240
-                }
241
-            } else {
242
-                $propType[ 'start' ] = 1;
243
-            }
244
-            $propValue[ 'start' ] = join('', $start_code);
245
-        } else {
246
-            $start_code =
247
-                array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0',
248
-                      5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')',
249
-                      11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ',
250
-                      15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ',
251
-                      18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1",
252
-                      19 => ')');
253
-            if ($propType[ 'step' ] == 0) {
254
-                $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = '';
255
-                if ($propValue[ 'step' ] > 0) {
256
-                    $start_code[ 6 ] = $start_code[ 18 ] = '';
257
-                } else {
258
-                    $start_code[ 4 ] = $start_code[ 16 ] = '';
259
-                }
260
-            }
261
-            if ($propType[ 'start' ] == 0) {
262
-                if ($propType[ 'loop' ] == 0) {
263
-                    $start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ];
264
-                }
265
-                $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ];
266
-                $start_code[ 1 ] = '';
267
-                if ($propValue[ 'start' ] < 0) {
268
-                    for ($i = 11; $i <= 19; $i ++) {
269
-                        $start_code[ $i ] = '';
270
-                    }
271
-                    if ($propType[ 'start' ] == 0) {
272
-                        $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1,
273
-                                                $propValue[ 'start' ] + $propValue[ 'loop' ]));
274
-                    }
275
-                } else {
276
-                    for ($i = 1; $i <= 11; $i ++) {
277
-                        $start_code[ $i ] = '';
278
-                    }
279
-                    if ($propType[ 'start' ] == 0) {
280
-                        $start_code =
281
-                            array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
282
-                                      $propValue[ 'start' ]));
283
-                    }
284
-                }
285
-            }
286
-            $propValue[ 'start' ] = join('', $start_code);
287
-        }
288
-        if ($propType[ 'start' ] != 0) {
289
-            $initLocal[ 'start' ] = $propValue[ 'start' ];
290
-            $propValue[ 'start' ] = "{$local}start";
291
-        }
226
+		if (!isset($propValue[ 'start' ])) {
227
+			$start_code =
228
+				array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1');
229
+			if ($propType[ 'loop' ] == 0) {
230
+				$start_code[ 5 ] = '';
231
+				$start_code[ 4 ] = $propValue[ 'loop' ] - 1;
232
+			}
233
+			if ($propType[ 'step' ] == 0) {
234
+				if ($propValue[ 'step' ] > 0) {
235
+					$start_code = array(1 => '0');
236
+					$propType[ 'start' ] = 0;
237
+				} else {
238
+					$start_code[ 1 ] = $start_code[ 2 ] = $start_code[ 3 ] = '';
239
+					$propType[ 'start' ] = $propType[ 'loop' ];
240
+				}
241
+			} else {
242
+				$propType[ 'start' ] = 1;
243
+			}
244
+			$propValue[ 'start' ] = join('', $start_code);
245
+		} else {
246
+			$start_code =
247
+				array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0',
248
+					  5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')',
249
+					  11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ',
250
+					  15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ',
251
+					  18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1",
252
+					  19 => ')');
253
+			if ($propType[ 'step' ] == 0) {
254
+				$start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = '';
255
+				if ($propValue[ 'step' ] > 0) {
256
+					$start_code[ 6 ] = $start_code[ 18 ] = '';
257
+				} else {
258
+					$start_code[ 4 ] = $start_code[ 16 ] = '';
259
+				}
260
+			}
261
+			if ($propType[ 'start' ] == 0) {
262
+				if ($propType[ 'loop' ] == 0) {
263
+					$start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ];
264
+				}
265
+				$propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ];
266
+				$start_code[ 1 ] = '';
267
+				if ($propValue[ 'start' ] < 0) {
268
+					for ($i = 11; $i <= 19; $i ++) {
269
+						$start_code[ $i ] = '';
270
+					}
271
+					if ($propType[ 'start' ] == 0) {
272
+						$start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1,
273
+												$propValue[ 'start' ] + $propValue[ 'loop' ]));
274
+					}
275
+				} else {
276
+					for ($i = 1; $i <= 11; $i ++) {
277
+						$start_code[ $i ] = '';
278
+					}
279
+					if ($propType[ 'start' ] == 0) {
280
+						$start_code =
281
+							array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
282
+									  $propValue[ 'start' ]));
283
+					}
284
+				}
285
+			}
286
+			$propValue[ 'start' ] = join('', $start_code);
287
+		}
288
+		if ($propType[ 'start' ] != 0) {
289
+			$initLocal[ 'start' ] = $propValue[ 'start' ];
290
+			$propValue[ 'start' ] = "{$local}start";
291
+		}
292 292
 
293
-        $initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}";
293
+		$initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}";
294 294
 
295
-        if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) {
296
-            $propValue[ 'total' ] = $propValue[ 'loop' ];
297
-            $propType[ 'total' ] = $propType[ 'loop' ];
298
-        } else {
299
-            $propType[ 'total' ] =
300
-                $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
301
-            if ($propType[ 'total' ] == 0) {
302
-                $propValue[ 'total' ] =
303
-                    min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
304
-                                 (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]);
305
-            } else {
306
-                $total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
307
-                                    5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
308
-                                    9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(',
309
-                                    14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",);
310
-                if (!isset($propValue[ 'max' ])) {
311
-                    $total_code[ 1 ] = $total_code[ 17 ] = '';
312
-                }
313
-                if ($propType[ 'loop' ] + $propType[ 'start' ] == 0) {
314
-                    $total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ];
315
-                    $total_code[ 6 ] = $total_code[ 7 ] = '';
316
-                }
317
-                if ($propType[ 'start' ] == 0) {
318
-                    $total_code[ 9 ] = (int) $propValue[ 'start' ] + 1;
319
-                    $total_code[ 10 ] = '';
320
-                }
321
-                if ($propType[ 'step' ] == 0) {
322
-                    $total_code[ 13 ] = $total_code[ 15 ] = '';
323
-                    if ($propValue[ 'step' ] == 1 || $propValue[ 'step' ] == - 1) {
324
-                        $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = '';
325
-                    } elseif ($propValue[ 'step' ] < 0) {
326
-                        $total_code[ 14 ] = - $propValue[ 'step' ];
327
-                    }
328
-                    $total_code[ 4 ] = '';
329
-                    if ($propValue[ 'step' ] > 0) {
330
-                        $total_code[ 8 ] = $total_code[ 9 ] = $total_code[ 10 ] = '';
331
-                    } else {
332
-                        $total_code[ 5 ] = $total_code[ 6 ] = $total_code[ 7 ] = $total_code[ 8 ] = '';
333
-                    }
334
-                }
335
-                $propValue[ 'total' ] = join('', $total_code);
336
-            }
337
-        }
295
+		if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) {
296
+			$propValue[ 'total' ] = $propValue[ 'loop' ];
297
+			$propType[ 'total' ] = $propType[ 'loop' ];
298
+		} else {
299
+			$propType[ 'total' ] =
300
+				$propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
301
+			if ($propType[ 'total' ] == 0) {
302
+				$propValue[ 'total' ] =
303
+					min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
304
+								 (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]);
305
+			} else {
306
+				$total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
307
+									5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
308
+									9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(',
309
+									14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",);
310
+				if (!isset($propValue[ 'max' ])) {
311
+					$total_code[ 1 ] = $total_code[ 17 ] = '';
312
+				}
313
+				if ($propType[ 'loop' ] + $propType[ 'start' ] == 0) {
314
+					$total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ];
315
+					$total_code[ 6 ] = $total_code[ 7 ] = '';
316
+				}
317
+				if ($propType[ 'start' ] == 0) {
318
+					$total_code[ 9 ] = (int) $propValue[ 'start' ] + 1;
319
+					$total_code[ 10 ] = '';
320
+				}
321
+				if ($propType[ 'step' ] == 0) {
322
+					$total_code[ 13 ] = $total_code[ 15 ] = '';
323
+					if ($propValue[ 'step' ] == 1 || $propValue[ 'step' ] == - 1) {
324
+						$total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = '';
325
+					} elseif ($propValue[ 'step' ] < 0) {
326
+						$total_code[ 14 ] = - $propValue[ 'step' ];
327
+					}
328
+					$total_code[ 4 ] = '';
329
+					if ($propValue[ 'step' ] > 0) {
330
+						$total_code[ 8 ] = $total_code[ 9 ] = $total_code[ 10 ] = '';
331
+					} else {
332
+						$total_code[ 5 ] = $total_code[ 6 ] = $total_code[ 7 ] = $total_code[ 8 ] = '';
333
+					}
334
+				}
335
+				$propValue[ 'total' ] = join('', $total_code);
336
+			}
337
+		}
338 338
 
339
-        if (isset($namedAttr[ 'loop' ])) {
340
-            $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}";
341
-        }
342
-        if (isset($namedAttr[ 'total' ])) {
343
-            $initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}";
344
-            if ($propType[ 'total' ] > 0) {
345
-                $propValue[ 'total' ] = "{$sectionVar}->value['total']";
346
-            }
347
-        } elseif ($propType[ 'total' ] > 0) {
348
-            $initLocal[ 'total' ] = $propValue[ 'total' ];
349
-            $propValue[ 'total' ] = "{$local}total";
350
-        }
339
+		if (isset($namedAttr[ 'loop' ])) {
340
+			$initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}";
341
+		}
342
+		if (isset($namedAttr[ 'total' ])) {
343
+			$initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}";
344
+			if ($propType[ 'total' ] > 0) {
345
+				$propValue[ 'total' ] = "{$sectionVar}->value['total']";
346
+			}
347
+		} elseif ($propType[ 'total' ] > 0) {
348
+			$initLocal[ 'total' ] = $propValue[ 'total' ];
349
+			$propValue[ 'total' ] = "{$local}total";
350
+		}
351 351
 
352
-        $cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}";
352
+		$cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}";
353 353
 
354
-        foreach ($initLocal as $key => $code) {
355
-            $output .= "{$local}{$key} = {$code};\n";
356
-        }
354
+		foreach ($initLocal as $key => $code) {
355
+			$output .= "{$local}{$key} = {$code};\n";
356
+		}
357 357
 
358
-        $_vars = 'array(' . join(', ', $initNamedProperty) . ')';
359
-        $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n";
360
-        $cond_code = "{$propValue['total']} != 0";
361
-        if ($propType[ 'total' ] == 0) {
362
-            if ($propValue[ 'total' ] == 0) {
363
-                $cond_code = 'false';
364
-            } else {
365
-                $cond_code = 'true';
366
-            }
367
-        }
368
-        if ($propType[ 'show' ] > 0) {
369
-            $output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n";
370
-            $output .= "if ({$local}show) {\n";
371
-        } elseif ($propValue[ 'show' ] == 'true') {
372
-            $output .= "if ({$cond_code}) {\n";
373
-        } else {
374
-            $output .= "if (false) {\n";
375
-        }
376
-        $jinit = join(', ', $initFor);
377
-        $jcmp = join(', ', $cmpFor);
378
-        $jinc = join(', ', $incFor);
379
-        $output .= "for ({$jinit}; {$jcmp}; {$jinc}){\n";
380
-        if (isset($namedAttr[ 'rownum' ])) {
381
-            $output .= "{$sectionVar}->value['rownum'] = {$propValue['iteration']};\n";
382
-        }
383
-        if (isset($namedAttr[ 'index_prev' ])) {
384
-            $output .= "{$sectionVar}->value['index_prev'] = {$propValue['index']} - {$propValue['step']};\n";
385
-        }
386
-        if (isset($namedAttr[ 'index_next' ])) {
387
-            $output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n";
388
-        }
389
-        if (isset($namedAttr[ 'first' ])) {
390
-            $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} == 1);\n";
391
-        }
392
-        if (isset($namedAttr[ 'last' ])) {
393
-            $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} == {$propValue['total']});\n";
394
-        }
395
-        $output .= "?>";
358
+		$_vars = 'array(' . join(', ', $initNamedProperty) . ')';
359
+		$output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n";
360
+		$cond_code = "{$propValue['total']} != 0";
361
+		if ($propType[ 'total' ] == 0) {
362
+			if ($propValue[ 'total' ] == 0) {
363
+				$cond_code = 'false';
364
+			} else {
365
+				$cond_code = 'true';
366
+			}
367
+		}
368
+		if ($propType[ 'show' ] > 0) {
369
+			$output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n";
370
+			$output .= "if ({$local}show) {\n";
371
+		} elseif ($propValue[ 'show' ] == 'true') {
372
+			$output .= "if ({$cond_code}) {\n";
373
+		} else {
374
+			$output .= "if (false) {\n";
375
+		}
376
+		$jinit = join(', ', $initFor);
377
+		$jcmp = join(', ', $cmpFor);
378
+		$jinc = join(', ', $incFor);
379
+		$output .= "for ({$jinit}; {$jcmp}; {$jinc}){\n";
380
+		if (isset($namedAttr[ 'rownum' ])) {
381
+			$output .= "{$sectionVar}->value['rownum'] = {$propValue['iteration']};\n";
382
+		}
383
+		if (isset($namedAttr[ 'index_prev' ])) {
384
+			$output .= "{$sectionVar}->value['index_prev'] = {$propValue['index']} - {$propValue['step']};\n";
385
+		}
386
+		if (isset($namedAttr[ 'index_next' ])) {
387
+			$output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n";
388
+		}
389
+		if (isset($namedAttr[ 'first' ])) {
390
+			$output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} == 1);\n";
391
+		}
392
+		if (isset($namedAttr[ 'last' ])) {
393
+			$output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} == {$propValue['total']});\n";
394
+		}
395
+		$output .= "?>";
396 396
 
397
-        return $output;
398
-    }
397
+		return $output;
398
+	}
399 399
 }
400 400
 
401 401
 /**
@@ -406,24 +406,24 @@  discard block
 block discarded – undo
406 406
  */
407 407
 class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase
408 408
 {
409
-    /**
410
-     * Compiles code for the {sectionelse} tag
411
-     *
412
-     * @param  array                                $args     array with attributes from parser
413
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
414
-     *
415
-     * @return string compiled code
416
-     */
417
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
418
-    {
419
-        // check and get attributes
420
-        $_attr = $this->getAttributes($compiler, $args);
409
+	/**
410
+	 * Compiles code for the {sectionelse} tag
411
+	 *
412
+	 * @param  array                                $args     array with attributes from parser
413
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
414
+	 *
415
+	 * @return string compiled code
416
+	 */
417
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
418
+	{
419
+		// check and get attributes
420
+		$_attr = $this->getAttributes($compiler, $args);
421 421
 
422
-        list($openTag, $nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section'));
423
-        $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache, $local, $sectionVar));
422
+		list($openTag, $nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section'));
423
+		$this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache, $local, $sectionVar));
424 424
 
425
-        return "<?php }} else {\n ?>";
426
-    }
425
+		return "<?php }} else {\n ?>";
426
+	}
427 427
 }
428 428
 
429 429
 /**
@@ -434,36 +434,36 @@  discard block
 block discarded – undo
434 434
  */
435 435
 class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
436 436
 {
437
-    /**
438
-     * Compiles code for the {/section} tag
439
-     *
440
-     * @param  array                                $args     array with attributes from parser
441
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
442
-     *
443
-     * @return string compiled code
444
-     */
445
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
446
-    {
447
-        $compiler->loopNesting --;
448
-        // must endblock be nocache?
449
-        if ($compiler->nocache) {
450
-            $compiler->tag_nocache = true;
451
-        }
437
+	/**
438
+	 * Compiles code for the {/section} tag
439
+	 *
440
+	 * @param  array                                $args     array with attributes from parser
441
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
442
+	 *
443
+	 * @return string compiled code
444
+	 */
445
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
446
+	{
447
+		$compiler->loopNesting --;
448
+		// must endblock be nocache?
449
+		if ($compiler->nocache) {
450
+			$compiler->tag_nocache = true;
451
+		}
452 452
 
453
-        list($openTag, $compiler->nocache, $local, $sectionVar) =
454
-            $this->closeTag($compiler, array('section', 'sectionelse'));
453
+		list($openTag, $compiler->nocache, $local, $sectionVar) =
454
+			$this->closeTag($compiler, array('section', 'sectionelse'));
455 455
 
456
-        $output = "<?php\n";
457
-        if ($openTag == 'sectionelse') {
458
-            $output .= "}\n";
459
-        } else {
460
-            $output .= "}\n}\n";
461
-        }
462
-        $output .= "if ({$local}saved) {\n";
463
-        $output .= "{$sectionVar} = {$local}saved;\n";
464
-        $output .= "}\n";
465
-        $output .= "?>";
456
+		$output = "<?php\n";
457
+		if ($openTag == 'sectionelse') {
458
+			$output .= "}\n";
459
+		} else {
460
+			$output .= "}\n}\n";
461
+		}
462
+		$output .= "if ({$local}saved) {\n";
463
+		$output .= "{$sectionVar} = {$local}saved;\n";
464
+		$output .= "}\n";
465
+		$output .= "?>";
466 466
 
467
-        return $output;
468
-    }
467
+		return $output;
468
+	}
469 469
 }
Please login to merge, or discard this patch.
Spacing   +129 added lines, -130 removed lines patch added patch discarded remove patch
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
89 89
     {
90
-        $compiler->loopNesting ++;
90
+        $compiler->loopNesting++;
91 91
         // check and get attributes
92 92
         $_attr = $this->getAttributes($compiler, $args);
93
-        $attributes = array('name' => $compiler->getId($_attr[ 'name' ]));
94
-        unset($_attr[ 'name' ]);
93
+        $attributes = array('name' => $compiler->getId($_attr['name']));
94
+        unset($_attr['name']);
95 95
         foreach ($attributes as $a => $v) {
96 96
             if ($v === false) {
97 97
                 $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true);
98 98
             }
99 99
         }
100
-        $local = "\$__section_{$attributes['name']}_" . $this->counter ++ . '_';
100
+        $local = "\$__section_{$attributes['name']}_" . $this->counter++ . '_';
101 101
         $sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']";
102 102
         $this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar));
103 103
         // maybe nocache because of nocache variables
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
         $propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,);
117 117
         // search for used tag attributes
118 118
         $this->scanForProperties($attributes, $compiler);
119
-        if (!empty($this->matchResults[ 'named' ])) {
120
-            $namedAttr = $this->matchResults[ 'named' ];
119
+        if (!empty($this->matchResults['named'])) {
120
+            $namedAttr = $this->matchResults['named'];
121 121
         }
122
-        if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
123
-            foreach ($match[ 1 ] as $prop) {
122
+        if (isset($_attr['properties']) && preg_match_all("/['](.*?)[']/", $_attr['properties'], $match)) {
123
+            foreach ($match[1] as $prop) {
124 124
                 if (in_array($prop, $this->nameProperties)) {
125
-                    $namedAttr[ $prop ] = true;
125
+                    $namedAttr[$prop] = true;
126 126
                 } else {
127 127
                     $compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
128 128
                 }
129 129
             }
130 130
         }
131
-        $namedAttr[ 'index' ] = true;
131
+        $namedAttr['index'] = true;
132 132
         $output = "<?php\n";
133 133
         foreach ($_attr as $attr_name => $attr_value) {
134 134
             switch ($attr_name) {
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
                         $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))";
141 141
                         $t = 1;
142 142
                     }
143
-                    if (isset($namedAttr[ 'loop' ])) {
144
-                        $initNamedProperty[ 'loop' ] = "'loop' => {$v}";
143
+                    if (isset($namedAttr['loop'])) {
144
+                        $initNamedProperty['loop'] = "'loop' => {$v}";
145 145
                         if ($t == 1) {
146 146
                             $v = "{$sectionVar}->value['loop']";
147 147
                         }
148 148
                     } elseif ($t == 1) {
149
-                        $initLocal[ 'loop' ] = $v;
149
+                        $initLocal['loop'] = $v;
150 150
                         $v = "{$local}loop";
151 151
                     }
152 152
                     break;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                         $t = 0;
167 167
                         break;
168 168
                     }
169
-                    $initLocal[ 'step' ] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value";
169
+                    $initLocal['step'] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value";
170 170
                     $v = "{$local}step";
171 171
                     $t = 2;
172 172
                     break;
@@ -185,171 +185,170 @@  discard block
 block discarded – undo
185 185
             if ($t == 3 && $compiler->getId($attr_value)) {
186 186
                 $t = 1;
187 187
             }
188
-            $propValue[ $attr_name ] = $v;
189
-            $propType[ $attr_name ] = $t;
188
+            $propValue[$attr_name] = $v;
189
+            $propType[$attr_name] = $t;
190 190
         }
191 191
 
192
-        if (isset($namedAttr[ 'step' ])) {
193
-            $initNamedProperty[ 'step' ] = $propValue[ 'step' ];
192
+        if (isset($namedAttr['step'])) {
193
+            $initNamedProperty['step'] = $propValue['step'];
194 194
         }
195
-        if (isset($namedAttr[ 'iteration' ])) {
196
-            $propValue[ 'iteration' ] = "{$sectionVar}->value['iteration']";
195
+        if (isset($namedAttr['iteration'])) {
196
+            $propValue['iteration'] = "{$sectionVar}->value['iteration']";
197 197
         }
198
-        $incFor[ 'iteration' ] = "{$propValue['iteration']}++";
199
-        $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1";
198
+        $incFor['iteration'] = "{$propValue['iteration']}++";
199
+        $initFor['iteration'] = "{$propValue['iteration']} = 1";
200 200
 
201
-        if ($propType[ 'step' ] == 0) {
202
-            if ($propValue[ 'step' ] == 1) {
203
-                $incFor[ 'index' ] = "{$sectionVar}->value['index']++";
204
-            } elseif ($propValue[ 'step' ] > 1) {
205
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
201
+        if ($propType['step'] == 0) {
202
+            if ($propValue['step'] == 1) {
203
+                $incFor['index'] = "{$sectionVar}->value['index']++";
204
+            } elseif ($propValue['step'] > 1) {
205
+                $incFor['index'] = "{$sectionVar}->value['index'] += {$propValue['step']}";
206 206
             } else {
207
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . - $propValue[ 'step' ];
207
+                $incFor['index'] = "{$sectionVar}->value['index'] -= " . - $propValue['step'];
208 208
             }
209 209
         } else {
210
-            $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
210
+            $incFor['index'] = "{$sectionVar}->value['index'] += {$propValue['step']}";
211 211
         }
212 212
 
213
-        if (!isset($propValue[ 'max' ])) {
214
-            $propValue[ 'max' ] = $propValue[ 'loop' ];
215
-            $propType[ 'max' ] = $propType[ 'loop' ];
216
-        } elseif ($propType[ 'max' ] != 0) {
217
-            $propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}";
218
-            $propType[ 'max' ] = 1;
213
+        if (!isset($propValue['max'])) {
214
+            $propValue['max'] = $propValue['loop'];
215
+            $propType['max'] = $propType['loop'];
216
+        } elseif ($propType['max'] != 0) {
217
+            $propValue['max'] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}";
218
+            $propType['max'] = 1;
219 219
         } else {
220
-            if ($propValue[ 'max' ] < 0) {
221
-                $propValue[ 'max' ] = $propValue[ 'loop' ];
222
-                $propType[ 'max' ] = $propType[ 'loop' ];
220
+            if ($propValue['max'] < 0) {
221
+                $propValue['max'] = $propValue['loop'];
222
+                $propType['max'] = $propType['loop'];
223 223
             }
224 224
         }
225 225
 
226
-        if (!isset($propValue[ 'start' ])) {
226
+        if (!isset($propValue['start'])) {
227 227
             $start_code =
228
-                array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1');
229
-            if ($propType[ 'loop' ] == 0) {
230
-                $start_code[ 5 ] = '';
231
-                $start_code[ 4 ] = $propValue[ 'loop' ] - 1;
228
+                array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue['loop'], 5 => ' - 1');
229
+            if ($propType['loop'] == 0) {
230
+                $start_code[5] = '';
231
+                $start_code[4] = $propValue['loop'] - 1;
232 232
             }
233
-            if ($propType[ 'step' ] == 0) {
234
-                if ($propValue[ 'step' ] > 0) {
233
+            if ($propType['step'] == 0) {
234
+                if ($propValue['step'] > 0) {
235 235
                     $start_code = array(1 => '0');
236
-                    $propType[ 'start' ] = 0;
236
+                    $propType['start'] = 0;
237 237
                 } else {
238
-                    $start_code[ 1 ] = $start_code[ 2 ] = $start_code[ 3 ] = '';
239
-                    $propType[ 'start' ] = $propType[ 'loop' ];
238
+                    $start_code[1] = $start_code[2] = $start_code[3] = '';
239
+                    $propType['start'] = $propType['loop'];
240 240
                 }
241 241
             } else {
242
-                $propType[ 'start' ] = 1;
242
+                $propType['start'] = 1;
243 243
             }
244
-            $propValue[ 'start' ] = join('', $start_code);
244
+            $propValue['start'] = join('', $start_code);
245 245
         } else {
246 246
             $start_code =
247 247
                 array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0',
248 248
                       5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')',
249
-                      11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ',
250
-                      15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ',
251
-                      18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1",
249
+                      11 => ' : ', 12 => 'min(', 13 => $propValue['start'], 14 => ', ',
250
+                      15 => "{$propValue['step']} > 0 ? ", 16 => $propValue['loop'], 17 => ' : ',
251
+                      18 => $propType['loop'] == 0 ? $propValue['loop'] - 1 : "{$propValue['loop']} - 1",
252 252
                       19 => ')');
253
-            if ($propType[ 'step' ] == 0) {
254
-                $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = '';
255
-                if ($propValue[ 'step' ] > 0) {
256
-                    $start_code[ 6 ] = $start_code[ 18 ] = '';
253
+            if ($propType['step'] == 0) {
254
+                $start_code[3] = $start_code[5] = $start_code[15] = $start_code[17] = '';
255
+                if ($propValue['step'] > 0) {
256
+                    $start_code[6] = $start_code[18] = '';
257 257
                 } else {
258
-                    $start_code[ 4 ] = $start_code[ 16 ] = '';
258
+                    $start_code[4] = $start_code[16] = '';
259 259
                 }
260 260
             }
261
-            if ($propType[ 'start' ] == 0) {
262
-                if ($propType[ 'loop' ] == 0) {
263
-                    $start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ];
261
+            if ($propType['start'] == 0) {
262
+                if ($propType['loop'] == 0) {
263
+                    $start_code[8] = $propValue['start'] + $propValue['loop'];
264 264
                 }
265
-                $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ];
266
-                $start_code[ 1 ] = '';
267
-                if ($propValue[ 'start' ] < 0) {
268
-                    for ($i = 11; $i <= 19; $i ++) {
269
-                        $start_code[ $i ] = '';
265
+                $propType['start'] = $propType['step'] + $propType['loop'];
266
+                $start_code[1] = '';
267
+                if ($propValue['start'] < 0) {
268
+                    for ($i = 11; $i <= 19; $i++) {
269
+                        $start_code[$i] = '';
270 270
                     }
271
-                    if ($propType[ 'start' ] == 0) {
272
-                        $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1,
273
-                                                $propValue[ 'start' ] + $propValue[ 'loop' ]));
271
+                    if ($propType['start'] == 0) {
272
+                        $start_code = array(max($propValue['step'] > 0 ? 0 : - 1,
273
+                                                $propValue['start'] + $propValue['loop']));
274 274
                     }
275 275
                 } else {
276
-                    for ($i = 1; $i <= 11; $i ++) {
277
-                        $start_code[ $i ] = '';
276
+                    for ($i = 1; $i <= 11; $i++) {
277
+                        $start_code[$i] = '';
278 278
                     }
279
-                    if ($propType[ 'start' ] == 0) {
279
+                    if ($propType['start'] == 0) {
280 280
                         $start_code =
281
-                            array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
282
-                                      $propValue[ 'start' ]));
281
+                            array(min($propValue['step'] > 0 ? $propValue['loop'] : $propValue['loop'] - 1,
282
+                                      $propValue['start']));
283 283
                     }
284 284
                 }
285 285
             }
286
-            $propValue[ 'start' ] = join('', $start_code);
286
+            $propValue['start'] = join('', $start_code);
287 287
         }
288
-        if ($propType[ 'start' ] != 0) {
289
-            $initLocal[ 'start' ] = $propValue[ 'start' ];
290
-            $propValue[ 'start' ] = "{$local}start";
288
+        if ($propType['start'] != 0) {
289
+            $initLocal['start'] = $propValue['start'];
290
+            $propValue['start'] = "{$local}start";
291 291
         }
292 292
 
293
-        $initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}";
293
+        $initFor['index'] = "{$sectionVar}->value['index'] = {$propValue['start']}";
294 294
 
295
-        if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) {
296
-            $propValue[ 'total' ] = $propValue[ 'loop' ];
297
-            $propType[ 'total' ] = $propType[ 'loop' ];
295
+        if (!isset($_attr['start']) && !isset($_attr['step']) && !isset($_attr['max'])) {
296
+            $propValue['total'] = $propValue['loop'];
297
+            $propType['total'] = $propType['loop'];
298 298
         } else {
299
-            $propType[ 'total' ] =
300
-                $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
301
-            if ($propType[ 'total' ] == 0) {
302
-                $propValue[ 'total' ] =
303
-                    min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
304
-                                 (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]);
299
+            $propType['total'] =
300
+                $propType['start'] + $propType['loop'] + $propType['step'] + $propType['max'];
301
+            if ($propType['total'] == 0) {
302
+                $propValue['total'] =
303
+                    min(ceil(($propValue['step'] > 0 ? $propValue['loop'] - $propValue['start'] : (int) $propValue['start'] + 1) / abs($propValue['step'])), $propValue['max']);
305 304
             } else {
306 305
                 $total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
307
-                                    5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
308
-                                    9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(',
309
-                                    14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",);
310
-                if (!isset($propValue[ 'max' ])) {
311
-                    $total_code[ 1 ] = $total_code[ 17 ] = '';
306
+                                    5 => $propValue['loop'], 6 => ' - ', 7 => $propValue['start'], 8 => ' : ',
307
+                                    9 => $propValue['start'], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(',
308
+                                    14 => $propValue['step'], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",);
309
+                if (!isset($propValue['max'])) {
310
+                    $total_code[1] = $total_code[17] = '';
312 311
                 }
313
-                if ($propType[ 'loop' ] + $propType[ 'start' ] == 0) {
314
-                    $total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ];
315
-                    $total_code[ 6 ] = $total_code[ 7 ] = '';
312
+                if ($propType['loop'] + $propType['start'] == 0) {
313
+                    $total_code[5] = $propValue['loop'] - $propValue['start'];
314
+                    $total_code[6] = $total_code[7] = '';
316 315
                 }
317
-                if ($propType[ 'start' ] == 0) {
318
-                    $total_code[ 9 ] = (int) $propValue[ 'start' ] + 1;
319
-                    $total_code[ 10 ] = '';
316
+                if ($propType['start'] == 0) {
317
+                    $total_code[9] = (int) $propValue['start'] + 1;
318
+                    $total_code[10] = '';
320 319
                 }
321
-                if ($propType[ 'step' ] == 0) {
322
-                    $total_code[ 13 ] = $total_code[ 15 ] = '';
323
-                    if ($propValue[ 'step' ] == 1 || $propValue[ 'step' ] == - 1) {
324
-                        $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = '';
325
-                    } elseif ($propValue[ 'step' ] < 0) {
326
-                        $total_code[ 14 ] = - $propValue[ 'step' ];
320
+                if ($propType['step'] == 0) {
321
+                    $total_code[13] = $total_code[15] = '';
322
+                    if ($propValue['step'] == 1 || $propValue['step'] == - 1) {
323
+                        $total_code[2] = $total_code[12] = $total_code[14] = $total_code[16] = '';
324
+                    } elseif ($propValue['step'] < 0) {
325
+                        $total_code[14] = - $propValue['step'];
327 326
                     }
328
-                    $total_code[ 4 ] = '';
329
-                    if ($propValue[ 'step' ] > 0) {
330
-                        $total_code[ 8 ] = $total_code[ 9 ] = $total_code[ 10 ] = '';
327
+                    $total_code[4] = '';
328
+                    if ($propValue['step'] > 0) {
329
+                        $total_code[8] = $total_code[9] = $total_code[10] = '';
331 330
                     } else {
332
-                        $total_code[ 5 ] = $total_code[ 6 ] = $total_code[ 7 ] = $total_code[ 8 ] = '';
331
+                        $total_code[5] = $total_code[6] = $total_code[7] = $total_code[8] = '';
333 332
                     }
334 333
                 }
335
-                $propValue[ 'total' ] = join('', $total_code);
334
+                $propValue['total'] = join('', $total_code);
336 335
             }
337 336
         }
338 337
 
339
-        if (isset($namedAttr[ 'loop' ])) {
340
-            $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}";
338
+        if (isset($namedAttr['loop'])) {
339
+            $initNamedProperty['loop'] = "'loop' => {$propValue['total']}";
341 340
         }
342
-        if (isset($namedAttr[ 'total' ])) {
343
-            $initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}";
344
-            if ($propType[ 'total' ] > 0) {
345
-                $propValue[ 'total' ] = "{$sectionVar}->value['total']";
341
+        if (isset($namedAttr['total'])) {
342
+            $initNamedProperty['total'] = "'total' => {$propValue['total']}";
343
+            if ($propType['total'] > 0) {
344
+                $propValue['total'] = "{$sectionVar}->value['total']";
346 345
             }
347
-        } elseif ($propType[ 'total' ] > 0) {
348
-            $initLocal[ 'total' ] = $propValue[ 'total' ];
349
-            $propValue[ 'total' ] = "{$local}total";
346
+        } elseif ($propType['total'] > 0) {
347
+            $initLocal['total'] = $propValue['total'];
348
+            $propValue['total'] = "{$local}total";
350 349
         }
351 350
 
352
-        $cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}";
351
+        $cmpFor['iteration'] = "{$propValue['iteration']} <= {$propValue['total']}";
353 352
 
354 353
         foreach ($initLocal as $key => $code) {
355 354
             $output .= "{$local}{$key} = {$code};\n";
@@ -358,17 +357,17 @@  discard block
 block discarded – undo
358 357
         $_vars = 'array(' . join(', ', $initNamedProperty) . ')';
359 358
         $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n";
360 359
         $cond_code = "{$propValue['total']} != 0";
361
-        if ($propType[ 'total' ] == 0) {
362
-            if ($propValue[ 'total' ] == 0) {
360
+        if ($propType['total'] == 0) {
361
+            if ($propValue['total'] == 0) {
363 362
                 $cond_code = 'false';
364 363
             } else {
365 364
                 $cond_code = 'true';
366 365
             }
367 366
         }
368
-        if ($propType[ 'show' ] > 0) {
367
+        if ($propType['show'] > 0) {
369 368
             $output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n";
370 369
             $output .= "if ({$local}show) {\n";
371
-        } elseif ($propValue[ 'show' ] == 'true') {
370
+        } elseif ($propValue['show'] == 'true') {
372 371
             $output .= "if ({$cond_code}) {\n";
373 372
         } else {
374 373
             $output .= "if (false) {\n";
@@ -377,19 +376,19 @@  discard block
 block discarded – undo
377 376
         $jcmp = join(', ', $cmpFor);
378 377
         $jinc = join(', ', $incFor);
379 378
         $output .= "for ({$jinit}; {$jcmp}; {$jinc}){\n";
380
-        if (isset($namedAttr[ 'rownum' ])) {
379
+        if (isset($namedAttr['rownum'])) {
381 380
             $output .= "{$sectionVar}->value['rownum'] = {$propValue['iteration']};\n";
382 381
         }
383
-        if (isset($namedAttr[ 'index_prev' ])) {
382
+        if (isset($namedAttr['index_prev'])) {
384 383
             $output .= "{$sectionVar}->value['index_prev'] = {$propValue['index']} - {$propValue['step']};\n";
385 384
         }
386
-        if (isset($namedAttr[ 'index_next' ])) {
385
+        if (isset($namedAttr['index_next'])) {
387 386
             $output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n";
388 387
         }
389
-        if (isset($namedAttr[ 'first' ])) {
388
+        if (isset($namedAttr['first'])) {
390 389
             $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} == 1);\n";
391 390
         }
392
-        if (isset($namedAttr[ 'last' ])) {
391
+        if (isset($namedAttr['last'])) {
393 392
             $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} == {$propValue['total']});\n";
394 393
         }
395 394
         $output .= "?>";
@@ -444,7 +443,7 @@  discard block
 block discarded – undo
444 443
      */
445 444
     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
446 445
     {
447
-        $compiler->loopNesting --;
446
+        $compiler->loopNesting--;
448 447
         // must endblock be nocache?
449 448
         if ($compiler->nocache) {
450 449
             $compiler->tag_nocache = true;
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,46 +11,46 @@
 block discarded – undo
11 11
 class Smarty_Internal_Runtime_Make_Nocache
12 12
 {
13 13
 
14
-    /**
15
-     * Save current variable value while rendering compiled template and inject nocache code to
16
-     * assign variable value in cahed template
17
-     *
18
-     * @param \Smarty_Internal_Template $tpl
19
-     * @param string                    $var variable name
20
-     *
21
-     * @throws \SmartyException
22
-     */
23
-    public function save(Smarty_Internal_Template $tpl, $var)
24
-    {
25
-        if (isset($tpl->tpl_vars[ $var ])) {
26
-            $export = preg_replace('/^Smarty_Variable::__set_state[(]|\s|[)]$/', '',
27
-                                   var_export($tpl->tpl_vars[ $var ], true));
28
-            if (preg_match('/(\w+)::__set_state/', $export, $match)) {
29
-                throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
30
-            }
31
-            echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/<?php " .
32
-                 addcslashes("\$_smarty_tpl->smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', " . $export,
33
-                             '\\') . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/";
34
-        }
35
-    }
14
+	/**
15
+	 * Save current variable value while rendering compiled template and inject nocache code to
16
+	 * assign variable value in cahed template
17
+	 *
18
+	 * @param \Smarty_Internal_Template $tpl
19
+	 * @param string                    $var variable name
20
+	 *
21
+	 * @throws \SmartyException
22
+	 */
23
+	public function save(Smarty_Internal_Template $tpl, $var)
24
+	{
25
+		if (isset($tpl->tpl_vars[ $var ])) {
26
+			$export = preg_replace('/^Smarty_Variable::__set_state[(]|\s|[)]$/', '',
27
+								   var_export($tpl->tpl_vars[ $var ], true));
28
+			if (preg_match('/(\w+)::__set_state/', $export, $match)) {
29
+				throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
30
+			}
31
+			echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/<?php " .
32
+				 addcslashes("\$_smarty_tpl->smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', " . $export,
33
+							 '\\') . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/";
34
+		}
35
+	}
36 36
 
37
-    /**
38
-     * Store variable value saved while rendering compiled template in cached template context
39
-     *
40
-     * @param \Smarty_Internal_Template $tpl
41
-     * @param  string                   $var variable name
42
-     * @param  array                    $properties
43
-     */
44
-    public function store(Smarty_Internal_Template $tpl, $var, $properties)
45
-    {
46
-        // do not overwrite existing nocache variables
47
-        if (!isset($tpl->tpl_vars[ $var ]) || !$tpl->tpl_vars[ $var ]->nocache) {
48
-            $newVar = new Smarty_Variable();
49
-            unset($properties[ 'nocache' ]);
50
-            foreach ($properties as $k => $v) {
51
-                $newVar->$k = $v;
52
-            }
53
-            $tpl->tpl_vars[ $var ] = $newVar;
54
-        }
55
-    }
37
+	/**
38
+	 * Store variable value saved while rendering compiled template in cached template context
39
+	 *
40
+	 * @param \Smarty_Internal_Template $tpl
41
+	 * @param  string                   $var variable name
42
+	 * @param  array                    $properties
43
+	 */
44
+	public function store(Smarty_Internal_Template $tpl, $var, $properties)
45
+	{
46
+		// do not overwrite existing nocache variables
47
+		if (!isset($tpl->tpl_vars[ $var ]) || !$tpl->tpl_vars[ $var ]->nocache) {
48
+			$newVar = new Smarty_Variable();
49
+			unset($properties[ 'nocache' ]);
50
+			foreach ($properties as $k => $v) {
51
+				$newVar->$k = $v;
52
+			}
53
+			$tpl->tpl_vars[ $var ] = $newVar;
54
+		}
55
+	}
56 56
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function save(Smarty_Internal_Template $tpl, $var)
24 24
     {
25
-        if (isset($tpl->tpl_vars[ $var ])) {
25
+        if (isset($tpl->tpl_vars[$var])) {
26 26
             $export = preg_replace('/^Smarty_Variable::__set_state[(]|\s|[)]$/', '',
27
-                                   var_export($tpl->tpl_vars[ $var ], true));
27
+                                   var_export($tpl->tpl_vars[$var], true));
28 28
             if (preg_match('/(\w+)::__set_state/', $export, $match)) {
29 29
                 throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
30 30
             }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
     public function store(Smarty_Internal_Template $tpl, $var, $properties)
45 45
     {
46 46
         // do not overwrite existing nocache variables
47
-        if (!isset($tpl->tpl_vars[ $var ]) || !$tpl->tpl_vars[ $var ]->nocache) {
47
+        if (!isset($tpl->tpl_vars[$var]) || !$tpl->tpl_vars[$var]->nocache) {
48 48
             $newVar = new Smarty_Variable();
49
-            unset($properties[ 'nocache' ]);
49
+            unset($properties['nocache']);
50 50
             foreach ($properties as $k => $v) {
51 51
                 $newVar->$k = $v;
52 52
             }
53
-            $tpl->tpl_vars[ $var ] = $newVar;
53
+            $tpl->tpl_vars[$var] = $newVar;
54 54
         }
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_undefined_variable.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,29 +9,29 @@
 block discarded – undo
9 9
  */
10 10
 class Smarty_Undefined_Variable
11 11
 {
12
-    /**
13
-     * Returns FALSE for 'nocache' and NULL otherwise.
14
-     *
15
-     * @param  string $name
16
-     *
17
-     * @return bool
18
-     */
19
-    public function __get($name)
20
-    {
21
-        if ($name == 'nocache') {
22
-            return false;
23
-        } else {
24
-            return null;
25
-        }
26
-    }
12
+	/**
13
+	 * Returns FALSE for 'nocache' and NULL otherwise.
14
+	 *
15
+	 * @param  string $name
16
+	 *
17
+	 * @return bool
18
+	 */
19
+	public function __get($name)
20
+	{
21
+		if ($name == 'nocache') {
22
+			return false;
23
+		} else {
24
+			return null;
25
+		}
26
+	}
27 27
 
28
-    /**
29
-     * Always returns an empty string.
30
-     *
31
-     * @return string
32
-     */
33
-    public function __toString()
34
-    {
35
-        return "";
36
-    }
28
+	/**
29
+	 * Always returns an empty string.
30
+	 *
31
+	 * @return string
32
+	 */
33
+	public function __toString()
34
+	{
35
+		return "";
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
      *
15 15
      * @param  string $name
16 16
      *
17
-     * @return bool
17
+     * @return false|null
18 18
      */
19 19
     public function __get($name)
20 20
     {
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_template.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -19,110 +19,110 @@
 block discarded – undo
19 19
 class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
20 20
 {
21 21
 
22
-    /**
23
-     * Array of template elements
24
-     *
25
-     * @var array
26
-     */
27
-    public $subtrees = Array();
22
+	/**
23
+	 * Array of template elements
24
+	 *
25
+	 * @var array
26
+	 */
27
+	public $subtrees = Array();
28 28
 
29
-    /**
30
-     * Create root of parse tree for template elements
31
-     *
32
-     */
33
-    public function __construct()
34
-    {
35
-    }
29
+	/**
30
+	 * Create root of parse tree for template elements
31
+	 *
32
+	 */
33
+	public function __construct()
34
+	{
35
+	}
36 36
 
37
-    /**
38
-     * Append buffer to subtree
39
-     *
40
-     * @param \Smarty_Internal_Templateparser $parser
41
-     * @param Smarty_Internal_ParseTree       $subtree
42
-     */
43
-    public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
44
-    {
45
-        if (!empty($subtree->subtrees)) {
46
-            $this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
47
-        } else {
48
-            if ($subtree->data !== '') {
49
-                $this->subtrees[] = $subtree;
50
-            }
51
-        }
52
-    }
37
+	/**
38
+	 * Append buffer to subtree
39
+	 *
40
+	 * @param \Smarty_Internal_Templateparser $parser
41
+	 * @param Smarty_Internal_ParseTree       $subtree
42
+	 */
43
+	public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
44
+	{
45
+		if (!empty($subtree->subtrees)) {
46
+			$this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
47
+		} else {
48
+			if ($subtree->data !== '') {
49
+				$this->subtrees[] = $subtree;
50
+			}
51
+		}
52
+	}
53 53
 
54
-    /**
55
-     * Append array to subtree
56
-     *
57
-     * @param \Smarty_Internal_Templateparser $parser
58
-     * @param \Smarty_Internal_ParseTree[]    $array
59
-     */
60
-    public function append_array(Smarty_Internal_Templateparser $parser, $array = array())
61
-    {
62
-        if (!empty($array)) {
63
-            $this->subtrees = array_merge($this->subtrees, (array) $array);
64
-        }
65
-    }
54
+	/**
55
+	 * Append array to subtree
56
+	 *
57
+	 * @param \Smarty_Internal_Templateparser $parser
58
+	 * @param \Smarty_Internal_ParseTree[]    $array
59
+	 */
60
+	public function append_array(Smarty_Internal_Templateparser $parser, $array = array())
61
+	{
62
+		if (!empty($array)) {
63
+			$this->subtrees = array_merge($this->subtrees, (array) $array);
64
+		}
65
+	}
66 66
 
67
-    /**
68
-     * Prepend array to subtree
69
-     *
70
-     * @param \Smarty_Internal_Templateparser $parser
71
-     * @param \Smarty_Internal_ParseTree[]    $array
72
-     */
73
-    public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array())
74
-    {
75
-        if (!empty($array)) {
76
-            $this->subtrees = array_merge((array) $array, $this->subtrees);
77
-        }
78
-    }
67
+	/**
68
+	 * Prepend array to subtree
69
+	 *
70
+	 * @param \Smarty_Internal_Templateparser $parser
71
+	 * @param \Smarty_Internal_ParseTree[]    $array
72
+	 */
73
+	public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array())
74
+	{
75
+		if (!empty($array)) {
76
+			$this->subtrees = array_merge((array) $array, $this->subtrees);
77
+		}
78
+	}
79 79
 
80
-    /**
81
-     * Sanitize and merge subtree buffers together
82
-     *
83
-     * @param \Smarty_Internal_Templateparser $parser
84
-     *
85
-     * @return string template code content
86
-     */
87
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
88
-    {
89
-        $code = '';
90
-        for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
91
-            if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
92
-                $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
93
-                while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
94
-                                           $this->subtrees[ $key + 1 ]->data == '')) {
95
-                    $key ++;
96
-                    if ($this->subtrees[ $key ]->data == '') {
97
-                        continue;
98
-                    }
99
-                    $subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
100
-                }
101
-                if ($subtree == '') {
102
-                    continue;
103
-                }
104
-                $code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n",
105
-                                      $subtree);
106
-                continue;
107
-            }
108
-            if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
109
-                $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
110
-                while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
111
-                                           $this->subtrees[ $key + 1 ]->data == '')) {
112
-                    $key ++;
113
-                    if ($this->subtrees[ $key ]->data == '') {
114
-                        continue;
115
-                    }
116
-                    $subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
117
-                }
118
-                if ($subtree == '') {
119
-                    continue;
120
-                }
121
-                $code .= $subtree;
122
-                continue;
123
-            }
124
-            $code .= $this->subtrees[ $key ]->to_smarty_php($parser);
125
-        }
126
-        return $code;
127
-    }
80
+	/**
81
+	 * Sanitize and merge subtree buffers together
82
+	 *
83
+	 * @param \Smarty_Internal_Templateparser $parser
84
+	 *
85
+	 * @return string template code content
86
+	 */
87
+	public function to_smarty_php(Smarty_Internal_Templateparser $parser)
88
+	{
89
+		$code = '';
90
+		for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
91
+			if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
92
+				$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
93
+				while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
94
+										   $this->subtrees[ $key + 1 ]->data == '')) {
95
+					$key ++;
96
+					if ($this->subtrees[ $key ]->data == '') {
97
+						continue;
98
+					}
99
+					$subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
100
+				}
101
+				if ($subtree == '') {
102
+					continue;
103
+				}
104
+				$code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n",
105
+									  $subtree);
106
+				continue;
107
+			}
108
+			if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
109
+				$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
110
+				while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
111
+										   $this->subtrees[ $key + 1 ]->data == '')) {
112
+					$key ++;
113
+					if ($this->subtrees[ $key ]->data == '') {
114
+						continue;
115
+					}
116
+					$subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
117
+				}
118
+				if ($subtree == '') {
119
+					continue;
120
+				}
121
+				$code .= $subtree;
122
+				continue;
123
+			}
124
+			$code .= $this->subtrees[ $key ]->to_smarty_php($parser);
125
+		}
126
+		return $code;
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
     public function to_smarty_php(Smarty_Internal_Templateparser $parser)
88 88
     {
89 89
         $code = '';
90
-        for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
91
-            if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
92
-                $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
93
-                while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
94
-                                           $this->subtrees[ $key + 1 ]->data == '')) {
95
-                    $key ++;
96
-                    if ($this->subtrees[ $key ]->data == '') {
90
+        for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
91
+            if ($this->subtrees[$key] instanceof Smarty_Internal_ParseTree_Text) {
92
+                $subtree = $this->subtrees[$key]->to_smarty_php($parser);
93
+                while ($key + 1 < $cnt && ($this->subtrees[$key + 1] instanceof Smarty_Internal_ParseTree_Text ||
94
+                                           $this->subtrees[$key + 1]->data == '')) {
95
+                    $key++;
96
+                    if ($this->subtrees[$key]->data == '') {
97 97
                         continue;
98 98
                     }
99
-                    $subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
99
+                    $subtree .= $this->subtrees[$key]->to_smarty_php($parser);
100 100
                 }
101 101
                 if ($subtree == '') {
102 102
                     continue;
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
                                       $subtree);
106 106
                 continue;
107 107
             }
108
-            if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
109
-                $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
110
-                while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
111
-                                           $this->subtrees[ $key + 1 ]->data == '')) {
112
-                    $key ++;
113
-                    if ($this->subtrees[ $key ]->data == '') {
108
+            if ($this->subtrees[$key] instanceof Smarty_Internal_ParseTree_Tag) {
109
+                $subtree = $this->subtrees[$key]->to_smarty_php($parser);
110
+                while ($key + 1 < $cnt && ($this->subtrees[$key + 1] instanceof Smarty_Internal_ParseTree_Tag ||
111
+                                           $this->subtrees[$key + 1]->data == '')) {
112
+                    $key++;
113
+                    if ($this->subtrees[$key]->data == '') {
114 114
                         continue;
115 115
                     }
116
-                    $subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
116
+                    $subtree = $parser->compiler->appendCode($subtree, $this->subtrees[$key]->to_smarty_php($parser));
117 117
                 }
118 118
                 if ($subtree == '') {
119 119
                     continue;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 $code .= $subtree;
122 122
                 continue;
123 123
             }
124
-            $code .= $this->subtrees[ $key ]->to_smarty_php($parser);
124
+            $code .= $this->subtrees[$key]->to_smarty_php($parser);
125 125
         }
126 126
         return $code;
127 127
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smartyexception.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  */
8 8
 class SmartyException extends Exception
9 9
 {
10
-    public static $escape = false;
10
+	public static $escape = false;
11 11
 
12
-    public function __toString()
13
-    {
14
-        return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
15
-    }
12
+	public function __toString()
13
+	{
14
+		return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
15
+	}
16 16
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_nocache_insert.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Nocache_Insert
18 18
 {
19
-    /**
20
-     * Compiles code for the {insert} tag into cache file
21
-     *
22
-     * @param  string                   $_function insert function name
23
-     * @param  array                    $_attr     array with parameter
24
-     * @param  Smarty_Internal_Template $_template template object
25
-     * @param  string                   $_script   script name to load or 'null'
26
-     * @param  string                   $_assign   optional variable name
27
-     *
28
-     * @return string                   compiled code
29
-     */
30
-    public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
31
-    {
32
-        $_output = '<?php ';
33
-        if ($_script != 'null') {
34
-            // script which must be included
35
-            // code for script file loading
36
-            $_output .= "require_once '{$_script}';";
37
-        }
38
-        // call insert
39
-        if (isset($_assign)) {
40
-            $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
41
-                        ",\$_smarty_tpl), true);?>";
42
-        } else {
43
-            $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
44
-        }
45
-        $_tpl = $_template;
46
-        while (isset($_tpl->parent) && $_tpl->parent->_objType == 2) {
47
-            $_tpl = $_tpl->parent;
48
-        }
19
+	/**
20
+	 * Compiles code for the {insert} tag into cache file
21
+	 *
22
+	 * @param  string                   $_function insert function name
23
+	 * @param  array                    $_attr     array with parameter
24
+	 * @param  Smarty_Internal_Template $_template template object
25
+	 * @param  string                   $_script   script name to load or 'null'
26
+	 * @param  string                   $_assign   optional variable name
27
+	 *
28
+	 * @return string                   compiled code
29
+	 */
30
+	public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
31
+	{
32
+		$_output = '<?php ';
33
+		if ($_script != 'null') {
34
+			// script which must be included
35
+			// code for script file loading
36
+			$_output .= "require_once '{$_script}';";
37
+		}
38
+		// call insert
39
+		if (isset($_assign)) {
40
+			$_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
41
+						",\$_smarty_tpl), true);?>";
42
+		} else {
43
+			$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
44
+		}
45
+		$_tpl = $_template;
46
+		while (isset($_tpl->parent) && $_tpl->parent->_objType == 2) {
47
+			$_tpl = $_tpl->parent;
48
+		}
49 49
 
50
-        return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output .
51
-               "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
52
-    }
50
+		return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output .
51
+			   "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
52
+	}
53 53
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_ClearAllAssign
13 13
 {
14
-    /**
15
-     * Valid for all objects
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 7;
14
+	/**
15
+	 * Valid for all objects
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 7;
20 20
 
21
-    /**
22
-     * clear all the assigned template variables.
23
-     *
24
-     * @api  Smarty::clearAllAssign()
25
-     * @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl
26
-     *
27
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
-     *
29
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
30
-     */
31
-    public function clearAllAssign(Smarty_Internal_Data $data)
32
-    {
33
-        $data->tpl_vars = array();
21
+	/**
22
+	 * clear all the assigned template variables.
23
+	 *
24
+	 * @api  Smarty::clearAllAssign()
25
+	 * @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
+	 *
29
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
30
+	 */
31
+	public function clearAllAssign(Smarty_Internal_Data $data)
32
+	{
33
+		$data->tpl_vars = array();
34 34
 
35
-        return $data;
36
-    }
35
+		return $data;
36
+	}
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -16,49 +16,49 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Make_Nocache 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 $option_flags = array();
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $option_flags = array();
26 26
 
27
-    /**
28
-     * Array of names of required attribute required by tag
29
-     *
30
-     * @var array
31
-     */
32
-    public $required_attributes = array('var');
27
+	/**
28
+	 * Array of names of required attribute required by tag
29
+	 *
30
+	 * @var array
31
+	 */
32
+	public $required_attributes = array('var');
33 33
 
34
-    /**
35
-     * Shorttag attribute order defined by its names
36
-     *
37
-     * @var array
38
-     */
39
-    public $shorttag_order = array('var');
34
+	/**
35
+	 * Shorttag attribute order defined by its names
36
+	 *
37
+	 * @var array
38
+	 */
39
+	public $shorttag_order = array('var');
40 40
 
41
-    /**
42
-     * Compiles code for the {make_nocache} tag
43
-     *
44
-     * @param  array                                $args      array with attributes from parser
45
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
46
-     * @param  array                                $parameter array with compilation parameter
47
-     *
48
-     * @return string compiled code
49
-     * @throws \SmartyCompilerException
50
-     */
51
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
52
-    {
53
-        // check and get attributes
54
-        $_attr = $this->getAttributes($compiler, $args);
55
-        if ($compiler->template->caching) {
56
-            $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
57
-            $compiler->has_code = true;
58
-            $compiler->suppressNocacheProcessing = true;
59
-            return $output;
60
-        } else {
61
-            return true;
62
-        }
63
-    }
41
+	/**
42
+	 * Compiles code for the {make_nocache} tag
43
+	 *
44
+	 * @param  array                                $args      array with attributes from parser
45
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
46
+	 * @param  array                                $parameter array with compilation parameter
47
+	 *
48
+	 * @return string compiled code
49
+	 * @throws \SmartyCompilerException
50
+	 */
51
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
52
+	{
53
+		// check and get attributes
54
+		$_attr = $this->getAttributes($compiler, $args);
55
+		if ($compiler->template->caching) {
56
+			$output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
57
+			$compiler->has_code = true;
58
+			$compiler->suppressNocacheProcessing = true;
59
+			return $output;
60
+		} else {
61
+			return true;
62
+		}
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
         // check and get attributes
54 54
         $_attr = $this->getAttributes($compiler, $args);
55 55
         if ($compiler->template->caching) {
56
-            $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
56
+            $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr['var']});\n?>\n";
57 57
             $compiler->has_code = true;
58 58
             $compiler->suppressNocacheProcessing = true;
59 59
             return $output;
Please login to merge, or discard this patch.