20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
22 include_once XOOPS_ROOT_PATH . '/kernel/
object.php';
34 var $handlers = array();
39 function __construct()
46 function XoopsModelFactory()
55 function getInstance()
58 if (!isset($instance)) {
60 $instance =
new $class();
74 function loadHandler($ohander, $name, $args = null)
77 if (!isset($handlers[$name])) {
78 if (file_exists(
$file = dirname(__FILE__) .
'/' . $name .
'.php')) {
80 $className =
'XoopsModel' . ucfirst($name);
83 $handler = XoopsModel::loadHandler($name);
86 trigger_error(
'Handler not found in file ' . __FILE__ .
'at line ' . __LINE__, E_USER_WARNING);
91 $handlers[$name]->setHandler($ohander);
92 if (!empty($args) && is_array($args) && is_a($handlers[$name],
'XoopsModelAbstract')) {
93 $handlers[$name]->setVars($args);
95 return $handlers[$name];
149 if (is_object(
$handler) && is_a(
$handler,
'XoopsPersistableObjectHandler')) {
164 if (!empty($args) && is_array($args)) {
165 foreach ($args as $key => $value) {
166 $this->$key = $value;