From 60ac124ea921dbc021c12a7e33a3c40d3c800913 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Fri, 26 Apr 2024 15:47:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D0=B2?= =?UTF-8?q?=D0=BD=D1=83=D1=82=D1=80=D0=B8=20vendor=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D1=82=D1=8F=D0=B3=D0=B8=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=B2=D0=BD=D1=83=D1=82=D1=80=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B8=20src.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/autoload.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_incl_data/autoload.php b/_incl_data/autoload.php index 865c3f24..a4e480d5 100644 --- a/_incl_data/autoload.php +++ b/_incl_data/autoload.php @@ -10,13 +10,18 @@ require_once 'mysql_override.php'; spl_autoload_register(function (string $className) { $rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data' . DIRECTORY_SEPARATOR; + $addsrc = function ($class) { + $c = explode('\\', $class); + array_splice($c, 1, 0, 'src'); + return implode(DIRECTORY_SEPARATOR, $c); + }; # 1 with namespaces # 2 without $fileName = [ $rootdir . 'class' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), $rootdir . 'class' . DIRECTORY_SEPARATOR . $className . '.php', $rootdir . 'function' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), - $rootdir . 'vendor' . DIRECTORY_SEPARATOR . $className . '.php', + $rootdir . 'vendor' . DIRECTORY_SEPARATOR . $addsrc($className) . '.php', ]; foreach ($fileName as $file) { if (file_exists($file)) {