refactoring and bug fixes.
This commit is contained in:
@@ -26,8 +26,9 @@ define('EXT', '.php');
|
||||
define('BLADE_EXT', '.blade.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.
|
||||
* 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.'facades'.EXT;
|
||||
require SYS_PATH.'config'.EXT;
|
||||
@@ -35,9 +36,10 @@ require SYS_PATH.'loader'.EXT;
|
||||
require SYS_PATH.'arr'.EXT;
|
||||
|
||||
/**
|
||||
* Bootstrap the application inversion of control (IoC) container. The container provides the
|
||||
* convenient resolution of objects and their dependencies, allowing for flexibility and
|
||||
* testability within the framework and application.
|
||||
* Bootstrap the application inversion of control (IoC) container.
|
||||
* The container provides the convenient resolution of objects and
|
||||
* their dependencies, allowing for flexibility and testability
|
||||
* within the framework and application.
|
||||
*/
|
||||
require SYS_PATH.'container'.EXT;
|
||||
|
||||
@@ -46,25 +48,13 @@ $container = new Container(Config::get('container'));
|
||||
IoC::$container = $container;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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($container->resolve('laravel.loader'), 'load'));
|
||||
|
||||
/**
|
||||
* Define a few convenient global functions.
|
||||
*/
|
||||
function e($value)
|
||||
{
|
||||
return HTML::entities($value);
|
||||
}
|
||||
|
||||
function __($key, $replacements = array(), $language = null)
|
||||
{
|
||||
return Lang::line($key, $replacements, $language);
|
||||
}
|
||||
|
||||
function fe($function)
|
||||
{
|
||||
return function_exists($function);
|
||||
}
|
||||
require 'functions'.EXT;
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php namespace Laravel;
|
||||
|
||||
/**
|
||||
* Create the exception formatter closure. This function will format the exception
|
||||
* message and severity for display and return the two formatted strings in an array.
|
||||
* Create the exception formatter closure. This function will format
|
||||
* the exception message and severity for display and return the two
|
||||
* formatted strings in an array.
|
||||
*/
|
||||
$formatter = function($e)
|
||||
{
|
||||
@@ -32,20 +33,30 @@ $formatter = function($e)
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the exception handler function. All of the handlers registered with PHP
|
||||
* will call this handler when an error occurs so the code stays D.R.Y.
|
||||
* Create the exception handler function. All of the handlers
|
||||
* registered with PHP will call this handler when an error
|
||||
* occurs so the code stays D.R.Y.
|
||||
*/
|
||||
$handler = function($e) use ($formatter)
|
||||
{
|
||||
list($severity, $message) = $formatter($e);
|
||||
|
||||
call_user_func(Config::get('error.handler'), $e, $severity, $message, Config::get('error'));
|
||||
$config = Config::get('error');
|
||||
|
||||
if ($config['log'])
|
||||
{
|
||||
call_user_func($config['logger'], $e, $severity, $message, $config);
|
||||
}
|
||||
|
||||
call_user_func($config['handler'], $e, $severity, $message, $config);
|
||||
|
||||
exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Register the exception, error, and shutdown error handlers. These handlers will
|
||||
* catch all PHP exceptions and errors and pass the exceptions into the common
|
||||
* Laravel error handler.
|
||||
* Register the exception, error, and shutdown error handlers.
|
||||
* These handlers will catch all PHP exceptions and errors and
|
||||
* pass the exceptions into the common Laravel error handler.
|
||||
*/
|
||||
set_exception_handler(function($e) use ($handler)
|
||||
{
|
||||
@@ -66,8 +77,9 @@ register_shutdown_function(function() use ($handler)
|
||||
});
|
||||
|
||||
/**
|
||||
* Set the error reporting and display levels. Since the framework will be displaying
|
||||
* the exception messages, we don't want PHP to display any error information.
|
||||
* Set the error reporting and display levels. Since the framework
|
||||
* will be displaying the exception messages, we don't want PHP to
|
||||
* display any error information.
|
||||
*/
|
||||
error_reporting(-1);
|
||||
|
||||
|
||||
16
laravel/bootstrap/functions.php
Normal file
16
laravel/bootstrap/functions.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
function fe($function)
|
||||
{
|
||||
return function_exists($function);
|
||||
}
|
||||
|
||||
function e($value)
|
||||
{
|
||||
return HTML::entities($value);
|
||||
}
|
||||
|
||||
function __($key, $replacements = array(), $language = null)
|
||||
{
|
||||
return Lang::line($key, $replacements, $language);
|
||||
}
|
||||
Reference in New Issue
Block a user