bootstrap.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Assetic package, an OpenSky project.
  4. *
  5. * (c) 2010-2012 OpenSky Project Inc
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. spl_autoload_register(function($class) {
  11. if (0 === strpos($class, 'Assetic\\Test\\')) {
  12. $file = __DIR__ . '/../tests/' . str_replace('\\', '/', $class) . '.php';
  13. if (file_exists($file)) {
  14. require_once $file;
  15. return true;
  16. }
  17. } elseif (0 === strpos($class, 'Assetic\\')) {
  18. $file = __DIR__ . '/../src/' . str_replace('\\', '/', $class) . '.php';
  19. if (file_exists($file)) {
  20. require_once $file;
  21. return true;
  22. }
  23. } elseif (isset($_SERVER['TWIG_LIB']) && 0 === strpos($class, 'Twig_')) {
  24. $file = $_SERVER['TWIG_LIB'] . '/' . str_replace('_', '/', $class) . '.php';
  25. if (file_exists($file)) {
  26. require_once $file;
  27. return true;
  28. }
  29. }
  30. });
  31. if (isset($_SERVER['LESSPHP'])) {
  32. require_once $_SERVER['LESSPHP'];
  33. }
  34. if (isset($_SERVER['CSSMIN'])) {
  35. require_once $_SERVER['CSSMIN'];
  36. }
  37. if (isset($_SERVER['PACKAGER'])) {
  38. require_once $_SERVER['PACKAGER'];
  39. }