core.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php namespace Laravel;
  2. /**
  3. * Define all of the constants that we will need to use the framework.
  4. * These are things like file extensions, as well as all of the paths
  5. * used by the framework. All of the paths are built on top of the
  6. * basic application, laravel, and public paths.
  7. */
  8. define('EXT', '.php');
  9. define('CRLF', "\r\n");
  10. define('BLADE_EXT', '.blade.php');
  11. define('DEFAULT_BUNDLE', 'application');
  12. define('MB_STRING', (int) function_exists('mb_get_info'));
  13. /**
  14. * Require all of the classes that can't be loaded by the auto-loader.
  15. * These are typically classes that the auto-loader relies upon to
  16. * load classes, such as the array and configuration classes.
  17. */
  18. require $GLOBALS['SYS_PATH'].'bundle'.EXT;
  19. require $GLOBALS['SYS_PATH'].'config'.EXT;
  20. require $GLOBALS['SYS_PATH'].'helpers'.EXT;
  21. require $GLOBALS['SYS_PATH'].'autoloader'.EXT;
  22. /**
  23. * Register the Autoloader's "load" method on the auto-loader stack.
  24. * This method provides the lazy-loading of all class files, as well
  25. * as any PSR-0 compliant libraries used by the application.
  26. */
  27. spl_autoload_register(array('Laravel\\Autoloader', 'load'));
  28. /**
  29. * Register all of the core class aliases. These aliases provide a
  30. * convenient way of working with the Laravel core classes without
  31. * having to worry about the namespacing. The developer is also
  32. * free to remove aliases when they extend core classes.
  33. */
  34. Autoloader::$aliases = Config::get('application.aliases');
  35. /**
  36. * Register all of the bundles that are defined in the bundle info
  37. * file within the bundles directory. This informs the framework
  38. * where the bundle lives and which URIs it responds to.
  39. */
  40. $bundles = require $GLOBALS['BUNDLE_PATH'].'bundles'.EXT;
  41. foreach ($bundles as $bundle => $value)
  42. {
  43. if (is_numeric($bundle)) $bundle = $value;
  44. Bundle::register($bundle, $value);
  45. }