Loader.php 589 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Class Minify_Loader
  4. * @package Minify
  5. */
  6. /**
  7. * Class autoloader
  8. *
  9. * @package Minify
  10. * @author Stephen Clay <steve@mrclay.org>
  11. */
  12. class Minify_Loader {
  13. public function loadClass($class)
  14. {
  15. $file = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
  16. $file .= strtr($class, "\\_", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR) . '.php';
  17. if (is_readable($file)) {
  18. require $file;
  19. }
  20. }
  21. static public function register()
  22. {
  23. $inst = new self();
  24. spl_autoload_register(array($inst, 'loadClass'));
  25. }
  26. }