mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-14 12:16:39 +09:00
- fixed not numeric issue;
This commit is contained in:
@@ -1133,14 +1133,16 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function format_bytes( $size , $precision = 1 ) {
|
||||
if ( is_numeric( $size ) ) {
|
||||
$base = log( $size, 1024 );
|
||||
$suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
|
||||
$computed_size = round( pow( 1024, $base - floor( $base ) ), $precision );
|
||||
$unit = $suffixes[ floor( $base ) ];
|
||||
|
||||
$base = log($size, 1024);
|
||||
$suffixes = array('', 'kb', 'MB', 'GB', 'TB');
|
||||
$computed_size = round(pow(1024, $base - floor($base)), $precision);
|
||||
$unit = $suffixes[ floor($base) ];
|
||||
|
||||
return $computed_size.' '.$unit;
|
||||
return $computed_size.' '.$unit;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user