Exemple #1
0
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     if ($notification instanceof TitleAwareInterface) {
         $command = $this->shellCommand . ' -e \'display notification "' . addslashes($notification->message()) . '" with title "' . addslashes($notification->title()) . '"\'';
     } else {
         $command = $this->shellCommand . ' -e \'display notification "' . addslashes($notification->message()) . '"\'';
     }
     exec($command . ' > /dev/null', $output, $code);
     return $code === 0;
 }
Exemple #2
0
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     if ($notification instanceof AttributeAwareInterface) {
         $notify = $notification->attribute('notify');
         $format = $notification->attribute('format') ?: HipChat::FORMAT_HTML;
     } else {
         $format = HipChat::FORMAT_HTML;
         $notify = true;
     }
     return $this->hipchat->message_room($this->room, $this->from, $notification->message(), $notify, $this->levelMapping[$level], $format);
 }
Exemple #3
0
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     if (!headers_sent()) {
         if ($notification instanceof AttributeAwareInterface) {
             $options = $notification->attributes();
         } else {
             $options = [];
         }
         if ($notification instanceof TitleAwareInterface) {
             $options['header'] = $notification->title();
         }
         header('X-' . $this->identifier . '-Notification-' . self::$messageindex++ . ':' . json_encode(['message' => $notification->message(), 'type' => isset($this->levelMapping[$level]) ? $this->levelMapping[$level] : self::STANDARD, 'options' => $options]));
         return true;
     }
     return true;
 }
Exemple #4
0
 /**
  * Handle a notification.
  *
  * @return  boolean
  */
 public function handle(NotificationInterface $notification, $level)
 {
     if ($notification instanceof AttributeAwareInterface) {
         $options = $notification->attributes();
     } else {
         $options = [];
     }
     if ($notification instanceof TitleAwareInterface) {
         $options['header'] = $notification->title();
     }
     $variable = ['message' => $notification->message(), 'type' => isset($this->levelMapping[$level]) ? $this->levelMapping[$level] : self::STANDARD, 'options' => $options];
     $current = $this->smarty->getTemplateVars($this->var);
     if (!$current) {
         $this->smarty->assign($this->var, [$variable]);
     } else {
         $this->smarty->append($this->var, $variable);
     }
     return true;
 }
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     if ($notification instanceof TitleAwareInterface) {
         $command = $this->shellCommand . ' ' . escapeshellarg($notification->message()) . ' ' . escapeshellarg($notification->title());
     } else {
         $command = $this->shellCommand . ' ' . escapeshellarg($notification->message());
     }
     if ($notification instanceof AttributeAwareInterface) {
         $expiry = (int) $notification->attribute('expiry');
         if ($expiry) {
             $command .= "-t " . $expiry . " ";
         }
         $icon = $notification->attribute('icon');
         if ($expiry) {
             $command .= "-i " . $icon . " ";
         }
     }
     $command .= "-u " . $this->levelMapping[$level] . " ";
     exec($command . ' > /dev/null', $output, $code);
     return $code === 0;
 }
Exemple #6
0
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     $this->memory[$level][] = $notification->message();
     return true;
 }
Exemple #7
0
 /**
  * Handle a notification
  *
  * @return bool
  */
 public function handle(NotificationInterface $notification, $level)
 {
     syslog($this->levelMapping[$level], $notification->message());
     return true;
 }