Ejemplo n.º 1
0
 public function transform(FeedItem $item)
 {
     $array = ['title' => $item->getTitle(), 'link' => $item->getUrl(), 'author' => $item->getAuthor(), 'publishedDate' => $item->getDate()->format('D, d M Y H:i:s O'), 'contentSnippet' => preg_replace('/\\s+?(\\S+)?$/', '', substr(strip_tags($item->getContent()), 0, 150)), 'content' => $item->getContent()];
     if (($media = $item->getMedia()) && ($thumbnails = $media->getThumbnails()) && sizeof($thumbnails) > 0) {
         $array['thumbnail'] = $thumbnails[0]['url'];
     }
     return $array;
 }
Ejemplo n.º 2
0
 /**
  * Genereate the item id.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \AsteFeed\Parser\Item $item  Item object
  * @param \AsteFeed\Parser\Feed $feed  Feed object
  */
 public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
 {
     $id = XmlParser::getXPathResult($entry, 'atom:id', $this->namespaces) ?: XmlParser::getXPathResult($entry, 'id');
     if (!empty($id)) {
         $item->id = $this->generateId((string) current($id));
     } else {
         $item->id = $this->generateId($item->getTitle(), $item->getUrl(), $item->getContent());
     }
 }
Ejemplo n.º 3
0
 /**
  * Genereate the item id.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \AsteFeed\Parser\Item $item  Item object
  * @param \AsteFeed\Parser\Feed $feed  Feed object
  */
 public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
 {
     $item->id = $this->generateId($item->getTitle(), $item->getUrl(), $item->getContent());
 }
Ejemplo n.º 4
0
 /**
  * Genereate the item id.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \AsteFeed\Parser\Item $item  Item object
  * @param \AsteFeed\Parser\Feed $feed  Feed object
  */
 public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
 {
     $id = (string) current(XmlParser::getXPathResult($entry, 'guid'));
     if ($id) {
         $item->id = $this->generateId($id);
     } else {
         $item->id = $this->generateId($item->getTitle(), $item->getUrl(), $item->getContent());
     }
 }