aboutsummaryrefslogtreecommitdiffstats
path: root/include/plugin.php
diff options
context:
space:
mode:
authorZvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net>2012-06-21 13:38:14 +0300
committerZvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net>2012-06-21 13:38:14 +0300
commit5e3e3915e347e4c298498ce0a8c493b9cd03201b (patch)
tree5a7aabb78964ab82caebac84299015af4f87882d /include/plugin.php
parentd20cdf09eafbc57c1b6dbcb78a5cdaa731ae876d (diff)
parent53c9ea760659b39deeab9cff5d4f26d5abd63d31 (diff)
downloadvolse-hubzilla-5e3e3915e347e4c298498ce0a8c493b9cd03201b.tar.gz
volse-hubzilla-5e3e3915e347e4c298498ce0a8c493b9cd03201b.tar.bz2
volse-hubzilla-5e3e3915e347e4c298498ce0a8c493b9cd03201b.zip
Merge git://github.com/friendica/friendica
Diffstat (limited to 'include/plugin.php')
-rw-r--r--include/plugin.php35
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])
+ );
}
}
}
+
}}