58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
$baseDir = _PS_MODULE_DIR_ . 'x13gpsr/';
|
|
|
|
if (!defined('X13_GPSR_DIR')) {
|
|
define('X13_GPSR_DIR', $baseDir);
|
|
define('X13_GPSR_RESOURCES_DIR', X13_GPSR_DIR . 'src/Resources/');
|
|
define('X13_GPSR_CACHE_DIR', X13_GPSR_RESOURCES_DIR . 'cache/');
|
|
define('X13_GPSR_LOG_DIR', X13_GPSR_RESOURCES_DIR . 'log/');
|
|
define('X13_GPSR_TOOLS_DIR', X13_GPSR_DIR . 'tools/');
|
|
}
|
|
|
|
if (!defined('X13_GPSR_ION')) {
|
|
if (PHP_VERSION_ID >= 80100) {
|
|
$x13IonVer = '-81';
|
|
$x13IonFolder = 'php81';
|
|
} elseif (PHP_VERSION_ID >= 70100) {
|
|
$x13IonVer = '-71';
|
|
$x13IonFolder = 'php71';
|
|
} elseif (PHP_VERSION_ID >= 70000) {
|
|
$x13IonVer = '-7';
|
|
$x13IonFolder = 'php70';
|
|
} else {
|
|
$x13IonVer = '';
|
|
$x13IonFolder = 'php5';
|
|
}
|
|
|
|
$phpVersions = 'php5;php70;php71;php81';
|
|
|
|
if (file_exists(X13_GPSR_DIR . 'dev')) {
|
|
$x13IonVer = '';
|
|
$x13IonFolder = 'php5';
|
|
$phpVersions = 'php5';
|
|
}
|
|
|
|
define('X13_GPSR_ION_VERSIONS', $phpVersions);
|
|
define('X13_GPSR_ION', $x13IonFolder);
|
|
}
|
|
|
|
// Autoload classes
|
|
include_once X13_GPSR_TOOLS_DIR . 'Psr/Autoloader/GPSRPsr4Autoloader.php';
|
|
|
|
$loader = new GPSRPsr4Autoloader();
|
|
$loader->register();
|
|
$loader->addNamespace('x13gpsr', $baseDir . 'src/' . X13_GPSR_ION . '/');
|
|
|
|
|
|
// To prevent some errors with legacy classes we load them manually
|
|
$classesDir = X13_GPSR_DIR . 'classes/';
|
|
if (is_dir($classesDir)) {
|
|
$files = scandir($classesDir);
|
|
foreach ($files as $file) {
|
|
if (strpos($file, 'XGpsr') === 0 && substr($file, -4) === '.php') {
|
|
include_once $classesDir . $file;
|
|
}
|
|
}
|
|
}
|