mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Allow hook file to be callable
This commit is contained in:
parent
42d97721bf
commit
7bab8f033c
@ -91,15 +91,25 @@ class Hook
|
||||
|
||||
public function execute($params)
|
||||
{
|
||||
extract($params);
|
||||
/*if(is_callable($this->_callback))
|
||||
{
|
||||
$tmp = $this->_callback;
|
||||
$ret = $tmp($params);
|
||||
}*/
|
||||
|
||||
global $db, $config, $template_path, $ots, $content, $twig;
|
||||
|
||||
if(is_callable($this->_file))
|
||||
{
|
||||
$params['db'] = $db;
|
||||
$params['config'] = $config;
|
||||
$params['template_path'] = $template_path;
|
||||
$params['ots'] = $ots;
|
||||
$params['content'] = $content;
|
||||
$params['twig'] = $twig;
|
||||
|
||||
$tmp = $this->_file;
|
||||
$ret = $tmp($params);
|
||||
}
|
||||
else {
|
||||
extract($params);
|
||||
|
||||
$ret = include BASE . $this->_file;
|
||||
}
|
||||
|
||||
return !isset($ret) || $ret == 1 || $ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user