Pluf_Signal::connect('Pluf_Template_Context_Request::construct',
array('Pluf_Middleware_Session', 'processContext'));
-*/
\ No newline at end of file
+*/
public $data = array();
public $touched = false;
- function clear(){
+ function clear()
+ {
$this->data = array();
$this->touched = true;
}
- function setData($key, $value=null){
+ function getSessionData()
+ {
+ return unserialize($this->session_data);
+ }
+
+ private function unserializeData()
+ {
+ if (!$this->data)
+ $this->data = $this->getSessionData();
+ }
+
+ function setData($key, $value=null)
+ {
+ $this->unserializeData();
if (is_null($value)) {
unset($this->data[$key]);
} else {
$this->touched = true;
}
- function getSessionData(){
- return unserialize($this->session_data);
- }
-
- function getData($key=null, $default=''){
- if (is_null($key))
+ function getData($key=null, $default='')
+ {
+ if (is_null($key))
return parent::getData();
+ $this->unserializeData();
if (isset($this->data[$key])) {
return $this->data[$key];
} else {
}
$this->expire_data = gmdate('Y-m-d H:i:s', time()+31536000);
}
-}
\ No newline at end of file
+}
+