Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/utility/formatters/formatter.php
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | |||||
$format = trim(str_replace('fck_ready', '', $format), ';'); | $format = trim(str_replace('fck_ready', '', $format), ';'); | ||||
} | } | ||||
} | } | ||||
if (isset($format) && $format) { | if (isset($format) && $format) { | ||||
$value = sprintf($format, $value); | $value = sprintf($format, $value); | ||||
if ( isset($options['cut_zeros']) && $options['cut_zeros'] ) { | if ( isset($options['cut_zeros']) && $options['cut_zeros'] ) { | ||||
// converts 5.00 to 5, but doesn't change 5.340 or 5.34 | // Remove trailing zeros in decimal part (including "." if any left at the end). | ||||
$value = preg_replace('/\.[0]+$/', '', $value); | $value = rtrim(preg_replace('/\.([1-9]*)[0]+$/', '.$1', $value), '.'); | ||||
} | } | ||||
} | } | ||||
if (preg_match('#int|integer|double|float|real|numeric#', $options['type'])) { | if (preg_match('#int|integer|double|float|real|numeric#', $options['type'])) { | ||||
$lang = $this->Application->recallObject('lang.current'); | $lang = $this->Application->recallObject('lang.current'); | ||||
/* @var $lang LanguagesItem */ | /* @var $lang LanguagesItem */ | ||||
return $lang->formatNumber($value); | return $lang->formatNumber($value); | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |