Completed
Push — developer ( 7f46f3...3f66fa )
by Błażej
134:52 queued 72:56
created
libraries/Smarty/libs/plugins/modifiercompiler.string_format.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function smarty_modifiercompiler_string_format($params)
23 23
 {
24
-    return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')';
24
+	return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')';
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function smarty_modifiercompiler_string_format($params)
23 23
 {
24
-    return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')';
24
+    return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
25 25
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.indent.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 
23 23
 function smarty_modifiercompiler_indent($params)
24 24
 {
25
-    if (!isset($params[ 1 ])) {
26
-        $params[ 1 ] = 4;
27
-    }
28
-    if (!isset($params[ 2 ])) {
29
-        $params[ 2 ] = "' '";
30
-    }
25
+	if (!isset($params[ 1 ])) {
26
+		$params[ 1 ] = 4;
27
+	}
28
+	if (!isset($params[ 2 ])) {
29
+		$params[ 2 ] = "' '";
30
+	}
31 31
 
32
-    return 'preg_replace(\'!^!m\',str_repeat(' . $params[ 2 ] . ',' . $params[ 1 ] . '),' . $params[ 0 ] . ')';
32
+	return 'preg_replace(\'!^!m\',str_repeat(' . $params[ 2 ] . ',' . $params[ 1 ] . '),' . $params[ 0 ] . ')';
33 33
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 
23 23
 function smarty_modifiercompiler_indent($params)
24 24
 {
25
-    if (!isset($params[ 1 ])) {
26
-        $params[ 1 ] = 4;
25
+    if (!isset($params[1])) {
26
+        $params[1] = 4;
27 27
     }
28
-    if (!isset($params[ 2 ])) {
29
-        $params[ 2 ] = "' '";
28
+    if (!isset($params[2])) {
29
+        $params[2] = "' '";
30 30
     }
31 31
 
32
-    return 'preg_replace(\'!^!m\',str_repeat(' . $params[ 2 ] . ',' . $params[ 1 ] . '),' . $params[ 0 ] . ')';
32
+    return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
33 33
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_radios.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -45,188 +45,188 @@
 block discarded – undo
45 45
  */
46 46
 function smarty_function_html_radios($params, $template)
47 47
 {
48
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
-
50
-    $name = 'radio';
51
-    $values = null;
52
-    $options = null;
53
-    $selected = null;
54
-    $separator = '';
55
-    $escape = true;
56
-    $labels = true;
57
-    $label_ids = false;
58
-    $output = null;
59
-    $extra = '';
60
-
61
-    foreach ($params as $_key => $_val) {
62
-        switch ($_key) {
63
-            case 'name':
64
-            case 'separator':
65
-                $$_key = (string) $_val;
66
-                break;
67
-
68
-            case 'checked':
69
-            case 'selected':
70
-                if (is_array($_val)) {
71
-                    trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
72
-                } elseif (is_object($_val)) {
73
-                    if (method_exists($_val, "__toString")) {
74
-                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());
75
-                    } else {
76
-                        trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) .
77
-                                      "' without __toString() method", E_USER_NOTICE);
78
-                    }
79
-                } else {
80
-                    $selected = (string) $_val;
81
-                }
82
-                break;
83
-
84
-            case 'escape':
85
-            case 'labels':
86
-            case 'label_ids':
87
-                $$_key = (bool) $_val;
88
-                break;
89
-
90
-            case 'options':
91
-                $$_key = (array) $_val;
92
-                break;
93
-
94
-            case 'values':
95
-            case 'output':
96
-                $$_key = array_values((array) $_val);
97
-                break;
98
-
99
-            case 'radios':
100
-                trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
101
-                              E_USER_WARNING);
102
-                $options = (array) $_val;
103
-                break;
104
-
105
-            case 'assign':
106
-                break;
107
-
108
-            case 'strict':
109
-                break;
110
-
111
-            case 'disabled':
112
-            case 'readonly':
113
-                if (!empty($params[ 'strict' ])) {
114
-                    if (!is_scalar($_val)) {
115
-                        trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116
-                                      E_USER_NOTICE);
117
-                    }
118
-
119
-                    if ($_val === true || $_val === $_key) {
120
-                        $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
121
-                    }
122
-
123
-                    break;
124
-                }
125
-            // omit break; to fall through!
126
-
127
-            default:
128
-                if (!is_array($_val)) {
129
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
130
-                } else {
131
-                    trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
132
-                }
133
-                break;
134
-        }
135
-    }
136
-
137
-    if (!isset($options) && !isset($values)) {
138
-        /* raise error here? */
139
-
140
-        return '';
141
-    }
142
-
143
-    $_html_result = array();
144
-
145
-    if (isset($options)) {
146
-        foreach ($options as $_key => $_val) {
147
-            $_html_result[] =
148
-                smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
149
-                                                   $label_ids, $escape);
150
-        }
151
-    } else {
152
-        foreach ($values as $_i => $_key) {
153
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
154
-            $_html_result[] =
155
-                smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156
-                                                   $label_ids, $escape);
157
-        }
158
-    }
159
-
160
-    if (!empty($params[ 'assign' ])) {
161
-        $template->assign($params[ 'assign' ], $_html_result);
162
-    } else {
163
-        return implode("\n", $_html_result);
164
-    }
48
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
+
50
+	$name = 'radio';
51
+	$values = null;
52
+	$options = null;
53
+	$selected = null;
54
+	$separator = '';
55
+	$escape = true;
56
+	$labels = true;
57
+	$label_ids = false;
58
+	$output = null;
59
+	$extra = '';
60
+
61
+	foreach ($params as $_key => $_val) {
62
+		switch ($_key) {
63
+			case 'name':
64
+			case 'separator':
65
+				$$_key = (string) $_val;
66
+				break;
67
+
68
+			case 'checked':
69
+			case 'selected':
70
+				if (is_array($_val)) {
71
+					trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
72
+				} elseif (is_object($_val)) {
73
+					if (method_exists($_val, "__toString")) {
74
+						$selected = smarty_function_escape_special_chars((string) $_val->__toString());
75
+					} else {
76
+						trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) .
77
+									  "' without __toString() method", E_USER_NOTICE);
78
+					}
79
+				} else {
80
+					$selected = (string) $_val;
81
+				}
82
+				break;
83
+
84
+			case 'escape':
85
+			case 'labels':
86
+			case 'label_ids':
87
+				$$_key = (bool) $_val;
88
+				break;
89
+
90
+			case 'options':
91
+				$$_key = (array) $_val;
92
+				break;
93
+
94
+			case 'values':
95
+			case 'output':
96
+				$$_key = array_values((array) $_val);
97
+				break;
98
+
99
+			case 'radios':
100
+				trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
101
+							  E_USER_WARNING);
102
+				$options = (array) $_val;
103
+				break;
104
+
105
+			case 'assign':
106
+				break;
107
+
108
+			case 'strict':
109
+				break;
110
+
111
+			case 'disabled':
112
+			case 'readonly':
113
+				if (!empty($params[ 'strict' ])) {
114
+					if (!is_scalar($_val)) {
115
+						trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116
+									  E_USER_NOTICE);
117
+					}
118
+
119
+					if ($_val === true || $_val === $_key) {
120
+						$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
121
+					}
122
+
123
+					break;
124
+				}
125
+			// omit break; to fall through!
126
+
127
+			default:
128
+				if (!is_array($_val)) {
129
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
130
+				} else {
131
+					trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
132
+				}
133
+				break;
134
+		}
135
+	}
136
+
137
+	if (!isset($options) && !isset($values)) {
138
+		/* raise error here? */
139
+
140
+		return '';
141
+	}
142
+
143
+	$_html_result = array();
144
+
145
+	if (isset($options)) {
146
+		foreach ($options as $_key => $_val) {
147
+			$_html_result[] =
148
+				smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
149
+												   $label_ids, $escape);
150
+		}
151
+	} else {
152
+		foreach ($values as $_i => $_key) {
153
+			$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
154
+			$_html_result[] =
155
+				smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156
+												   $label_ids, $escape);
157
+		}
158
+	}
159
+
160
+	if (!empty($params[ 'assign' ])) {
161
+		$template->assign($params[ 'assign' ], $_html_result);
162
+	} else {
163
+		return implode("\n", $_html_result);
164
+	}
165 165
 }
