mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
e107 class / e_model / preference handler fixes
This commit is contained in:
parent
668c25c3ed
commit
24d3826258
@ -9,9 +9,9 @@
|
|||||||
* e107 Main
|
* e107 Main
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||||
* $Revision: 1.44 $
|
* $Revision: 1.45 $
|
||||||
* $Date: 2009-09-04 20:38:36 $
|
* $Date: 2009-09-08 12:13:00 $
|
||||||
* $Author: marj_nl_fr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@ -383,13 +383,13 @@ class e107
|
|||||||
if(!isset(self::$_plug_config_arr[$plug_name.$multi_row]))
|
if(!isset(self::$_plug_config_arr[$plug_name.$multi_row]))
|
||||||
{
|
{
|
||||||
e107_require_once(e_HANDLER.'pref_class.php');
|
e107_require_once(e_HANDLER.'pref_class.php');
|
||||||
$override_id = $plug_name.($multi_row ? "_{$multi_row}_" : '');
|
$override_id = $plug_name.($multi_row ? "_{$multi_row}" : '');
|
||||||
|
|
||||||
//check (once) for custom plugin pref handler
|
//check (once) for custom plugin pref handler
|
||||||
if(is_readable(e_PLUGIN.$plug_name.'/e_pref/'.$override_id.'_pref.php'))
|
if(is_readable(e_PLUGIN.$plug_name.'/e_pref/'.$override_id.'_pref.php'))
|
||||||
{
|
{
|
||||||
require_once(e_PLUGIN.$plug_name.'/e_pref/'.$override_id.'_pref.php');
|
require_once(e_PLUGIN.$plug_name.'/e_pref/'.$override_id.'_pref.php');
|
||||||
$class_name = 'e_plugin_'.$override_id.'pref';
|
$class_name = 'e_plugin_'.$override_id.'_pref';
|
||||||
|
|
||||||
//PHPVER: string parameter for is_subclass_of require PHP 5.0.3+
|
//PHPVER: string parameter for is_subclass_of require PHP 5.0.3+
|
||||||
if(class_exists($class_name, false) && is_subclass_of('e_plugin_pref', $class_name)) //or e_pref ?
|
if(class_exists($class_name, false) && is_subclass_of('e_plugin_pref', $class_name)) //or e_pref ?
|
||||||
@ -417,7 +417,7 @@ class e107
|
|||||||
* @param mixed $default default value if preference is not found
|
* @param mixed $default default value if preference is not found
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getPlugPref($plug_name, $pref_name, $default = null)
|
public static function getPlugPref($plug_name, $pref_name = '', $default = null)
|
||||||
{
|
{
|
||||||
return empty($pref_name) ? self::getPlugConfig($plug_name)->getPref() : self::getPlugConfig($plug_name)->get($pref_name, $default);
|
return empty($pref_name) ? self::getPlugConfig($plug_name)->getPref() : self::getPlugConfig($plug_name)->get($pref_name, $default);
|
||||||
}
|
}
|
||||||
|
@ -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.7 $
|
* $Revision: 1.8 $
|
||||||
* $Date: 2009-09-04 17:04:14 $
|
* $Date: 2009-09-08 12:13:00 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ class e_model
|
|||||||
*/
|
*/
|
||||||
public function setPostedData($key = null, $data = null, $strict = false)
|
public function setPostedData($key = null, $data = null, $strict = false)
|
||||||
{
|
{
|
||||||
return $this->setData($key, $data, $strict, '_posted_data');
|
return $this->_setData($key, $data, $strict, '_posted_data');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
* 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.19 $
|
* $Revision: 1.20 $
|
||||||
* $Date: 2009-09-04 17:04:15 $
|
* $Date: 2009-09-08 12:13:00 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class e_pref extends e_model
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Merge only allowed
|
//Merge only allowed
|
||||||
if(is_array($pref_name))
|
if(is_array($pref_name))
|
||||||
{
|
{
|
||||||
@ -307,7 +307,7 @@ class e_pref extends e_model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disallow public use of addData()
|
* Disallow public use of e_model::addData()
|
||||||
* Disallow preference override
|
* Disallow preference override
|
||||||
*
|
*
|
||||||
* @param string|array $pref_name
|
* @param string|array $pref_name
|
||||||
@ -337,7 +337,19 @@ class e_pref extends e_model
|
|||||||
final public function setData($pref_name, $value = null)
|
final public function setData($pref_name, $value = null)
|
||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
parent::setData($pref_name, $value, true);
|
if(empty($pref_name))
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Merge only allowed
|
||||||
|
if(is_array($pref_name))
|
||||||
|
{
|
||||||
|
$this->mergeData($pref_name, false, false, false);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::setData($pref_name, $value, false);
|
||||||
|
|
||||||
//BC
|
//BC
|
||||||
if($this->alias === 'core')
|
if($this->alias === 'core')
|
||||||
@ -348,7 +360,7 @@ class e_pref extends e_model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disallow public use of removeData()
|
* Disallow public use of e_model::removeData()
|
||||||
* Object data reseting is not allowed
|
* Object data reseting is not allowed
|
||||||
*
|
*
|
||||||
* @param string $pref_name
|
* @param string $pref_name
|
||||||
@ -479,7 +491,7 @@ class e_pref extends e_model
|
|||||||
|
|
||||||
if($from_post)
|
if($from_post)
|
||||||
{
|
{
|
||||||
$this->mergePostedData(); //all posted data is sanitized and filtered vs structure array
|
$this->mergePostedData(); //all posted data is sanitized and filtered vs preferences array
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - LAN
|
//TODO - LAN
|
||||||
@ -776,8 +788,8 @@ class e_plugin_pref extends e_pref
|
|||||||
{
|
{
|
||||||
$plugin_id = $plugin_id.'_'.$multi_row;
|
$plugin_id = $plugin_id.'_'.$multi_row;
|
||||||
}
|
}
|
||||||
parent::__construct($plugin_id, 'plugin_'.$plugin_id);
|
parent::__construct('plugin_'.$plugin_id, $this->plugin_id);
|
||||||
if($load && e107::findPref('plug_installed/'.$this->plugin_id))
|
if($load /*&& e107::findPref('plug_installed/'.$this->plugin_id)*/)
|
||||||
{
|
{
|
||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user