예제 #1
0
 private function createFeed($hasFavicon = false)
 {
     $this->expectFeed('getTitle', $this->feedTitle);
     $this->expectFeed('getSiteUrl', $this->feedLink);
     $feed = new Feed();
     $feed->setTitle('&its a title');
     $feed->setUrl($this->url);
     $feed->setLink($this->feedLink);
     $feed->setAdded($this->time);
     $feed->setLastModified($this->modified);
     $feed->setEtag($this->etag);
     $feed->setLocation($this->location);
     if ($hasFavicon) {
         $this->faviconFactory->expects($this->once())->method('build')->will($this->returnValue($this->faviconFetcher));
         $this->faviconFetcher->expects($this->once())->method('find')->with($this->equalTo($this->feedLink))->will($this->returnValue($this->webFavicon));
         $feed->setFaviconLink($this->webFavicon);
     }
     return $feed;
 }
예제 #2
0
 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;
 }
예제 #3
0
파일: bootstrap.php 프로젝트: sbambach/news
 private function createFeed($feed)
 {
     $newFeed = new Feed();
     $newFeed->setUserId($this->userId);
     $newFeed->setFolderId($feed['folderId']);
     $newFeed->setTitle($feed['title']);
     $newFeed->setUrl($feed['url']);
     $newFeed->setLocation($feed['location']);
     $newFeed->setFaviconLink($feed['faviconLink']);
     $newFeed->setAdded($feed['added']);
     $newFeed->setLink($feed['link']);
     $newFeed->setPreventUpdate($feed['preventUpdate']);
     $newFeed->setDeletedAt($feed['deletedAt']);
     $newFeed->setArticlesPerUpdate($feed['articlesPerUpdate']);
     $newFeed->setLastModified($feed['lastModified']);
     $newFeed->setEtag($feed['etag']);
     return $this->feedMapper->insert($newFeed);
 }