From bdda3d24a0181f9fcef49a5e426420cc29da3747 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Sat, 15 Apr 2023 22:18:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=20=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=B3=D0=BB=D1=83=D0=B1=D0=BE=D0=BA=D0=B8=D1=85=20?= =?UTF-8?q?=D0=B2=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF?= =?UTF-8?q?=D0=B0=D0=BF=D0=BE=D0=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/autoload.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/_incl_data/autoload.php b/_incl_data/autoload.php index d5f54a2b..55f7e9ac 100644 --- a/_incl_data/autoload.php +++ b/_incl_data/autoload.php @@ -9,11 +9,12 @@ require_once 'mysql_override.php'; require_once 'class/Insallah/Config.php'; spl_autoload_register(function (string $className) { + $rootdir = getcwd() . '/_incl_data'; # 1 with namespaces # 2 without $fileName = [ - __DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), - __DIR__ . '/class/' . $className . '.php' + $rootdir . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), + $rootdir . '/class/' . $className . '.php' ]; foreach ($fileName as $file) { if (file_exists($file)) { @@ -24,10 +25,11 @@ spl_autoload_register(function (string $className) { }); spl_autoload_register(function (string $classname) { + $rootdir = getcwd() . '/_incl_data'; $classMap = [ - 'NewCombats' => __DIR__ . '/class/', - 'Insallah' => __DIR__ . '/class/Insallah/', - 'DarksLight2' => __DIR__ . '/class/DarksLight2/', + 'NewCombats' => $rootdir . '/class/', + 'Insallah' => $rootdir . '/class/Insallah/', + 'DarksLight2' => $rootdir . '/class/DarksLight2/', ]; $parts = explode('\\', $classname); $namespace = array_shift($parts);