166 166
 
167 167
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
168
-                                            $escape)
168
+											$escape)
169 169
 {
170
-    $_output = '';
171
-
172
-    if (is_object($value)) {
173
-        if (method_exists($value, "__toString")) {
174
-            $value = (string) $value->__toString();
175
-        } else {
176
-            trigger_error("html_options: value is an object of class '" . get_class($value) .
177
-                          "' without __toString() method", E_USER_NOTICE);
178
-
179
-            return '';
180
-        }
181
-    } else {
182
-        $value = (string) $value;
183
-    }
184
-
185
-    if (is_object($output)) {
186
-        if (method_exists($output, "__toString")) {
187
-            $output = (string) $output->__toString();
188
-        } else {
189
-            trigger_error("html_options: output is an object of class '" . get_class($output) .
190
-                          "' without __toString() method", E_USER_NOTICE);
191
-
192
-            return '';
193
-        }
194
-    } else {
195
-        $output = (string) $output;
196
-    }
197
-
198
-    if ($labels) {
199
-        if ($label_ids) {
200
-            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
201
-                                                                     $name . '_' . $value));
202
-            $_output .= '<label for="' . $_id . '">';
203
-        } else {
204
-            $_output .= '<label>';
205
-        }
206
-    }
207
-
208
-    $name = smarty_function_escape_special_chars($name);
209
-    $value = smarty_function_escape_special_chars($value);
210
-    if ($escape) {
211
-        $output = smarty_function_escape_special_chars($output);
212
-    }
213
-
214
-    $_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
215
-
216
-    if ($labels && $label_ids) {
217
-        $_output .= ' id="' . $_id . '"';
218
-    }
219
-
220
-    if ($value === $selected) {
221
-        $_output .= ' checked="checked"';
222
-    }
223
-
224
-    $_output .= $extra . ' />' . $output;
225
-    if ($labels) {
226
-        $_output .= '</label>';
227
-    }
228
-
229
-    $_output .= $separator;
230
-
231
-    return $_output;
170
+	$_output = '';
171
+
172
+	if (is_object($value)) {
173
+		if (method_exists($value, "__toString")) {
174
+			$value = (string) $value->__toString();
175
+		} else {
176
+			trigger_error("html_options: value is an object of class '" . get_class($value) .
177
+						  "' without __toString() method", E_USER_NOTICE);
178
+
179
+			return '';
180
+		}
181
+	} else {
182
+		$value = (string) $value;
183
+	}
184
+
185
+	if (is_object($output)) {
186
+		if (method_exists($output, "__toString")) {
187
+			$output = (string) $output->__toString();
188
+		} else {
189
+			trigger_error("html_options: output is an object of class '" . get_class($output) .
190
+						  "' without __toString() method", E_USER_NOTICE);
191
+
192
+			return '';
193
+		}
194
+	} else {
195
+		$output = (string) $output;
196
+	}
197
+
198
+	if ($labels) {
199
+		if ($label_ids) {
200
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
201
+																	 $name . '_' . $value));
202
+			$_output .= '<label for="' . $_id . '">';
203
+		} else {
204
+			$_output .= '<label>';
205
+		}
206
+	}
207
+
208
+	$name = smarty_function_escape_special_chars($name);
209
+	$value = smarty_function_escape_special_chars($value);
210
+	if ($escape) {
211
+		$output = smarty_function_escape_special_chars($output);
212
+	}
213
+
214
+	$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
215
+
216
+	if ($labels && $label_ids) {
217
+		$_output .= ' id="' . $_id . '"';
218
+	}
219
+
220
+	if ($value === $selected) {
221
+		$_output .= ' checked="checked"';
222
+	}
223
+
224
+	$_output .= $extra . ' />' . $output;
225
+	if ($labels) {
226
+		$_output .= '</label>';
227
+	}
228
+
229
+	$_output .= $separator;
230
+
231
+	return $_output;
232 232
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
             case 'disabled':
