working on the core bootstrap comments.
This commit is contained in:
parent
d57af216e6
commit
79c586523d
|
@ -1,14 +1,8 @@
|
||||||
<?php namespace Laravel;
|
<?php namespace Laravel;
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Define the PHP file extensions.
|
* Define core framework paths and constants.
|
||||||
// --------------------------------------------------------------
|
*/
|
||||||
define('EXT', '.php');
|
|
||||||
define('BLADE_EXT', '.blade.php');
|
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
// Define the core framework paths.
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
define('APP_PATH', realpath($application).'/');
|
define('APP_PATH', realpath($application).'/');
|
||||||
define('BASE_PATH', realpath(str_replace('laravel', '', $laravel)).'/');
|
define('BASE_PATH', realpath(str_replace('laravel', '', $laravel)).'/');
|
||||||
define('PACKAGE_PATH', realpath($packages).'/');
|
define('PACKAGE_PATH', realpath($packages).'/');
|
||||||
|
@ -18,9 +12,6 @@
|
||||||
|
|
||||||
unset($laravel, $application, $config, $packages, $public, $storage);
|
unset($laravel, $application, $config, $packages, $public, $storage);
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
// Define various other framework paths.
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
define('CACHE_PATH', STORAGE_PATH.'cache/');
|
define('CACHE_PATH', STORAGE_PATH.'cache/');
|
||||||
define('CONFIG_PATH', APP_PATH.'config/');
|
define('CONFIG_PATH', APP_PATH.'config/');
|
||||||
define('CONTROLLER_PATH', APP_PATH.'controllers/');
|
define('CONTROLLER_PATH', APP_PATH.'controllers/');
|
||||||
|
@ -32,54 +23,60 @@
|
||||||
define('SYS_LANG_PATH', SYS_PATH.'language/');
|
define('SYS_LANG_PATH', SYS_PATH.'language/');
|
||||||
define('VIEW_PATH', APP_PATH.'views/');
|
define('VIEW_PATH', APP_PATH.'views/');
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
define('EXT', '.php');
|
||||||
// Load the configuration manager and its dependencies.
|
define('BLADE_EXT', '.blade.php');
|
||||||
// --------------------------------------------------------------
|
|
||||||
|
/**
|
||||||
|
* Load the classes that can't be resolved through the auto-loader.
|
||||||
|
* Typically, these are classes that are used by the auto-loader
|
||||||
|
* or configuration classes.
|
||||||
|
*/
|
||||||
require SYS_PATH.'facades'.EXT;
|
require SYS_PATH.'facades'.EXT;
|
||||||
require SYS_PATH.'config'.EXT;
|
require SYS_PATH.'config'.EXT;
|
||||||
require SYS_PATH.'loader'.EXT;
|
require SYS_PATH.'loader'.EXT;
|
||||||
require SYS_PATH.'arr'.EXT;
|
require SYS_PATH.'arr'.EXT;
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Determine the application environment.
|
* Determine the application environment. The environment is typically
|
||||||
// --------------------------------------------------------------
|
* set by an environment variable on the server.
|
||||||
|
*/
|
||||||
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? $_SERVER['LARAVEL_ENV'] : null;
|
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? $_SERVER['LARAVEL_ENV'] : null;
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Register the configuration file paths.
|
* Register the path to the configuration files.
|
||||||
// --------------------------------------------------------------
|
*/
|
||||||
$config = array(SYS_CONFIG_PATH, CONFIG_PATH);
|
$configs = array(SYS_CONFIG_PATH, CONFIG_PATH);
|
||||||
|
|
||||||
if ( ! is_null($environment)) $config[] = CONFIG_PATH.$environment.'/';
|
if ( ! is_null($environment)) $configs[] = CONFIG_PATH.$environment.'/';
|
||||||
|
|
||||||
Config::paths($config);
|
Config::$paths = $configs;
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Set a few core configuration options.
|
* Bootstrap the application inversion of control (IoC) container.
|
||||||
// --------------------------------------------------------------
|
* The container provides the convenient resolution of objects and
|
||||||
Config::set('view.path', VIEW_PATH);
|
* their dependencies, allowing for flexibility and testability
|
||||||
|
* within the framework.
|
||||||
// --------------------------------------------------------------
|
*/
|
||||||
// Bootstrap the IoC container.
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
require SYS_PATH.'container'.EXT;
|
require SYS_PATH.'container'.EXT;
|
||||||
|
|
||||||
$container = new Container(Config::get('container'));
|
$container = new Container(Config::get('container'));
|
||||||
|
|
||||||
IoC::$container = $container;
|
IoC::$container = $container;
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Register the auto-loader on the auto-loader stack.
|
* Register the application auto-loader. The auto-loader is responsible
|
||||||
// --------------------------------------------------------------
|
* for the lazy-loading of all of the Laravel core classes, as well as
|
||||||
|
* the developer created libraries and models.
|
||||||
|
*/
|
||||||
spl_autoload_register(array('Laravel\\Loader', 'load'));
|
spl_autoload_register(array('Laravel\\Loader', 'load'));
|
||||||
|
|
||||||
Loader::$paths = array(BASE_PATH, APP_PATH.'models/', APP_PATH);
|
Loader::$paths = array(BASE_PATH, APP_PATH.'models/', APP_PATH.'libraries/', APP_PATH);
|
||||||
|
|
||||||
Loader::$aliases = Config::get('aliases');
|
Loader::$aliases = Config::get('aliases');
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
/**
|
||||||
// Define some convenient global functions.
|
* Define a few convenient global functions.
|
||||||
// --------------------------------------------------------------
|
*/
|
||||||
function e($value)
|
function e($value)
|
||||||
{
|
{
|
||||||
return HTML::entities($value);
|
return HTML::entities($value);
|
||||||
|
|
|
@ -16,18 +16,7 @@ class Config {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected static $paths = array();
|
public static $paths = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the paths in which the configuration files are located.
|
|
||||||
*
|
|
||||||
* @param array $paths
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function paths($paths)
|
|
||||||
{
|
|
||||||
static::$paths = $paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a configuration item or file exists.
|
* Determine if a configuration item or file exists.
|
||||||
|
|
Loading…
Reference in New Issue