diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-10-20 22:49:22 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-10-20 22:49:22 +0200 |
| commit | c14da77997880189e6f4b7012d40dec227b9b225 (patch) | |
| tree | 114dbe1f13d51dcdae2bc9e0e4f69a71178adb31 /htdocs/includes/utils.php | |
| parent | d439d65db1c4f56aa5bafa5df6b595855501fcb9 (diff) | |
chore: add php template and includes (config, i18n and utils)
Diffstat (limited to 'htdocs/includes/utils.php')
| -rw-r--r-- | htdocs/includes/utils.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/htdocs/includes/utils.php b/htdocs/includes/utils.php new file mode 100644 index 0000000..8b661d7 --- /dev/null +++ b/htdocs/includes/utils.php @@ -0,0 +1,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 ''; + } +} |
