All pastes #823852 Raw Edit

KYLE

public php v1 · immutable
·published 2007-12-19 16:59 UTC
rendered paste body
<?phpclass errors{    var $debug_level = 0;	// Blah Blah Blah    function errors($debug_level = 0)    {        // Populate class variables        $this->debug_level = $setting['debug'];        // Take over from PHP error handling        set_error_handler(array($this, 'handle_error'));    }		// Blah Blah Blah    function handle_error($type, $string, $file, $line, $vars)    {        // Decide which type of error it is, and handle appropriately        switch ($type)        {            // Error type            case FATAL:            // Select debug level            switch ($this->debug_level)            {                default:                case 0:					// @todo: intergrate with template class                    echo 'Error: '.$string.' in '.$file.' on line'. $line.'<br />';                    print_r($var);                    // Stop application                    exit;                case 1:					// @todo: intergrate with template class                    echo 'There has been an error. Sorry for the inconvenience.';                    // Stop application                    exit;            }            case ERROR:			// @todo: intergrate with template class            echo '<pre><b>ERROR</b> ['.$type.'] '.$string.'<br />'."</pre>n";            break;            case WARNING:			// @todo: intergrate with template class            echo '<pre><b>WARNING</b> ['.$type.'] '.$string.'<br />'."</pre>n";            break;        }    }} ?>