paths.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Laravel - A PHP Framework For Web Artisans
  4. *
  5. * @package Laravel
  6. * @version 3.0.4
  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. * A global path helper function.
  62. *
  63. * <code>
  64. * $storage = path('storage');
  65. * </code>
  66. *
  67. * @param string $path
  68. * @return string
  69. */
  70. function path($path)
  71. {
  72. return $GLOBALS['laravel_paths'][$path];
  73. }
  74. /**
  75. * A global path setter function.
  76. *
  77. * @param string $path
  78. * @param string $value
  79. * @return void
  80. */
  81. function set_path($path, $value)
  82. {
  83. $GLOBALS['laravel_paths'][$path] = $value;
  84. }