Changeset 338 for trunk/lib/Utilities.inc.php
- Timestamp:
- Aug 29, 2008 8:30:19 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r336 r338 266 266 case 'end' : 267 267 return preg_replace(array(sprintf('/^(.{%s}).{4,}$/sU', $part1 + $part2), '/\s*\.{3,}\s*/sU'), array('$1' . $delim, $delim), $str); 268 break; 269 } 270 } 271 272 /** 273 * Return a human readable filesize.274 * 275 * @param int $size Size 268 break; 269 } 270 } 271 272 /** 273 * Return a human readable disk space measurement. Input value measured in bytes. 274 * 275 * @param int $size Size in bytes. 276 276 * @param int $unit The maximum unit 277 277 * @param int $format The return string format … … 279 279 * @version 1.1.0 280 280 */ 281 function humanFileSize($size, $format='%01.2f %s', $max_unit=null )281 function humanFileSize($size, $format='%01.2f %s', $max_unit=null, $multiplier=1024) 282 282 { 283 283 // Units … … 293 293 // Loop 294 294 $i = 0; 295 while ($max_unit != $i && $size >= 1024&& $i < $ii) {296 $size /= 1024;295 while ($max_unit != $i && $size >= $multiplier && $i < $ii) { 296 $size /= $multiplier; 297 297 $i++; 298 298 }
Note: See TracChangeset
for help on using the changeset viewer.