From e8b60312037e54c34a06d6f57d7c21946cf3cd1f Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 28 Dec 2005 20:17:54 +0000 Subject: Modified the way to access application singleton. IService and IModule interfaces are also adjusted accordingly. --- framework/Exceptions/TErrorHandler.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'framework/Exceptions') diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index ca42c8ff..c8137a09 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -64,10 +64,6 @@ class TErrorHandler extends TModule */ const SOURCE_LINES=12; - /** - * @var TApplication application instance - */ - private $_application; /** * @var string error template directory */ @@ -76,15 +72,13 @@ class TErrorHandler extends TModule /** * Initializes the module. * This method is required by IModule and is invoked by application. - * @param TApplication application * @param TXmlElement module configuration */ - public function init($application,$config) + public function init($config=null) { - parent::init($application,$config); + parent::init($config); - $this->_application=$application; - $application->setErrorHandler($this); + $this->getApplication()->setErrorHandler($this); } /** @@ -132,13 +126,13 @@ class TErrorHandler extends TModule else { $handling=true; - if(($response=Prado::getApplication()->getResponse())!==null) + if(($response=$this->getResponse())!==null) $response->clear(); if(!headers_sent()) header('Content-Type: text/html; charset=UTF-8'); if($param instanceof THttpException) $this->handleExternalError($param->getStatusCode(),$param); - else if(Prado::getApplication()->getMode()===TApplication::STATE_DEBUG) + else if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) $this->displayException($param); else $this->handleExternalError(500,$param); @@ -192,7 +186,7 @@ class TErrorHandler extends TModule */ protected function handleRecursiveError($exception) { - if(Prado::getApplication()->getMode()===TApplication::STATE_DEBUG) + if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) { echo "Recursive Error\n"; echo "

Recursive Error

\n"; -- cgit v1.2.3