@@ -116,7 +116,7 @@ |
||
| 116 | 116 | * @param array $replace |
| 117 | 117 | * @param string $delimiter |
| 118 | 118 | * |
| 119 | - * @return mixed|string |
|
| 119 | + * @return string |
|
| 120 | 120 | */ |
| 121 | 121 | function slugify($str, $replace=array(), $delimiter='-') { |
| 122 | 122 | if( !empty($replace) ) { |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | return '0 seconds'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $a = array( 365 * 24 * 60 * 60 => 'year', |
|
| 41 | + $a = array(365 * 24 * 60 * 60 => 'year', |
|
| 42 | 42 | 30 * 24 * 60 * 60 => 'month', |
| 43 | 43 | 24 * 60 * 60 => 'day', |
| 44 | 44 | 60 * 60 => 'hour', |
| 45 | 45 | 60 => 'minute', |
| 46 | 46 | 1 => 'second' |
| 47 | 47 | ); |
| 48 | - $a_plural = array( 'year' => 'years', |
|
| 48 | + $a_plural = array('year' => 'years', |
|
| 49 | 49 | 'month' => 'months', |
| 50 | 50 | 'day' => 'days', |
| 51 | 51 | 'hour' => 'hours', |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | if ($d >= 1) |
| 60 | 60 | { |
| 61 | 61 | $r = round($d); |
| 62 | - return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago'; |
|
| 62 | + return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago'; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | return 0; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | -function humanFileSize($size,$unit="") { |
|
| 69 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
| 70 | - return number_format($size/(1<<30),2)."GB"; |
|
| 71 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
| 72 | - return number_format($size/(1<<20),2)."MB"; |
|
| 73 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
| 74 | - return number_format($size/(1<<10),2)."KB"; |
|
| 68 | +function humanFileSize($size, $unit = "") { |
|
| 69 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
| 70 | + return number_format($size / (1 << 30), 2)."GB"; |
|
| 71 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
| 72 | + return number_format($size / (1 << 20), 2)."MB"; |
|
| 73 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
| 74 | + return number_format($size / (1 << 10), 2)."KB"; |
|
| 75 | 75 | return number_format($size)." bytes"; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @return mixed|string |
| 120 | 120 | */ |
| 121 | -function slugify($str, $replace=array(), $delimiter='-') { |
|
| 122 | - if( !empty($replace) ) { |
|
| 123 | - $str = str_replace((array)$replace, ' ', $str); |
|
| 121 | +function slugify($str, $replace = array(), $delimiter = '-') { |
|
| 122 | + if (!empty($replace)) { |
|
| 123 | + $str = str_replace((array) $replace, ' ', $str); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $debug_backtrace = current(debug_backtrace()); |
| 145 | 145 | if (PHP_SAPI == 'cli') { |
| 146 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
| 146 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
| 147 | 147 | foreach (func_get_args() as $data) { |
| 148 | 148 | var_dump($data); |
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | 151 | ob_clean(); |
| 152 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
| 152 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
| 153 | 153 | echo '<pre>'; |
| 154 | 154 | foreach (func_get_args() as $data) { |
| 155 | 155 | echo "<code>"; |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | function utf8Convert($array) |
| 192 | 192 | { |
| 193 | - array_walk_recursive($array, function(&$item, $key){ |
|
| 194 | - if(!mb_detect_encoding($item, 'utf-8', true)){ |
|
| 193 | + array_walk_recursive($array, function(&$item, $key) { |
|
| 194 | + if (!mb_detect_encoding($item, 'utf-8', true)) { |
|
| 195 | 195 | $item = utf8_encode($item); |
| 196 | 196 | } |
| 197 | 197 | }); |