autoloader.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Simple autoloader, so we don't need Composer just for this.
  4. */
  5. spl_autoload_register(function ($class) {
  6. if (preg_match('/^DebugBar/', $class)) {
  7. $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
  8. //var_dump($class.' - '.file_exists($file).' - '.$file);
  9. if (file_exists($file)) {
  10. require_once $file;
  11. return true;
  12. }
  13. return false;
  14. }
  15. if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) {
  16. $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
  17. //var_dump($class.' - '.file_exists($file).' - '.$file);
  18. if (file_exists($file)) {
  19. require_once $file;
  20. return true;
  21. }
  22. return false;
  23. }
  24. if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) {
  25. $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class);
  26. $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
  27. if (file_exists($file)) {
  28. require_once $file;
  29. return true;
  30. }
  31. return false;
  32. }
  33. return true;
  34. });