triggerregistry.inc.php
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
class KTTriggerRegistry {
var $triggers = array();
// {{{ getSingleton
function &getSingleton () {
if (!KTUtil::arrayGet($GLOBALS, 'oKTTriggerRegistry')) {
$GLOBALS['oKTTriggerRegistry'] = new KTTriggerRegistry;
}
return $GLOBALS['oKTTriggerRegistry'];
}
// }}}
// {{{ registerTrigger
function registerTrigger($action, $slot, $name, $nsname, $path = "") {
if (!array_key_exists($action, $this->triggers)) {
$this->triggers[$action] = array();
}
if (!array_key_exists($slot, $this->triggers[$action])) {
$this->triggers[$action][$slot] = array();
}
$this->triggers[$action][$slot][$nsname] = array($name, $path, $nsname);
}
// }}}
// {{{ getTriggers
function getTriggers($action, $slot) {
$ret = array();
if (array_key_exists($action, $this->triggers)) {
if (array_key_exists($slot, $this->triggers[$action])) {
$ret = $this->triggers[$action][$slot];
}
}
if (empty($ret)) {
return array();
}
return $ret;
}
// }}}
}
?>