v1.0-release

This commit is contained in:
Yuri
2025-11-18 23:16:28 +01:00
parent 271960206c
commit 0b15c1cbf7
6 changed files with 258 additions and 9 deletions
+11 -3
View File
@@ -23,6 +23,9 @@ class WHMCS_Pricing_API {
'cache_duration' => 3600,
'default_currency' => 'USD',
'show_decimals' => true,
'decimal_separator' => '.',
'hide_currency_symbol' => false,
'hide_billing_cycle' => false,
'debug_mode' => false
);
@@ -227,12 +230,16 @@ class WHMCS_Pricing_API {
private static function format_price($price, $currency, $format) {
$settings = self::get_settings();
// Get decimal separator from settings (default to '.')
$decimal_sep = isset($settings['decimal_separator']) ? $settings['decimal_separator'] : '.';
$thousands_sep = ($decimal_sep === '.') ? ',' : '.';
// Apply decimal formatting
if ($format === 'no_decimals' || !$settings['show_decimals']) {
$price = round($price);
$formatted_price = number_format($price, 0);
$formatted_price = number_format($price, 0, $decimal_sep, $thousands_sep);
} else {
$formatted_price = number_format($price, 2);
$formatted_price = number_format($price, 2, $decimal_sep, $thousands_sep);
}
// Get currency symbol
@@ -271,7 +278,8 @@ class WHMCS_Pricing_API {
'SGD' => 'S$',
'NZD' => 'NZ$',
'MXN' => 'Mex$',
'ZAR' => 'R'
'ZAR' => 'R',
'ARS' => '$'
);
return isset($symbols[$currency]) ? $symbols[$currency] : $currency;