You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
859 B

  1. <?php
  2. /**
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage Load
  7. * @since 2010-02-24
  8. * @version SVN: $Id$
  9. * @filesource $URL$
  10. */
  11. class Load
  12. {
  13. static protected $autoload;
  14. static public function autoload($class)
  15. {
  16. if (! isset(self::$autoload[$class])) {
  17. throw new MJException('There is no such class "' . $class . '" in autoload.');
  18. }
  19. require(PATH . self::$autoload[$class]);
  20. }
  21. static public function setAutoloadFrom($file)
  22. {
  23. if (! file_exists($file)) {
  24. throw new MJException('Autoload source doesn\'t exists! Try to generate it!');
  25. }
  26. self::$autoload = require($file);
  27. }
  28. static public function getFilePath($class)
  29. {
  30. return self::$autoload[$class];
  31. }
  32. }