refactored error and file classes.
This commit is contained in:
parent
4b063ac042
commit
6a77a98f95
|
@ -31,7 +31,7 @@ class Error {
|
||||||
*/
|
*/
|
||||||
public static function handle($e)
|
public static function handle($e)
|
||||||
{
|
{
|
||||||
// Clean the output buffer. We don't want any rendered views or text sent to the browser.
|
// Clean the output buffer so no previously rendered views or text is sent to the browser.
|
||||||
if (ob_get_level() > 0)
|
if (ob_get_level() > 0)
|
||||||
{
|
{
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
@ -40,7 +40,8 @@ public static function handle($e)
|
||||||
// Get the error severity in human readable format.
|
// Get the error severity in human readable format.
|
||||||
$severity = (array_key_exists($e->getCode(), static::$levels)) ? static::$levels[$e->getCode()] : $e->getCode();
|
$severity = (array_key_exists($e->getCode(), static::$levels)) ? static::$levels[$e->getCode()] : $e->getCode();
|
||||||
|
|
||||||
// Get the error file. Views require special handling since view errors occur in eval'd code.
|
// Get the file in which the error occured.
|
||||||
|
// Views require special handling since view errors occur in eval'd code.
|
||||||
if (strpos($e->getFile(), 'view.php') !== false and strpos($e->getFile(), "eval()'d code") !== false)
|
if (strpos($e->getFile(), 'view.php') !== false and strpos($e->getFile(), "eval()'d code") !== false)
|
||||||
{
|
{
|
||||||
$file = APP_PATH.'views/'.View::$last.EXT;
|
$file = APP_PATH.'views/'.View::$last.EXT;
|
||||||
|
|
|
@ -125,11 +125,6 @@ public static function download($path, $name = null)
|
||||||
*/
|
*/
|
||||||
public static function upload($key, $path)
|
public static function upload($key, $path)
|
||||||
{
|
{
|
||||||
if ( ! array_key_exists($key, $_FILES))
|
return array_key_exists($key, $_FILES) ? move_uploaded_file($_FILES[$key]['tmp_name'], $path) : false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return move_uploaded_file($_FILES[$key]['tmp_name'], $path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue