summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-01-07 18:39:39 +0100
committerAndrey Andreev <narf@bofh.bg>2012-01-07 18:39:39 +0100
commit7ac33d7a615f9b5e27fe92a0a91c4ebfb19faad3 (patch)
treebd7b5db4cbe3d8380ff19110dc003b65fe1ea8d1
parent9252d7bf2208d351aad4292cb79c509391f0313f (diff)
Improve core Controller & Exceptions libraries
-rw-r--r--system/core/Controller.php16
-rwxr-xr-xsystem/core/Exceptions.php83
2 files changed, 40 insertions, 59 deletions
diff --git a/system/core/Controller.php b/system/core/Controller.php
index 55b3ec235..5ae0b0924 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -1,13 +1,13 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -43,13 +43,10 @@ class CI_Controller {
private static $instance;
- /**
- * Constructor
- */
public function __construct()
{
self::$instance =& $this;
-
+
// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
@@ -59,9 +56,7 @@ class CI_Controller {
}
$this->load =& load_class('Loader', 'core');
-
$this->load->initialize();
-
log_message('debug', "Controller Class Initialized");
}
@@ -70,7 +65,6 @@ class CI_Controller {
return self::$instance;
}
}
-// END Controller class
/* End of file Controller.php */
-/* Location: ./system/core/Controller.php */ \ No newline at end of file
+/* Location: ./system/core/Controller.php */
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 3737f2930..9b672ac54 100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -1,13 +1,13 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -37,49 +37,44 @@
* @link http://codeigniter.com/user_guide/libraries/exceptions.html
*/
class CI_Exceptions {
- var $action;
- var $severity;
- var $message;
- var $filename;
- var $line;
+
+ public $action;
+ public $severity;
+ public $message;
+ public $filename;
+ public $line;
/**
* Nesting level of the output buffering mechanism
*
* @var int
- * @access public
*/
- var $ob_level;
+ public $ob_level;
/**
* List if available error levels
*
* @var array
- * @access public
*/
- var $levels = array(
- E_ERROR => 'Error',
- E_WARNING => 'Warning',
- E_PARSE => 'Parsing Error',
- E_NOTICE => 'Notice',
- E_CORE_ERROR => 'Core Error',
- E_CORE_WARNING => 'Core Warning',
- E_COMPILE_ERROR => 'Compile Error',
- E_COMPILE_WARNING => 'Compile Warning',
- E_USER_ERROR => 'User Error',
- E_USER_WARNING => 'User Warning',
- E_USER_NOTICE => 'User Notice',
- E_STRICT => 'Runtime Notice'
- );
+ public $levels = array(
+ E_ERROR => 'Error',
+ E_WARNING => 'Warning',
+ E_PARSE => 'Parsing Error',
+ E_NOTICE => 'Notice',
+ E_CORE_ERROR => 'Core Error',
+ E_CORE_WARNING => 'Core Warning',
+ E_COMPILE_ERROR => 'Compile Error',
+ E_COMPILE_WARNING => 'Compile Warning',
+ E_USER_ERROR => 'User Error',
+ E_USER_WARNING => 'User Warning',
+ E_USER_NOTICE => 'User Notice',
+ E_STRICT => 'Runtime Notice'
+ );
-
- /**
- * Constructor
- */
public function __construct()
{
$this->ob_level = ob_get_level();
- // Note: Do not log messages from this constructor.
+ // Note: Do not log messages from this constructor.
}
// --------------------------------------------------------------------
@@ -89,17 +84,15 @@ class CI_Exceptions {
*
* This function logs PHP generated error messages
*
- * @access private
* @param string the error severity
* @param string the error string
* @param string the error filepath
* @param string the error line number
- * @return string
+ * @return void
*/
- function log_exception($severity, $message, $filepath, $line)
+ public function log_exception($severity, $message, $filepath, $line)
{
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
-
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
@@ -108,15 +101,14 @@ class CI_Exceptions {
/**
* 404 Page Not Found Handler
*
- * @access private
* @param string the page
* @param bool log error yes/no
* @return string
*/
- function show_404($page = '', $log_error = TRUE)
+ public function show_404($page = '', $log_error = TRUE)
{
- $heading = "404 Page Not Found";
- $message = "The page you requested was not found.";
+ $heading = '404 Page Not Found';
+ $message = 'The page you requested was not found.';
// By default we log this, but allow a dev to skip it
if ($log_error)
@@ -137,14 +129,13 @@ class CI_Exceptions {
* (either as a string or an array) and displays
* it using the specified template.
*
- * @access private
* @param string the heading
* @param string the message
* @param string the template name
* @param int the status code
* @return string
*/
- function show_error($heading, $message, $template = 'error_general', $status_code = 500)
+ public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
set_status_header($status_code);
@@ -155,7 +146,7 @@ class CI_Exceptions {
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/'.$template.'.php');
+ include(APPPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php');
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
@@ -166,7 +157,6 @@ class CI_Exceptions {
/**
* Native PHP error handler
*
- * @access private
* @param string the error severity
* @param string the error string
* @param string the error filepath
@@ -176,8 +166,7 @@ class CI_Exceptions {
function show_php_error($severity, $message, $filepath, $line)
{
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
-
- $filepath = str_replace("\\", "/", $filepath);
+ $filepath = str_replace('\\', '/', $filepath);
// For safety reasons we do not show the full file path
if (FALSE !== strpos($filepath, '/'))
@@ -191,15 +180,13 @@ class CI_Exceptions {
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/error_php.php');
+ include(APPPATH.'errors'.DIRECTORY_SEPARATOR.'error_php.php');
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
}
-
}
-// END Exceptions Class
/* End of file Exceptions.php */
-/* Location: ./system/core/Exceptions.php */ \ No newline at end of file
+/* Location: ./system/core/Exceptions.php */