@@ -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; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function get_gravatar($email, $size = 32) |
90 | 90 | { |
91 | - $url = '//www.gravatar.com/avatar/' . md5(is_scalar($email) ? $email : '') . '?s=' . (int)abs($size); |
|
91 | + $url = '//www.gravatar.com/avatar/'.md5(is_scalar($email) ? $email : '').'?s='.(int)abs($size); |
|
92 | 92 | return $url; |
93 | 93 | } |
94 | 94 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function share_vk($url, $title = '') |
105 | 105 | { |
106 | - return 'http://vkontakte.ru/share.php?url=' . urlencode($url) . '&title=' . urlencode($title); |
|
106 | + return 'http://vkontakte.ru/share.php?url='.urlencode($url).'&title='.urlencode($title); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | function share_ok($url, $title = '') |
119 | 119 | { |
120 | - return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl=' . urlencode($url) . '&st.comments=' . urlencode($title); |
|
120 | + return 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl='.urlencode($url).'&st.comments='.urlencode($title); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | function share_google($url) |
132 | 132 | { |
133 | - return 'https://plus.google.com/share?url=' . urlencode($url); |
|
133 | + return 'https://plus.google.com/share?url='.urlencode($url); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function share_facebook($url, $title = '') |
146 | 146 | { |
147 | - return 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]=' . urlencode($url) . '&p[title]=' . urlencode($title); |
|
147 | + return 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]='.urlencode($url).'&p[title]='.urlencode($title); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | function share_twitter($url, $title = '') |
160 | 160 | { |
161 | - return 'https://twitter.com/intent/tweet?url=' . urlencode($url) . '&text=' . urlencode($title); |
|
161 | + return 'https://twitter.com/intent/tweet?url='.urlencode($url).'&text='.urlencode($title); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function share_mail($url, $title = '') |
174 | 174 | { |
175 | - return 'http://connect.mail.ru/share?share_url=' . urlencode($url) . '&title=' . urlencode($title); |
|
175 | + return 'http://connect.mail.ru/share?share_url='.urlencode($url).'&title='.urlencode($title); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function share_linkedin($url, $title = '') |
188 | 188 | { |
189 | - return 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($url) . '&title=' . urlencode($title); |
|
189 | + return 'http://www.linkedin.com/shareArticle?mini=true&url='.urlencode($url).'&title='.urlencode($title); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | { |
203 | 203 | $size = (int)$size; |
204 | 204 | $size = implode("x", array($size, $size)); |
205 | - return '//chart.apis.google.com/chart?cht=qr&chs=' . $size . '&chl=' . (is_scalar($str) ? urlencode($str) : ''); |
|
205 | + return '//chart.apis.google.com/chart?cht=qr&chs='.$size.'&chl='.(is_scalar($str) ? urlencode($str) : ''); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function get_user_ip($out = '127.0.0.1') |
219 | 219 | { |
220 | - $_getEnv = function ($data) { |
|
220 | + $_getEnv = function($data) { |
|
221 | 221 | switch (true) { |
222 | 222 | case (isset($_SERVER[$data])): |
223 | 223 | $out = $_SERVER[$data]; |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | |
351 | 351 | // connect to whois server: |
352 | 352 | if ($conn = fsockopen($nic_server, 43)) { |
353 | - fputs($conn, $domain . "\r\n"); |
|
353 | + fputs($conn, $domain."\r\n"); |
|
354 | 354 | while (!feof($conn)) { |
355 | 355 | $output .= fgets($conn, 128); |
356 | 356 | } |
357 | 357 | fclose($conn); |
358 | - } else { |
|
359 | - throw new ErrorException('Could not connect to ' . $nic_server . '!'); |
|
358 | + }else { |
|
359 | + throw new ErrorException('Could not connect to '.$nic_server.'!'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | return $output; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | function copyright($year, $sep = ' - ') |
375 | 375 | { |
376 | 376 | $y = date('Y'); |
377 | - return ($y != $year) ? ($year . $sep . $y) : $year; |
|
377 | + return ($y != $year) ? ($year.$sep.$y) : $year; |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | function image_size($image, $mode = null) |
437 | 437 | { |
438 | 438 | $width = $height = 0; |
439 | - if(is_scalar($image) && is_file($image)){ |
|
439 | + if (is_scalar($image) && is_file($image)) { |
|
440 | 440 | $size = @getimagesize($image); |
441 | 441 | $width = isset($size[0]) ? $size[0] : 0; |
442 | 442 | $height = isset($size[1]) ? $size[1] : 0; |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | -if(!function_exists('validate_date')){ |
|
478 | +if (!function_exists('validate_date')) { |
|
479 | 479 | /** |
480 | 480 | * Проверка валидности даты |
481 | 481 | * |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | * @param Closure $validator метод для дополнительной проверки даты |
492 | 492 | * @return null|string |
493 | 493 | */ |
494 | - function validate_date($date, $fromFormat='Y-m-d', $toFormat = 'Y-m-d', Closure $validator = null){ |
|
494 | + function validate_date($date, $fromFormat = 'Y-m-d', $toFormat = 'Y-m-d', Closure $validator = null) { |
|
495 | 495 | $validTime = false; |
496 | 496 | $datetime2 = null; |
497 | - if(is_scalar($date)){ |
|
497 | + if (is_scalar($date)) { |
|
498 | 498 | $datetime1 = new \DateTime("NOW"); |
499 | 499 | $datetime2 = \DateTime::createFromFormat($fromFormat, $date); |
500 | - if($datetime2 instanceof \DateTime){ |
|
500 | + if ($datetime2 instanceof \DateTime) { |
|
501 | 501 | $interval = $datetime1->diff($datetime2); |
502 | 502 | $validTime = is_callable($validator) ? (bool)$validator($datetime2, $interval) : true; |
503 | 503 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | return $validTime ? $datetime2->format($toFormat) : null; |
506 | 506 | } |
507 | 507 | } |
508 | -if(!function_exists('format_bytes')){ |
|
508 | +if (!function_exists('format_bytes')) { |
|
509 | 509 | /** |
510 | 510 | * Преобразование из байт в другие порядки (кило, мега, гига) с добавлением префикса |
511 | 511 | * |
@@ -516,23 +516,23 @@ discard block |
||
516 | 516 | */ |
517 | 517 | function format_bytes($bytes, $precision = 2, $suffixes = array('Байт', 'Кбайт', 'Мбайт', 'Гбайт', 'Тбайт')) { |
518 | 518 | $bytes = (float)$bytes; |
519 | - if(empty($bytes)) return 0; |
|
519 | + if (empty($bytes)) return 0; |
|
520 | 520 | $base = log($bytes, 1024); |
521 | - return trim(round(pow(1024, $base - floor($base)), $precision) . ' ' .get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
521 | + return trim(round(pow(1024, $base - floor($base)), $precision).' '.get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | -if(!function_exists('format_microtime')){ |
|
525 | +if (!function_exists('format_microtime')) { |
|
526 | 526 | /** |
527 | 527 | * Форматирование microtime времени |
528 | 528 | * @param string $time microtime время |
529 | 529 | * @param int $len Кол-во символов после точки |
530 | 530 | */ |
531 | - function format_microtime($time, $len = 4){ |
|
531 | + function format_microtime($time, $len = 4) { |
|
532 | 532 | return sprintf("%.".(int)$len."f", $time); |
533 | 533 | } |
534 | 534 | } |
535 | -if(!function_exists('ip_in_range')){ |
|
535 | +if (!function_exists('ip_in_range')) { |
|
536 | 536 | /** |
537 | 537 | * Входит ли указанный IP в заданный диапазон |
538 | 538 | * |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @param string $upper Конечный IP диапазона |
542 | 542 | * @return bool |
543 | 543 | */ |
544 | - function in_ip_range($ip, $lower, $upper){ |
|
544 | + function in_ip_range($ip, $lower, $upper) { |
|
545 | 545 | return (ip2long($lower) <= ip2long($ip) && ip2long($upper) >= ip2long($ip)) ? TRUE : FALSE; |
546 | 546 | } |
547 | 547 | } |
548 | 548 | \ No newline at end of file |