Namespaces | |
namespace | CodeIgniter |
Functions | |
is_really_writable ($file) | |
& | load_class ($class, $instantiate=TRUE) |
& | get_config () |
config_item ($item) | |
show_error ($message) | |
show_404 ($page= '') | |
log_message ($level= 'error', $message, $php_error=FALSE) | |
_exception_handler ($severity, $message, $filepath, $line) |
_exception_handler | ( | $ | severity, | |
$ | message, | |||
$ | filepath, | |||
$ | line | |||
) |
Exception Handler
This is the custom exception handler that is declaired at the top of Codeigniter.php. The main reason we use this is permit PHP errors to be logged in our own log files since we may not have access to server logs. Since this function effectively intercepts PHP errors, however, we also need to display errors based on the current error_reporting level. We do that with the use of a PHP error template.
private
config_item | ( | $ | item | ) |
Gets a config item
public
& get_config | ( | ) |
Loads the main config.php file
private
is_really_writable | ( | $ | file | ) |
Tests for file writability
is_writable() returns TRUE on Windows servers when you really can't write to the file, based on the read-only attribute. is_writable() is also unreliable on Unix servers if safe_mode is on.
private
& load_class | ( | $ | class, | |
$ | instantiate = TRUE | |||
) |
Class registry
This function acts as a singleton. If the requested class does not exist it is instantiated and set to a static variable. If it has previously been instantiated the variable is returned.
public
string | the class name being requested | |
bool | optional flag that lets classes get loaded but not instantiated |
log_message | ( | $ | level = 'error' , |
|
$ | message, | |||
$ | php_error = FALSE | |||
) |
Error Logging Interface
We use this as a simple mechanism to access the logging class and send messages to be logged.
public
show_404 | ( | $ | page = '' |
) |
404 Page Handler
This function is similar to the show_error() function above However, instead of the standard error template it displays 404 errors.
public
show_error | ( | $ | message | ) |
Error Handler
This function lets us invoke the exception class and display errors using the standard error template located in application/errors/errors.php This function will send the error page directly to the browser and exit.
public