示例#1
0
 /**
  * Send header and the generated feed on the standard output.
  *
  * @param string $title
  *        	the feed title
  * @param string $description
  *        	optional, a feed description
  * @param string $url
  *        	the url where the feed is published
  */
 public function outputFeed($title, $description, $url)
 {
     $parser = $this->parserFactory->createFromWebPage();
     $feed = new RSSFeedGenerator($title, $description, $this->parserFactory->getAlboPretorioLandingPage(), $url);
     foreach ($parser as $e) {
         $item = $this->converter->getRSSItem($e);
         if (strlen($item->errors)) {
             $feed->addComment($item->errors);
         } else {
             $feed->addItemObject($item);
         }
     }
     // output
     header('Content-type: application/rss+xml; charset=UTF-8');
     /*
      * Impostazioni locali in italiano, utilizzato per la stampa di data e ora
      * (il server deve avere il locale italiano installato
      */
     setlocale(LC_TIME, 'it_IT');
     AccessLogUtils::logAccess();
     echo $feed->getFeed();
 }