112 112
             case 'readonly':
113
-                if (!empty($params[ 'strict' ])) {
113
+                if (!empty($params['strict'])) {
114 114
                     if (!is_scalar($_val)) {
115 115
                         trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116 116
                                       E_USER_NOTICE);
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
         }
151 151
     } else {
152 152
         foreach ($values as $_i => $_key) {
153
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
153
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
154 154
             $_html_result[] =
155 155
                 smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156 156
                                                    $label_ids, $escape);
157 157
         }
158 158
     }
159 159
 
160
-    if (!empty($params[ 'assign' ])) {
161
-        $template->assign($params[ 'assign' ], $_html_result);
160
+    if (!empty($params['assign'])) {
161
+        $template->assign($params['assign'], $_html_result);
162 162
     } else {
163 163
         return implode("\n", $_html_result);
164 164
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.counter.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -23,51 +23,51 @@
 block discarded – undo
23 23
  */
24 24
 function smarty_function_counter($params, $template)
25 25
 {
26
-    static $counters = array();
26
+	static $counters = array();
27 27
 
28
-    $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
29
-    if (!isset($counters[ $name ])) {
30
-        $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
31
-    }
32
-    $counter =& $counters[ $name ];
28
+	$name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
29
+	if (!isset($counters[ $name ])) {
30
+		$counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
31
+	}
32
+	$counter =& $counters[ $name ];
33 33
 
34
-    if (isset($params[ 'start' ])) {
35
-        $counter[ 'start' ] = $counter[ 'count' ] = (int) $params[ 'start' ];
36
-    }
34
+	if (isset($params[ 'start' ])) {
35
+		$counter[ 'start' ] = $counter[ 'count' ] = (int) $params[ 'start' ];
36
+	}
37 37
 
38
-    if (!empty($params[ 'assign' ])) {
39
-        $counter[ 'assign' ] = $params[ 'assign' ];
40
-    }
38
+	if (!empty($params[ 'assign' ])) {
39
+		$counter[ 'assign' ] = $params[ 'assign' ];
40
+	}
41 41
 
42
-    if (isset($counter[ 'assign' ])) {
43
-        $template->assign($counter[ 'assign' ], $counter[ 'count' ]);
44
-    }
42
+	if (isset($counter[ 'assign' ])) {
43
+		$template->assign($counter[ 'assign' ], $counter[ 'count' ]);
44
+	}
45 45
 
46
-    if (isset($params[ 'print' ])) {
47
-        $print = (bool) $params[ 'print' ];
48
-    } else {
49
-        $print = empty($counter[ 'assign' ]);
50
-    }
46
+	if (isset($params[ 'print' ])) {
47
+		$print = (bool) $params[ 'print' ];
48
+	} else {
49
+		$print = empty($counter[ 'assign' ]);
50
+	}
51 51
 
52
-    if ($print) {
53
-        $retval = $counter[ 'count' ];
54
-    } else {
55
-        $retval = null;
56
-    }
52
+	if ($print) {
53
+		$retval = $counter[ 'count' ];
54
+	} else {
55
+		$retval = null;
56
+	}
57 57
 
58
-    if (isset($params[ 'skip' ])) {
59
-        $counter[ 'skip' ] = $params[ 'skip' ];
60
-    }
58
+	if (isset($params[ 'skip' ])) {
59
+		$counter[ 'skip' ] = $params[ 'skip' ];
60
+	}
61 61
 
62
-    if (isset($params[ 'direction' ])) {
63
-        $counter[ 'direction' ] = $params[ 'direction' ];
64
-    }
62
+	if (isset($params[ 'direction' ])) {
63
+		$counter[ 'direction' ] = $params[ 'direction' ];
64
+	}
65 65
 
66
-    if ($counter[ 'direction' ] == "down") {
67
-        $counter[ 'count' ] -= $counter[ 'skip' ];
68
-    } else {
69
-        $counter[ 'count' ] += $counter[ 'skip' ];
70
-    }
66
+	if ($counter[ 'direction' ] == "down") {
67
+		$counter[ 'count' ] -= $counter[ 'skip' ];
68
+	} else {
69
+		$counter[ 'count' ] += $counter[ 'skip' ];
70
+	}
71 71
 
72
-    return $retval;
72
+	return $retval;
73 73
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,48 +25,48 @@
 block discarded – undo
25 25
 {
26 26
     static $counters = array();
27 27
 
28
-    $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
29
-    if (!isset($counters[ $name ])) {
30
-        $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
28
+    $name = (isset($params['name'])) ? $params['name'] : 'default';
29
+    if (!isset($counters[$name])) {
30
+        $counters[$name] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
31 31
     }
32
-    $counter =& $counters[ $name ];
32
+    $counter = & $counters[$name];
33 33
 
34
-    if (isset($params[ 'start' ])) {
35
-        $counter[ 'start' ] = $counter[ 'count' ] = (int) $params[ 'start' ];
34
+    if (isset($params['start'])) {
35
+        $counter['start'] = $counter['count'] = (int) $params['start'];
36 36
     }
37 37
 
38
-    if (!empty($params[ 'assign' ])) {
39
-        $counter[ 'assign' ] = $params[ 'assign' ];
38
+    if (!empty($params['assign'])) {
39
+        $counter['assign'] = $params['assign'];
40 40
     }
41 41
 
42
-    if (isset($counter[ 'assign' ])) {
43
-        $template->assign($counter[ 'assign' ], $counter[ 'count' ]);
42
+    if (isset($counter['assign'])) {
43
+        $template->assign($counter['assign'], $counter['count']);
44 44
     }
45 45
 
46
-    if (isset($params[ 'print' ])) {
47
-        $print = (bool) $params[ 'print' ];
46
+    if (isset($params['print'])) {
47
+        $print = (bool) $params['print'];
48 48
     } else {
49
-        $print = empty($counter[ 'assign' ]);
49
+        $print = empty($counter['assign']);
50 50
     }
51 51
 
52 52
     if ($print) {
53
-        $retval = $counter[ 'count' ];
53
+        $retval = $counter['count'];
54 54
     } else {
55 55
         $retval = null;
56 56
     }
57 57
 
58
-    if (isset($params[ 'skip' ])) {
59
-        $counter[ 'skip' ] = $params[ 'skip' ];
58
+    if (isset($params['skip'])) {
59
+        $counter['skip'] = $params['skip'];
60 60
     }
61 61
 
62
-    if (isset($params[ 'direction' ])) {
63
-        $counter[ 'direction' ] = $params[ 'direction' ];
62
+    if (isset($params['direction'])) {
63
+        $counter['direction'] = $params['direction'];
64 64
     }
65 65
 
66
-    if ($counter[ 'direction' ] == "down") {
67
-        $counter[ 'count' ] -= $counter[ 'skip' ];
66
+    if ($counter['direction'] == "down") {
67
+        $counter['count'] -= $counter['skip'];
68 68
     } else {
69
-        $counter[ 'count' ] += $counter[ 'skip' ];
69
+        $counter['count'] += $counter['skip'];
70 70
     }
71 71
 
72 72
     return $retval;
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.cat.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,5 +25,5 @@
 block discarded – undo
25 25
  */
26 26
 function smarty_modifiercompiler_cat($params)
27 27
 {
28
-    return '(' . implode(').(', $params) . ')';
28
+	return '(' . implode(').(', $params) . ')';
29 29
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/variablefilter.htmlspecialchars.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,5 +15,5 @@
 block discarded – undo
15 15
  */
16 16
 function smarty_variablefilter_htmlspecialchars($source)
17 17
 {
18
-    return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
18
+	return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
19 19
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_RegisterPlugin
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Registers plugin to be used in templates
23
-     *
24
-     * @api  Smarty::registerPlugin()
25
-     * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
26
-     *
27
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
-     * @param  string                                                         $type       plugin type
29
-     * @param  string                                                         $name       name of template tag
30
-     * @param  callback                                                       $callback   PHP callback to register
31
-     * @param  bool                                                           $cacheable  if true (default) this
32
-     *                                                                                    function is cache able
33
-     * @param  mixed                                                          $cache_attr caching attributes if any
34
-     *
35
-     * @return \Smarty|\Smarty_Internal_Template
36
-     * @throws SmartyException              when the plugin tag is invalid
37
-     */
38
-    public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true,
39
-                                   $cache_attr = null)
40
-    {
41
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
42
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
43
-            throw new SmartyException("Plugin tag \"{$name}\" already registered");
44
-        } elseif (!is_callable($callback)) {
45
-            throw new SmartyException("Plugin \"{$name}\" not callable");
46
-        } else {
47
-            $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr);
48
-        }
49
-        return $obj;
50
-    }
21
+	/**
22
+	 * Registers plugin to be used in templates
23
+	 *
24
+	 * @api  Smarty::registerPlugin()
25
+	 * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
+	 * @param  string                                                         $type       plugin type
29
+	 * @param  string                                                         $name       name of template tag
30
+	 * @param  callback                                                       $callback   PHP callback to register
31
+	 * @param  bool                                                           $cacheable  if true (default) this
32
+	 *                                                                                    function is cache able
33
+	 * @param  mixed                                                          $cache_attr caching attributes if any
34
+	 *
35
+	 * @return \Smarty|\Smarty_Internal_Template
36
+	 * @throws SmartyException              when the plugin tag is invalid
37
+	 */
38
+	public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true,
39
+								   $cache_attr = null)
40
+	{
41
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
42
+		if (isset($smarty->registered_plugins[ $type ][ $name ])) {
43
+			throw new SmartyException("Plugin tag \"{$name}\" already registered");
44
+		} elseif (!is_callable($callback)) {
45
+			throw new SmartyException("Plugin \"{$name}\" not callable");
46
+		} else {
47
+			$smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr);
48
+		}
49
+		return $obj;
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@
 block discarded – undo
39 39
                                    $cache_attr = null)
40 40
     {
41 41
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
42
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
42
+        if (isset($smarty->registered_plugins[$type][$name])) {
43 43
             throw new SmartyException("Plugin tag \"{$name}\" already registered");
44 44
         } elseif (!is_callable($callback)) {
45 45
             throw new SmartyException("Plugin \"{$name}\" not callable");
46 46
         } else {
47
-            $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr);
47
+            $smarty->registered_plugins[$type][$name] = array($callback, (bool) $cacheable, (array) $cache_attr);
48 48
         }
49 49
         return $obj;
50 50
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_eval.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,57 +16,57 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
18 18
 {
19
-    /**
20
-     * Attribute definition: Overwrites base class.
21
-     *
22
-     * @var array
23
-     * @see Smarty_Internal_CompileBase
24
-     */
25
-    public $required_attributes = array('var');
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $required_attributes = array('var');
26 26
 
27
-    /**
28
-     * Attribute definition: Overwrites base class.
29
-     *
30
-     * @var array
31
-     * @see Smarty_Internal_CompileBase
32
-     */
33
-    public $optional_attributes = array('assign');
27
+	/**
28
+	 * Attribute definition: Overwrites base class.
29
+	 *
30
+	 * @var array
31
+	 * @see Smarty_Internal_CompileBase
32
+	 */
33
+	public $optional_attributes = array('assign');
34 34
 
35
-    /**
36
-     * Attribute definition: Overwrites base class.
37
-     *
38
-     * @var array
39
-     * @see Smarty_Internal_CompileBase
40
-     */
41
-    public $shorttag_order = array('var', 'assign');
35
+	/**
36
+	 * Attribute definition: Overwrites base class.
37
+	 *
38
+	 * @var array
39
+	 * @see Smarty_Internal_CompileBase
40
+	 */
41
+	public $shorttag_order = array('var', 'assign');
42 42
 
43
-    /**
44
-     * Compiles code for the {eval} tag
45
-     *
46
-     * @param  array  $args     array with attributes from parser
47
-     * @param  object $compiler compiler object
48
-     *
49
-     * @return string compiled code
50
-     */
51
-    public function compile($args, $compiler)
52
-    {
53
-        // check and get attributes
54
-        $_attr = $this->getAttributes($compiler, $args);
55
-        if (isset($_attr[ 'assign' ])) {
56
-            // output will be stored in a smarty variable instead of being displayed
57
-            $_assign = $_attr[ 'assign' ];
58
-        }
43
+	/**
44
+	 * Compiles code for the {eval} tag
45
+	 *
46
+	 * @param  array  $args     array with attributes from parser
47
+	 * @param  object $compiler compiler object
48
+	 *
49
+	 * @return string compiled code
50
+	 */
51
+	public function compile($args, $compiler)
52
+	{
53
+		// check and get attributes
54
+		$_attr = $this->getAttributes($compiler, $args);
55
+		if (isset($_attr[ 'assign' ])) {
56
+			// output will be stored in a smarty variable instead of being displayed
57
+			$_assign = $_attr[ 'assign' ];
58
+		}
59 59
 
60
-        // create template object
61
-        $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] .
62
-                   ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
63
-        //was there an assign attribute?
64
-        if (isset($_assign)) {
65
-            $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
66
-        } else {
67
-            $_output .= "echo \$_template->fetch();";
68
-        }
60
+		// create template object
61
+		$_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] .
62
+				   ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
63
+		//was there an assign attribute?
64
+		if (isset($_assign)) {
65
+			$_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
66
+		} else {
67
+			$_output .= "echo \$_template->fetch();";
68
+		}
69 69
 
70
-        return "<?php $_output ?>";
71
-    }
70
+		return "<?php $_output ?>";
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@
 block discarded – undo
52 52
     {
53 53
         // check and get attributes
54 54
         $_attr = $this->getAttributes($compiler, $args);
55
-        if (isset($_attr[ 'assign' ])) {
55
+        if (isset($_attr['assign'])) {
56 56
             // output will be stored in a smarty variable instead of being displayed
57
-            $_assign = $_attr[ 'assign' ];
57
+            $_assign = $_attr['assign'];
58 58
         }
59 59
 
60 60
         // create template object
61
-        $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] .
61
+        $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr['var'] .
62 62
                    ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
63 63
         //was there an assign attribute?
64 64
         if (isset($_assign)) {
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_block.php 2 patches
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -15,134 +15,134 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inheritance
17 17
 {
18
-    /**
19
-     * Attribute definition: Overwrites base class.
20
-     *
21
-     * @var array
22
-     * @see Smarty_Internal_CompileBase
23
-     */
24
-    public $required_attributes = array('name');
18
+	/**
19
+	 * Attribute definition: Overwrites base class.
20
+	 *
21
+	 * @var array
22
+	 * @see Smarty_Internal_CompileBase
23
+	 */
24
+	public $required_attributes = array('name');
25 25
 
26
-    /**
27
-     * Attribute definition: Overwrites base class.
28
-     *
29
-     * @var array
30
-     * @see Smarty_Internal_CompileBase
31
-     */
32
-    public $shorttag_order = array('name');
26
+	/**
27
+	 * Attribute definition: Overwrites base class.
28
+	 *
29
+	 * @var array
30
+	 * @see Smarty_Internal_CompileBase
31
+	 */
32
+	public $shorttag_order = array('name');
33 33
 
34
-    /**
35
-     * Attribute definition: Overwrites base class.
36
-     *
37
-     * @var array
38
-     * @see Smarty_Internal_CompileBase
39
-     */
40
-    public $option_flags = array('hide', 'nocache');
34
+	/**
35
+	 * Attribute definition: Overwrites base class.
36
+	 *
37
+	 * @var array
38
+	 * @see Smarty_Internal_CompileBase
39
+	 */
40
+	public $option_flags = array('hide', 'nocache');
41 41
 
42
-    /**
43
-     * Attribute definition: Overwrites base class.
44
-     *
45
-     * @var array
46
-     * @see Smarty_Internal_CompileBase
47
-     */
48
-    public $optional_attributes = array('assign');
42
+	/**
43
+	 * Attribute definition: Overwrites base class.
44
+	 *
45
+	 * @var array
46
+	 * @see Smarty_Internal_CompileBase
47
+	 */
48
+	public $optional_attributes = array('assign');
49 49
 
50
-    /**
51
-     * nesting level of block tags
52
-     *
53
-     * @var int
54
-     */
55
-    public static $blockTagNestingLevel = 0;
50
+	/**
51
+	 * nesting level of block tags
52
+	 *
53
+	 * @var int
54
+	 */
55
+	public static $blockTagNestingLevel = 0;
56 56
 
57
-    /**
58
-     * Saved compiler object
59
-     *
60
-     * @var Smarty_Internal_TemplateCompilerBase
61
-     */
62
-    public $compiler = null;
57
+	/**
58
+	 * Saved compiler object
59
+	 *
60
+	 * @var Smarty_Internal_TemplateCompilerBase
61
+	 */
62
+	public $compiler = null;
63 63
 
64
-    /**
65
-     * Compiles code for the {block} tag
66
-     *
67
-     * @param  array                                 $args      array with attributes from parser
68
-     * @param  \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
69
-     * @param  array                                 $parameter array with compilation parameter
70
-     *
71
-     * @return bool true
72
-     */
73
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
74
-    {
75
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
76
-            $compiler->_cache[ 'blockNesting' ] = 0;
77
-        }
78
-        if ($compiler->_cache[ 'blockNesting' ] == 0) {
79
-            // make sure that inheritance gets initialized in template code
80
-            $this->registerInit($compiler);
81
-            $this->option_flags = array('hide', 'nocache', 'append', 'prepend');
82
-        } else {
83
-            $this->option_flags = array('hide', 'nocache');
84
-        }
85
-        // check and get attributes
86
-        $_attr = $this->getAttributes($compiler, $args);
87
-        $compiler->_cache[ 'blockNesting' ] ++;
88
-        $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ];
89
-        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
90
-        $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
91
-                                                 $compiler->template->compiled->has_nocache_code,
92
-                                                 $compiler->template->caching));
93
-        // must whole block be nocache ?
94
-        if ($compiler->tag_nocache) {
95
-            $i = 0;
96
-        }
97
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
98
-        if ($_attr[ 'nocache' ] === true) {
64
+	/**
65
+	 * Compiles code for the {block} tag
66
+	 *
67
+	 * @param  array                                 $args      array with attributes from parser
68
+	 * @param  \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
69
+	 * @param  array                                 $parameter array with compilation parameter
70
+	 *
71
+	 * @return bool true
72
+	 */
73
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
74
+	{
75
+		if (!isset($compiler->_cache[ 'blockNesting' ])) {
76
+			$compiler->_cache[ 'blockNesting' ] = 0;
77
+		}
78
+		if ($compiler->_cache[ 'blockNesting' ] == 0) {
79
+			// make sure that inheritance gets initialized in template code
80
+			$this->registerInit($compiler);
81
+			$this->option_flags = array('hide', 'nocache', 'append', 'prepend');
82
+		} else {
83
+			$this->option_flags = array('hide', 'nocache');
84
+		}
85
+		// check and get attributes
86
+		$_attr = $this->getAttributes($compiler, $args);
87
+		$compiler->_cache[ 'blockNesting' ] ++;
88
+		$compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ];
89
+		$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
90
+		$this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
91
+												 $compiler->template->compiled->has_nocache_code,
92
+												 $compiler->template->caching));
93
+		// must whole block be nocache ?
94
+		if ($compiler->tag_nocache) {
95
+			$i = 0;
96
+		}
97
+		$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
98
+		if ($_attr[ 'nocache' ] === true) {
99 99
 
100
-        }
101
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
102
-        $compiler->template->compiled->has_nocache_code = false;
103
-        $compiler->suppressNocacheProcessing = true;
104
-    }
100
+		}
101
+		$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
102
+		$compiler->template->compiled->has_nocache_code = false;
103
+		$compiler->suppressNocacheProcessing = true;
104
+	}
105 105
 
106
-    /**
107
-     * Compile saved child block source
108
-     *
109
-     * @param \Smarty_Internal_TemplateCompilerBase compiler object
110
-     * @param string                                $_name   optional name of child block
111
-     *
112
-     * @return string   compiled code of child block
113
-     */
114
-    static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
115
-    {
116
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
117
-            $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',
118
-                                              $compiler->parser->lex->taglineno);
119
-        }
120
-        $compiler->has_code = true;
121
-        $compiler->suppressNocacheProcessing = true;
122
-        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
123
-        $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n";
124
-        return $output;
125
-    }
106
+	/**
107
+	 * Compile saved child block source
108
+	 *
109
+	 * @param \Smarty_Internal_TemplateCompilerBase compiler object
110
+	 * @param string                                $_name   optional name of child block
111
+	 *
112
+	 * @return string   compiled code of child block
113
+	 */
114
+	static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
115
+	{
116
+		if (!isset($compiler->_cache[ 'blockNesting' ])) {
117
+			$compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',
118
+											  $compiler->parser->lex->taglineno);
119
+		}
120
+		$compiler->has_code = true;
121
+		$compiler->suppressNocacheProcessing = true;
122
+		$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
123
+		$output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n";
124
+		return $output;
125
+	}
126 126
 
127
-    /**
128
-     * Compile $smarty.block.parent
129
-     *
130
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
131
-     * @param string                                $_name    optional name of child block
132
-     *
133
-     * @return string   compiled code of child block
134
-     */
135
-    static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
136
-    {
137
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
138
-            $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',
139
-                                              $compiler->parser->lex->taglineno);
140
-        }
141
-        $compiler->suppressNocacheProcessing = true;
142
-        $compiler->has_code = true;
143
-        $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this);\n?>\n";
144
-        return $output;
145
-    }
127
+	/**
128
+	 * Compile $smarty.block.parent
129
+	 *
130
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
131
+	 * @param string                                $_name    optional name of child block
132
+	 *
133
+	 * @return string   compiled code of child block
134
+	 */
135
+	static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
136
+	{
137
+		if (!isset($compiler->_cache[ 'blockNesting' ])) {
138
+			$compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',
139
+											  $compiler->parser->lex->taglineno);
140
+		}
141
+		$compiler->suppressNocacheProcessing = true;
142
+		$compiler->has_code = true;
143
+		$output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this);\n?>\n";
144
+		return $output;
145
+	}
146 146
 }
