Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
7afa64f6
Commit
7afa64f6
authored
Dec 03, 2014
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added qa_format_number function to replace all number_format
parent
d3860445
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
format.php
qa-include/app/format.php
+18
-0
qa-lang-main.php
qa-include/lang/qa-lang-main.php
+2
-0
No files found.
qa-include/app/format.php
View file @
7afa64f6
...
...
@@ -2043,6 +2043,24 @@
);
}
/**
* Format a number using the decimal point and thousand separator specified in the language files
* @param integer $number Number to be formatted
* @param integer $decimals Amount of decimals to use
* @return string The formatted number as a string
*/
function
qa_format_number
(
$number
,
$decimals
=
0
)
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
return
number_format
(
$number
,
$decimals
,
qa_lang_html
(
'main/_decimal_point'
),
qa_lang_html
(
'main/_thousands_separator'
)
);
}
/*
Omit PHP closing tag to help avoid accidental output
...
...
qa-include/lang/qa-lang-main.php
View file @
7afa64f6
...
...
@@ -21,6 +21,8 @@
*/
return
array
(
'_decimal_point'
=>
'.'
,
'_thousands_separator'
=>
','
,
'1_answer'
=>
'1 answer'
,
'1_comment'
=>
'1 comment'
,
'1_day'
=>
'1 day'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment