constants.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. define('EXT', '.php');
  3. define('BLADE_EXT', '.blade.php');
  4. function constants($constants)
  5. {
  6. foreach ($constants as $key => $value)
  7. {
  8. if ( ! defined($key)) define($key, $value);
  9. }
  10. }
  11. /**
  12. * Register the core framework paths and all of the paths that
  13. * derive from them. If any constant has already been defined,
  14. * we will not attempt to define it again.
  15. */
  16. $constants = array(
  17. 'APP_PATH' => realpath($application).'/',
  18. 'BASE_PATH' => realpath("$laravel/..").'/',
  19. 'PUBLIC_PATH' => realpath($public).'/',
  20. 'STORAGE_PATH' => realpath($storage).'/',
  21. 'SYS_PATH' => realpath($laravel).'/',
  22. );
  23. constants($constants);
  24. unset($application, $public, $storage, $laravel);
  25. $constants = array(
  26. 'CACHE_PATH' => STORAGE_PATH.'cache/',
  27. 'CONFIG_PATH' => APP_PATH.'config/',
  28. 'CONTROLLER_PATH' => APP_PATH.'controllers/',
  29. 'DATABASE_PATH' => STORAGE_PATH.'database/',
  30. 'LANG_PATH' => APP_PATH.'language/',
  31. 'LIBRARY_PATH' => APP_PATH.'libraries/',
  32. 'MODEL_PATH' => APP_PATH.'models/',
  33. 'ROUTE_PATH' => APP_PATH.'routes/',
  34. 'SESSION_PATH' => STORAGE_PATH.'sessions/',
  35. 'SYS_CONFIG_PATH' => SYS_PATH.'config/',
  36. 'SYS_VIEW_PATH' => SYS_PATH.'views/',
  37. 'VIEW_PATH' => APP_PATH.'views/',
  38. );
  39. constants($constants);
  40. /**
  41. * Register the core framework paths and all of the paths that
  42. * derive from them. If any constant has already been defined,
  43. * we will not attempt to define it again.
  44. */
  45. $environment = (isset($_SERVER['LARAVEL_ENV'])) ? CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/' : '';
  46. constants(array('ENV_CONFIG_PATH' => $environment));
  47. unset($constants, $environment);