Autoloader.php 848 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * autoload library
  4. */
  5. PHPExcel_Autoloader::Register();
  6. class PHPExcel_Autoloader {
  7. /**
  8. * Register the Autoloader with SPL
  9. */
  10. public static function Register() {
  11. if (function_exists('__autoload')) {
  12. spl_autoload_register('__autoload');
  13. }
  14. return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
  15. }
  16. /**
  17. * Autoload a class identified by name
  18. * @param string $pClassName Name of the object to load
  19. */
  20. public static function Load($pClassName){
  21. if ((class_exists($pClassName, FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
  22. return FALSE;
  23. }
  24. $pClassFilePath = PHPEXCEL_ROOT . str_replace('_', DIRECTORY_SEPARATOR, $pClassName) . '.php';
  25. if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
  26. return FALSE;
  27. }
  28. require $pClassFilePath;
  29. }
  30. }