@@ -72,27 +72,27 @@ |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // split into paragraphs |
75 | - $_paragraphs = preg_split('![\r\n][\r\n]!',$content); |
|
75 | + $_paragraphs = preg_split('![\r\n][\r\n]!', $content); |
|
76 | 76 | $_output = ''; |
77 | 77 | |
78 | - for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { |
|
78 | + for ($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { |
|
79 | 79 | if ($_paragraphs[$_x] == '') { |
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | // convert mult. spaces & special chars to single space |
83 | - $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]); |
|
83 | + $_paragraphs[$_x] = preg_replace(array('!\s+!', '!(^\s+)|(\s+$)!'), array(' ', ''), $_paragraphs[$_x]); |
|
84 | 84 | // indent first line |
85 | - if($indent_first > 0) { |
|
86 | - $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x]; |
|
85 | + if ($indent_first > 0) { |
|
86 | + $_paragraphs[$_x] = str_repeat($indent_char, $indent_first).$_paragraphs[$_x]; |
|
87 | 87 | } |
88 | 88 | // wordwrap sentences |
89 | 89 | $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); |
90 | 90 | // indent lines |
91 | - if($indent > 0) { |
|
91 | + if ($indent > 0) { |
|
92 | 92 | $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]); |
93 | 93 | } |
94 | 94 | } |
95 | - $_output = implode($wrap_char . $wrap_char, $_paragraphs); |
|
95 | + $_output = implode($wrap_char.$wrap_char, $_paragraphs); |
|
96 | 96 | |
97 | 97 | return $assign ? $smarty->assign($assign, $_output) : $_output; |
98 | 98 |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $field_separator_count = -1; |
182 | 182 | if ($display_months) { |
183 | - $field_separator_count++; |
|
183 | + $field_separator_count++; |
|
184 | 184 | $month_names = array(); |
185 | 185 | $month_values = array(); |
186 | 186 | if(isset($month_empty)) { |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | 'values' => $month_values, |
214 | 214 | 'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '', |
215 | 215 | 'print_result' => false), |
216 | - $smarty); |
|
216 | + $smarty); |
|
217 | 217 | $month_result .= '</select>'; |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ($display_days) { |
221 | - $field_separator_count++; |
|
221 | + $field_separator_count++; |
|
222 | 222 | $days = array(); |
223 | 223 | if (isset($day_empty)) { |
224 | 224 | $days[''] = $day_empty; |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | } |
247 | 247 | $day_result .= $extra_attrs . '>'."\n"; |
248 | 248 | $day_result .= smarty_function_html_options(array('output' => $days, |
249 | - 'values' => $day_values, |
|
250 | - 'selected' => $time[2], |
|
251 | - 'print_result' => false), |
|
249 | + 'values' => $day_values, |
|
250 | + 'selected' => $time[2], |
|
251 | + 'print_result' => false), |
|
252 | 252 | $smarty); |
253 | 253 | $day_result .= '</select>'; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if ($display_years) { |
257 | - $field_separator_count++; |
|
257 | + $field_separator_count++; |
|
258 | 258 | if (null !== $field_array){ |
259 | 259 | $year_name = $field_array . '[' . $prefix . 'Year]'; |
260 | 260 | } else { |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | } |
294 | 294 | $year_result .= $extra_attrs . '>'."\n"; |
295 | 295 | $year_result .= smarty_function_html_options(array('output' => $years, |
296 | - 'values' => $yearvals, |
|
297 | - 'selected' => $time[0], |
|
298 | - 'print_result' => false), |
|
299 | - $smarty); |
|
296 | + 'values' => $yearvals, |
|
297 | + 'selected' => $time[0], |
|
298 | + 'print_result' => false), |
|
299 | + $smarty); |
|
300 | 300 | $year_result .= '</select>'; |
301 | 301 | } |
302 | 302 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function smarty_function_html_select_date($params, &$smarty) |
39 | 39 | { |
40 | - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); |
|
41 | - require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); |
|
42 | - require_once $smarty->_get_plugin_filepath('function','html_options'); |
|
40 | + require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); |
|
41 | + require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp'); |
|
42 | + require_once $smarty->_get_plugin_filepath('function', 'html_options'); |
|
43 | 43 | /* Default values. */ |
44 | 44 | $prefix = "Date_"; |
45 | 45 | $start_year = strftime("%Y"); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | break; |
125 | 125 | |
126 | 126 | default: |
127 | - if(!is_array($_value)) { |
|
127 | + if (!is_array($_value)) { |
|
128 | 128 | $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"'; |
129 | 129 | } else { |
130 | 130 | $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // force start year to include given date if not explicitly set |
169 | 169 | $start_year = $time[0]; |
170 | 170 | } |
171 | - if($end_year < $time[0] && !isset($params['end_year'])) { |
|
171 | + if ($end_year < $time[0] && !isset($params['end_year'])) { |
|
172 | 172 | // force end year to include given date if not explicitly set |
173 | 173 | $end_year = $time[0]; |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $field_separator_count++; |
184 | 184 | $month_names = array(); |
185 | 185 | $month_values = array(); |
186 | - if(isset($month_empty)) { |
|
186 | + if (isset($month_empty)) { |
|
187 | 187 | $month_names[''] = $month_empty; |
188 | 188 | $month_values[''] = ''; |
189 | 189 | } |
@@ -193,21 +193,21 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | $month_result .= '<select name='; |
196 | - if (null !== $field_array){ |
|
197 | - $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"'; |
|
196 | + if (null !== $field_array) { |
|
197 | + $month_result .= '"'.$field_array.'['.$prefix.'Month]"'; |
|
198 | 198 | } else { |
199 | - $month_result .= '"' . $prefix . 'Month"'; |
|
199 | + $month_result .= '"'.$prefix.'Month"'; |
|
200 | 200 | } |
201 | - if (null !== $month_size){ |
|
202 | - $month_result .= ' size="' . $month_size . '"'; |
|
201 | + if (null !== $month_size) { |
|
202 | + $month_result .= ' size="'.$month_size.'"'; |
|
203 | 203 | } |
204 | - if (null !== $month_extra){ |
|
205 | - $month_result .= ' ' . $month_extra; |
|
204 | + if (null !== $month_extra) { |
|
205 | + $month_result .= ' '.$month_extra; |
|
206 | 206 | } |
207 | - if (null !== $all_extra){ |
|
208 | - $month_result .= ' ' . $all_extra; |
|
207 | + if (null !== $all_extra) { |
|
208 | + $month_result .= ' '.$all_extra; |
|
209 | 209 | } |
210 | - $month_result .= $extra_attrs . '>'."\n"; |
|
210 | + $month_result .= $extra_attrs.'>'."\n"; |
|
211 | 211 | |
212 | 212 | $month_result .= smarty_function_html_options(array('output' => $month_names, |
213 | 213 | 'values' => $month_values, |
@@ -230,21 +230,21 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | $day_result .= '<select name='; |
233 | - if (null !== $field_array){ |
|
234 | - $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"'; |
|
233 | + if (null !== $field_array) { |
|
234 | + $day_result .= '"'.$field_array.'['.$prefix.'Day]"'; |
|
235 | 235 | } else { |
236 | - $day_result .= '"' . $prefix . 'Day"'; |
|
236 | + $day_result .= '"'.$prefix.'Day"'; |
|
237 | 237 | } |
238 | - if (null !== $day_size){ |
|
239 | - $day_result .= ' size="' . $day_size . '"'; |
|
238 | + if (null !== $day_size) { |
|
239 | + $day_result .= ' size="'.$day_size.'"'; |
|
240 | 240 | } |
241 | - if (null !== $all_extra){ |
|
242 | - $day_result .= ' ' . $all_extra; |
|
241 | + if (null !== $all_extra) { |
|
242 | + $day_result .= ' '.$all_extra; |
|
243 | 243 | } |
244 | - if (null !== $day_extra){ |
|
245 | - $day_result .= ' ' . $day_extra; |
|
244 | + if (null !== $day_extra) { |
|
245 | + $day_result .= ' '.$day_extra; |
|
246 | 246 | } |
247 | - $day_result .= $extra_attrs . '>'."\n"; |
|
247 | + $day_result .= $extra_attrs.'>'."\n"; |
|
248 | 248 | $day_result .= smarty_function_html_options(array('output' => $days, |
249 | 249 | 'values' => $day_values, |
250 | 250 | 'selected' => $time[2], |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | |
256 | 256 | if ($display_years) { |
257 | 257 | $field_separator_count++; |
258 | - if (null !== $field_array){ |
|
259 | - $year_name = $field_array . '[' . $prefix . 'Year]'; |
|
258 | + if (null !== $field_array) { |
|
259 | + $year_name = $field_array.'['.$prefix.'Year]'; |
|
260 | 260 | } else { |
261 | - $year_name = $prefix . 'Year'; |
|
261 | + $year_name = $prefix.'Year'; |
|
262 | 262 | } |
263 | 263 | if ($year_as_text) { |
264 | - $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"'; |
|
265 | - if (null !== $all_extra){ |
|
266 | - $year_result .= ' ' . $all_extra; |
|
264 | + $year_result .= '<input type="text" name="'.$year_name.'" value="'.$time[0].'" size="4" maxlength="4"'; |
|
265 | + if (null !== $all_extra) { |
|
266 | + $year_result .= ' '.$all_extra; |
|
267 | 267 | } |
268 | - if (null !== $year_extra){ |
|
269 | - $year_result .= ' ' . $year_extra; |
|
268 | + if (null !== $year_extra) { |
|
269 | + $year_result .= ' '.$year_extra; |
|
270 | 270 | } |
271 | 271 | $year_result .= ' />'; |
272 | 272 | } else { |
@@ -277,21 +277,21 @@ discard block |
||
277 | 277 | sort($years, SORT_NUMERIC); |
278 | 278 | } |
279 | 279 | $yearvals = $years; |
280 | - if(isset($year_empty)) { |
|
280 | + if (isset($year_empty)) { |
|
281 | 281 | array_unshift($years, $year_empty); |
282 | 282 | array_unshift($yearvals, ''); |
283 | 283 | } |
284 | - $year_result .= '<select name="' . $year_name . '"'; |
|
285 | - if (null !== $year_size){ |
|
286 | - $year_result .= ' size="' . $year_size . '"'; |
|
284 | + $year_result .= '<select name="'.$year_name.'"'; |
|
285 | + if (null !== $year_size) { |
|
286 | + $year_result .= ' size="'.$year_size.'"'; |
|
287 | 287 | } |
288 | - if (null !== $all_extra){ |
|
289 | - $year_result .= ' ' . $all_extra; |
|
288 | + if (null !== $all_extra) { |
|
289 | + $year_result .= ' '.$all_extra; |
|
290 | 290 | } |
291 | - if (null !== $year_extra){ |
|
292 | - $year_result .= ' ' . $year_extra; |
|
291 | + if (null !== $year_extra) { |
|
292 | + $year_result .= ' '.$year_extra; |
|
293 | 293 | } |
294 | - $year_result .= $extra_attrs . '>'."\n"; |
|
294 | + $year_result .= $extra_attrs.'>'."\n"; |
|
295 | 295 | $year_result .= smarty_function_html_options(array('output' => $years, |
296 | 296 | 'values' => $yearvals, |
297 | 297 | 'selected' => $time[0], |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | // Loop thru the field_order field |
305 | - for ($i = 0; $i <= 2; $i++){ |
|
305 | + for ($i = 0; $i <= 2; $i++) { |
|
306 | 306 | $c = substr($field_order, $i, 1); |
307 | - switch ($c){ |
|
307 | + switch ($c) { |
|
308 | 308 | case 'D': |
309 | 309 | $html_result .= $day_result; |
310 | 310 | break; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | break; |
319 | 319 | } |
320 | 320 | // Add the field seperator |
321 | - if($i < $field_separator_count) { |
|
321 | + if ($i < $field_separator_count) { |
|
322 | 322 | $html_result .= $field_separator; |
323 | 323 | } |
324 | 324 | } |
@@ -21,11 +21,12 @@ |
||
21 | 21 | */ |
22 | 22 | function smarty_modifier_strip_tags($string, $replace_with_space = true) |
23 | 23 | { |
24 | - if ($replace_with_space) |
|
25 | - return preg_replace('!<[^>]*?>!', ' ', $string); |
|
26 | - else |
|
27 | - return strip_tags($string); |
|
28 | -} |
|
24 | + if ($replace_with_space) { |
|
25 | + return preg_replace('!<[^>]*?>!', ' ', $string); |
|
26 | + } else { |
|
27 | + return strip_tags($string); |
|
28 | + } |
|
29 | + } |
|
29 | 30 | |
30 | 31 | /* vim: set expandtab: */ |
31 | 32 |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | |
31 | 31 | switch (gettype($var)) { |
32 | 32 | case 'array' : |
33 | - $results = '<b>Array (' . count($var) . ')</b>'; |
|
33 | + $results = '<b>Array ('.count($var).')</b>'; |
|
34 | 34 | foreach ($var as $curr_key => $curr_val) { |
35 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
36 | - . '<b>' . strtr($curr_key, $_replace) . '</b> => ' |
|
35 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
36 | + . '<b>'.strtr($curr_key, $_replace).'</b> => ' |
|
37 | 37 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
38 | 38 | $depth--; |
39 | 39 | } |
40 | 40 | break; |
41 | 41 | case 'object' : |
42 | 42 | $object_vars = get_object_vars($var); |
43 | - $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; |
|
43 | + $results = '<b>'.get_class($var).' Object ('.count($object_vars).')</b>'; |
|
44 | 44 | foreach ($object_vars as $curr_key => $curr_val) { |
45 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
46 | - . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' |
|
45 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
46 | + . '<b> ->'.strtr($curr_key, $_replace).'</b> = ' |
|
47 | 47 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
48 | 48 | $depth--; |
49 | 49 | } |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | } elseif (null === $var) { |
59 | 59 | $results = 'null'; |
60 | 60 | } else { |
61 | - $results = htmlspecialchars((string) $var); |
|
61 | + $results = htmlspecialchars((string)$var); |
|
62 | 62 | } |
63 | - $results = '<i>' . $results . '</i>'; |
|
63 | + $results = '<i>'.$results.'</i>'; |
|
64 | 64 | break; |
65 | 65 | case 'integer' : |
66 | 66 | case 'float' : |
67 | - $results = htmlspecialchars((string) $var); |
|
67 | + $results = htmlspecialchars((string)$var); |
|
68 | 68 | break; |
69 | 69 | case 'string' : |
70 | 70 | $results = strtr($var, $_replace); |
71 | - if (strlen($var) > $length ) { |
|
72 | - $results = substr($var, 0, $length - 3) . '...'; |
|
71 | + if (strlen($var) > $length) { |
|
72 | + $results = substr($var, 0, $length - 3).'...'; |
|
73 | 73 | } |
74 | - $results = htmlspecialchars('"' . $results . '"'); |
|
74 | + $results = htmlspecialchars('"'.$results.'"'); |
|
75 | 75 | break; |
76 | 76 | case 'unknown type' : |
77 | 77 | default : |
78 | - $results = strtr((string) $var, $_replace); |
|
79 | - if (strlen($results) > $length ) { |
|
80 | - $results = substr($results, 0, $length - 3) . '...'; |
|
78 | + $results = strtr((string)$var, $_replace); |
|
79 | + if (strlen($results) > $length) { |
|
80 | + $results = substr($results, 0, $length - 3).'...'; |
|
81 | 81 | } |
82 | 82 | $results = htmlspecialchars($results); |
83 | 83 | } |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | } |
101 | 101 | $html_result .= '>'."\n"; |
102 | 102 | $html_result .= smarty_function_html_options(array('output' => $hours, |
103 | - 'values' => $hours, |
|
104 | - 'selected' => strftime($hour_fmt, $time), |
|
105 | - 'print_result' => false), |
|
106 | - $smarty); |
|
103 | + 'values' => $hours, |
|
104 | + 'selected' => strftime($hour_fmt, $time), |
|
105 | + 'print_result' => false), |
|
106 | + $smarty); |
|
107 | 107 | $html_result .= "</select>\n"; |
108 | 108 | } |
109 | 109 | |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | $html_result .= '>'."\n"; |
128 | 128 | |
129 | 129 | $html_result .= smarty_function_html_options(array('output' => $minutes, |
130 | - 'values' => $minutes, |
|
131 | - 'selected' => $selected, |
|
132 | - 'print_result' => false), |
|
133 | - $smarty); |
|
130 | + 'values' => $minutes, |
|
131 | + 'selected' => $selected, |
|
132 | + 'print_result' => false), |
|
133 | + $smarty); |
|
134 | 134 | $html_result .= "</select>\n"; |
135 | 135 | } |
136 | 136 | |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | $html_result .= '>'."\n"; |
156 | 156 | |
157 | 157 | $html_result .= smarty_function_html_options(array('output' => $seconds, |
158 | - 'values' => $seconds, |
|
159 | - 'selected' => $selected, |
|
160 | - 'print_result' => false), |
|
161 | - $smarty); |
|
158 | + 'values' => $seconds, |
|
159 | + 'selected' => $selected, |
|
160 | + 'print_result' => false), |
|
161 | + $smarty); |
|
162 | 162 | $html_result .= "</select>\n"; |
163 | 163 | } |
164 | 164 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $html_result .= '>'."\n"; |
180 | 180 | |
181 | 181 | $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'), |
182 | - 'values' => array('am', 'pm'), |
|
183 | - 'selected' => strtolower(strftime('%p', $time)), |
|
184 | - 'print_result' => false), |
|
185 | - $smarty); |
|
182 | + 'values' => array('am', 'pm'), |
|
183 | + 'selected' => strtolower(strftime('%p', $time)), |
|
184 | + 'print_result' => false), |
|
185 | + $smarty); |
|
186 | 186 | $html_result .= "</select>\n"; |
187 | 187 | } |
188 | 188 |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function smarty_function_html_select_time($params, &$smarty) |
25 | 25 | { |
26 | - require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); |
|
27 | - require_once $smarty->_get_plugin_filepath('function','html_options'); |
|
26 | + require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp'); |
|
27 | + require_once $smarty->_get_plugin_filepath('function', 'html_options'); |
|
28 | 28 | /* Default values. */ |
29 | 29 | $prefix = "Time_"; |
30 | 30 | $time = time(); |
@@ -82,21 +82,21 @@ discard block |
||
82 | 82 | $html_result = ''; |
83 | 83 | |
84 | 84 | if ($display_hours) { |
85 | - $hours = $use_24_hours ? range(0, 23) : range(1, 12); |
|
85 | + $hours = $use_24_hours ? range(0, 23) : range(1, 12); |
|
86 | 86 | $hour_fmt = $use_24_hours ? '%H' : '%I'; |
87 | 87 | for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) |
88 | 88 | $hours[$i] = sprintf('%02d', $hours[$i]); |
89 | 89 | $html_result .= '<select name='; |
90 | 90 | if (null !== $field_array) { |
91 | - $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"'; |
|
91 | + $html_result .= '"'.$field_array.'['.$prefix.'Hour]"'; |
|
92 | 92 | } else { |
93 | - $html_result .= '"' . $prefix . 'Hour"'; |
|
93 | + $html_result .= '"'.$prefix.'Hour"'; |
|
94 | 94 | } |
95 | - if (null !== $hour_extra){ |
|
96 | - $html_result .= ' ' . $hour_extra; |
|
95 | + if (null !== $hour_extra) { |
|
96 | + $html_result .= ' '.$hour_extra; |
|
97 | 97 | } |
98 | - if (null !== $all_extra){ |
|
99 | - $html_result .= ' ' . $all_extra; |
|
98 | + if (null !== $all_extra) { |
|
99 | + $html_result .= ' '.$all_extra; |
|
100 | 100 | } |
101 | 101 | $html_result .= '>'."\n"; |
102 | 102 | $html_result .= smarty_function_html_options(array('output' => $hours, |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | |
110 | 110 | if ($display_minutes) { |
111 | 111 | $all_minutes = range(0, 59); |
112 | - for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval) |
|
112 | + for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i += $minute_interval) |
|
113 | 113 | $minutes[] = sprintf('%02d', $all_minutes[$i]); |
114 | 114 | $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval); |
115 | 115 | $html_result .= '<select name='; |
116 | 116 | if (null !== $field_array) { |
117 | - $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"'; |
|
117 | + $html_result .= '"'.$field_array.'['.$prefix.'Minute]"'; |
|
118 | 118 | } else { |
119 | - $html_result .= '"' . $prefix . 'Minute"'; |
|
119 | + $html_result .= '"'.$prefix.'Minute"'; |
|
120 | 120 | } |
121 | - if (null !== $minute_extra){ |
|
122 | - $html_result .= ' ' . $minute_extra; |
|
121 | + if (null !== $minute_extra) { |
|
122 | + $html_result .= ' '.$minute_extra; |
|
123 | 123 | } |
124 | - if (null !== $all_extra){ |
|
125 | - $html_result .= ' ' . $all_extra; |
|
124 | + if (null !== $all_extra) { |
|
125 | + $html_result .= ' '.$all_extra; |
|
126 | 126 | } |
127 | 127 | $html_result .= '>'."\n"; |
128 | 128 | |
@@ -136,21 +136,21 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($display_seconds) { |
138 | 138 | $all_seconds = range(0, 59); |
139 | - for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval) |
|
139 | + for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i += $second_interval) |
|
140 | 140 | $seconds[] = sprintf('%02d', $all_seconds[$i]); |
141 | 141 | $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); |
142 | 142 | $html_result .= '<select name='; |
143 | 143 | if (null !== $field_array) { |
144 | - $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"'; |
|
144 | + $html_result .= '"'.$field_array.'['.$prefix.'Second]"'; |
|
145 | 145 | } else { |
146 | - $html_result .= '"' . $prefix . 'Second"'; |
|
146 | + $html_result .= '"'.$prefix.'Second"'; |
|
147 | 147 | } |
148 | 148 | |
149 | - if (null !== $second_extra){ |
|
150 | - $html_result .= ' ' . $second_extra; |
|
149 | + if (null !== $second_extra) { |
|
150 | + $html_result .= ' '.$second_extra; |
|
151 | 151 | } |
152 | - if (null !== $all_extra){ |
|
153 | - $html_result .= ' ' . $all_extra; |
|
152 | + if (null !== $all_extra) { |
|
153 | + $html_result .= ' '.$all_extra; |
|
154 | 154 | } |
155 | 155 | $html_result .= '>'."\n"; |
156 | 156 | |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | if ($display_meridian && !$use_24_hours) { |
166 | 166 | $html_result .= '<select name='; |
167 | 167 | if (null !== $field_array) { |
168 | - $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"'; |
|
168 | + $html_result .= '"'.$field_array.'['.$prefix.'Meridian]"'; |
|
169 | 169 | } else { |
170 | - $html_result .= '"' . $prefix . 'Meridian"'; |
|
170 | + $html_result .= '"'.$prefix.'Meridian"'; |
|
171 | 171 | } |
172 | 172 | |
173 | - if (null !== $meridian_extra){ |
|
174 | - $html_result .= ' ' . $meridian_extra; |
|
173 | + if (null !== $meridian_extra) { |
|
174 | + $html_result .= ' '.$meridian_extra; |
|
175 | 175 | } |
176 | - if (null !== $all_extra){ |
|
177 | - $html_result .= ' ' . $all_extra; |
|
176 | + if (null !== $all_extra) { |
|
177 | + $html_result .= ' '.$all_extra; |
|
178 | 178 | } |
179 | 179 | $html_result .= '>'."\n"; |
180 | 180 |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | if ($display_hours) { |
85 | 85 | $hours = $use_24_hours ? range(0, 23) : range(1, 12); |
86 | 86 | $hour_fmt = $use_24_hours ? '%H' : '%I'; |
87 | - for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) |
|
88 | - $hours[$i] = sprintf('%02d', $hours[$i]); |
|
87 | + for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) { |
|
88 | + $hours[$i] = sprintf('%02d', $hours[$i]); |
|
89 | + } |
|
89 | 90 | $html_result .= '<select name='; |
90 | 91 | if (null !== $field_array) { |
91 | 92 | $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"'; |
@@ -109,8 +110,9 @@ discard block |
||
109 | 110 | |
110 | 111 | if ($display_minutes) { |
111 | 112 | $all_minutes = range(0, 59); |
112 | - for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval) |
|
113 | - $minutes[] = sprintf('%02d', $all_minutes[$i]); |
|
113 | + for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval) { |
|
114 | + $minutes[] = sprintf('%02d', $all_minutes[$i]); |
|
115 | + } |
|
114 | 116 | $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval); |
115 | 117 | $html_result .= '<select name='; |
116 | 118 | if (null !== $field_array) { |
@@ -136,8 +138,9 @@ discard block |
||
136 | 138 | |
137 | 139 | if ($display_seconds) { |
138 | 140 | $all_seconds = range(0, 59); |
139 | - for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval) |
|
140 | - $seconds[] = sprintf('%02d', $all_seconds[$i]); |
|
141 | + for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval) { |
|
142 | + $seconds[] = sprintf('%02d', $all_seconds[$i]); |
|
143 | + } |
|
141 | 144 | $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); |
142 | 145 | $html_result .= '<select name='; |
143 | 146 | if (null !== $field_array) { |
@@ -71,17 +71,17 @@ |
||
71 | 71 | case 'nonstd': |
72 | 72 | // escape non-standard chars, such as ms document quotes |
73 | 73 | $_res = ''; |
74 | - for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { |
|
75 | - $_ord = ord(substr($string, $_i, 1)); |
|
76 | - // non-standard char, escape it |
|
77 | - if($_ord >= 126){ |
|
78 | - $_res .= '&#' . $_ord . ';'; |
|
79 | - } |
|
80 | - else { |
|
81 | - $_res .= substr($string, $_i, 1); |
|
82 | - } |
|
83 | - } |
|
84 | - return $_res; |
|
74 | + for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { |
|
75 | + $_ord = ord(substr($string, $_i, 1)); |
|
76 | + // non-standard char, escape it |
|
77 | + if($_ord >= 126){ |
|
78 | + $_res .= '&#' . $_ord . ';'; |
|
79 | + } |
|
80 | + else { |
|
81 | + $_res .= substr($string, $_i, 1); |
|
82 | + } |
|
83 | + } |
|
84 | + return $_res; |
|
85 | 85 | |
86 | 86 | default: |
87 | 87 | return $string; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return rawurlencode($string); |
33 | 33 | |
34 | 34 | case 'urlpathinfo': |
35 | - return str_replace('%2F','/',rawurlencode($string)); |
|
35 | + return str_replace('%2F', '/', rawurlencode($string)); |
|
36 | 36 | |
37 | 37 | case 'quotes': |
38 | 38 | // escape unescaped single quotes |
@@ -41,41 +41,41 @@ discard block |
||
41 | 41 | case 'hex': |
42 | 42 | // escape every character into hex |
43 | 43 | $return = ''; |
44 | - for ($x=0; $x < strlen($string); $x++) { |
|
45 | - $return .= '%' . bin2hex($string[$x]); |
|
44 | + for ($x = 0; $x < strlen($string); $x++) { |
|
45 | + $return .= '%'.bin2hex($string[$x]); |
|
46 | 46 | } |
47 | 47 | return $return; |
48 | 48 | |
49 | 49 | case 'hexentity': |
50 | 50 | $return = ''; |
51 | - for ($x=0; $x < strlen($string); $x++) { |
|
52 | - $return .= '&#x' . bin2hex($string[$x]) . ';'; |
|
51 | + for ($x = 0; $x < strlen($string); $x++) { |
|
52 | + $return .= '&#x'.bin2hex($string[$x]).';'; |
|
53 | 53 | } |
54 | 54 | return $return; |
55 | 55 | |
56 | 56 | case 'decentity': |
57 | 57 | $return = ''; |
58 | - for ($x=0; $x < strlen($string); $x++) { |
|
59 | - $return .= '&#' . ord($string[$x]) . ';'; |
|
58 | + for ($x = 0; $x < strlen($string); $x++) { |
|
59 | + $return .= '&#'.ord($string[$x]).';'; |
|
60 | 60 | } |
61 | 61 | return $return; |
62 | 62 | |
63 | 63 | case 'javascript': |
64 | 64 | // escape quotes and backslashes, newlines, etc. |
65 | - return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/')); |
|
65 | + return strtr($string, array('\\'=>'\\\\', "'"=>"\\'", '"'=>'\\"', "\r"=>'\\r', "\n"=>'\\n', '</'=>'<\/')); |
|
66 | 66 | |
67 | 67 | case 'mail': |
68 | 68 | // safe way to display e-mail address on a web page |
69 | - return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string); |
|
69 | + return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string); |
|
70 | 70 | |
71 | 71 | case 'nonstd': |
72 | 72 | // escape non-standard chars, such as ms document quotes |
73 | 73 | $_res = ''; |
74 | - for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { |
|
74 | + for ($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { |
|
75 | 75 | $_ord = ord(substr($string, $_i, 1)); |
76 | 76 | // non-standard char, escape it |
77 | - if($_ord >= 126){ |
|
78 | - $_res .= '&#' . $_ord . ';'; |
|
77 | + if ($_ord >= 126) { |
|
78 | + $_res .= '&#'.$_ord.';'; |
|
79 | 79 | } |
80 | 80 | else { |
81 | 81 | $_res .= substr($string, $_i, 1); |
@@ -76,8 +76,7 @@ |
||
76 | 76 | // non-standard char, escape it |
77 | 77 | if($_ord >= 126){ |
78 | 78 | $_res .= '&#' . $_ord . ';'; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | $_res .= substr($string, $_i, 1); |
82 | 81 | } |
83 | 82 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * @param boolean |
22 | 22 | * @return string |
23 | 23 | */ |
24 | -function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false) |
|
24 | +function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false) |
|
25 | 25 | { |
26 | - return wordwrap($string,$length,$break,$cut); |
|
26 | + return wordwrap($string, $length, $break, $cut); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |
@@ -22,7 +22,7 @@ |
||
22 | 22 | function smarty_modifier_count_characters($string, $include_spaces = false) |
23 | 23 | { |
24 | 24 | if ($include_spaces) |
25 | - return(strlen($string)); |
|
25 | + return(strlen($string)); |
|
26 | 26 | |
27 | 27 | return preg_match_all("/[^\s]/",$string, $match); |
28 | 28 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if ($include_spaces) |
25 | 25 | return(strlen($string)); |
26 | 26 | |
27 | - return preg_match_all("/[^\s]/",$string, $match); |
|
27 | + return preg_match_all("/[^\s]/", $string, $match); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /* vim: set expandtab: */ |
@@ -21,8 +21,9 @@ |
||
21 | 21 | */ |
22 | 22 | function smarty_modifier_count_characters($string, $include_spaces = false) |
23 | 23 | { |
24 | - if ($include_spaces) |
|
25 | - return(strlen($string)); |
|
24 | + if ($include_spaces) { |
|
25 | + return(strlen($string)); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | return preg_match_all("/[^\s]/",$string, $match); |
28 | 29 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | function smarty_modifier_cat($string, $cat) |
27 | 27 | { |
28 | - return $string . $cat; |
|
28 | + return $string.$cat; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /* vim: set expandtab: */ |