147 147
 
148 148
 /**
@@ -151,95 +151,95 @@  discard block
 block discarded – undo
151 151
  */
152 152
 class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance
153 153
 {
154
-    /**
155
-     * Compiles code for the {/block} tag
156
-     *
157
-     * @param  array                                $args      array with attributes from parser
158
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
159
-     * @param  array                                $parameter array with compilation parameter
160
-     *
161
-     * @return bool true
162
-     */
163
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
164
-    {
165
-        list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
166
-        // init block parameter
167
-        $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];
168
-        unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);
169
-        $_name = $_attr[ 'name' ];
170
-        $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
171
-        unset($_attr[ 'assign' ], $_attr[ 'name' ]);
172
-        foreach ($_attr as $name => $stat) {
173
-            if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) {
174
-                $_block[ $name ] = 'true';
175
-            }
176
-        }
177
-        $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true));
178
-        // get compiled block code
179
-        $_functionCode = $compiler->parser->current_buffer;
180
-        // setup buffer for template function code
181
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
154
+	/**
155
+	 * Compiles code for the {/block} tag
156
+	 *
157
+	 * @param  array                                $args      array with attributes from parser
158
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
159
+	 * @param  array                                $parameter array with compilation parameter
160
+	 *
161
+	 * @return bool true
162
+	 */
163
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
164
+	{
165
+		list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
166
+		// init block parameter
167
+		$_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];
168
+		unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);
169
+		$_name = $_attr[ 'name' ];
170
+		$_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
171
+		unset($_attr[ 'assign' ], $_attr[ 'name' ]);
172
+		foreach ($_attr as $name => $stat) {
173
+			if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) {
174
+				$_block[ $name ] = 'true';
175
+			}
176
+		}
177
+		$_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true));
178
+		// get compiled block code
179
+		$_functionCode = $compiler->parser->current_buffer;
180
+		// setup buffer for template function code
181
+		$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
182 182
 
