mdl_settings->setting('currency_symbol'); $currency_symbol_placement = $CI->mdl_settings->setting('currency_symbol_placement'); $thousands_separator = $CI->mdl_settings->setting('thousands_separator'); $decimal_point = $CI->mdl_settings->setting('decimal_point'); if ($currency_symbol_placement == 'before') { return $currency_symbol . number_format($amount, ($decimal_point) ? 2 : 0, $decimal_point, $thousands_separator); } elseif ($currency_symbol_placement == 'afterspace') { return number_format($amount, ($decimal_point) ? 2 : 0, $decimal_point, $thousands_separator) . ' ' . $currency_symbol; } else { return number_format($amount, ($decimal_point) ? 2 : 0, $decimal_point, $thousands_separator) . $currency_symbol; } } /** * Output the amount as a currency amount, e.g. 1.234,56 * * @param null $amount * @return null|string */ function format_amount($amount = null) { if ($amount) { $CI =& get_instance(); $thousands_separator = $CI->mdl_settings->setting('thousands_separator'); $decimal_point = $CI->mdl_settings->setting('decimal_point'); return number_format($amount, ($decimal_point) ? 2 : 0, $decimal_point, $thousands_separator); } return null; } /** * Standardize an amount based on the system settings * * @param $amount * @return mixed */ function standardize_amount($amount) { $CI =& get_instance(); $thousands_separator = $CI->mdl_settings->setting('thousands_separator'); $decimal_point = $CI->mdl_settings->setting('decimal_point'); $amount = str_replace($thousands_separator, '', $amount); $amount = str_replace($decimal_point, '.', $amount); return $amount; }