diff --git a/inc/inc.ClassControllerCommon.php b/inc/inc.ClassControllerCommon.php index 93ed4af67..403f18518 100644 --- a/inc/inc.ClassControllerCommon.php +++ b/inc/inc.ClassControllerCommon.php @@ -231,6 +231,7 @@ class SeedDMS_Controller_Common { */ function callHook($hook) { /* {{{ */ $tmps = $this->getHookClassNames(); + $ret = null; foreach($tmps as $tmp) if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)])) { $this->lasthookresult = null; @@ -238,29 +239,35 @@ class SeedDMS_Controller_Common { if (method_exists($hookObj, $hook)) { switch(func_num_args()) { case 4: - $result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3)); + $tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3)); break; case 3: - $result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2)); + $tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2)); break; case 2: - $result = $hookObj->$hook($this, func_get_arg(1)); + $tmpret = $hookObj->$hook($this, func_get_arg(1)); break; case 1: default: - $result = $hookObj->$hook($this); + $tmpret = $hookObj->$hook($this); } - if($result === false) { - return $result; + if($tmpret === false) { + return $tmpret; } - if($result !== null) { - $this->lasthookresult = $result; + if($tmpret !== null) { + $this->lasthookresult = $tmpret; + if(is_string($tmpret)) { + $ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret))); + } elseif(is_array($tmpret)) { // || is_object($tmpret)) { + $ret = ($ret === null) ? $tmpret : (is_string($ret) ? array_merge(array($ret), $tmpret) : array_merge($ret, $tmpret)); + } else + $ret = $tmpret; } } } - return $this->lasthookresult; +// return $this->lasthookresult; } - return null; + return $ret; } /* }}} */ /**