@@ -28,9 +28,9 @@ |
||
28 | 28 | } |
29 | 29 | if($num < 0){ |
30 | 30 | $out = $minus . abs($num); |
31 | - }else if ($num > 0){ |
|
31 | + } else if ($num > 0){ |
|
32 | 32 | $out = $plus . abs($num); |
33 | - }else{ |
|
33 | + } else{ |
|
34 | 34 | $out = 0; |
35 | 35 | } |
36 | 36 | return $out; |
@@ -230,7 +230,9 @@ discard block |
||
230 | 230 | $path = explode($separator, $path); |
231 | 231 | while (count($path) > 1) { |
232 | 232 | $key = array_shift($path); |
233 | - if (!isset($tmp[$key])) return; |
|
233 | + if (!isset($tmp[$key])) { |
|
234 | + return; |
|
235 | + } |
|
234 | 236 | $tmp = &$tmp[$key]; |
235 | 237 | } |
236 | 238 | unset($tmp[array_shift($path)]); |
@@ -253,7 +255,9 @@ discard block |
||
253 | 255 | $path = explode($separator, $path); |
254 | 256 | while (count($path) > 1) { |
255 | 257 | $key = array_shift($path); |
256 | - if (!isset($tmp[$key])) $tmp[$key] = array(); |
|
258 | + if (!isset($tmp[$key])) { |
|
259 | + $tmp[$key] = array(); |
|
260 | + } |
|
257 | 261 | $tmp = &$tmp[$key]; |
258 | 262 | } |
259 | 263 | $tmp[array_shift($path)] = $value; |
@@ -535,7 +535,9 @@ |
||
535 | 535 | */ |
536 | 536 | function format_bytes($bytes, $precision = 2, $suffixes = array('Байт', 'Кбайт', 'Мбайт', 'Гбайт', 'Тбайт')) { |
537 | 537 | $bytes = (float)$bytes; |
538 | - if(empty($bytes)) return 0; |
|
538 | + if(empty($bytes)) { |
|
539 | + return 0; |
|
540 | + } |
|
539 | 541 | $base = log($bytes, 1024); |
540 | 542 | return trim(round(pow(1024, $base - floor($base)), $precision) . ' ' .get_key($suffixes, (int)$base, '', 'is_scalar')); |
541 | 543 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | if ((string)$val === (string)$current) { |
127 | 127 | $value['selected'] = true; |
128 | 128 | $selected = true; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | unset($value['selected']); |
131 | 131 | } |
132 | 132 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | ); |
100 | 100 | $out['time'] = format_microtime($marks[$key]['time']); |
101 | 101 | $out = format_bytes($marks[$key]['memory']); |
102 | - }else{ |
|
102 | + } else{ |
|
103 | 103 | $out = get_key($marks, $key, array( |
104 | 104 | 'time' => get_key($_SERVER, 'REQUEST_TIME_FLOAT', 0), |
105 | 105 | 'memory'=> 0 |
@@ -299,26 +299,38 @@ discard block |
||
299 | 299 | $tag = strtolower($s[1]); |
300 | 300 | if (!empty($_allowable_tags)) { |
301 | 301 | #tag with attributes |
302 | - if (array_key_exists($tag, $_allowable_tags)) return $s[0]; |
|
302 | + if (array_key_exists($tag, $_allowable_tags)) { |
|
303 | + return $s[0]; |
|
304 | + } |
|
303 | 305 | |
304 | 306 | #tag without attributes |
305 | 307 | if (array_key_exists('<' . $tag . '>', $_allowable_tags)) { |
306 | - if (substr($s[0], 0, 2) === '</') return '</' . $tag . '>'; |
|
307 | - if (substr($s[0], -2) === '/>') return '<' . $tag . ' />'; |
|
308 | + if (substr($s[0], 0, 2) === '</') { |
|
309 | + return '</' . $tag . '>'; |
|
310 | + } |
|
311 | + if (substr($s[0], -2) === '/>') { |
|
312 | + return '<' . $tag . ' />'; |
|
313 | + } |
|
308 | 314 | return '<' . $tag . '>'; |
309 | 315 | } |
310 | 316 | } |
311 | - if ($tag === 'br') return "\r\n"; |
|
312 | - if (!empty($_para_tags) && array_key_exists($tag, $_para_tags)) return "\r\n\r\n"; |
|
317 | + if ($tag === 'br') { |
|
318 | + return "\r\n"; |
|
319 | + } |
|
320 | + if (!empty($_para_tags) && array_key_exists($tag, $_para_tags)) { |
|
321 | + return "\r\n\r\n"; |
|
322 | + } |
|
313 | 323 | return ''; |
314 | 324 | } |
315 | 325 | trigger_error('Unknown callback type "' . $_callback_type . '"!', E_USER_ERROR); |
316 | 326 | } |
317 | 327 | |
318 | - if (($pos = strpos($s, '<')) === false || strpos($s, '>', $pos) === false) #speed improve |
|
328 | + if (($pos = strpos($s, '<')) === false || strpos($s, '>', $pos) === false) { |
|
329 | + #speed improve |
|
319 | 330 | { |
320 | 331 | #tags are not found |
321 | - return $s; |
|
332 | + return $s; |
|
333 | + } |
|
322 | 334 | } |
323 | 335 | |
324 | 336 | $length = strlen($s); |
@@ -354,7 +366,9 @@ discard block |
||
354 | 366 | ); |
355 | 367 | if (!empty($pair_tags)) { |
356 | 368 | #парные таги вместе с содержимым: |
357 | - foreach ($pair_tags as $k => $v) $pair_tags[$k] = preg_quote($v, '/'); |
|
369 | + foreach ($pair_tags as $k => $v) { |
|
370 | + $pair_tags[$k] = preg_quote($v, '/'); |
|
371 | + } |
|
358 | 372 | $patterns[] = '/ <((?i:' . implode('|', $pair_tags) . '))' . $re_attrs_fast_safe . '(?<!\/)> |
359 | 373 | .*? |
360 | 374 | <\/(?i:\\1)' . $re_attrs_fast_safe . '> |
@@ -400,10 +414,14 @@ discard block |
||
400 | 414 | } |
401 | 415 | |
402 | 416 | #массив тагов, которые не будут вырезаны |
403 | - if (!empty($allowable_tags)) $_allowable_tags = array_flip($allowable_tags); |
|
417 | + if (!empty($allowable_tags)) { |
|
418 | + $_allowable_tags = array_flip($allowable_tags); |
|
419 | + } |
|
404 | 420 | |
405 | 421 | #парные таги, которые будут восприниматься как параграфы |
406 | - if (!empty($para_tags)) $_para_tags = array_flip($para_tags); |
|
422 | + if (!empty($para_tags)) { |
|
423 | + $_para_tags = array_flip($para_tags); |
|
424 | + } |
|
407 | 425 | } |
408 | 426 | }#if |
409 | 427 | |
@@ -418,11 +436,16 @@ discard block |
||
418 | 436 | } |
419 | 437 | } |
420 | 438 | |
421 | - if ($s === $s2) break; |
|
439 | + if ($s === $s2) { |
|
440 | + break; |
|
441 | + } |
|
422 | 442 | $s = $s2; |
423 | 443 | $i++; |
424 | 444 | }#while |
425 | - if ($i >= $max) $s = strip_tags($s); #too many cycles for replace... |
|
445 | + if ($i >= $max) { |
|
446 | + $s = strip_tags($s); |
|
447 | + } |
|
448 | + #too many cycles for replace... |
|
426 | 449 | |
427 | 450 | if ($is_format_spaces && strlen($s) !== $length) { |
428 | 451 | #remove a duplicate spaces |