start.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. | Auto-Loader Mappings
  45. |--------------------------------------------------------------------------
  46. |
  47. | Registering a mapping couldn't be easier. Just pass an array of class
  48. | to path maps into the "map" function of Autoloader. Then, when you
  49. | want to use that class, just use it. It's simple!
  50. |
  51. */
  52. Autoloader::map(array(
  53. 'Base_Controller' => path('app').'controllers/base.php',
  54. ));
  55. /*
  56. |--------------------------------------------------------------------------
  57. | Auto-Loader Directories
  58. |--------------------------------------------------------------------------
  59. |
  60. | The Laravel auto-loader can search directories for files using the PSR-0
  61. | naming convention. This convention basically organizes classes by using
  62. | the class namespace to indicate the directory structure.
  63. |
  64. */
  65. Autoloader::directories(array(
  66. path('app').'models',
  67. path('app').'libraries',
  68. ));
  69. /*
  70. |--------------------------------------------------------------------------
  71. | Laravel View Loader
  72. |--------------------------------------------------------------------------
  73. |
  74. | The Laravel view loader is responsible for returning the full file path
  75. | for the given bundle and view. Of course, a default implementation is
  76. | provided to load views according to typical Laravel conventions but
  77. | you may change this to customize how your views are organized.
  78. |
  79. */
  80. Event::listen(View::loader, function($bundle, $view)
  81. {
  82. return View::file($bundle, $view, Bundle::path($bundle).'views');
  83. });
  84. /*
  85. |--------------------------------------------------------------------------
  86. | Laravel Language Loader
  87. |--------------------------------------------------------------------------
  88. |
  89. | The Laravel language loader is responsible for returning the array of
  90. | language lines for a given bundle, language, and "file". A default
  91. | implementation has been provided which uses the default language
  92. | directories included with Laravel.
  93. |
  94. */
  95. Event::listen(Lang::loader, function($bundle, $language, $file)
  96. {
  97. return Lang::file($bundle, $language, $file);
  98. });
  99. /*
  100. |--------------------------------------------------------------------------
  101. | Attach The Laravel Profiler
  102. |--------------------------------------------------------------------------
  103. |
  104. | If the profiler is enabled, we will attach it to the Laravel events
  105. | for both queries and logs. This allows the profiler to intercept
  106. | any of the queries or logs performed by the application.
  107. |
  108. */
  109. if (Config::get('application.profiler'))
  110. {
  111. Profiler::attach();
  112. }
  113. /*
  114. |--------------------------------------------------------------------------
  115. | Enable The Blade View Engine
  116. |--------------------------------------------------------------------------
  117. |
  118. | The Blade view engine provides a clean, beautiful templating language
  119. | for your application, including syntax for echoing data and all of
  120. | the typical PHP control structures. We'll simply enable it here.
  121. |
  122. */
  123. Blade::sharpen();
  124. /*
  125. |--------------------------------------------------------------------------
  126. | Set The Default Timezone
  127. |--------------------------------------------------------------------------
  128. |
  129. | We need to set the default timezone for the application. This controls
  130. | the timezone that will be used by any of the date methods and classes
  131. | utilized by Laravel or your application. The timezone may be set in
  132. | your application configuration file.
  133. |
  134. */
  135. date_default_timezone_set(Config::get('application.timezone'));
  136. /*
  137. |--------------------------------------------------------------------------
  138. | Start / Load The User Session
  139. |--------------------------------------------------------------------------
  140. |
  141. | Sessions allow the web, which is stateless, to simulate state. In other
  142. | words, sessions allow you to store information about the current user
  143. | and state of your application. Here we'll just fire up the session
  144. | if a session driver has been configured.
  145. |
  146. */
  147. if ( ! Request::cli() and Config::get('session.driver') !== '')
  148. {
  149. Session::load();
  150. }