params = $params; } function setParams($params) { $this->params = $params; } function setParam($name, $value) { $this->params[$name] = $value; } function unsetParam($name) { if(isset($this->params[$name])) unset($this->params[$name]); } function run() { } /** * Call a controller hook * * @param $hook string name of hook * @return mixed false if one of the hooks fails, * true if all hooks succedded, * null if no hook was called */ function callHook($hook) { /* {{{ */ $tmp = explode('_', get_class($this)); if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) { foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) { if (method_exists($hookObj, $hook)) { switch(func_num_args()) { case 2: $result = $hookObj->$hook($this, func_get_arg(1)); break; case 1: default: $result = $hookObj->$hook($this); } if($result === false) { return $result; } } } return true; } return null; } /* }}} */ /** * Check if a hook is registered * * @param $hook string name of hook * @return mixed false if one of the hooks fails, * true if all hooks succedded, * null if no hook was called */ function hasHook($hook) { /* {{{ */ $tmp = explode('_', get_class($this)); if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) { foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) { if (method_exists($hookObj, $hook)) { return true; } } } return false; } /* }}} */ }