/
handler.php
48 lines (43 loc) · 1.4 KB
/
handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* App Handler File
*
* These functions will be called automatically
* when an specific event occurs.
* If a class is not defined and is called,
* the handler will automatically include the
* file containing the class name
*
* @author: Elvis D'Andrea
* @email: elvis.vista@gmail.com
*/
/**
* Error Message Level
*
* Removing E_ALL is not recommended
*/
session_start();
error_reporting(E_ERROR | E_PARSE | E_ALL);
/**
* Handler functions registration
*/
require_once KRNDIR . '/AutoloadHandler.php'; // Call the AutoLoader
spl_autoload_register (array('AutoloadHandler', 'autoLoad')); // Register the autoload handler
set_error_handler (array('ExceptionHandler','ExceptionListener')); // Register the Error Handler
set_exception_handler (array('ExceptionHandler','ExceptionListener')); // Register the User Exception Handler
register_shutdown_function (array('ExceptionHandler','FatalExceptionListener')); // Register the Shutdown Handler for Fatal Error Handling
/**
* Debugger Function
*
* To support a debug in any position of the code,
* regardless the possibility of a template engine,
* this must be text-based
*
* @param $mixed
* @param $element
*/
function debug($mixed, $element = '#content'){
//TODO: Use Termination function
echo Debugger::debug($mixed, $element);
exit;
}