示例#1
0
 function saveDataFromInput()
 {
     $page = Idno::site()->currentPage();
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->likeof = $page->getInput('like-of');
     if ($this->likeof) {
         foreach ((array) $this->likeof as $likeofurl) {
             $this->syndicatedto = Webmention::addSyndicatedReplyTargets($likeofurl, $this->syndicatedto);
         }
     }
     $this->description = $page->getInput('description');
     if (empty($this->description)) {
         $result = \IdnoPlugins\Reactions\Pages\Fetch::fetch($this->likeof);
         if (!empty($result['description'])) {
             $this->description = $result['description'];
         }
     }
     $this->setAccess($page->getInput('access'));
     Idno::site()->logging()->log("saving like. new: {$new}");
     if ($this->publish($new)) {
         Idno::site()->logging()->log("sending webmentions from {$this->getURL()} to {$this->likeof}");
         Webmention::sendWebmentionPayload($this->getURL(), $this->likeof);
     }
     return true;
 }
示例#2
0
 function saveDataFromInput()
 {
     $page = Idno::site()->currentPage();
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->repostof = $page->getInput('repost-of');
     if ($this->repostof) {
         foreach ((array) $this->repostof as $repostofurl) {
             $this->syndicatedto = Webmention::addSyndicatedReplyTargets($repostofurl, $this->syndicatedto);
         }
     }
     $this->description = $page->getInput('description');
     $this->body = $page->getInput('body');
     if (empty($this->description) && empty($this->body)) {
         $result = \IdnoPlugins\Reactions\Pages\Fetch::fetch($this->repostof);
         if (isset($result['description'])) {
             $this->description = $result['description'];
         }
         if (isset($result['content'])) {
             $this->body = $result['content'];
         }
     }
     $this->setAccess($page->getInput('access'));
     if ($this->publish($new)) {
         Webmention::sendWebmentionPayload($this->getURL(), $this->repostof);
     }
     return true;
 }