Example #1
0
 /**
  * Filter HTML for entry content.
  *
  * @param Feed $feed Feed object
  * @param Item $item Item object
  */
 public function filterItemContent(Feed $feed, Item $item)
 {
     if ($this->isFilteringEnabled()) {
         $filter = Filter::html($item->getContent(), $feed->getSiteUrl());
         $filter->setConfig($this->config);
         $item->content = $filter->execute();
     } else {
         Logger::setMessage(get_called_class() . ': Content filtering disabled');
     }
 }
Example #2
0
 public function transform(Feed $feed)
 {
     return ['feedUrl' => $feed->getFeedUrl(), 'title' => $feed->getTitle(), 'link' => $feed->getSiteUrl(), 'description' => $feed->getDescription()];
 }
Example #3
0
 /**
  * Find the feed id.
  *
  * @param SimpleXMLElement      $xml  Feed xml
  * @param \AsteFeed\Parser\Feed $feed Feed object
  */
 public function findFeedId(SimpleXMLElement $xml, Feed $feed)
 {
     $feed->id = $feed->getFeedUrl() ?: $feed->getSiteUrl();
 }
Example #4
0
 /**
  * Find the item enclosure.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \AsteFeed\Parser\Item $item  Item object
  * @param \AsteFeed\Parser\Feed $feed  Feed object
  */
 public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
 {
     $enclosure = $this->findLink($entry, 'enclosure');
     if ($enclosure) {
         $item->enclosure_url = Url::resolve((string) $enclosure['href'], $feed->getSiteUrl());
         $item->enclosure_type = (string) $enclosure['type'];
     }
 }
Example #5
0
 /**
  * Find the item enclosure.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \AsteFeed\Parser\Item $item  Item object
  * @param \AsteFeed\Parser\Feed $feed  Feed object
  */
 public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
 {
     if (isset($entry->enclosure)) {
         $enclosure_url = XmlParser::getXPathResult($entry, 'feedburner:origEnclosureLink', $this->namespaces) ?: XmlParser::getXPathResult($entry, 'enclosure/@url');
         $enclosure_type = XmlParser::getXPathResult($entry, 'enclosure/@type');
         $item->enclosure_url = Url::resolve((string) current($enclosure_url), $feed->getSiteUrl());
         $item->enclosure_type = (string) current($enclosure_type);
     }
 }