Minor improvements to blobs
This commit is contained in:
@@ -46,21 +46,14 @@ class Model_Setup extends ORMOSB {
|
||||
if (! $mo->loaded())
|
||||
throw new Kohana_Exception('Unknown module :name',array(':name'=>$key));
|
||||
|
||||
static $mc = array();
|
||||
|
||||
if (! $mc)
|
||||
$mc = $this->blob($this->module_config);
|
||||
|
||||
// If $value is NULL, we are a getter
|
||||
if ($value === NULL)
|
||||
return empty($mc[$mo->id]) ? array() : $mc[$mo->id];
|
||||
return empty($this->module_config[$mo->id]) ? array() : $this->module_config[$mo->id];
|
||||
|
||||
// Store new value
|
||||
$mc[$mo->id] = $value;
|
||||
$this->module_config = $this->blob($mc,TRUE);
|
||||
$this->save();
|
||||
$this->module_config[$mo->id] = $value;
|
||||
|
||||
return $this->saved();
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,17 +63,12 @@ class Model_Setup extends ORMOSB {
|
||||
* @param $value Values to store. If NULL, retrieves the value stored, otherwise stores value.
|
||||
*/
|
||||
public function site_details($key,array $value=NULL) {
|
||||
static $sc = array();
|
||||
|
||||
if (! $sc AND $this->site_details)
|
||||
$sc = $this->blob($this->site_details);
|
||||
|
||||
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email')))
|
||||
throw new Kohana_Exception('Unknown Site Configuration Key :key',array(':key'=>$key));
|
||||
|
||||
// If $value is NULL, we are a getter
|
||||
if ($value === NULL)
|
||||
return empty($sc[$key]) ? '' : $sc[$key];
|
||||
return empty($this->site_details[$key]) ? '' : $this->site_details[$key];
|
||||
|
||||
// Store new value
|
||||
$sc[$key] = $value;
|
||||
|
Reference in New Issue
Block a user