diff --git a/helpers/html.php b/helpers/html.php index f8df46d..146f8cd 100644 --- a/helpers/html.php +++ b/helpers/html.php @@ -99,3 +99,11 @@ return $date.' '.gmdate($time_format, $timestamp); } }); + +// +// A wrapper for PHP's number_format function +// +HTML::macro('number_format', function($number, $decimals = 0) +{ + return is_numeric($number) ? number_format($number, $decimals, __('fluxbb::common.lang_decimal_point'), __('fluxbb::common.lang_thousands_sep')) : $number; +}); diff --git a/language/en/common.php b/language/en/common.php index 355cfbf..5480951 100644 --- a/language/en/common.php +++ b/language/en/common.php @@ -2,6 +2,10 @@ return array( + // Number formatting + 'lang_decimal_point' => '.', + 'lang_thousands_sep' => ',', + 'index' => 'Index', 'user_list' => 'User list', 'rules' => 'Rules', diff --git a/views/index.blade.php b/views/index.blade.php index d2dd92c..0783318 100644 --- a/views/index.blade.php +++ b/views/index.blade.php @@ -42,7 +42,7 @@ ?> -
{{ number_format($forum_count) }}
+
{{ HTML::number_format($forum_count) }}
- {{ number_format($forum->num_topics()) }} - {{ number_format($forum->num_posts()) }} + {{ HTML::number_format($forum->num_topics()) }} + {{ HTML::number_format($forum->num_posts()) }} {{ $last_post }} @endforeach @@ -81,4 +81,4 @@
@endforeach -@endsection \ No newline at end of file +@endsection diff --git a/views/viewforum.blade.php b/views/viewforum.blade.php index 70efc98..b6e0a17 100644 --- a/views/viewforum.blade.php +++ b/views/viewforum.blade.php @@ -31,7 +31,7 @@ ?> -
{{ number_format($topic_count + $start_from) }}
+
{{ HTML::number_format($topic_count + $start_from) }}
{{ e($topic->subject) }} {{ __('fluxbb::common.by', array('author' => e($topic->poster))) }} @@ -54,4 +54,4 @@
-@endsection \ No newline at end of file +@endsection diff --git a/views/viewtopic.blade.php b/views/viewtopic.blade.php index f59f6f3..fbe6502 100644 --- a/views/viewtopic.blade.php +++ b/views/viewtopic.blade.php @@ -29,7 +29,7 @@
{{ __('fluxbb::topic.from', array('name' => e($post->poster->location))) }}
@endif
{{ __('fluxbb::topic.registered', array('time' => HTML::format_time($post->poster->registered, true))) }}
-
{{ __('fluxbb::topic.posts', array('count' => number_format($post->poster->num_posts))) }}
+
{{ __('fluxbb::topic.posts', array('count' => HTML::number_format($post->poster->num_posts))) }}
{{ __('fluxbb::topic.ip') }}
@if ($post->poster->has_admin_note())
{{ __('fluxbb::topic.note') }} {{ e($post->poster->admin_note) }}
@@ -87,4 +87,4 @@ @endforeach -@endsection \ No newline at end of file +@endsection