diff options
author | Vasudev Kamath <kamathvasudev@gmail.com> | 2012-06-23 08:11:35 +0530 |
---|---|---|
committer | Vasudev Kamath <kamathvasudev@gmail.com> | 2012-06-23 08:11:35 +0530 |
commit | 6e4760dd9c512147309b5e4a98d25216610f81da (patch) | |
tree | cd1ea2edf6b257e52ab8fd10c781ba600d884506 /include/plugin.php | |
parent | 11974b4d948ae5d9b9fb53970838463bd88bb9f6 (diff) | |
parent | 4e7eb36dd1e65bf481ffe30614565674cbef4fe5 (diff) | |
download | volse-hubzilla-6e4760dd9c512147309b5e4a98d25216610f81da.tar.gz volse-hubzilla-6e4760dd9c512147309b5e4a98d25216610f81da.tar.bz2 volse-hubzilla-6e4760dd9c512147309b5e4a98d25216610f81da.zip |
Merge branch 'master' of git://github.com/friendica/friendica
Diffstat (limited to 'include/plugin.php')
-rw-r--r-- | include/plugin.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/include/plugin.php b/include/plugin.php index ae8eee78a..c6b61ae6e 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -148,7 +148,9 @@ function load_hooks() { $r = q("SELECT * FROM `hook` WHERE 1"); if(count($r)) { foreach($r as $rr) { - $a->hooks[] = array($rr['hook'], $rr['file'], $rr['function']); + if(! array_key_exists($rr['hook'],$a->hooks)) + $a->hooks[$rr['hook']] = array(); + $a->hooks[$rr['hook']][] = array($rr['file'],$rr['function']); } } }} @@ -158,25 +160,24 @@ if(! function_exists('call_hooks')) { function call_hooks($name, &$data = null) { $a = get_app(); - if(count($a->hooks)) { - foreach($a->hooks as $hook) { - if($hook[HOOK_HOOK] === $name) { - @include_once($hook[HOOK_FILE]); - if(function_exists($hook[HOOK_FUNCTION])) { - $func = $hook[HOOK_FUNCTION]; - $func($a,$data); - } - else { - // remove orphan hooks - q("delete from hook where hook = '%s' and file = '$s' and function = '%s' limit 1", - dbesc($hook[HOOK_HOOK]), - dbesc($hook[HOOK_FILE]), - dbesc($hook[HOOK_FUNCTION]) - ); - } + if((is_array($a->hooks)) && (array_key_exists($name,$a->hooks))) { + foreach($a->hooks[$name] as $hook) { + @include_once($hook[0]); + if(function_exists($hook[1])) { + $func = $hook[1]; + $func($a,$data); + } + else { + // remove orphan hooks + q("delete from hook where hook = '%s' and file = '$s' and function = '%s' limit 1", + dbesc($name), + dbesc($hook[0]), + dbesc($hook[1]) + ); } } } + }} |