added autoloading, configurable paste size limit, changed JS to calculate localized comment times instead of UTC

This commit is contained in:
Simon Rupf 2012-04-30 22:58:08 +02:00
parent 5d6401b44d
commit edf95ff56d
14 changed files with 207 additions and 91 deletions

View file

@ -31,4 +31,23 @@ class filter
array_map('filter::stripslashes_deep', $value) :
stripslashes($value);
}
/**
* format a given number of bytes
*
* @access public
* @static
* @param int $size
* @return string
*/
public static function size_humanreadable($size)
{
$i = 0;
$iec = array('B', 'kiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
while ( ( $size / 1024 ) > 1 ) {
$size = $size / 1024;
$i++;
}
return number_format($size, 2, ".", " ") . ' ' . $iec[$i];
}
}