PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.7.2
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.7.2
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
fluent-booking / boot / globals.php

globals.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.7.2, at boot/globals.php

71 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 ***** DO NOT CALL ANY FUNCTIONS DIRECTLY FROM THIS FILE ******
5 *
6 * This file will be loaded even before the framework is loaded
7 * so the $app is not available here, only declare functions here.
8 */
9
10 defined( 'ABSPATH' ) || exit;
11
12 if ($app->config->get('app.env') == 'dev') {
13
14 $globalsDevFile = __DIR__ . '/globals_dev.php';
15
16 is_readable($globalsDevFile) && include $globalsDevFile;
17 }
18
19 if (!function_exists('dd')) {
20 function dd()
21 {
22 foreach (func_get_args() as $arg) {
23 echo "<pre>";
24 print_r($arg);
25 echo "</pre>";
26 }
27 die();
28 }
29 }
30
31 function fluentbookingFormattedAmount($amountInCents, $currencySettings)
32 {
33 $default = [
34 'currency_sign' => '',
35 'currency_position' => 'left',
36 'decimal_separator' => '.',
37 'thousand_separator' => ',',
38 'currency_separator' => 'dot_comma',
39 'decimal_points' => 2,
40 ];
41
42 $currencySettings = array_merge($default, $currencySettings);
43
44 $position = $currencySettings['currency_position'];
45 $symbol = $currencySettings['currency_sign'];
46 $decimalPoints = $currencySettings['decimal_points'];
47 $decmalSeparator = $currencySettings['decimal_separator'];
48 $thousandSeparator = $currencySettings['thousand_separator'];
49
50 if ($currencySettings['currency_separator'] != 'dot_comma') {
51 $decmalSeparator = ',';
52 $thousandSeparator = '.';
53 }
54 if ($amountInCents % 100 == 0 && $currencySettings['decimal_points'] == 0) {
55 $decimalPoints = 0;
56 }
57
58 $amount = number_format($amountInCents / 100, $decimalPoints, $decmalSeparator, $thousandSeparator);
59
60 if ('left' === $position) {
61 return $symbol . $amount;
62 } elseif ('left_space' === $position) {
63 return $symbol . ' ' . $amount;
64 } elseif ('right' === $position) {
65 return $amount . $symbol;
66 } elseif ('right_space' === $position) {
67 return $amount . ' ' . $symbol;
68 }
69 return $amount;
70 }
71