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();
}
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)) {