mirror of
https://github.com/unraid/webgui.git
synced 2026-04-29 14:29:24 -05:00
@@ -19,7 +19,7 @@ function my_scale($value, &$unit, $decimals=NULL, $scale=NULL, $kilo=1000) {
|
||||
global $display,$language;
|
||||
$scale = $scale ?? $display['scale'];
|
||||
$number = $display['number'] ?? '.,';
|
||||
$units = explode(' ', ' '.($language['prefix_SI'] ?? 'K M G T P E Z Y'));
|
||||
$units = explode(' ', ' '.($kilo==1000 ? ($language['prefix_SI'] ?? 'K M G T P E Z Y') : ($language['prefix_IEC'] ?? 'Ki Mi Gi Ti Pi Ei Zi Yi')));
|
||||
$size = count($units);
|
||||
if ($scale==0 && ($decimals===NULL || $decimals<0)) {
|
||||
$decimals = 0;
|
||||
@@ -32,7 +32,7 @@ function my_scale($value, &$unit, $decimals=NULL, $scale=NULL, $kilo=1000) {
|
||||
if ($decimals===NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100===0 ? 0 : 2));
|
||||
elseif ($decimals<0) $decimals = $value>=100||round($value*10)%10===0 ? 0 : abs($decimals);
|
||||
if ($scale<0 && round($value,-1)==1000) {$value = 1; $base++;}
|
||||
$unit = $units[$base].($kilo==1000 ? _('B') : '');
|
||||
$unit = $units[$base]._('B');
|
||||
}
|
||||
return number_format($value, $decimals, $number[0], $value>9999 ? $number[1] : '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user