From cb95f9cee22d165a2d014b9ef2072e93e1a6ce29 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 8 Jan 2013 23:52:23 +0200 Subject: [PATCH] Core Improvements: Next Round #79 #80 --- .../Gelato/ErrorHandler/ErrorHandler.php | 36 +- .../Resources/Views/Errors/exception.php | 432 ++++++++++-------- .../Resources/Views/Errors/production.php | 54 +-- plugins/box/information/information.admin.php | 38 +- .../box/information/information.plugin.php | 46 +- plugins/box/menu/menu.plugin.php | 1 - 6 files changed, 339 insertions(+), 268 deletions(-) diff --git a/libraries/Gelato/ErrorHandler/ErrorHandler.php b/libraries/Gelato/ErrorHandler/ErrorHandler.php index 5420229..2f5b9a8 100644 --- a/libraries/Gelato/ErrorHandler/ErrorHandler.php +++ b/libraries/Gelato/ErrorHandler/ErrorHandler.php @@ -39,7 +39,7 @@ class ErrorHandler */ protected static function highlightCode($file, $line, $padding = 6) { - if (!is_readable($file)) { + if ( ! is_readable($file)) { return false; } @@ -47,7 +47,7 @@ class ErrorHandler $lines = array(); $currentLine = 0; - while (!feof($handle)) { + while ( ! feof($handle)) { $currentLine++; $temp = fgets($handle); @@ -118,20 +118,23 @@ class ErrorHandler return $backtrace; } - // Remove unnecessary info from backtrace - + /** + * Remove unnecessary info from backtrace + */ if ($backtrace[0]['function'] == '{closure}') { unset($backtrace[0]); } - // Format backtrace - + /** + * Format backtrace + */ $trace = array(); foreach ($backtrace as $entry) { - // Function - + /** + * Function + */ $function = ''; if (isset($entry['class'])) { @@ -140,8 +143,9 @@ class ErrorHandler $function .= $entry['function'] . '()'; - // Arguments - + /** + * Arguments + */ $arguments = array(); if (isset($entry['args']) && count($entry['args']) > 0) { @@ -158,8 +162,9 @@ class ErrorHandler } } - // Location - + /** + * Location + */ $location = array(); if (isset($entry['file'])) { @@ -168,8 +173,9 @@ class ErrorHandler $location['code'] = static::highlightCode($entry['file'], $entry['line']); } - // Compile into array - + /** + * Compile into array + */ $trace[] = array ( 'function' => $function, @@ -265,7 +271,7 @@ class ErrorHandler include 'Resources/Views/Errors/exception.php'; } else { Response::status(500); - include 'Resources/Views/Errors/error.php'; + include 'Resources/Views/Errors/production.php'; } } catch (Exception $e) { while(ob_get_level() > 0) ob_end_clean(); diff --git a/libraries/Gelato/ErrorHandler/Resources/Views/Errors/exception.php b/libraries/Gelato/ErrorHandler/Resources/Views/Errors/exception.php index 81d72c0..8f01ebd 100644 --- a/libraries/Gelato/ErrorHandler/Resources/Views/Errors/exception.php +++ b/libraries/Gelato/ErrorHandler/Resources/Views/Errors/exception.php @@ -4,206 +4,274 @@ Error
-
- [] -Gelato -
-
-Message: +
+ [] + Gelato +
+
+ Message: - -

-Location: (line ) - + +

+ Location: (line ) + - -

-
- - class="highlighted"> - -
- -
+ +

+
+ + class="highlighted"> + +
+ +
- -
-Backtrace + -
- - + +
+ Backtrace + +
+ + -
-Superglobals + -
- +
+ Included Files + +
+ +
Gelato Library
- \ No newline at end of file + diff --git a/libraries/Gelato/ErrorHandler/Resources/Views/Errors/production.php b/libraries/Gelato/ErrorHandler/Resources/Views/Errors/production.php index 657ae34..ddecb0f 100644 --- a/libraries/Gelato/ErrorHandler/Resources/Views/Errors/production.php +++ b/libraries/Gelato/ErrorHandler/Resources/Views/Errors/production.php @@ -5,47 +5,47 @@ Error -
-

Error

-
-

Aw, snap! An error has occurred while processing your request.

-
+
+

Error

+
+

Aw, snap! An error has occurred while processing your request.

+
- \ No newline at end of file + diff --git a/plugins/box/information/information.admin.php b/plugins/box/information/information.admin.php index de7e757..0e545a4 100644 --- a/plugins/box/information/information.admin.php +++ b/plugins/box/information/information.admin.php @@ -1,28 +1,28 @@ assign('php_modules', $php_modules) - ->display(); - } + // Get array with the names of all modules compiled and loaded + $php_modules = get_loaded_extensions(); + // Display view + View::factory('box/information/views/backend/index') + ->assign('php_modules', $php_modules) + ->display(); } + +} diff --git a/plugins/box/information/information.plugin.php b/plugins/box/information/information.plugin.php index 8b1e84f..86aa357 100644 --- a/plugins/box/information/information.plugin.php +++ b/plugins/box/information/information.plugin.php @@ -1,29 +1,29 @@ display(); } - }