Skip to content

Commit

Permalink
refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 22, 2011
1 parent b9b9711 commit 0c4018e
Show file tree
Hide file tree
Showing 42 changed files with 1,007 additions and 1,357 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
favicon.*
10 changes: 5 additions & 5 deletions application/config/aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'Cache' => 'Laravel\\Cache',
'Config' => 'Laravel\\Config',
'Controller' => 'Laravel\\Controller',
'Cookie' => 'Laravel\\Cookie',
'Cookie' => 'Laravel\\Facades\\Cookie',
'Crypter' => 'Laravel\\Facades\\Crypter',
'DB' => 'Laravel\\Database\\Manager',
'Eloquent' => 'Laravel\\Database\\Eloquent\\Model',
Expand All @@ -34,20 +34,20 @@
'Hasher' => 'Laravel\\Facades\\Hasher',
'HTML' => 'Laravel\\HTML',
'Inflector' => 'Laravel\\Inflector',
'Input' => 'Laravel\\Input',
'Input' => 'Laravel\\Facades\\Input',
'IoC' => 'Laravel\\IoC',
'Lang' => 'Laravel\\Lang',
'Loader' => 'Laravel\\Loader',
'Messages' => 'Laravel\\Validation\\Messages',
'Package' => 'Laravel\\Facades\\Package',
'URI' => 'Laravel\\URI',
'URI' => 'Laravel\\Facades\\URI',
'URL' => 'Laravel\\URL',
'Redirect' => 'Laravel\\Redirect',
'Request' => 'Laravel\\Request',
'Request' => 'Laravel\\Facades\\Request',
'Response' => 'Laravel\\Response',
'Session' => 'Laravel\\Facades\\Session',
'Str' => 'Laravel\\Str',
'Validator' => 'Laravel\\Validator',
'Validator' => 'Laravel\\Validation\\Validator',
'View' => 'Laravel\\View',

);
75 changes: 72 additions & 3 deletions application/config/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,42 @@

return array(

/*
|--------------------------------------------------------------------------
| Error Detail
|--------------------------------------------------------------------------
|
| Detailed error messages contain information about the file in which
| an error occurs, a stack trace, and a snapshot of the source code
| in which the error occured.
|
| If your application is in production, consider turning off error details
| for enhanced security and user experience.
|
*/

'detail' => true,

/*
|--------------------------------------------------------------------------
| Error Logging
|--------------------------------------------------------------------------
|
| Error Logging will use the "logger" function defined below to log error
| messages, which gives you complete freedom to determine how error
| messages are logged. Enjoy the flexibility.
|
*/

'log' => false,

/*
|--------------------------------------------------------------------------
| Error Handler
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
| flexibility to manage error logging as you see fit.
| flexibility in Laravel to manage error logging as you see fit.
|
| This function will be called when an error occurs in your application.
| You can log the error however you like.
Expand All @@ -21,11 +50,51 @@
|
*/

'handler' => function($exception)
'handler' => function($exception, $severity, $message, $config)
{
var_dump($exception);
if ($config['detail'])
{
$data = compact('exception', 'severity', 'message');

$response = Response::view('error.exception', $data)->status(500);
}
else
{
$response = Response::error('500');
}

if ($config['log'])
{
call_user_func($config['logger'], $severity, $message);
}

$response->send();

exit(1);
},

/*
|--------------------------------------------------------------------------
| Error Logger
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
| flexibility to manage error logging as you see fit.
|
| This function will be called when an error occurs in your application.
| You can log the error however you like.
|
| The error "severity" passed to the method is a human-readable severity
| level such as "Parsing Error" or "Fatal Error".
|
| A simple logging system has been setup for you. By default, all errors
| will be logged to the storage/log.txt file.
|
*/

'logger' => function($severity, $message)
{
File::append(STORAGE_PATH.'log.txt', date('Y-m-d H:i:s').' '.$severity.' - '.$message.PHP_EOL);
}

);
2 changes: 1 addition & 1 deletion application/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

'auth' => function()
{
return ( ! Auth::make()->check()) ? Redirect::to_login() : null;
return ( ! Auth::check()) ? Redirect::to('login') : null;
},


Expand Down
125 changes: 51 additions & 74 deletions application/views/error/404.php
Original file line number Diff line number Diff line change
@@ -1,87 +1,64 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>404 - Not Found</title>
<head>
<meta charset="utf-8">

<link href="http://fonts.googleapis.com/css?family=Quattrocento&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
<title>Error 404 - Not Found</title>

<style type="text/css">
body {
background-color: #eee;
color: #6d6d6d;
font-family: 'Ubuntu';
font-size: 16px;
}
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu);

a {
color: #7089b3;
font-weight: bold;
text-decoration: none;
}
body {
background:#eee;
color: #6d6d6d;
font: normal normal normal 16px/1.253 Ubuntu, sans-serif;
margin:0;
min-width:800px;
padding:0;
}

h1.laravel {
font-family: 'Lobster Two', Helvetica, serif;
font-size: 60px;
margin: 0 0 15px -10px;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main {
background-clip: padding-box;
background-color: #fff;
border:1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px #cdcdcd;
margin: 50px auto 0;
padding: 30px;
width: 700px;
}

h2 {
font-family: 'Quattrocento', serif;
font-size: 30px;
margin: 30px 0 0 0;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main h1 {
font-family: 'Ubuntu';
font-size: 34px;
margin: 0 0 20px 0;
padding: 0;
}

p {
margin: 10px 0 0 0;
line-height: 25px;
}
#main h2,h3 {
margin-top: 25px;
padding: 0 0 0 0;
}

#header {
margin: 0 auto;
margin-bottom: 15px;
margin-top: 20px;
width: 80%;
}
#main h3 {
font-size: 18px;
}

#wrapper {
background-color: #fff;
border-radius: 10px;
margin: 0 auto;
padding: 10px;
width: 80%;
}
#main p {
line-height: 25px;
margin: 10px 0;
}
</style>
</head>
<body>
<div id="main">
<?php $messages = array('We need a map.', 'I think we\'re lost.', 'We took a wrong turn.'); ?>

#wrapper h2:first-of-type {
margin-top: 0;
}
</style>
</head>
<body>
<div id="header">
<?php
$messages = array("We're lost.", "This doesn't look familiar.", "We need a map.");
$message = $messages[mt_rand(0, 2)];
?>
<h1><?php echo $messages[mt_rand(0, 2)]; ?></h1>

<h1 class="laravel"><?php echo $message; ?></h1>
</div>
<p>We're really sorry, but we couldn't find the resource you requested.</p>

<div id="wrapper">
<?php
$apologies = array("This is embarrassing.", "Don't give up on us.", "We're really sorry.");
$apology = $apologies[mt_rand(0, 2)];
?>

<h2><?php echo $apology; ?></h2>

<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo Config::get('application.url'); ?>">home page</a> instead?</p>
</div>
</body>
<p>Perhaps you would like to go to our <?php echo HTML::link('/', 'home page'); ?> instead?</p>
</div>
</body>
</html>
Loading

0 comments on commit 0c4018e

Please sign in to comment.