refactoring various pieces of the framework.

This commit is contained in:
Taylor Otwell
2011-10-18 20:19:36 -05:00
parent e985057b4c
commit 9fc9f88a41
18 changed files with 193 additions and 114 deletions

View File

@@ -0,0 +1,44 @@
<?php
define('EXT', '.php');
define('BLADE_EXT', '.blade.php');
function constants($constants)
{
foreach ($constants as $key => $value)
{
if ( ! defined($key)) define($key, $value);
}
}
$constants = array(
'APP_PATH' => realpath($application).'/',
'BASE_PATH' => realpath("$laravel/..").'/',
'PACKAGE_PATH' => realpath($packages).'/',
'PUBLIC_PATH' => realpath($public).'/',
'STORAGE_PATH' => realpath($storage).'/',
'SYS_PATH' => realpath($laravel).'/',
);
constants($constants);
$constants = array(
'CACHE_PATH' => STORAGE_PATH.'cache/',
'CONFIG_PATH' => APP_PATH.'config/',
'CONTROLLER_PATH' => APP_PATH.'controllers/',
'DATABASE_PATH' => STORAGE_PATH.'database/',
'LANG_PATH' => APP_PATH.'language/',
'LIBRARY_PATH' => APP_PATH.'libraries/',
'MODEL_PATH' => APP_PATH.'models/',
'ROUTE_PATH' => APP_PATH.'routes/',
'SESSION_PATH' => STORAGE_PATH.'sessions/',
'SYS_CONFIG_PATH' => SYS_PATH.'config/',
'SYS_LANG_PATH' => SYS_PATH.'language/',
'SYS_VIEW_PATH' => SYS_PATH.'views/',
'VIEW_PATH' => APP_PATH.'views/',
);
constants($constants);
unset($constants);

View File

@@ -1,43 +1,15 @@
<?php namespace Laravel;
/**
* Define a multitude of framework constants. Mainly, we define
* various file paths to core locations of the framework, as well
* as a couple of file extensions.
*/
define('EXT', '.php');
define('BLADE_EXT', '.blade.php');
define('APP_PATH', realpath($application).'/');
define('BASE_PATH', realpath("$laravel/..").'/');
define('PACKAGE_PATH', realpath($packages).'/');
define('PUBLIC_PATH', realpath($public).'/');
define('STORAGE_PATH', realpath($storage).'/');
define('SYS_PATH', realpath($laravel).'/');
define('CACHE_PATH', STORAGE_PATH.'cache/');
define('CONFIG_PATH', APP_PATH.'config/');
define('CONTROLLER_PATH', APP_PATH.'controllers/');
define('DATABASE_PATH', STORAGE_PATH.'database/');
define('LANG_PATH', APP_PATH.'language/');
define('LIBRARY_PATH', APP_PATH.'libraries/');
define('MODEL_PATH', APP_PATH.'models/');
define('ROUTE_PATH', APP_PATH.'routes/');
define('SESSION_PATH', STORAGE_PATH.'sessions/');
define('SYS_CONFIG_PATH', SYS_PATH.'config/');
define('SYS_LANG_PATH', SYS_PATH.'language/');
define('SYS_VIEW_PATH', SYS_PATH.'views/');
define('VIEW_PATH', APP_PATH.'views/');
unset($laravel, $application, $config, $packages, $public, $storage);
require 'constants.php';
/**
* Load the classes that can't be resolved through the auto-loader.
* These are typically classes that are used by the auto-loader or
* configuration classes, and therefore cannot be auto-loaded.
*/
require SYS_PATH.'arr'.EXT;
require SYS_PATH.'config'.EXT;
require SYS_PATH.'loader'.EXT;
require SYS_PATH.'arr'.EXT;
/**
* If a Laravel environment has been specified on the server, we will