Example #1
0
 /**
  * Add a callback to an event queue, after a given event.
  *
  * @param   string   event name
  * @param   array    existing event callback
  * @param   array    event callback
  * @return  boolean
  */
 public static function add_after($name, $existing, $callback)
 {
     if (empty(Event::$events[$name]) or ($key = array_search($existing, Event::$events[$name])) === FALSE) {
         // Just add the event if there are no events
         return Event::add($name, $callback);
     } else {
         // Insert the event immediately after the existing event
         return Event::insert_event($name, $key + 1, $callback);
     }
 }