From 841d4d70eb3cb363a249305c215f0439f1970684 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 28 Mar 2008 17:25:54 +0000 Subject: Corresponding fix for register_plugin_hook git-svn-id: https://code.elgg.org/elgg/trunk@284 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 6a15f2e9a..90cd11360 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -682,16 +682,18 @@ $CONFIG->hooks = array(); } else if (!isset($CONFIG->hooks[$hook]) && !empty($hook)) { $CONFIG->hooks[$hook] = array(); + } else if (!isset($CONFIG->hooks[$hook][$entity_type]) && !empty($entity_type)) { + $CONFIG->hooks[$hook][$entity_type] = array(); } - if (!empty($hook) && is_callable($function)) { + if (!empty($hook) && !empty($entity_type) && is_callable($function)) { $priority = (int) $priority; if ($priority < 0) $priority = 0; - while (isset($CONFIG->hooks[$hook][$priority])) { + while (isset($CONFIG->hooks[$hook][$entity_type][$priority])) { $priority++; } - $CONFIG->hooks[$hook][$priority] = $function; - ksort($CONFIG->hooks[$hook]); + $CONFIG->hooks[$hook][$entity_type][$priority] = $function; + ksort($CONFIG->hooks[$hook][$entity_type]); return true; } else { return false; -- cgit v1.2.3