Ejemplo n.º 1
0
 private function setAttachments($links, $extra = false)
 {
     $l = [];
     foreach ($links as $attachment) {
         $enc = [];
         $enc = (array) $attachment->attributes();
         $enc = $enc['@attributes'];
         array_push($l, $enc);
         if ($this->picture == null && isset($enc['type']) && $this->typeIsPicture($enc['type']) && isSmallPicture($enc['href'])) {
             $this->picture = $enc['href'];
         }
         if ($enc['rel'] == 'alternate' && Validator::url()->validate($enc['href'])) {
             $this->open = true;
         }
         if ((string) $attachment->attributes()->title == 'comments') {
             $substr = explode('?', substr((string) $attachment->attributes()->href, 5));
             $this->commentorigin = reset($substr);
             $this->commentnodeid = substr((string) $substr[1], 36);
         }
     }
     if ($extra) {
         array_push($l, ['rel' => 'enclosure', 'href' => $extra, 'type' => 'picture']);
     }
     if (!empty($l)) {
         $this->links = serialize($l);
     }
 }
Ejemplo n.º 2
0
 public function checkPicture()
 {
     $body = trim($this->body);
     if (Validator::url()->notEmpty()->validate($body) && isSmallPicture($body)) {
         $this->picture = $body;
     }
 }