183
-        $output = "<?php\n";
184
-        $output .= "/* {block {$_name}} */\n";
185
-        $output .= "class {$_className} extends Smarty_Internal_Block\n";
186
-        $output .= "{\n";
187
-        foreach ($_block as $property => $value) {
188
-            $output .= "public \${$property} = {$value};\n";
189
-        }
190
-        $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n";
191
-        if ($compiler->template->compiled->has_nocache_code) {
192
-            $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n";
193
-        }
194
-        if (isset($_assign)) {
195
-            $output .= "ob_start();\n";
196
-        }
197
-        $output .= "?>\n";
198
-        $compiler->parser->current_buffer->append_subtree($compiler->parser,
199
-                                                          new Smarty_Internal_ParseTree_Tag($compiler->parser,
200
-                                                                                            $output));
201
-        $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
202
-        $output = "<?php\n";
203
-        if (isset($_assign)) {
204
-            $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
205
-        }
206
-        $output .= "}\n";
207
-        $output .= "}\n";
208
-        $output .= "/* {/block {$_name}} */\n\n";
209
-        $output .= "?>\n";
210
-        $compiler->parser->current_buffer->append_subtree($compiler->parser,
211
-                                                          new Smarty_Internal_ParseTree_Tag($compiler->parser,
212
-                                                                                            $output));
213
-        $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
214
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
215
-        // nocache plugins must be copied
216
-        if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) {
217
-            foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) {
218
-                foreach ($tmp as $type => $data) {
219
-                    $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] =
220
-                        $data;
221
-                }
222
-            }
223
-        }
183
+		$output = "<?php\n";
184
+		$output .= "/* {block {$_name}} */\n";
185
+		$output .= "class {$_className} extends Smarty_Internal_Block\n";
186
+		$output .= "{\n";
187
+		foreach ($_block as $property => $value) {
188
+			$output .= "public \${$property} = {$value};\n";
189
+		}
190
+		$output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n";
191
+		if ($compiler->template->compiled->has_nocache_code) {
192
+			$output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n";
193
+		}
194
+		if (isset($_assign)) {
195
+			$output .= "ob_start();\n";
196
+		}
197
+		$output .= "?>\n";
198
+		$compiler->parser->current_buffer->append_subtree($compiler->parser,
199
+														  new Smarty_Internal_ParseTree_Tag($compiler->parser,
200
+																							$output));
201
+		$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
202
+		$output = "<?php\n";
203
+		if (isset($_assign)) {
204
+			$output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
205
+		}
206
+		$output .= "}\n";
207
+		$output .= "}\n";
208
+		$output .= "/* {/block {$_name}} */\n\n";
209
+		$output .= "?>\n";
210
+		$compiler->parser->current_buffer->append_subtree($compiler->parser,
211
+														  new Smarty_Internal_ParseTree_Tag($compiler->parser,
212
+																							$output));
213
+		$compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
214
+		$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
215
+		// nocache plugins must be copied
216
+		if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) {
217
+			foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) {
218
+				foreach ($tmp as $type => $data) {
219
+					$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] =
220
+						$data;
221
+				}
222
+			}
223
+		}
224 224
 
