@@ -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,7 +543,7 @@ 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 | \ No newline at end of file |
@@ -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 | |
@@ -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 |
@@ -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); |