1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

model/pref handlers issues

This commit is contained in:
secretr
2009-09-03 14:15:36 +00:00
parent 262c075a49
commit aea4a559d7
2 changed files with 26 additions and 25 deletions

View File

@@ -9,8 +9,8 @@
* e107 Base Model * e107 Base Model
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Date: 2009-08-27 23:37:24 $ * $Date: 2009-09-03 14:15:36 $
* $Author: secretr $ * $Author: secretr $
*/ */
@@ -184,9 +184,9 @@ class e_model
* @param mixed $default * @param mixed $default
* @return mixed * @return mixed
*/ */
public function get(string $key, $default = null) public function get($key, $default = null)
{ {
return $this->_getDataSimple($key, $default); return $this->_getDataSimple((string) $key, $default);
} }
/** /**
@@ -213,9 +213,9 @@ class e_model
* @param mixed $default * @param mixed $default
* @return mixed * @return mixed
*/ */
public function getPosted(string $key, $default = null) public function getPosted($key, $default = null)
{ {
return $this->_getDataSimple($key, $default, '_posted_data'); return $this->_getDataSimple((string) $key, $default, '_posted_data');
} }
/** /**
@@ -245,13 +245,13 @@ class e_model
* @param integer $index * @param integer $index
* @return string * @return string
*/ */
public function getIfPosted(string $key, $default = '', $index = null) public function getIfPosted($key, $default = '', $index = null)
{ {
if(null !== $this->getPostedData($key)) if(null !== $this->getPostedData((string) $key))
{ {
return e107::getParser()->post_toForm($this->getPostedData($key, null, $index)); return e107::getParser()->post_toForm($this->getPostedData((string) $key, null, $index));
} }
return e107::getParser()->toForm($this->getData($key, $default, $index)); return e107::getParser()->toForm($this->getData((string) $key, $default, $index));
} }
/** /**
@@ -739,8 +739,9 @@ class e_model
* @param string $data_src * @param string $data_src
* @return e_model * @return e_model
*/ */
protected function _setDataSimple(string $key, $value = null, $strict = false, $data_src = '_data') protected function _setDataSimple($key, $value = null, $strict = false, $data_src = '_data')
{ {
$key = $key.'';//smart toString
if(!$strict) if(!$strict)
{ {
//data has changed //data has changed

View File

@@ -9,9 +9,9 @@
* e107 Preference Handler * e107 Preference Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $
* $Revision: 1.16 $ * $Revision: 1.17 $
* $Date: 2009-09-01 20:09:36 $ * $Date: 2009-09-03 14:15:36 $
* $Author: e107coders $ * $Author: secretr $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -112,7 +112,7 @@ class e_pref extends e_model
*/ */
public function get($pref_name, $default = null) public function get($pref_name, $default = null)
{ {
return parent::get($pref_name, $default); return parent::get((string) $pref_name, $default);
} }
/** /**
@@ -173,14 +173,14 @@ class e_pref extends e_model
* @param mixed $value * @param mixed $value
* @return e_pref * @return e_pref
*/ */
public function set(string $pref_name, $value) public function set($pref_name, $value)
{ {
global $pref; global $pref;
if(empty($pref_name)) if(empty($pref_name))
{ {
return $this; return $this;
} }
parent::set($pref_name, $value, false); parent::set((string) $pref_name, $value, false);
//BC //BC
if($this->alias === 'core') if($this->alias === 'core')
@@ -198,14 +198,14 @@ class e_pref extends e_model
* @param mixed $value * @param mixed $value
* @return e_pref * @return e_pref
*/ */
public function update(string $pref_name, $value) public function update($pref_name, $value)
{ {
global $pref; global $pref;
if(empty($pref_name)) if(empty($pref_name))
{ {
return $this; return $this;
} }
parent::set($pref_name, $value, true); parent::set((string) $pref_name, $value, true);
//BC //BC
if($this->alias === 'core') if($this->alias === 'core')
@@ -223,13 +223,13 @@ class e_pref extends e_model
* @param mixed $value * @param mixed $value
* @return e_pref * @return e_pref
*/ */
public function add(string $pref_name, $value) public function add($pref_name, $value)
{ {
if(empty($pref_name)) if(empty($pref_name))
{ {
return $this; return $this;
} }
$this->addData($pref_name, $value); $this->addData((string) $pref_name, $value);
return $this; return $this;
} }
@@ -254,10 +254,10 @@ class e_pref extends e_model
* @param string $pref_name * @param string $pref_name
* @return e_pref * @return e_pref
*/ */
public function remove(string $pref_name) public function remove($pref_name)
{ {
global $pref; global $pref;
parent::remove($pref_name); parent::remove((string) $pref_name);
//BC //BC
if($this->alias === 'core') if($this->alias === 'core')
@@ -328,10 +328,10 @@ class e_pref extends e_model
* @param string $pref_name * @param string $pref_name
* @return e_pref * @return e_pref
*/ */
final public function removeData(string $pref_name) final public function removeData($pref_name)
{ {
global $pref; global $pref;
parent::removeData($pref_name); parent::removeData((string) $pref_name);
//BC //BC
if($this->alias === 'core') if($this->alias === 'core')