moneyformat; } if (!$valueFormat) { $valueFormat = $config->moneyvalueformat; } if ($onlyNumber) { // money_format() exists only in certain PHP install (CRM-650) if (is_numeric($amount) and function_exists('money_format')) { $amount = money_format($valueFormat, $amount); } return $amount; } if (!self::$_currencySymbols) { self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('keyColumn' => 'name', 'labelColumn' => 'symbol')); } if (!$currency) { $currency = $config->defaultCurrency; } // money_format() exists only in certain PHP install (CRM-650) // setlocale() affects native gettext (CRM-11054, CRM-9976) if (is_numeric($amount) && function_exists('money_format')) { $lc = setlocale(LC_MONETARY, 0); setlocale(LC_MONETARY, 'en_US.utf8', 'en_US', 'en_US.utf8', 'en_US', 'C'); $amount = money_format($valueFormat, $amount); setlocale(LC_MONETARY, $lc); } $rep = array( ',' => $config->monetaryThousandSeparator, '.' => $config->monetaryDecimalPoint, ); // If it contains tags, means that HTML was passed and the // amount is already converted properly, // so don't mess with it again. if (strpos($amount, '<') === FALSE) { $amount = strtr($amount, $rep); } $replacements = array( '%a' => $amount, '%C' => $currency, '%c' => CRM_Utils_Array::value($currency, self::$_currencySymbols, $currency), ); return strtr($format, $replacements); } }