summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2005-12-01 16:33:16 +0000
committerxue <>2005-12-01 16:33:16 +0000
commit9b334afcd805d57834ca6504873f5efbb02d47fd (patch)
tree635c69c1e08a27f132b7127a81bf113036c47c0e /framework
parent5d7149045a6fb6c40c0dbfb863e8b4fef3d9952f (diff)
Diffstat (limited to 'framework')
-rw-r--r--framework/TApplication.php52
-rw-r--r--framework/Web/Services/TPageService.php27
2 files changed, 53 insertions, 26 deletions
diff --git a/framework/TApplication.php b/framework/TApplication.php
index f4d8c124..bd8e8e39 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -220,7 +220,6 @@ class TApplication extends TComponent
$this->_cacheFile=$cacheFile;
// generates unique ID by hashing the configuration file path
$this->_uniqueID=md5($this->_configFile);
- $this->_errorHandler=new TErrorHandler;
}
/**
@@ -363,6 +362,11 @@ class TApplication extends TComponent
*/
public function getRequest()
{
+ if(!$this->_request)
+ {
+ $this->_request=new THttpRequest;
+ $this->_request->init($this,null);
+ }
return $this->_request;
}
@@ -379,6 +383,11 @@ class TApplication extends TComponent
*/
public function getResponse()
{
+ if(!$this->_response)
+ {
+ $this->_response=new THttpResponse;
+ $this->_response->init($this,null);
+ }
return $this->_response;
}
@@ -391,35 +400,45 @@ class TApplication extends TComponent
}
/**
- * @return TErrorHandler the error hanlder module
+ * @return THttpSession the session module, null if session module is not installed
*/
- public function getErrorHandler()
+ public function getSession()
{
- return $this->_errorHandler;
+ if(!$this->_session)
+ {
+ $this->_session=new THttpSession;
+ $this->_session->init($this,null);
+ }
+ return $this->_session;
}
/**
- * @param TErrorHandler the error hanlder module
+ * @param THttpSession the session module
*/
- public function setErrorHandler(TErrorHandler $handler)
+ public function setSession(THttpSession $session)
{
- $this->_errorHandler=$handler;
+ $this->_session=$session;
}
/**
- * @return THttpSession the session module, null if session module is not installed
+ * @return TErrorHandler the error hanlder module
*/
- public function getSession()
+ public function getErrorHandler()
{
- return $this->_session;
+ if(!$this->_errorHandler)
+ {
+ $this->_errorHandler=new TErrorHandler;
+ $this->_errorHandler->init($this,null);
+ }
+ return $this->_errorHandler;
}
/**
- * @param THttpSession the session module
+ * @param TErrorHandler the error hanlder module
*/
- public function setSession(THttpSession $session)
+ public function setErrorHandler(TErrorHandler $handler)
{
- $this->_session=$session;
+ $this->_errorHandler=$handler;
}
/**
@@ -559,7 +578,7 @@ class TApplication extends TComponent
if($this->hasEventHandler('Error'))
$this->raiseEvent('Error',$this,$param);
else
- $this->_errorHandler->handleError($this,$param);
+ $this->getErrorHandler()->handleError($this,$param);
}
/**
@@ -724,10 +743,7 @@ class TApplicationConfiguration extends TComponent
/**
* @var array list of module configurations
*/
- private $_modules=array(
- 'request'=>array('THttpRequest',array(),null),
- 'response'=>array('THttpResponse',array(),null)
- );
+ private $_modules=array();
/**
* @var array list of service configurations
*/
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 520c4187..6ef07d03 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -116,15 +116,15 @@ class TPageService extends TComponent implements IService
/**
* @var TAssetManager asset manager
*/
- private $_assetManager;
+ private $_assetManager=null;
/**
* @var TThemeManager theme manager
*/
- private $_themeManager;
+ private $_themeManager=null;
/**
* @var TTemplateManager template manager
*/
- private $_templateManager;
+ private $_templateManager=null;
/**
* Initializes the service.
@@ -253,6 +253,11 @@ class TPageService extends TComponent implements IService
*/
public function getTemplateManager()
{
+ if(!$this->_templateManager)
+ {
+ $this->_templateManager=new TTemplateManager;
+ $this->_templateManager->init($this->_application,null);
+ }
return $this->_templateManager;
}
@@ -269,6 +274,11 @@ class TPageService extends TComponent implements IService
*/
public function getAssetManager()
{
+ if(!$this->_assetManager)
+ {
+ $this->_assetManager=new TAssetManager;
+ $this->_assetManager->init($this->_application,null);
+ }
return $this->_assetManager;
}
@@ -285,6 +295,11 @@ class TPageService extends TComponent implements IService
*/
public function getThemeManager()
{
+ if(!$this->_themeManager)
+ {
+ $this->_themeManager=new TThemeManager;
+ $this->_themeManager->init($this->_application,null);
+ }
return $this->_themeManager;
}
@@ -430,11 +445,7 @@ class TPageConfiguration extends TComponent
/**
* @var array list of module configurations
*/
- private $_modules=array(
- 'template'=>array('TTemplateManager',array(),null),
- 'asset'=>array('TAssetManager',array(),null),
- 'theme'=>array('TThemeManager',array(),null)
- );
+ private $_modules=array();
/**
* @var array list of parameters
*/