Skip to content

Instantly share code, notes, and snippets.

@borislav-angelov
Created November 18, 2013 13:23
Show Gist options
  • Save borislav-angelov/7527626 to your computer and use it in GitHub Desktop.
Save borislav-angelov/7527626 to your computer and use it in GitHub Desktop.
class Ai1ec_Event_Dispatcher {
public function register(
$hook,
Ai1ec_Event_Callback_Abstract $entity,
$priority = 10,
$accepted_args = 1
) {
if ($entity instanceof Ai1ec_Event_Callback_Filter) {
add_filter(
$hook,
array( $entity, $entity->getMethod() ),
$priority,
$accepted_args
);
} else {
add_action(
$hook,
array( $entity, $entity->getMethod() ),
$priority,
$accepted_args
);
}
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment