paths.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * Laravel - A PHP Framework For Web Artisans
  4. *
  5. * @package Laravel
  6. * @version 3.1.7
  7. * @author Taylor Otwell <taylorotwell@gmail.com>
  8. * @link http://laravel.com
  9. */
  10. // --------------------------------------------------------------
  11. // Change to the current working directory.
  12. // --------------------------------------------------------------
  13. chdir(__DIR__);
  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. $paths['public'] = 'public';
  45. // --------------------------------------------------------------
  46. // Define each constant if it hasn't been defined.
  47. // --------------------------------------------------------------
  48. foreach ($paths as $name => $path)
  49. {
  50. if ( ! isset($GLOBALS['laravel_paths'][$name]))
  51. {
  52. $GLOBALS['laravel_paths'][$name] = realpath($path).DS;
  53. }
  54. }
  55. /**
  56. * A global path helper function.
  57. *
  58. * <code>
  59. * $storage = path('storage');
  60. * </code>
  61. *
  62. * @param string $path
  63. * @return string
  64. */
  65. function path($path)
  66. {
  67. return $GLOBALS['laravel_paths'][$path];
  68. }
  69. /**
  70. * A global path setter function.
  71. *
  72. * @param string $path
  73. * @param string $value
  74. * @return void
  75. */
  76. function set_path($path, $value)
  77. {
  78. $GLOBALS['laravel_paths'][$path] = $value;
  79. }