diff options
| author | 2014-10-30 19:31:32 +0100 | |
|---|---|---|
| committer | 2014-10-30 19:31:32 +0100 | |
| commit | 036240ab01999c8eff1b9b3a98a7313cf43f5836 (patch) | |
| tree | 10adb38f50ca5ad2c64c1bb4170c3b1a14f63c58 | |
| parent | ee5bbe48269a2fd5bc9c175fdb1e5a92a2c04502 (diff) | |
Fix coding style formatNumber and formatBytes
| -rw-r--r-- | app/views/configure/archiving.phtml | 4 | ||||
| -rw-r--r-- | app/views/stats/index.phtml | 20 | ||||
| -rw-r--r-- | app/views/user/manage.phtml | 4 | ||||
| -rw-r--r-- | lib/lib_rss.php | 14 |
4 files changed, 20 insertions, 22 deletions
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 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.phtml index 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.phtml index 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.php index 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) { |
