autoload.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. define('ELFINDER_PHP_ROOT_PATH', dirname(__FILE__));
  3. function elFinderAutoloader($name)
  4. {
  5. $map = array(
  6. 'elFinder' => 'elFinder.class.php',
  7. 'elFinderConnector' => 'elFinderConnector.class.php',
  8. 'elFinderEditor' => 'editors/editor.php',
  9. 'elFinderLibGdBmp' => 'libs/GdBmp.php',
  10. 'elFinderPlugin' => 'elFinderPlugin.php',
  11. 'elFinderPluginAutoResize' => 'plugins/AutoResize/plugin.php',
  12. 'elFinderPluginAutoRotate' => 'plugins/AutoRotate/plugin.php',
  13. 'elFinderPluginNormalizer' => 'plugins/Normalizer/plugin.php',
  14. 'elFinderPluginSanitizer' => 'plugins/Sanitizer/plugin.php',
  15. 'elFinderPluginWatermark' => 'plugins/Watermark/plugin.php',
  16. 'elFinderSession' => 'elFinderSession.php',
  17. 'elFinderSessionInterface' => 'elFinderSessionInterface.php',
  18. 'elFinderVolumeDriver' => 'elFinderVolumeDriver.class.php',
  19. 'elFinderVolumeDropbox2' => 'elFinderVolumeDropbox2.class.php',
  20. 'elFinderVolumeFTP' => 'elFinderVolumeFTP.class.php',
  21. 'elFinderVolumeFlysystemGoogleDriveCache' => 'elFinderFlysystemGoogleDriveNetmount.php',
  22. 'elFinderVolumeFlysystemGoogleDriveNetmount' => 'elFinderFlysystemGoogleDriveNetmount.php',
  23. 'elFinderVolumeGoogleDrive' => 'elFinderVolumeGoogleDrive.class.php',
  24. 'elFinderVolumeGroup' => 'elFinderVolumeGroup.class.php',
  25. 'elFinderVolumeLocalFileSystem' => 'elFinderVolumeLocalFileSystem.class.php',
  26. 'elFinderVolumeMySQL' => 'elFinderVolumeMySQL.class.php',
  27. 'elFinderVolumeTrash' => 'elFinderVolumeTrash.class.php',
  28. );
  29. if (isset($map[$name])) {
  30. return include_once(ELFINDER_PHP_ROOT_PATH . '/' . $map[$name]);
  31. }
  32. $prefix = substr($name, 0, 14);
  33. if (substr($prefix, 0, 8) === 'elFinder') {
  34. if ($prefix === 'elFinderVolume') {
  35. $file = ELFINDER_PHP_ROOT_PATH . '/' . $name . '.class.php';
  36. return (is_file($file) && include_once($file));
  37. } else if ($prefix === 'elFinderPlugin') {
  38. $file = ELFINDER_PHP_ROOT_PATH . '/plugins/' . substr($name, 14) . '/plugin.php';
  39. return (is_file($file) && include_once($file));
  40. } else if ($prefix === 'elFinderEditor') {
  41. $file = ELFINDER_PHP_ROOT_PATH . '/editors/' . substr($name, 14) . '/editor.php';
  42. return (is_file($file) && include_once($file));
  43. }
  44. }
  45. return false;
  46. }
  47. if (version_compare(PHP_VERSION, '5.3', '<')) {
  48. spl_autoload_register('elFinderAutoloader');
  49. } else {
  50. spl_autoload_register('elFinderAutoloader', true, true);
  51. }