コード例 #1
0
ファイル: GetItem.php プロジェクト: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $to = current(explode('/', (string) $stanza->attributes()->to));
     $from = $this->_to;
     $node = $this->_node;
     if ($stanza->pubsub->items->item) {
         $post = false;
         foreach ($stanza->pubsub->items->item as $item) {
             if (isset($item->entry) && (string) $item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') {
                 $p = new \Modl\Postn();
                 $promise = $p->set($item, $from, false, $node);
                 $promise->done(function () use($p) {
                     $pd = new \Modl\PostnDAO();
                     $pd->set($p);
                     $post = true;
                     if (is_array($this->_askreply)) {
                         $this->pack(['origin' => $this->_askreply['origin'], 'node' => $this->_askreply['node'], 'nodeid' => $this->_askreply['nodeid']]);
                         $this->deliver();
                     } else {
                         $this->pack($p);
                         $this->event('post', $this->packet);
                     }
                     $this->pack(['server' => $this->_to, 'node' => $this->_node]);
                     $this->deliver();
                 });
             }
         }
     } else {
         $pd = new PostDelete();
         $pd->setTo($this->_to)->setNode($this->_node)->setId($this->_id);
         $pd->handle($stanza);
     }
 }
コード例 #2
0
ファイル: CommentsGet.php プロジェクト: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new Event();
     $node = (string) $stanza->pubsub->items->attributes()->node;
     list($xmlns, $parent) = explode("/", $node);
     if ($stanza->pubsub->items->item) {
         foreach ($stanza->pubsub->items->item as $item) {
             $p = new \Modl\Postn();
             $p->set($item, $this->_to, false, $node);
             $pd = new \Modl\PostnDAO();
             $pd->set($p);
         }
     }
     $this->pack(['server' => $this->_to, 'node' => $this->_node, 'id' => $this->_id]);
     $this->deliver();
 }