summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TPageStatePersister.php
diff options
context:
space:
mode:
authorxue <>2005-12-28 20:17:54 +0000
committerxue <>2005-12-28 20:17:54 +0000
commite8b60312037e54c34a06d6f57d7c21946cf3cd1f (patch)
treea6f35f5d4bb921998ca306602a33fc03ba47c4b5 /framework/Web/UI/TPageStatePersister.php
parent930c51a6d618d487105cd46c517f36c3b1fe3b44 (diff)
Modified the way to access application singleton.
IService and IModule interfaces are also adjusted accordingly.
Diffstat (limited to 'framework/Web/UI/TPageStatePersister.php')
-rw-r--r--framework/Web/UI/TPageStatePersister.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/framework/Web/UI/TPageStatePersister.php b/framework/Web/UI/TPageStatePersister.php
index 07e1eba1..988a2938 100644
--- a/framework/Web/UI/TPageStatePersister.php
+++ b/framework/Web/UI/TPageStatePersister.php
@@ -2,20 +2,17 @@
class TPageStatePersister extends TModule implements IStatePersister
{
- private $_application;
private $_privateKey=null;
/**
* Initializes the service.
* This method is required by IModule interface.
- * @param TApplication application
* @param TXmlElement module configuration
*/
- public function init($application, $config)
+ public function init($config=null)
{
- parent::init($application,$config);
- $this->_application=$application;
- $application->getService()->setPageStatePersister($this);
+ parent::init($config);
+ $this->getService()->setPageStatePersister($this);
}
public function save($state)
@@ -26,12 +23,12 @@ class TPageStatePersister extends TModule implements IStatePersister
$data=gzcompress($hmac.$data);
else
$data=$hmac.$data;
- $this->_application->getService()->getRequestedPage()->getClientScript()->registerHiddenField(TPage::FIELD_PAGESTATE,base64_encode($data));
+ $this->getService()->getRequestedPage()->getClientScript()->registerHiddenField(TPage::FIELD_PAGESTATE,base64_encode($data));
}
public function load()
{
- $str=base64_decode($this->_application->getRequest()->getItems()->itemAt(TPage::FIELD_PAGESTATE));
+ $str=base64_decode($this->getApplication()->getRequest()->getItems()->itemAt(TPage::FIELD_PAGESTATE));
if($str==='')
return null;
if(extension_loaded('zlib'))
@@ -60,10 +57,10 @@ class TPageStatePersister extends TModule implements IStatePersister
{
if(empty($this->_privateKey))
{
- if(($this->_privateKey=$this->_application->getGlobalState('prado:pagestatepersister:privatekey'))===null)
+ if(($this->_privateKey=$this->getApplication()->getGlobalState('prado:pagestatepersister:privatekey'))===null)
{
$this->_privateKey=$this->generatePrivateKey();
- $this->_application->setGlobalState('prado:pagestatepersister:privatekey',$this->_privateKey,null);
+ $this->getApplication()->setGlobalState('prado:pagestatepersister:privatekey',$this->_privateKey,null);
}
}
return $this->_privateKey;