A free, self-hostable news aggregator…
Fix coding style formatNumber and formatBytes
Marien Fressinaud036240ab0199
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtmlindex 410434599..7c2d79343 100644--- a/app/views/configure/archiving.phtml+++ b/app/views/configure/archiving.phtml@@ -60,7 +60,7 @@<div class="form-group"><label class="group-name"><?php echo _t('current_user'); ?></label><div class="group-controls">- <?php echo _t('conf.users.articles_and_size', formatNumber($this->nb_total), formatBytes($this->size_user)); ?>+ <?php echo _t('conf.users.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)); ?></div></div>@@ -68,7 +68,7 @@<div class="form-group"><label class="group-name"><?php echo _t('users'); ?></label><div class="group-controls">- <?php echo formatBytes($this->size_total); ?>+ <?php echo format_bytes($this->size_total); ?></div></div>diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtmlindex ba4258b71..c75810850 100644--- a/app/views/stats/index.phtml+++ b/app/views/stats/index.phtml@@ -18,23 +18,23 @@<tbody><tr><th><?php echo _t('status_total'); ?></th>- <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['total']); ?></td>- <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['total']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['total']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['total']); ?></td></tr><tr><th><?php echo _t('status_read'); ?></th>- <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['read']); ?></td>- <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['read']); ?></td>+ <td class="numeric"><?php echo FreshRSS_Context::$conf($this->repartition['main_stream']['read']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['read']); ?></td></tr><tr><th><?php echo _t('status_unread'); ?></th>- <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['unread']); ?></td>- <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['unread']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['unread']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['unread']); ?></td></tr><tr><th><?php echo _t('status_favorites'); ?></th>- <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['favorite']); ?></td>- <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['favorite']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['favorite']); ?></td>+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['favorite']); ?></td></tr></tbody></table>@@ -56,8 +56,8 @@<tr><td><a href="<?php echo _url('stats', 'repartition', 'id', $feed['id']); ?>"><?php echo $feed['name']; ?></a></td><td><?php echo $feed['category']; ?></td>- <td class="numeric"><?php echo formatNumber($feed['count']); ?></td>- <td class="numeric"><?php echo formatNumber($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1);?></td>+ <td class="numeric"><?php echo format_number($feed['count']); ?></td>+ <td class="numeric"><?php echo format_number($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1);?></td></tr><?php endforeach;?></tbody>diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtmlindex 2bfd633a2..e46e02572 100644--- a/app/views/user/manage.phtml+++ b/app/views/user/manage.phtml@@ -65,8 +65,8 @@</select><p><?php echo _t('admin.users.articles_and_size',- formatNumber($this->nb_articles),- formatBytes($this->size_user)); ?></p>+ format_number($this->nb_articles),+ format_bytes($this->size_user)); ?></p></div></div>diff --git a/lib/lib_rss.php b/lib/lib_rss.phpindex 3648a4582..317c6852f 100644--- a/lib/lib_rss.php+++ b/lib/lib_rss.php@@ -56,16 +56,14 @@ function checkUrl($url) {}}-function formatNumber($n, $precision = 0) {- return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable- number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible-}function format_number($n, $precision = 0) {- // TODO: coding style, prefer THIS function. Remove formatNumber.- return formatNumber($n, $precision);+ // number_format does not seem to be Unicode-compatible+ return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable+ number_format($n, $precision, '.', ' ')+ );}-function formatBytes($bytes, $precision = 2, $system = 'IEC') {+function format_bytes($bytes, $precision = 2, $system = 'IEC') {if ($system === 'IEC') {$base = 1024;$units = array('B', 'KiB', 'MiB', 'GiB', 'TiB');@@ -77,7 +75,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 formatNumber($bytes, $precision) . ' ' . $units[$pow];+ return format_number($bytes, $precision) . ' ' . $units[$pow];}function timestamptodate ($t, $hour = true) {