Pluf Framework

Pluf Framework Commit Details


Date:2009-07-09 09:58:58 (15 years 5 months ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:32cde71cd010739aef3e5ddff01efb5ec5501dfc
Parents: bb66724b9b2fb9bfce7f93f49a1584b8db67a5e5
Message:Correctly use SI units and added the GB.

Changes:

File differences

src/Pluf/Utils.php
8686
8787
8888
89
89
9090
9191
92
92
9393
9494
95
95
9696
9797
98
99
100
101
98
99
100
101
102
103
102104
103105
104106
{
switch (strtolower(substr($size, -1))) {
case 'k':
$size = substr($size, 0, -1) * 1024;
$size = substr($size, 0, -1) * 1000;
break;
case 'm':
$size = substr($size, 0, -1) * 1024*1024;
$size = substr($size, 0, -1) * 1000*1000;
break;
case 'g':
$size = substr($size, 0, -1) * 1024*1024*1024;
$size = substr($size, 0, -1) * 1000*1000*1000;
break;
}
if ($size > (1024*1024)) {
$mysize = sprintf('%01.2f', $size/(1024*1024)).' '. __('MB');
} elseif ($size >= 1024) {
$mysize = sprintf('%01.2f', $size/1024).' '.__('kB');
if ($size > (1000*1000*1000)) {
$mysize = sprintf('%01.2f', $size/(1000*1000*1000)).' '. __('GB');
} elseif ($size > (1000*1000)) {
$mysize = sprintf('%01.2f', $size/(1000*1000)).' '. __('MB');
} elseif ($size >= 1000) {
$mysize = sprintf('%01.2f', $size/1000).' '.__('kB');
} else {
$mysize = sprintf('%d', $size).' '.__('bytes');
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.05655s using 13 queries.