@@ -552,25 +552,25 @@ |
||
552 | 552 | /** |
553 | 553 | * Формирование правильной CSV строки |
554 | 554 | * |
555 | - * @see: https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
555 | + * @see: https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
556 | 556 | * @param array $data Массив с данными |
557 | 557 | * @return string |
558 | - */ |
|
559 | - function make_csv($data){ |
|
560 | - // Create a stream opening it with read / write mode |
|
561 | - $stream = fopen('data://text/plain,' . "", 'w+'); |
|
558 | + */ |
|
559 | + function make_csv($data){ |
|
560 | + // Create a stream opening it with read / write mode |
|
561 | + $stream = fopen('data://text/plain,' . "", 'w+'); |
|
562 | 562 | |
563 | - // Iterate over the data, writting each line to the text stream |
|
564 | - fputcsv($stream, $data); |
|
563 | + // Iterate over the data, writting each line to the text stream |
|
564 | + fputcsv($stream, $data); |
|
565 | 565 | |
566 | - // Rewind the stream |
|
567 | - rewind($stream); |
|
566 | + // Rewind the stream |
|
567 | + rewind($stream); |
|
568 | 568 | |
569 | - // You can now echo it's content |
|
570 | - $out = stream_get_contents($stream); |
|
569 | + // You can now echo it's content |
|
570 | + $out = stream_get_contents($stream); |
|
571 | 571 | |
572 | - // Close the stream |
|
573 | - fclose($stream); |
|
574 | - return $out; |
|
575 | - } |
|
572 | + // Close the stream |
|
573 | + fclose($stream); |
|
574 | + return $out; |
|
575 | + } |
|
576 | 576 | } |
577 | 577 | \ No newline at end of file |
@@ -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 | |
@@ -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 | 358 | }else { |
359 | - throw new ErrorException('Could not connect to ' . $nic_server . '!'); |
|
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 | |
@@ -516,25 +516,25 @@ discard block |
||
516 | 516 | */ |
517 | 517 | function format_bytes($bytes, $precision = 2, $suffixes = array('Байт', 'Кбайт', 'Мбайт', 'Гбайт', 'Тбайт')) { |
518 | 518 | $bytes = (float)$bytes; |
519 | - if(empty($bytes)) { |
|
519 | + if (empty($bytes)) { |
|
520 | 520 | return 0; |
521 | 521 | } |
522 | 522 | $base = log($bytes, 1024); |
523 | - return trim(round(pow(1024, $base - floor($base)), $precision) . ' ' .get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
523 | + return trim(round(pow(1024, $base - floor($base)), $precision).' '.get_key($suffixes, (int)$base, '', 'is_scalar')); |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | -if(!function_exists('format_microtime')){ |
|
527 | +if (!function_exists('format_microtime')) { |
|
528 | 528 | /** |
529 | 529 | * Форматирование microtime времени |
530 | 530 | * @param string $time microtime время |
531 | 531 | * @param int $len Кол-во символов после точки |
532 | 532 | */ |
533 | - function format_microtime($time, $len = 4){ |
|
533 | + function format_microtime($time, $len = 4) { |
|
534 | 534 | return sprintf("%.".(int)$len."f", $time); |
535 | 535 | } |
536 | 536 | } |
537 | -if(!function_exists('ip_in_range')){ |
|
537 | +if (!function_exists('ip_in_range')) { |
|
538 | 538 | /** |
539 | 539 | * Входит ли указанный IP в заданный диапазон |
540 | 540 | * |
@@ -543,12 +543,12 @@ discard block |
||
543 | 543 | * @param string $upper Конечный IP диапазона |
544 | 544 | * @return bool |
545 | 545 | */ |
546 | - function in_ip_range($ip, $lower, $upper){ |
|
546 | + function in_ip_range($ip, $lower, $upper) { |
|
547 | 547 | return (ip2long($lower) <= ip2long($ip) && ip2long($upper) >= ip2long($ip)) ? TRUE : FALSE; |
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | -if(!function_exists('make_csv')){ |
|
551 | +if (!function_exists('make_csv')) { |
|
552 | 552 | /** |
553 | 553 | * Формирование правильной CSV строки |
554 | 554 | * |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | * @param array $data Массив с данными |
557 | 557 | * @return string |
558 | 558 | */ |
559 | - function make_csv($data){ |
|
559 | + function make_csv($data) { |
|
560 | 560 | // Create a stream opening it with read / write mode |
561 | - $stream = fopen('data://text/plain,' . "", 'w+'); |
|
561 | + $stream = fopen('data://text/plain,'."", 'w+'); |
|
562 | 562 | |
563 | 563 | // Iterate over the data, writting each line to the text stream |
564 | 564 | fputcsv($stream, $data); |