mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
allow to call multiple hooks
the first hook does not return the callHook function
This commit is contained in:
parent
bb7eed2730
commit
332d6b7b6c
|
@ -72,22 +72,31 @@ class SeedDMS_View_Common {
|
|||
*/
|
||||
function callHook($hook) {
|
||||
$tmp = explode('_', get_class($this));
|
||||
$ret = null;
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) {
|
||||
if (method_exists($hookObj, $hook)) {
|
||||
switch(func_num_args()) {
|
||||
case 1:
|
||||
return $hookObj->$hook($this);
|
||||
$tmpret = $hookObj->$hook($this);
|
||||
if(is_string($tmpret))
|
||||
$ret .= $tmpret;
|
||||
break;
|
||||
case 2:
|
||||
return $hookObj->$hook($this, func_get_arg(1));
|
||||
$tmpret = $hookObj->$hook($this, func_get_arg(1));
|
||||
if(is_string($tmpret))
|
||||
$ret .= $tmpret;
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
return $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
||||
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
||||
if(is_string($tmpret))
|
||||
$ret .= $tmpret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user