225
-        // restore old status
226
-        $compiler->template->compiled->has_nocache_code = $_has_nocache_code;
227
-        $compiler->tag_nocache = $compiler->nocache;
228
-        $compiler->nocache = $_nocache;
229
-        $compiler->parser->current_buffer = $_buffer;
230
-        $output = "<?php \n";
231
-        if ($compiler->_cache[ 'blockNesting' ] == 1) {
232
-            $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";
233
-        } else {
234
-            $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
235
-        }
236
-        $output .= "?>\n";
237
-        $compiler->_cache[ 'blockNesting' ] --;
238
-        if ($compiler->_cache[ 'blockNesting' ] == 0) {
239
-            unset($compiler->_cache[ 'blockNesting' ]);
240
-        }
241
-        $compiler->has_code = true;
242
-        $compiler->suppressNocacheProcessing = true;
243
-        return $output;
244
-    }
225
+		// restore old status
226
+		$compiler->template->compiled->has_nocache_code = $_has_nocache_code;
227
+		$compiler->tag_nocache = $compiler->nocache;
228
+		$compiler->nocache = $_nocache;
229
+		$compiler->parser->current_buffer = $_buffer;
230
+		$output = "<?php \n";
231
+		if ($compiler->_cache[ 'blockNesting' ] == 1) {
232
+			$output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";
233
+		} else {
234
+			$output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
235
+		}
236
+		$output .= "?>\n";
237
+		$compiler->_cache[ 'blockNesting' ] --;
238
+		if ($compiler->_cache[ 'blockNesting' ] == 0) {
239
+			unset($compiler->_cache[ 'blockNesting' ]);
240
+		}
241
+		$compiler->has_code = true;
242
+		$compiler->suppressNocacheProcessing = true;
243
+		return $output;
244
+	}
245 245
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
74 74
     {
75
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
76
-            $compiler->_cache[ 'blockNesting' ] = 0;
75
+        if (!isset($compiler->_cache['blockNesting'])) {
76
+            $compiler->_cache['blockNesting'] = 0;
77 77
         }
78
-        if ($compiler->_cache[ 'blockNesting' ] == 0) {
78
+        if ($compiler->_cache['blockNesting'] == 0) {
79 79
             // make sure that inheritance gets initialized in template code
80 80
             $this->registerInit($compiler);
81 81
             $this->option_flags = array('hide', 'nocache', 'append', 'prepend');
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         }
85 85
         // check and get attributes
86 86
         $_attr = $this->getAttributes($compiler, $args);
87
-        $compiler->_cache[ 'blockNesting' ] ++;
88
-        $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ];
89
-        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
87
+        $compiler->_cache['blockNesting']++;
88
+        $compiler->_cache['blockName'][$compiler->_cache['blockNesting']] = $_attr['name'];
89
+        $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']] = array();
90 90
         $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
91 91
                                                  $compiler->template->compiled->has_nocache_code,
92 92
                                                  $compiler->template->caching));
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $i = 0;
96 96
         }
