2016-07-28 22:47:47 +02:00
|
|
|
<?php
|
|
|
|
|
2020-04-22 21:55:53 +02:00
|
|
|
function loadApp()
|
|
|
|
{
|
2016-11-17 17:02:12 +01:00
|
|
|
// Loaded as a dependency
|
|
|
|
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
|
|
|
return require_once __DIR__ . '/../../../autoload.php';
|
|
|
|
}
|
2016-07-29 08:55:08 +02:00
|
|
|
|
2016-11-17 17:02:12 +01:00
|
|
|
// Loaded in the project itself
|
|
|
|
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
|
|
|
return require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
}
|
2020-04-22 22:24:52 +02:00
|
|
|
|
2017-10-18 21:15:35 +02:00
|
|
|
throw new Exception('Impossible to load Daux, missing vendor/');
|
2016-07-28 22:47:47 +02:00
|
|
|
}
|
|
|
|
|
2016-11-17 17:02:12 +01:00
|
|
|
$loader = loadApp();
|
|
|
|
|
2019-12-05 21:25:58 +01:00
|
|
|
// This will define the path at which to
|
|
|
|
// find the daux processor extensions
|
2016-11-17 17:02:12 +01:00
|
|
|
if ($loader) {
|
|
|
|
$ext = __DIR__ . '/../daux';
|
2020-04-22 22:24:52 +02:00
|
|
|
if (is_dir(getcwd() . '/daux')) {
|
|
|
|
$ext = getcwd() . '/daux';
|
2016-11-17 17:02:12 +01:00
|
|
|
}
|
2020-04-22 22:24:52 +02:00
|
|
|
|
2016-11-17 17:02:12 +01:00
|
|
|
$env = getenv('DAUX_EXTENSION');
|
|
|
|
if ($env && is_dir($env)) {
|
|
|
|
$ext = $env;
|
|
|
|
}
|
2020-04-22 22:24:52 +02:00
|
|
|
|
2016-11-17 17:02:12 +01:00
|
|
|
define('DAUX_EXTENSION', $ext);
|
|
|
|
|
2020-04-22 22:24:52 +02:00
|
|
|
$loader->setPsr4('Todaymade\\Daux\\Extension\\', $ext);
|
2016-11-17 17:02:12 +01:00
|
|
|
}
|