aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-22 10:48:16 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-22 10:48:16 +0000
commit8cd947d1734727c21cd6450c4fb987279204328e (patch)
treec6eba1631461db8e0e4a032fdd3a8661cb0103eb /engine/lib
parente37975e154f8116bb220a2d4f6b4e603c4fe6579 (diff)
downloadelgg-8cd947d1734727c21cd6450c4fb987279204328e.tar.gz
elgg-8cd947d1734727c21cd6450c4fb987279204328e.tar.bz2
better creation of event and plugin hook registration arrays
git-svn-id: http://code.elgg.org/elgg/trunk@7115 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index b73a6599a..c66d952ca 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -982,9 +982,11 @@ function register_elgg_event_handler($event, $object_type, $function, $priority
if (!isset($CONFIG->events)) {
$CONFIG->events = array();
- } else if (!isset($CONFIG->events[$event])) {
+ }
+ if (!isset($CONFIG->events[$event])) {
$CONFIG->events[$event] = array();
- } else if (!isset($CONFIG->events[$event][$object_type])) {
+ }
+ if (!isset($CONFIG->events[$event][$object_type])) {
$CONFIG->events[$event][$object_type] = array();
}
@@ -1156,16 +1158,18 @@ function trigger_elgg_event($event, $object_type, $object = null) {
function register_plugin_hook($hook, $type, $callback, $priority = 500) {
global $CONFIG;
+ if (empty($hook) || empty($type)) {
+ return FALSE;
+ }
+
if (!isset($CONFIG->hooks)) {
$CONFIG->hooks = array();
- } else if (!isset($CONFIG->hooks[$hook]) && !empty($hook)) {
+ }
+ if (!isset($CONFIG->hooks[$hook])) {
$CONFIG->hooks[$hook] = array();
- } else if (!isset($CONFIG->hooks[$hook][$type]) && !empty($type)) {
- $CONFIG->hooks[$hook][$type] = array();
}
-
- if (empty($hook) && empty($type)) {
- return FALSE;
+ if (!isset($CONFIG->hooks[$hook][$type])) {
+ $CONFIG->hooks[$hook][$type] = array();
}
if (!is_callable($callback)) {