aboutsummaryrefslogtreecommitdiffstats
path: root/htdocs/includes/utils.php
blob: 8b661d7d1490e6a8342f5e2f75984ca3cb4ada91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
 * Utilities for demo.armandphilippot.com
 *
 * @package   DemoArmandphilippotCom
 * @author    Armand Philippot <contact@armandphilippot.com>
 * @copyright 2021 Armand Philippot
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      https://demo.armandphilippot.com/
 * @since     1.0.0
 */

/**
 * Get current environment defined in .env file.
 *
 * @since 1.0.0
 *
 * @return string Current env or empty string.
 */
function dap_get_current_env()
{
    if (file_exists(__DIR__ . '/vendor/autoload.php')) {
        require_once __DIR__ . '/vendor/autoload.php';
        $dap_dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
        $dap_dotenv->safeLoad();
        $dap_current_env = $_ENV['WP_THEME_ENV'];
        return $dap_current_env;
    } else {
        return '';
    }
}