paths.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Laravel - A PHP Framework For Web Artisans
  4. *
  5. * @package Laravel
  6. * @version 3.0.0
  7. * @author Taylor Otwell <taylorotwell@gmail.com>
  8. * @link http://laravel.com
  9. */
  10. // --------------------------------------------------------------
  11. // Initialize the web variable if it doesn't exist.
  12. // --------------------------------------------------------------
  13. if ( ! isset($web)) $web = false;
  14. // --------------------------------------------------------------
  15. // Define the directory separator for the environment.
  16. // --------------------------------------------------------------
  17. if ( ! defined('DS'))
  18. {
  19. define('DS', DIRECTORY_SEPARATOR);
  20. }
  21. // --------------------------------------------------------------
  22. // Define the path to the base directory.
  23. // --------------------------------------------------------------
  24. $GLOBALS['laravel_paths']['base'] = __DIR__.DS;
  25. // --------------------------------------------------------------
  26. // The path to the application directory.
  27. // --------------------------------------------------------------
  28. $paths['app'] = 'application';
  29. // --------------------------------------------------------------
  30. // The path to the Laravel directory.
  31. // --------------------------------------------------------------
  32. $paths['sys'] = 'laravel';
  33. // --------------------------------------------------------------
  34. // The path to the bundles directory.
  35. // --------------------------------------------------------------
  36. $paths['bundle'] = 'bundles';
  37. // --------------------------------------------------------------
  38. // The path to the storage directory.
  39. // --------------------------------------------------------------
  40. $paths['storage'] = 'storage';
  41. // --------------------------------------------------------------
  42. // The path to the public directory.
  43. // --------------------------------------------------------------
  44. if ($web)
  45. {
  46. $GLOBALS['laravel_paths']['public'] = realpath('').DS;
  47. }
  48. else
  49. {
  50. $paths['public'] = 'public';
  51. }
  52. // --------------------------------------------------------------
  53. // Define each constant if it hasn't been defined.
  54. // --------------------------------------------------------------
  55. foreach ($paths as $name => $path)
  56. {
  57. if ($web) $path = "../{$path}";
  58. $GLOBALS['laravel_paths'][$name] = realpath($path).DS;
  59. }
  60. // --------------------------------------------------------------
  61. // Define a global path helper function.
  62. // --------------------------------------------------------------
  63. function path($path)
  64. {
  65. return $GLOBALS['laravel_paths'][$path];
  66. }
  67. // --------------------------------------------------------------
  68. // Define a global path setter function.
  69. // --------------------------------------------------------------
  70. function set_path($path, $value)
  71. {
  72. $GLOBALS['laravel_paths'][$path] = $value;
  73. }