mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-07 22:54:43 -04:00
Formatage nombres
Implémente https://github.com/marienfressinaud/FreshRSS/issues/395
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<div class="form-group">
|
||||
<p class="group-name"><?php echo Minz_Translate::t('current_user'); ?></p>
|
||||
<div class="group-controls">
|
||||
<p><?php echo $this->nb_total, ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?></p>
|
||||
<p><?php echo formatNumber($this->nb_total), ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?></p>
|
||||
<input type="hidden" name="optimiseDatabase" value="1" />
|
||||
<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('optimize_bdd'); ?></button>
|
||||
<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('optimize_todo_sometimes'); ?>
|
||||
|
||||
@@ -62,6 +62,11 @@ function small_hash ($txt) {
|
||||
return strtr ($t, '+/', '-_');
|
||||
}
|
||||
|
||||
function formatNumber($n, $precision = 0) {
|
||||
return str_replace(' ', ' ', //Espace fine insécable
|
||||
number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible
|
||||
}
|
||||
|
||||
function formatBytes($bytes, $precision = 2, $system = 'IEC') {
|
||||
if ($system === 'IEC') {
|
||||
$base = 1024;
|
||||
@@ -74,7 +79,7 @@ function formatBytes($bytes, $precision = 2, $system = 'IEC') {
|
||||
$pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base));
|
||||
$pow = min($pow, count($units) - 1);
|
||||
$bytes /= pow($base, $pow);
|
||||
return round($bytes, $precision) . ' ' . $units[$pow];
|
||||
return formatNumber($bytes, $precision) . ' ' . $units[$pow];
|
||||
}
|
||||
|
||||
function timestamptodate ($t, $hour = true) {
|
||||
|
||||
Reference in New Issue
Block a user