autoload.php 2.6 KB

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