static function nice_size($size) { $size = str::sanitize($size, 'int'); if ($size < 1) { return '0 kb'; } $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); return @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i]; }
function niceTotalSize() { return f::nice_size($this->totalSize()); }