@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | } |
63 | 63 | $vals = array(); |
64 | 64 | foreach ($arr as $key => $val) { |
65 | - $vals[] = is_array($val) ? "'" . $key . "'=>" . array_code($val, $level + 1) : "'" . $key . "'=>'" . $val . "'"; |
|
65 | + $vals[] = is_array($val) ? "'".$key."'=>".array_code($val, $level + 1) : "'".$key."'=>'".$val."'"; |
|
66 | 66 | } |
67 | - $php = "array(\r" . $tabs . implode(",\r" . $tabs, $vals) . "\r" . $breaks . ")"; |
|
67 | + $php = "array(\r".$tabs.implode(",\r".$tabs, $vals)."\r".$breaks.")"; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $php; |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | return html_wrap('pre', e(print_r($html, 1))); |
83 | 83 | } |
84 | 84 | } |
85 | -if (!function_exists('point_info')){ |
|
85 | +if (!function_exists('point_info')) { |
|
86 | 86 | /** |
87 | 87 | * Информация о ресурсах потребляемых на каком-то участке кода |
88 | 88 | * @param string $key Имя метки |
89 | 89 | * @param bool $store Необходимо ли сохранить информацию о метке в памяти |
90 | 90 | * @param bool $clear Нужно ли выполнить сброс меток |
91 | 91 | */ |
92 | - function point_info($key, $store = false, $clear = false){ |
|
92 | + function point_info($key, $store = false, $clear = false) { |
|
93 | 93 | static $marks = array(); |
94 | 94 | $out = array(); |
95 | 95 | |
96 | - if(is_scalar($key) && !empty($key)){ |
|
97 | - if($store){ |
|
96 | + if (is_scalar($key) && !empty($key)) { |
|
97 | + if ($store) { |
|
98 | 98 | $marks[$key] = array( |
99 | 99 | 'time' => microtime(true), |
100 | 100 | 'memory' => memory_get_usage() |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'memory' => format_bytes($marks[$key]['memory']), |
104 | 104 | 'time' => format_microtime($marks[$key]['time']) |
105 | 105 | ); |
106 | - }else{ |
|
106 | + }else { |
|
107 | 107 | $out = get_key($marks, $key, array( |
108 | 108 | 'time' => get_key($_SERVER, 'REQUEST_TIME_FLOAT', 0), |
109 | 109 | 'memory'=> 0 |
@@ -103,7 +103,7 @@ |
||
103 | 103 | 'memory' => format_bytes($marks[$key]['memory']), |
104 | 104 | 'time' => format_microtime($marks[$key]['time']) |
105 | 105 | ); |
106 | - }else{ |
|
106 | + } else{ |
|
107 | 107 | $out = get_key($marks, $key, array( |
108 | 108 | 'time' => get_key($_SERVER, 'REQUEST_TIME_FLOAT', 0), |
109 | 109 | 'memory'=> 0 |
@@ -27,9 +27,9 @@ |
||
27 | 27 | $num = 0; |
28 | 28 | } |
29 | 29 | if ($num < 0) { |
30 | - $out = $minus . abs($num); |
|
30 | + $out = $minus.abs($num); |
|
31 | 31 | }else if ($num > 0) { |
32 | - $out = $plus . abs($num); |
|
32 | + $out = $plus.abs($num); |
|
33 | 33 | }else { |
34 | 34 | $out = 0; |
35 | 35 | } |
@@ -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; |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | if (!is_scalar($addPS)) { |
68 | 68 | $addPS = ''; |
69 | 69 | } |
70 | - $InsertPrefix = (is_scalar($prefix) && $prefix !== '') ? ($prefix . $addPS) : ''; |
|
71 | - $InsertSuffix = (is_scalar($suffix) && $suffix !== '') ? ($addPS . $suffix) : ''; |
|
70 | + $InsertPrefix = (is_scalar($prefix) && $prefix !== '') ? ($prefix.$addPS) : ''; |
|
71 | + $InsertSuffix = (is_scalar($suffix) && $suffix !== '') ? ($addPS.$suffix) : ''; |
|
72 | 72 | foreach ($data as $key => $item) { |
73 | - $key = $InsertPrefix . $key; |
|
73 | + $key = $InsertPrefix.$key; |
|
74 | 74 | $val = null; |
75 | 75 | switch (true) { |
76 | 76 | case is_scalar($item): |
77 | 77 | $val = $item; |
78 | 78 | break; |
79 | 79 | case is_array($item): |
80 | - $val = (is_scalar($sep) && $sep !== '') ? rename_key_array($item, $key . $sep, $InsertSuffix, '', $sep) : array(); |
|
80 | + $val = (is_scalar($sep) && $sep !== '') ? rename_key_array($item, $key.$sep, $InsertSuffix, '', $sep) : array(); |
|
81 | 81 | $out = array_merge($out, $val); |
82 | 82 | $val = ''; |
83 | 83 | break; |
84 | 84 | } |
85 | - $out[$key . $InsertSuffix] = $val; |
|
85 | + $out[$key.$InsertSuffix] = $val; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | return $out; |
@@ -320,22 +320,22 @@ discard block |
||
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | -if(!function_exists('array_copy_key')){ |
|
323 | +if (!function_exists('array_copy_key')) { |
|
324 | 324 | /** |
325 | 325 | * Определить ключи массива равыне значениям |
326 | 326 | * |
327 | 327 | * @param array $data исходный массив со значениями |
328 | 328 | * @return array |
329 | 329 | */ |
330 | - function array_copy_key(array $data = array()){ |
|
331 | - $data = array_filter($data, function($val){ |
|
330 | + function array_copy_key(array $data = array()) { |
|
331 | + $data = array_filter($data, function($val) { |
|
332 | 332 | return is_scalar($val); |
333 | 333 | }); |
334 | 334 | return array_combine($data, $data); |
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | -if(!function_exists('make_tree')){ |
|
338 | +if (!function_exists('make_tree')) { |
|
339 | 339 | /** |
340 | 340 | * Helper function |
341 | 341 | * @see http://gostash.it/ru/users/3191 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $workArray = &$workArray[$subKey]; |
113 | 113 | } |
114 | 114 | } |
115 | - }else { |
|
115 | + } else { |
|
116 | 116 | $out = $data; |
117 | 117 | } |
118 | 118 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if ((int)$count > 0) { |
302 | 302 | $data = current(array_chunk($data, (int)$count, true)); |
303 | 303 | } |
304 | - }else { |
|
304 | + } else { |
|
305 | 305 | $data = array(); |
306 | 306 | } |
307 | 307 | return $data; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | function html_implode(array $arr, $el) |
11 | 11 | { |
12 | - return "<$el>" . implode("</$el><$el>", $arr) . "</$el>"; |
|
12 | + return "<$el>".implode("</$el><$el>", $arr)."</$el>"; |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if (!empty($thead)) { |
35 | 35 | $thead = html_wrap('thead', html_wrap('tr', $thead)); |
36 | 36 | } |
37 | - return html_wrap('table', $thead . html_wrap('tbody', (is_array($rows) ? html_implode($rows, 'tr') : $rows)), $attr); |
|
37 | + return html_wrap('table', $thead.html_wrap('tbody', (is_array($rows) ? html_implode($rows, 'tr') : $rows)), $attr); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @param array $noEscape имена аттрибутов, значения которых не следует экранировать |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - function html_attrs($attr, $noEscape = array('href', 'src')){ |
|
80 | + function html_attrs($attr, $noEscape = array('href', 'src')) { |
|
81 | 81 | $html = ''; |
82 | 82 | if (is_array($attr)) { |
83 | 83 | foreach ($attr as $key => $val) { |
84 | - switch(true){ |
|
84 | + switch (true) { |
|
85 | 85 | case (is_scalar($val) && is_scalar($key)): |
86 | - $html .= ' ' . $key . '="' . (in_array($key, $noEscape) ? $val : e($val)) . '"'; |
|
86 | + $html .= ' '.$key.'="'.(in_array($key, $noEscape) ? $val : e($val)).'"'; |
|
87 | 87 | break; |
88 | 88 | case ($val === true && is_scalar($key)): |
89 | 89 | $html .= ' '.$key; |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | do { |
242 | 242 | $new = false; |
243 | 243 | //Поиск открывающего тэга (одного!) |
244 | - preg_match('%(<' . $tag . '[^>]*>)(.*)%s', $html, $m); |
|
244 | + preg_match('%(<'.$tag.'[^>]*>)(.*)%s', $html, $m); |
|
245 | 245 | |
246 | 246 | if (isset($m[1], $m[2])) { |
247 | 247 | //Начинаем поиски закрывающих тегов (всех до конца документа) |
248 | - preg_match_all('%</' . $tag . '[^>]*>%is', $m[2], $tmp, PREG_OFFSET_CAPTURE); |
|
248 | + preg_match_all('%</'.$tag.'[^>]*>%is', $m[2], $tmp, PREG_OFFSET_CAPTURE); |
|
249 | 249 | if (!empty($tmp[0])) { |
250 | 250 | foreach ($tmp[0] as $j => $subTmp) { |
251 | 251 | $closeTag = $subTmp[0]; //закрывающий тэг |
252 | 252 | $subText = substr($m[2], 0, $subTmp[1]); //Тексту внутри тэгов |
253 | 253 | |
254 | 254 | //подсчет открывающих тэгов внутри полученного текста |
255 | - preg_match_all('%(<' . $tag . '[^>]*>)%s', $subText, $count); |
|
255 | + preg_match_all('%(<'.$tag.'[^>]*>)%s', $subText, $count); |
|
256 | 256 | if (count($count[0]) == $j) { |
257 | 257 | $replace[] = array($m[1], $subText, $closeTag); |
258 | 258 | $new = true; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $subTmp = $tmp[0][$j]; |
267 | 267 | $closeTag = $subTmp[0]; |
268 | 268 | |
269 | - $subText = substr($m[2], 0, $subTmp[1]) . $closeTag; |
|
269 | + $subText = substr($m[2], 0, $subTmp[1]).$closeTag; |
|
270 | 270 | $html = substr($m[2], $subTmp[1] + strlen($closeTag)); |
271 | 271 | $replace[] = array($m[1], $subText, $closeTag); |
272 | 272 | }else { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $thead = $table['head']; |
29 | 29 | } elseif (is_array($table)) { |
30 | 30 | $thead = html_implode($table, 'th'); |
31 | - }else { |
|
31 | + } else { |
|
32 | 32 | $thead = $table; |
33 | 33 | } |
34 | 34 | if (!empty($thead)) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if ((string)$val === (string)$current) { |
125 | 125 | $value['selected'] = true; |
126 | 126 | $selected = true; |
127 | - }else { |
|
127 | + } else { |
|
128 | 128 | unset($value['selected']); |
129 | 129 | } |
130 | 130 | |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | $subText = substr($m[2], 0, $subTmp[1]) . $closeTag; |
270 | 270 | $html = substr($m[2], $subTmp[1] + strlen($closeTag)); |
271 | 271 | $replace[] = array($m[1], $subText, $closeTag); |
272 | - }else { |
|
272 | + } else { |
|
273 | 273 | $replace[] = array($m[1], $m[2], ''); |
274 | 274 | $html = ''; |
275 | 275 | } |
276 | 276 | } |
277 | - }else { |
|
277 | + } else { |
|
278 | 278 | $html = ''; |
279 | 279 | } |
280 | 280 | } while (!empty($html)); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | return for_all($data, function($el) use ($charset) { |
13 | 13 | $str = one_space($el); |
14 | - return mb_strtolower(mb_substr($str, 0, 1, $charset), $charset) . mb_substr($str, 1, mb_strlen($str), $charset); |
|
14 | + return mb_strtolower(mb_substr($str, 0, 1, $charset), $charset).mb_substr($str, 1, mb_strlen($str), $charset); |
|
15 | 15 | }); |
16 | 16 | } |
17 | 17 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | return for_all($data, function($el) use ($charset) { |
30 | 30 | $str = one_space($el); |
31 | - return mb_strtoupper(mb_substr($str, 0, 1, $charset), $charset) . mb_substr($str, 1, mb_strlen($str), $charset); |
|
31 | + return mb_strtoupper(mb_substr($str, 0, 1, $charset), $charset).mb_substr($str, 1, mb_strlen($str), $charset); |
|
32 | 32 | }); |
33 | 33 | } |
34 | 34 | } |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | #tag without attributes |
307 | - if (array_key_exists('<' . $tag . '>', $_allowable_tags)) { |
|
307 | + if (array_key_exists('<'.$tag.'>', $_allowable_tags)) { |
|
308 | 308 | if (substr($s[0], 0, 2) === '</') { |
309 | - return '</' . $tag . '>'; |
|
309 | + return '</'.$tag.'>'; |
|
310 | 310 | } |
311 | 311 | if (substr($s[0], -2) === '/>') { |
312 | - return '<' . $tag . ' />'; |
|
312 | + return '<'.$tag.' />'; |
|
313 | 313 | } |
314 | - return '<' . $tag . '>'; |
|
314 | + return '<'.$tag.'>'; |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | if ($tag === 'br') { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | } |
323 | 323 | return ''; |
324 | 324 | } |
325 | - trigger_error('Unknown callback type "' . $_callback_type . '"!', E_USER_ERROR); |
|
325 | + trigger_error('Unknown callback type "'.$_callback_type.'"!', E_USER_ERROR); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | if (($pos = strpos($s, '<')) === false || strpos($s, '>', $pos) === false) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | [a-zA-Z][a-zA-Z\d]*+ |
342 | 342 | (?>:[a-zA-Z][a-zA-Z\d]*+)? |
343 | 343 | ) #1 |
344 | - ' . $re_attrs_fast_safe . ' |
|
344 | + ' . $re_attrs_fast_safe.' |
|
345 | 345 | > |
346 | 346 | ~sxSX'; |
347 | 347 | |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | foreach ($pair_tags as $k => $v) { |
370 | 370 | $pair_tags[$k] = preg_quote($v, '/'); |
371 | 371 | } |
372 | - $patterns[] = '/ <((?i:' . implode('|', $pair_tags) . '))' . $re_attrs_fast_safe . '(?<!\/)> |
|
372 | + $patterns[] = '/ <((?i:'.implode('|', $pair_tags).'))'.$re_attrs_fast_safe.'(?<!\/)> |
|
373 | 373 | .*? |
374 | - <\/(?i:\\1)' . $re_attrs_fast_safe . '> |
|
374 | + <\/(?i:\\1)' . $re_attrs_fast_safe.'> |
|
375 | 375 | /sxSX'; |
376 | 376 | } |
377 | 377 | #d($patterns); |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | $s2 = strtr($s2, "\x09\x0a\x0c\x0d", ' '); |
403 | 403 | */ |
404 | 404 | $s2 = preg_replace('/ [\x09\x0a\x0c\x0d]++ |
405 | - | <((?i:pre|textarea))' . $re_attrs_fast_safe . '(?<!\/)> |
|
405 | + | <((?i:pre|textarea))' . $re_attrs_fast_safe.'(?<!\/)> |
|
406 | 406 | .+? |
407 | - <\/(?i:\\1)' . $re_attrs_fast_safe . '> |
|
407 | + <\/(?i:\\1)' . $re_attrs_fast_safe.'> |
|
408 | 408 | \K |
409 | 409 | /sxSX', ' ', $s2); |
410 | 410 | if (preg_last_error() !== PREG_NO_ERROR) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | if (is_nop($last)) { |
476 | 476 | $last = $sep; |
477 | 477 | } |
478 | - return empty($out) ? $end : $out . $last . $end; |
|
478 | + return empty($out) ? $end : $out.$last.$end; |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $count += count($parts) - 1; |
206 | 206 | $subject = implode($replacements[$key], $parts); |
207 | 207 | } |
208 | - }else { |
|
208 | + } else { |
|
209 | 209 | // Call mb_str_replace for each subject in array, recursively |
210 | 210 | foreach ($subject as $key => $value) { |
211 | 211 | $subject[$key] = mb_str_replace($search, $replace, $value, $count); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $text = mb_substr($text, 0, $len + 1, $encoding); |
232 | 232 | if (mb_substr($text, -1, null, $encoding) == ' ') { |
233 | 233 | $out = trim($text); |
234 | - }else { |
|
234 | + } else { |
|
235 | 235 | $out = mb_substr($text, 0, mb_strripos($text, ' ', null, $encoding), $encoding); |
236 | 236 | } |
237 | 237 | return preg_replace("/(([\.,\-:!?;\s])|(&\w+;))+$/ui", "", $out); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | list(, $domain) = explode("@", $email, 2); |
18 | 18 | if (!$dns || ($dns && checkdnsrr($domain, "MX") && checkdnsrr($domain, "A"))) { |
19 | 19 | $error = false; |
20 | - }else { |
|
20 | + } else { |
|
21 | 21 | $error = 'dns'; |
22 | 22 | } |
23 | - }else { |
|
23 | + } else { |
|
24 | 24 | $error = 'format'; |
25 | 25 | } |
26 | 26 | return $error; |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $output .= fgets($conn, 128); |
356 | 356 | } |
357 | 357 | fclose($conn); |
358 | - }else { |
|
358 | + } else { |
|
359 | 359 | throw new ErrorException('Could not connect to ' . $nic_server . '!'); |
360 | 360 | } |
361 | 361 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (!function_exists('supports_ansi_colors')) { |
3 | 3 | /** |
4 | - * Функция позволяет узнать, поддерживает ли консоль цвета и другое форматирование. |
|
5 | - * @see: https://gostash.it/ru/stashes/1601-podderzivaet-li-konsol-cveta |
|
6 | - * @return bool Результат проверки |
|
7 | - * |
|
8 | - * DIRECTORY_SEPARATOR === '\\' — проверка на Windows. |
|
9 | - * getenv('ANSICON') !== false — проверка запуска через ANSICON. |
|
10 | - * getenv('ConEmuANSI') === 'ON' — проверка запуска через ConEmu. |
|
11 | - * function_exists('posix_isatty') && @posix_isatty(\STDOUT) — проверка на интерактивный терминал UNIX. |
|
12 | - */ |
|
4 | + * Функция позволяет узнать, поддерживает ли консоль цвета и другое форматирование. |
|
5 | + * @see: https://gostash.it/ru/stashes/1601-podderzivaet-li-konsol-cveta |
|
6 | + * @return bool Результат проверки |
|
7 | + * |
|
8 | + * DIRECTORY_SEPARATOR === '\\' — проверка на Windows. |
|
9 | + * getenv('ANSICON') !== false — проверка запуска через ANSICON. |
|
10 | + * getenv('ConEmuANSI') === 'ON' — проверка запуска через ConEmu. |
|
11 | + * function_exists('posix_isatty') && @posix_isatty(\STDOUT) — проверка на интерактивный терминал UNIX. |
|
12 | + */ |
|
13 | 13 | function supports_ansi_colors(){ |
14 | 14 | return DIRECTORY_SEPARATOR === '\\' |
15 | 15 | ? getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON' |
@@ -570,25 +570,25 @@ discard block |
||
570 | 570 | /** |
571 | 571 | * Формирование правильной CSV строки |
572 | 572 | * |
573 | - * @see: https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
573 | + * @see: https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
574 | 574 | * @param array $data Массив с данными |
575 | 575 | * @return string |
576 | 576 | */ |
577 | 577 | function make_csv($data, $separator = ","){ |
578 | - // Create a stream opening it with read / write mode |
|
579 | - $stream = fopen('data://text/plain,' . "", 'w+'); |
|
578 | + // Create a stream opening it with read / write mode |
|
579 | + $stream = fopen('data://text/plain,' . "", 'w+'); |
|
580 | 580 | |
581 | - // Iterate over the data, writting each line to the text stream |
|
582 | - fputcsv($stream, $data, $separator); |
|
581 | + // Iterate over the data, writting each line to the text stream |
|
582 | + fputcsv($stream, $data, $separator); |
|
583 | 583 | |
584 | - // Rewind the stream |
|
585 | - rewind($stream); |
|
584 | + // Rewind the stream |
|
585 | + rewind($stream); |
|
586 | 586 | |
587 | - // You can now echo it's content |
|
588 | - $out = stream_get_contents($stream); |
|
587 | + // You can now echo it's content |
|
588 | + $out = stream_get_contents($stream); |
|
589 | 589 | |
590 | - // Close the stream |
|
591 | - fclose($stream); |
|
592 | - return $out; |
|
593 | - } |
|
590 | + // Close the stream |
|
591 | + fclose($stream); |
|
592 | + return $out; |
|
593 | + } |
|
594 | 594 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * getenv('ConEmuANSI') === 'ON' — проверка запуска через ConEmu. |
11 | 11 | * function_exists('posix_isatty') && @posix_isatty(\STDOUT) — проверка на интерактивный терминал UNIX. |
12 | 12 | */ |
13 | - function supports_ansi_colors(){ |
|
13 | + function supports_ansi_colors() { |
|
14 | 14 | return DIRECTORY_SEPARATOR === '\\' |
15 | 15 | ? getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON' |
16 | 16 | : function_exists('posix_isatty') && @posix_isatty(\STDOUT); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | function get_gravatar($email, $size = 32) |
108 | 108 | { |
109 | - $url = '//www.gravatar.com/avatar/' . md5(is_scalar($email) ? $email : '') . '?s=' . (int)abs($size); |
|
109 | + $url = '//www.gravatar.com/avatar/'.md5(is_scalar($email) ? $email : '').'?s='.(int)abs($size); |
|
110 | 110 | return $url; |
111 | 111 | } |
112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function share_vk($url, $title = '') |
123 | 123 | { |
124 | - return 'http://vkontakte.ru/share.php?url=' . urlencode($url) . '&title=' . urlencode($title); |
|
124 | + return 'http://vkontakte.ru/share.php?url='.urlencode($url).'&title='.urlencode($title); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function share_ok($url, $title = '') |
137 | 137 | { |
138 | - return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl=' . urlencode($url) . '&st.comments=' . urlencode($title); |
|
138 | + return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl='.urlencode($url).'&st.comments='.urlencode($title); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | function share_google($url) |
150 | 150 | { |
151 | - return 'https://plus.google.com/share?url=' . urlencode($url); |
|
151 | + return 'https://plus.google.com/share?url='.urlencode($url); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function share_facebook($url, $title = '') |
164 | 164 | { |
165 | - return 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]=' . urlencode($url) . '&p[title]=' . urlencode($title); |
|
165 | + return 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]='.urlencode($url).'&p[title]='.urlencode($title); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | function share_twitter($url, $title = '') |
178 | 178 | { |
179 | - return 'https://twitter.com/intent/tweet?url=' . urlencode($url) . '&text=' . urlencode($title); |
|
179 | + return 'https://twitter.com/intent/tweet?url='.urlencode($url).'&text='.urlencode($title); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function share_mail($url, $title = '') |
192 | 192 | { |
193 | - return 'http://connect.mail.ru/share?share_url=' . urlencode($url) . '&title=' . urlencode($title); |
|
193 | + return 'http://connect.mail.ru/share?share_url='.urlencode($url).'&title='.urlencode($title); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | function share_linkedin($url, $title = '') |
206 | 206 | { |
207 | - return 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($url) . '&title=' . urlencode($title); |
|
207 | + return 'http://www.linkedin.com/shareArticle?mini=true&url='.urlencode($url).'&title='.urlencode($title); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $size = (int)$size; |
222 | 222 | $size = implode("x", array($size, $size)); |
223 | - return '//chart.apis.google.com/chart?cht=qr&chs=' . $size . '&chl=' . (is_scalar($str) ? urlencode($str) : ''); |
|
223 | + return '//chart.apis.google.com/chart?cht=qr&chs='.$size.'&chl='.(is_scalar($str) ? urlencode($str) : ''); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | |
369 | 369 | // connect to whois server: |
370 | 370 | if ($conn = fsockopen($nic_server, 43)) { |
371 | - fputs($conn, $domain . "\r\n"); |
|
371 | + fputs($conn, $domain."\r\n"); |
|
372 | 372 | while (!feof($conn)) { |
373 | 373 | $output .= fgets($conn, 128); |
374 | 374 | } |
375 | 375 | fclose($conn); |
376 | 376 | }else { |
377 | - throw new ErrorException('Could not connect to ' . $nic_server . '!'); |
|
377 | + throw new ErrorException('Could not connect to '.$nic_server.'!'); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | return $output; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | function copyright($year, $sep = ' - ') |
393 | 393 | { |
394 | 394 | $y = date('Y'); |
395 | - return ($y != $year) ? ($year . $sep . $y) : $year; |
|
395 | + return ($y != $year) ? ($year.$sep.$y) : $year; |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
@@ -534,25 +534,25 @@ discard block |
||
534 | 534 | */ |
535 | 535 | function format_bytes($bytes, $precision = 2, $suffixes = array('Байт', 'Кбайт', 'Мбайт', 'Гбайт', 'Тбайт')) { |
536 | 536 | $bytes = (float)$bytes; |
537 | - if(empty($bytes)) { |
|
537 | + if (empty($bytes)) { |
|
538 | 538 | return 0; |
539 | 539 | } |
540 | 540 | $base = log($bytes, 1024); |
541 | - return trim(round(pow(1024, $base - floor($base)), $precision) . ' ' .get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
541 | + return trim(round(pow(1024, $base - floor($base)), $precision).' '.get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
545 | -if(!function_exists('format_microtime')){ |
|
545 | +if (!function_exists('format_microtime')) { |
|
546 | 546 | /** |
547 | 547 | * Форматирование microtime времени |
548 | 548 | * @param string $time microtime время |
549 | 549 | * @param int $len Кол-во символов после точки |
550 | 550 | */ |
551 | - function format_microtime($time, $len = 4){ |
|
551 | + function format_microtime($time, $len = 4) { |
|
552 | 552 | return sprintf("%.".(int)$len."f", $time); |
553 | 553 | } |
554 | 554 | } |
555 | -if(!function_exists('ip_in_range')){ |
|
555 | +if (!function_exists('ip_in_range')) { |
|
556 | 556 | /** |
557 | 557 | * Входит ли указанный IP в заданный диапазон |
558 | 558 | * |
@@ -561,12 +561,12 @@ discard block |
||
561 | 561 | * @param string $upper Конечный IP диапазона |
562 | 562 | * @return bool |
563 | 563 | */ |
564 | - function in_ip_range($ip, $lower, $upper){ |
|
564 | + function in_ip_range($ip, $lower, $upper) { |
|
565 | 565 | return (ip2long($lower) <= ip2long($ip) && ip2long($upper) >= ip2long($ip)) ? TRUE : FALSE; |
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
569 | -if(!function_exists('make_csv')){ |
|
569 | +if (!function_exists('make_csv')) { |
|
570 | 570 | /** |
571 | 571 | * Формирование правильной CSV строки |
572 | 572 | * |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | * @param array $data Массив с данными |
575 | 575 | * @return string |
576 | 576 | */ |
577 | - function make_csv($data, $separator = ","){ |
|
577 | + function make_csv($data, $separator = ",") { |
|
578 | 578 | // Create a stream opening it with read / write mode |
579 | - $stream = fopen('data://text/plain,' . "", 'w+'); |
|
579 | + $stream = fopen('data://text/plain,'."", 'w+'); |
|
580 | 580 | |
581 | 581 | // Iterate over the data, writting each line to the text stream |
582 | 582 | fputcsv($stream, $data, $separator); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * @param string $path путь к папке |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - function sanitize_path($path ){ |
|
63 | + function sanitize_path($path) { |
|
64 | 64 | return preg_replace(array("/\.*[\/|\\\]/i", "/[\/|\\\]+/i"), array('/', '/'), $path); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | \ No newline at end of file |