97 97
         $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
98
-        if ($_attr[ 'nocache' ] === true) {
98
+        if ($_attr['nocache'] === true) {
99 99
 
100 100
         }
101 101
         $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
      */
114 114
     static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
115 115
     {
116
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
116
+        if (!isset($compiler->_cache['blockNesting'])) {
117 117
             $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',
118 118
                                               $compiler->parser->lex->taglineno);
119 119
         }
120 120
         $compiler->has_code = true;
121 121
         $compiler->suppressNocacheProcessing = true;
122
-        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
122
+        $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]['callsChild'] = 'true';
123 123
         $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n";
124 124
         return $output;
125 125
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
136 136
     {
137
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
137
+        if (!isset($compiler->_cache['blockNesting'])) {
138 138
             $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',
139 139
                                               $compiler->parser->lex->taglineno);
140 140
         }
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
     {
165 165
         list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
166 166
         // init block parameter
167
-        $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];
168
-        unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);
169
-        $_name = $_attr[ 'name' ];
170
-        $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
171
-        unset($_attr[ 'assign' ], $_attr[ 'name' ]);
167
+        $_block = $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']];
168
+        unset($compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]);
169
+        $_name = $_attr['name'];
170
+        $_assign = isset($_attr['assign']) ? $_attr['assign'] : null;
171
+        unset($_attr['assign'], $_attr['name']);
172 172
         foreach ($_attr as $name => $stat) {
173 173
             if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) {
174
-                $_block[ $name ] = 'true';
174
+                $_block[$name] = 'true';
175 175
             }
