From aea4a559d72472e56adbc6f51031d0709149a7dc Mon Sep 17 00:00:00 2001 From: secretr Date: Thu, 3 Sep 2009 14:15:36 +0000 Subject: [PATCH] model/pref handlers issues --- e107_handlers/model_class.php | 23 ++++++++++++----------- e107_handlers/pref_class.php | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 168cc4648..97f51d925 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -9,8 +9,8 @@ * e107 Base Model * * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ - * $Revision: 1.3 $ - * $Date: 2009-08-27 23:37:24 $ + * $Revision: 1.4 $ + * $Date: 2009-09-03 14:15:36 $ * $Author: secretr $ */ @@ -184,9 +184,9 @@ class e_model * @param mixed $default * @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 * @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 * @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 * @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) { //data has changed diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index f78550a6b..a2867c8a3 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -9,9 +9,9 @@ * e107 Preference Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $ - * $Revision: 1.16 $ - * $Date: 2009-09-01 20:09:36 $ - * $Author: e107coders $ + * $Revision: 1.17 $ + * $Date: 2009-09-03 14:15:36 $ + * $Author: secretr $ */ if (!defined('e107_INIT')) { exit; } @@ -112,7 +112,7 @@ class e_pref extends e_model */ 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 * @return e_pref */ - public function set(string $pref_name, $value) + public function set($pref_name, $value) { global $pref; if(empty($pref_name)) { return $this; } - parent::set($pref_name, $value, false); + parent::set((string) $pref_name, $value, false); //BC if($this->alias === 'core') @@ -198,14 +198,14 @@ class e_pref extends e_model * @param mixed $value * @return e_pref */ - public function update(string $pref_name, $value) + public function update($pref_name, $value) { global $pref; if(empty($pref_name)) { return $this; } - parent::set($pref_name, $value, true); + parent::set((string) $pref_name, $value, true); //BC if($this->alias === 'core') @@ -223,13 +223,13 @@ class e_pref extends e_model * @param mixed $value * @return e_pref */ - public function add(string $pref_name, $value) + public function add($pref_name, $value) { if(empty($pref_name)) { return $this; } - $this->addData($pref_name, $value); + $this->addData((string) $pref_name, $value); return $this; } @@ -254,10 +254,10 @@ class e_pref extends e_model * @param string $pref_name * @return e_pref */ - public function remove(string $pref_name) + public function remove($pref_name) { global $pref; - parent::remove($pref_name); + parent::remove((string) $pref_name); //BC if($this->alias === 'core') @@ -328,10 +328,10 @@ class e_pref extends e_model * @param string $pref_name * @return e_pref */ - final public function removeData(string $pref_name) + final public function removeData($pref_name) { global $pref; - parent::removeData($pref_name); + parent::removeData((string) $pref_name); //BC if($this->alias === 'core')