|
Revision 23810, 1.0 kB
(checked in by Kris.Wallsmith, 4 years ago)
|
[1.3] set svn:eol-style property to native and svn:keywords property to Id on all .php files
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
function format_number($number, $culture = null) |
|---|
| 21 |
{ |
|---|
| 22 |
if (null === $number) |
|---|
| 23 |
{ |
|---|
| 24 |
return null; |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
$numberFormat = new sfNumberFormat(_current_language($culture)); |
|---|
| 28 |
|
|---|
| 29 |
return $numberFormat->format($number); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
function format_currency($amount, $currency = null, $culture = null) |
|---|
| 33 |
{ |
|---|
| 34 |
if (null === $amount) |
|---|
| 35 |
{ |
|---|
| 36 |
return null; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
$numberFormat = new sfNumberFormat(_current_language($culture)); |
|---|
| 40 |
|
|---|
| 41 |
return $numberFormat->format($amount, 'c', $currency); |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
function _current_language($culture) |
|---|
| 45 |
{ |
|---|
| 46 |
return $culture ? $culture : sfContext::getInstance()->getUser()->getCulture(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|