mirror of
https://gitlab.com/ArkHost/WP-WHMCS-Pricing.git
synced 2026-09-19 17:37:31 +02:00
v1.0-release
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user