Created
November 18, 2013 13:24
-
-
Save borislav-angelov/7527635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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