dolibarr 21.0.0-alpha
autoloader.php
1<?php
2/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
3 */
10spl_autoload_register(
15 static function ($class) {
16 if (preg_match('/^DebugBar/', $class)) {
17 $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
18 //var_dump($class.' - '.file_exists($file).' - '.$file);
19 if (file_exists($file)) {
20 require_once $file;
21 return true;
22 }
23 return false;
24 }
25 if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) {
26 $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
27 //var_dump($class.' - '.file_exists($file).' - '.$file);
28 if (file_exists($file)) {
29 require_once $file;
30 return true;
31 }
32 return false;
33 }
34 if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) {
35 $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class);
36 $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
37 if (file_exists($file)) {
38 require_once $file;
39 return true;
40 }
41 return false;
42 }
43 return true;
44 }
45);