PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | app/Services/CurrenciesHelper.php +38 -2 1.5.21trunk View file →
@@ -5,17 +5,52 @@
5 5 use FluentBooking\Framework\Support\Arr;
6 6
7 7 class CurrenciesHelper
8 8 {
9 + private static $globalCurrencySettings = null;
10 +
11 + public static function getDefaultCurrencySettings()
12 + {
13 + return apply_filters('fluent_booking/default_currency_settings', [
14 + 'currency' => 'USD',
15 + 'is_active' => 'no',
16 + 'currency_sign' => '$',
17 + 'currency_position' => 'left', // left, right, left_space, right_space
18 + 'number_format' => 'comma_separated', // or dot_separated
19 + 'decimal_points' => 2
20 + ]);
21 + }
22 +
23 + public static function getGlobalCurrencySettings($force = false)
24 + {
25 + if (!$force && self::$globalCurrencySettings !== null) {
26 + return self::$globalCurrencySettings;
27 + }
28 +
29 + $defaultSettings = self::getDefaultCurrencySettings();
30 +
31 + $globalSettings = Helper::getGlobalPaymentSettings();
32 +
33 + $currencySettings = wp_parse_args($globalSettings, $defaultSettings);
34 +
35 + $currencySettings['currency_sign'] = self::getCurrencySign($currencySettings['currency']);
36 +
37 + self::$globalCurrencySettings = apply_filters('fluent_booking/global_currency_settings', $currencySettings);
38 +
39 + return self::$globalCurrencySettings;
40 + }
41 +
9 42 public static function getGlobalCurrency()
10 43 {
11 - $globalPaymentSettings = get_option('fluent_booking_global_payment_settings', ['currency' => 'USD']);
12 - return Arr::get($globalPaymentSettings, 'currency', 'USD');
44 + $globalCurrencySettings = self::getGlobalCurrencySettings();
45 +
46 + return Arr::get($globalCurrencySettings, 'currency', 'USD');
13 47 }
14 48
15 49 public static function getGlobalCurrencySign()
16 50 {
17 51 $currency = static::getGlobalCurrency();
52 +
18 53 return static::getCurrencySign($currency);
19 54 }
20 55
21 56 public static function getFormattedCurrencies()
@@ -342,8 +377,9 @@
342 377 'SOS' => 'Sh',
343 378 'SRD' => '$',
344 379 'SSP' => '£',
345 380 'STD' => 'Db',
381 + 'SVC' => '₡',
346 382 'SYP' => 'ل.س',
347 383 'SZL' => 'L',
348 384 'THB' => '฿',
349 385 'TJS' => 'ЅМ',