diff options
author | Mario <mario@mariovavti.com> | 2023-11-22 16:21:58 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-11-22 16:21:58 +0000 |
commit | 5cb1a9dcc63b751da008e21166b51fbcaf30332a (patch) | |
tree | eaa5ced569d916feaf1cc0109bcdd41aa82f26de /include/plugin.php | |
parent | f8c631a3f0181743b1bcb2e8292379953a4c293b (diff) | |
parent | 1cfa81450cf0ce5691cdbade0a7ab4dfd76ea483 (diff) | |
download | volse-hubzilla-5cb1a9dcc63b751da008e21166b51fbcaf30332a.tar.gz volse-hubzilla-5cb1a9dcc63b751da008e21166b51fbcaf30332a.tar.bz2 volse-hubzilla-5cb1a9dcc63b751da008e21166b51fbcaf30332a.zip |
Merge branch 'dev' into 8.8RC
Diffstat (limited to 'include/plugin.php')
-rw-r--r-- | include/plugin.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/plugin.php b/include/plugin.php index 1a253d38f..f1d501001 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -459,8 +459,6 @@ function insert_hook($hook, $fn, $version = 0, $priority = 0) { * @param[in,out] string|array &$data to transmit to the callback handler */ function call_hooks($name, &$data = null) { - $a = 0; - if (isset(App::$hooks[$name])) { foreach(App::$hooks[$name] as $hook) { @@ -482,9 +480,13 @@ function call_hooks($name, &$data = null) { } $data = $checkhook['data']; } + $origfn = $hook[1]; - if($hook[0]) + + if($hook[0]) { @include_once($hook[0]); + } + if(preg_match('|^a:[0-9]+:{.*}$|s', $hook[1])) { $hook[1] = unserialize($hook[1]); } @@ -496,13 +498,12 @@ function call_hooks($name, &$data = null) { $hook[1] = explode('::',$hook[1]); } + if(is_callable($hook[1])) { $func = $hook[1]; - if($hook[3]) - $func($data); + $func($data); } else { - // Don't do any DB write calls if we're currently logging a possibly failed DB call. if(! DBA::$logging) { // The hook should be removed so we don't process it. |