* fixed hooks return value

* (internal) added new function: $hooks->exist($type)
This commit is contained in:
slawkens1 2018-01-14 08:55:18 +01:00
parent d04f2b7965
commit fade78efc1

View File

@ -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,12 +71,18 @@ 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()
{
global $db;