| @@ 285-302 (lines=18) @@ | ||
| 282 | * @param string $callback The callback (or class if $method is specified) |
|
| 283 | * @param string $method (optional) Method for $callback |
|
| 284 | */ |
|
| 285 | final public function addHook($event, $callback, $method=null) { |
|
| 286 | ||
| 287 | try { |
|
| 288 | ||
| 289 | $this->events->add($event, $callback, $method); |
|
| 290 | ||
| 291 | } catch (Exception $e) { |
|
| 292 | ||
| 293 | //debug error but do not stop dispatcher |
|
| 294 | $this->logger->warning( 'Unable to add hook', array( |
|
| 295 | 'CALLBACK' => $callback, |
|
| 296 | 'METHOD' => $method, |
|
| 297 | 'EVENT' => $event |
|
| 298 | ) ); |
|
| 299 | ||
| 300 | } |
|
| 301 | ||
| 302 | } |
|
| 303 | ||
| 304 | /** |
|
| 305 | * Remove an hook |
|
| @@ 310-326 (lines=17) @@ | ||
| 307 | * @param string $event The event name |
|
| 308 | * @param string $callback The callback (or class if $method is specified) |
|
| 309 | */ |
|
| 310 | final public function removeHook($event, $callback=null) { |
|
| 311 | ||
| 312 | try { |
|
| 313 | ||
| 314 | $this->events->remove($event, $callback); |
|
| 315 | ||
| 316 | } catch (Exception $e) { |
|
| 317 | ||
| 318 | //debug error but do not stop dispatcher |
|
| 319 | $this->logger->warning( 'Unable to remove hook', array( |
|
| 320 | 'CALLBACK' => $callback, |
|
| 321 | 'EVENT' => $event |
|
| 322 | ) ); |
|
| 323 | ||
| 324 | } |
|
| 325 | ||
| 326 | } |
|
| 327 | ||
| 328 | /** |
|
| 329 | * Include a plugin |
|