176 176
         }
177 177
         $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true));
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
         $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
214 214
         $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
215 215
         // nocache plugins must be copied
216
-        if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) {
217
-            foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) {
216
+        if (!empty($compiler->template->compiled->required_plugins['nocache'])) {
217
+            foreach ($compiler->template->compiled->required_plugins['nocache'] as $plugin => $tmp) {
218 218
                 foreach ($tmp as $type => $data) {
219
-                    $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] =
219
+                    $compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] =
220 220
                         $data;
221 221
                 }
222 222
             }
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
         $compiler->nocache = $_nocache;
229 229
         $compiler->parser->current_buffer = $_buffer;
230 230
         $output = "<?php \n";
231
-        if ($compiler->_cache[ 'blockNesting' ] == 1) {
231
+        if ($compiler->_cache['blockNesting'] == 1) {
232 232
             $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";
233 233
         } else {
234 234
             $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
235 235
         }
236 236
         $output .= "?>\n";
237
-        $compiler->_cache[ 'blockNesting' ] --;
238
-        if ($compiler->_cache[ 'blockNesting' ] == 0) {
239
-            unset($compiler->_cache[ 'blockNesting' ]);
237
+        $compiler->_cache['blockNesting']--;
238
+        if ($compiler->_cache['blockNesting'] == 0) {
239
+            unset($compiler->_cache['blockNesting']);
240 240
         }
241 241
         $compiler->has_code = true;
242 242
         $compiler->suppressNocacheProcessing = true;
Please login to merge, or discard this patch.