Example #1
0
 /**
  * Show page notice block.
  *
  * Only show the block if a subclassed action has overrided
  * Action::showPageNotice(), or an event handler is registered for
  * the StartShowPageNotice event, in which case we assume the
  * 'page_notice' definition list is desired.  This is to prevent
  * empty 'page_notice' definition lists from being output everywhere.
  *
  * @return nothing
  */
 function showPageNoticeBlock()
 {
     $rmethod = new ReflectionMethod($this, 'showPageNotice');
     $dclass = $rmethod->getDeclaringClass()->getName();
     if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) {
         $this->elementStart('dl', array('id' => 'page_notice', 'class' => 'system_notice'));
         // TRANS: DT element for page notice. String is hidden in default CSS.
         $this->element('dt', null, _('Page notice'));
         $this->elementStart('dd');
         if (Event::handle('StartShowPageNotice', array($this))) {
             $this->showPageNotice();
             Event::handle('EndShowPageNotice', array($this));
         }
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
 }
Example #2
0
function common_enqueue_notice($notice)
{
    static $localTransports = array('omb', 'ping');
    $transports = array();
    if (common_config('sms', 'enabled')) {
        $transports[] = 'sms';
    }
    if (Event::hasHandler('HandleQueuedNotice')) {
        $transports[] = 'plugin';
    }
    // We can skip these for gatewayed notices.
    if ($notice->isLocal()) {
        $transports = array_merge($transports, $localTransports);
    }
    if (Event::handle('StartEnqueueNotice', array($notice, &$transports))) {
        $qm = QueueManager::get();
        foreach ($transports as $transport) {
            $qm->enqueue($notice, $transport);
        }
        Event::handle('EndEnqueueNotice', array($notice, $transports));
    }
    return true;
}
Example #3
0
function common_enqueue_notice($notice)
{
    static $localTransports = array('omb', 'ping');
    $transports = array();
    if (common_config('sms', 'enabled')) {
        $transports[] = 'sms';
    }
    if (Event::hasHandler('HandleQueuedNotice')) {
        $transports[] = 'plugin';
    }
    $xmpp = common_config('xmpp', 'enabled');
    if ($xmpp) {
        $transports[] = 'jabber';
    }
    // @fixme move these checks into QueueManager and/or individual handlers
    if ($notice->is_local == Notice::LOCAL_PUBLIC || $notice->is_local == Notice::LOCAL_NONPUBLIC) {
        $transports = array_merge($transports, $localTransports);
        if ($xmpp) {
            $transports[] = 'public';
        }
    }
    if (Event::handle('StartEnqueueNotice', array($notice, &$transports))) {
        $qm = QueueManager::get();
        foreach ($transports as $transport) {
            $qm->enqueue($notice, $transport);
        }
        Event::handle('EndEnqueueNotice', array($notice, $transports));
    }
    return true;
}
Example #4
0
 /**
  * Show page notice block.
  *
  * Only show the block if a subclassed action has overrided
  * Action::showPageNotice(), or an event handler is registered for
  * the StartShowPageNotice event, in which case we assume the
  * 'page_notice' definition list is desired.  This is to prevent
  * empty 'page_notice' definition lists from being output everywhere.
  *
  * @return nothing
  */
 function showPageNoticeBlock()
 {
     $rmethod = new ReflectionMethod($this, 'showPageNotice');
     $dclass = $rmethod->getDeclaringClass()->getName();
     if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) {
         $this->elementStart('div', array('id' => 'page_notice', 'class' => 'system_notice'));
         if (Event::handle('StartShowPageNotice', array($this))) {
             $this->showPageNotice();
             Event::handle('EndShowPageNotice', array($this));
         }
         $this->elementEnd('div');
     }
 }