# fluent-booking/1.5.21/boot/globals.php

Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution, version 1.5.21. 71 lines.

- Page: https://pluginprobe.com/plugins/fluent-booking/1.5.21/code/boot/globals.php
- Raw: https://pluginprobe.com/plugins/fluent-booking/1.5.21/raw/boot/globals.php
- Modified: 2024-07-16T14:25:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-booking/1.5.21/code/boot/globals.php#L10-L20`.

```php
<?php

/**
 ***** DO NOT CALL ANY FUNCTIONS DIRECTLY FROM THIS FILE ******
 *
 * This file will be loaded even before the framework is loaded
 * so the $app is not available here, only declare functions here.
 */

defined( 'ABSPATH' ) || exit;

if ($app->config->get('app.env') == 'dev') {

    $globalsDevFile = __DIR__ . '/globals_dev.php';
    
    is_readable($globalsDevFile) && include $globalsDevFile;
}

if (!function_exists('dd')) {
    function dd()
    {
        foreach (func_get_args() as $arg) {
            echo "<pre>";
            print_r($arg);
            echo "</pre>";
        }
        die();
    }
}

function fluentbookingFormattedAmount($amountInCents, $currencySettings)
{
    $default = [
        'currency_sign' => '',
        'currency_position' => 'left',
        'decimal_separator' => '.',
        'thousand_separator' => ',',
        'currency_separator' => 'dot_comma',
        'decimal_points' => 2,
    ];

    $currencySettings = array_merge($default, $currencySettings);

    $position =  $currencySettings['currency_position'];
    $symbol = $currencySettings['currency_sign'];
    $decimalPoints = $currencySettings['decimal_points'];
    $decmalSeparator = $currencySettings['decimal_separator'];
    $thousandSeparator = $currencySettings['thousand_separator'];

    if ($currencySettings['currency_separator'] != 'dot_comma') {
        $decmalSeparator = ',';
        $thousandSeparator = '.';
    }
    if ($amountInCents % 100 == 0 && $currencySettings['decimal_points'] == 0) {
        $decimalPoints = 0;
    }

    $amount = number_format($amountInCents / 100, $decimalPoints, $decmalSeparator, $thousandSeparator);

    if ('left' === $position) {
        return $symbol . $amount;
    } elseif ('left_space' === $position) {
        return $symbol . ' ' . $amount;
    } elseif ('right' === $position) {
        return $amount . $symbol;
    } elseif ('right_space' === $position) {
        return $amount . ' ' . $symbol;
    }
    return $amount;
}

```
