bootstrap.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Assetic package, an OpenSky project.
  4. *
  5. * (c) 2010-2011 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. {
  12. if (0 === strpos($class, 'Assetic\\Test\\')) {
  13. $file = __DIR__ . '/../tests/' . str_replace('\\', '/', $class) . '.php';
  14. if (file_exists($file)) {
  15. require_once $file;
  16. return true;
  17. }
  18. } elseif (0 === strpos($class, 'Assetic\\')) {
  19. $file = __DIR__ . '/../src/' . str_replace('\\', '/', $class) . '.php';
  20. if (file_exists($file)) {
  21. require_once $file;
  22. return true;
  23. }
  24. } elseif (isset($_SERVER['TWIG_LIB']) && 0 === strpos($class, 'Twig_')) {
  25. $file = $_SERVER['TWIG_LIB'] . '/' . str_replace('_', '/', $class) . '.php';
  26. if (file_exists($file)) {
  27. require_once $file;
  28. return true;
  29. }
  30. }
  31. });
  32. if (isset($_SERVER['LESSPHP'])) {
  33. require_once $_SERVER['LESSPHP'];
  34. }
  35. if (isset($_SERVER['CSSMIN'])) {
  36. require_once $_SERVER['CSSMIN'];
  37. }
  38. if (isset($_SERVER['PACKAGER'])) {
  39. require_once $_SERVER['PACKAGER'];
  40. }