コード例 #1
0
ファイル: GNTPRequest.php プロジェクト: iakio/gntp-notify
 /**
  * @param IO $io
  */
 protected function sendResources(IO $io)
 {
     foreach ($this->getResouces() as $resource) {
         $io->send("Identifier: " . $resource['hash']);
         $io->send("Length: " . strlen($resource['bin']));
         $io->send("");
         $io->sendBin($resource['bin']);
         $io->send("");
     }
 }
コード例 #2
0
 public function send(IO $io)
 {
     $io->send("GNTP/1.0 NOTIFY NONE");
     $io->send("Application-Name: " . $this->applicationName);
     $io->send("Notification-Name: " . $this->notificationName);
     $io->send("Notification-Title: " . $this->notificationTitle);
     if (isset($this->options['text'])) {
         $io->send("Notification-Text: " . $this->options['text']);
     }
     if (isset($this->options['icon_file'])) {
         $resource = $this->getResouce($this->options['icon_file']);
         $io->send("Notification-Icon: x-growl-resource://" . $resource['hash']);
     }
     $io->send("");
     $this->sendResources($io);
     $io->send("");
 }
コード例 #3
0
ファイル: RegisterRequest.php プロジェクト: iakio/gntp-notify
 public function send(IO $io)
 {
     $io->send("GNTP/1.0 REGISTER NONE");
     $io->send("Application-Name: " . $this->applicationName);
     if (isset($this->options['icon_file'])) {
         $resource = $this->getResouce($this->options['icon_file']);
         $io->send("Application-Icon: x-growl-resource://" . $resource['hash']);
     } elseif (isset($this->options['icon_url'])) {
         $io->send("Application-Icon: " . $this->options['icon_url']);
     }
     $io->send("Notifications-Count: " . count($this->notifications));
     $io->send("");
     foreach ($this->notifications as $name => $notification) {
         $io->send("Notification-Name: " . $name);
         if (isset($notification['icon_file'])) {
             $resource = $this->getResouce($notification['icon_file']);
             $io->send("Notification-Icon: x-growl-resource://" . $resource['hash']);
         } elseif (isset($notification['icon_url'])) {
             $io->send("Notification-Icon: " . $notification['icon_url']);
         }
         $io->send("Notification-Enabled: True");
         $io->send("");
     }
     $this->sendResources($io);
     $io->send("");
 }