protected function buildFeed($parsedFeed, $url, $getFavicon, $modified, $etag, $location) { $feed = new Feed(); $link = $parsedFeed->getSiteUrl(); if (!$link) { $link = $location; } // unescape content because angularjs helps against XSS $title = strip_tags($this->decodeTwice($parsedFeed->getTitle())); $feed->setTitle($title); $feed->setUrl($url); // the url used to add the feed $feed->setLocation($location); // the url where the feed was found $feed->setLink($link); // <link> attribute in the feed $feed->setLastModified($modified); $feed->setEtag($etag); $feed->setAdded($this->time->getTime()); if ($getFavicon) { $faviconFetcher = $this->faviconFactory->build(); $favicon = $faviconFetcher->find($feed->getLink()); $feed->setFaviconLink($favicon); } return $feed; }
protected function buildFeed($simplePieFeed, $url, $getFavicon) { $feed = new Feed(); // unescape content because angularjs helps against XSS $title = strip_tags($this->decodeTwice($simplePieFeed->get_title())); // if there is no title use the url if (!$title) { $title = $url; } $feed->setTitle($title); $feed->setUrl($url); $link = $simplePieFeed->get_permalink(); if (!$link) { $link = $url; } $feed->setLink($link); $feed->setAdded($this->time->getTime()); if ($getFavicon) { // use the favicon from the page first since most feeds use a weird image $favicon = $this->faviconFetcher->fetch($feed->getLink()); if (!$favicon) { $favicon = $simplePieFeed->get_image_url(); } $feed->setFaviconLink($favicon); } return $feed; }