From fade78efc1385031e70621b70248372e1c89eb7b Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Sun, 14 Jan 2018 08:55:18 +0100 Subject: [PATCH] * fixed hooks return value * (internal) added new function: $hooks->exist($type) --- system/hooks.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/system/hooks.php b/system/hooks.php index e4cc6702..0a299e08 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -42,12 +42,12 @@ class Hook $ret = $tmp($params); }*/ - global $db, $config, $template_path, $ots, $content; + global $db, $config, $template_path, $ots, $content, $twig; if(file_exists(BASE . $this->_file)) { - require(BASE . $this->_file); + $ret = require(BASE . $this->_file); } - return true; + return $ret === null || $ret == 1 || $ret; } public function name() {return $this->_name;} @@ -71,11 +71,17 @@ class Hooks if(isset(self::$_hooks[$type])) { foreach(self::$_hooks[$type] as $name => $hook) - $ret = $hook->execute($params); + if(!$hook->execute($params)) { + $ret = false; + } } return $ret; } + + public function exist($type) { + return isset(self::$_hooks[$type]); + } public function load() {