From 5b91223ce4ece508b25397dc00e1d04ef2e1bc28 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 21 Sep 2009 14:14:55 -0400 Subject: add a hook at point of enqueuing notices --- EVENTS.txt | 7 +++++++ lib/util.php | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index 121ae175d..64c3c08c7 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -254,3 +254,10 @@ StartApiRss: after the rss element is started StartApiAtom: after the element is started - $action: action object being shown +StartEnqueueNotice: about to add a notice to the queues (good place to add a new transport) +- $notice: the notice being added +- &$transports: modifiable list of transports (as strings) to queue for + +EndEnqueueNotice: after adding a notice to the queues +- $notice: the notice being added +- $transports: modifiable list of transports to use diff --git a/lib/util.php b/lib/util.php index d9ff8b863..eb247562d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -915,11 +915,16 @@ function common_enqueue_notice($notice) } } - $qm = QueueManager::get(); + if (Event::handle('StartEnqueueNotice', array($notice, &$transports))) { - foreach ($transports as $transport) - { - $qm->enqueue($notice, $transport); + $qm = QueueManager::get(); + + foreach ($transports as $transport) + { + $qm->enqueue($notice, $transport); + } + + Event::handle('EndEnqueueNotice', array($notice, $transports)); } return true; @@ -1384,7 +1389,7 @@ function common_shorten_url($long_url) } $reflectionObj = new ReflectionClass($_shorteners[$svc]['callInfo'][0]); - $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]); + $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]); $short_url = $short_url_service->shorten($long_url); if(substr($short_url,0,7)=='http://'){ -- cgit v1.2.3-54-g00ecf