/** * Bind to an event. */ function bind($event, $callback, $args = null) { if (!isset($this->events[$event])) { $this->events[$event] = array(); } $idx = PSU::_filter_build_unique_id($event, $callback, 10); if ($this->debug) { if (is_array($callback)) { echo "[", $this->ident, "] Binding ", get_class($callback[0]), "->", $callback[1], "<br>"; } else { echo "[", $this->ident, "] Binding ", $callback, "<br>"; } } $this->events[$event][$idx] = array($callback, $args); }