start.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | PHP Display Errors Configuration
  5. |--------------------------------------------------------------------------
  6. |
  7. | Since Laravel intercepts and displays all errors with a detailed stack
  8. | trace, we can turn off the display_errors ini directive. However, you
  9. | may want to enable this option if you ever run into a dreaded white
  10. | screen of death, as it can provide some clues.
  11. |
  12. */
  13. ini_set('display_errors', 'On');
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Laravel Configuration Loader
  17. |--------------------------------------------------------------------------
  18. |
  19. | The Laravel configuration loader is responsible for returning an array
  20. | of configuration options for a given bundle and file. By default, we
  21. | use the files provided with Laravel; however, you are free to use
  22. | your own storage mechanism for configuration arrays.
  23. |
  24. */
  25. Laravel\Event::listen(Laravel\Config::loader, function($bundle, $file)
  26. {
  27. return Laravel\Config::file($bundle, $file);
  28. });
  29. /*
  30. |--------------------------------------------------------------------------
  31. | Register Class Aliases
  32. |--------------------------------------------------------------------------
  33. |
  34. | Aliases allow you to use classes without always specifying their fully
  35. | namespaced path. This is convenient for working with any library that
  36. | makes a heavy use of namespace for class organization. Here we will
  37. | simply register the configured class aliases.
  38. |
  39. */
  40. $aliases = Laravel\Config::get('application.aliases');
  41. Laravel\Autoloader::$aliases = $aliases;
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Laravel View Loader
  45. |--------------------------------------------------------------------------
  46. |
  47. | The Laravel view loader is responsible for returning the full file path
  48. | for the given bundle and view. Of course, a default implementation is
  49. | provided to load views according to typical Laravel conventions but
  50. | you may change this to customize how your views are organized.
  51. |
  52. */
  53. Event::listen(View::loader, function($bundle, $view)
  54. {
  55. return View::file($bundle, $view);
  56. });
  57. /*
  58. |--------------------------------------------------------------------------
  59. | Laravel Language Loader
  60. |--------------------------------------------------------------------------
  61. |
  62. | The Laravel language loader is responsible for returning the array of
  63. | language lines for a given bundle, language, and "file". A default
  64. | implementation has been provided which uses the default language
  65. | directories included with Laravel.
  66. |
  67. */
  68. Event::listen(Lang::loader, function($bundle, $language, $file)
  69. {
  70. return Lang::file($bundle, $language, $file);
  71. });
  72. /*
  73. |--------------------------------------------------------------------------
  74. | Set The Default Timezone
  75. |--------------------------------------------------------------------------
  76. |
  77. | We need to set the default timezone for the application. This controls
  78. | the timezone that will be used by any of the date methods and classes
  79. | utilized by Laravel or your application. The timezone may be set in
  80. | your application configuration file.
  81. |
  82. */
  83. date_default_timezone_set(Config::get('application.timezone'));
  84. /*
  85. |--------------------------------------------------------------------------
  86. | Start / Load The User Session
  87. |--------------------------------------------------------------------------
  88. |
  89. | Sessions allow the web, which is stateless, to simulate state. In other
  90. | words, sessions allow you to store information about the current user
  91. | and state of your application. Here we'll just fire up the session
  92. | if a session driver has been configured.
  93. |
  94. */
  95. if ( ! Request::cli() and Config::get('session.driver') !== '')
  96. {
  97. Session::load();
  98. }
  99. /*
  100. |--------------------------------------------------------------------------
  101. | Auto-Loader Mappings
  102. |--------------------------------------------------------------------------
  103. |
  104. | Registering a mapping couldn't be easier. Just pass an array of class
  105. | to path maps into the "map" function of Autoloader. Then, when you
  106. | want to use that class, just use it. It's simple!
  107. |
  108. */
  109. Autoloader::map(array(
  110. 'Base_Controller' => path('app').'controllers/base.php',
  111. ));
  112. /*
  113. |--------------------------------------------------------------------------
  114. | Auto-Loader Directories
  115. |--------------------------------------------------------------------------
  116. |
  117. | The Laravel auto-loader can search directories for files using the PSR-0
  118. | naming convention. This convention basically organizes classes by using
  119. | the class namespace to indicate the directory structure.
  120. |
  121. */
  122. Autoloader::directories(array(
  123. path('app').'models',
  124. path('app').'libraries',
  125. ));