コード例 #1
0
 /**
  * Render feed
  * 
  * Render RSS 2.0 feed (spec: http://blogs.law.harvard.edu/tech/rss)
  *
  * @param Angie_Feed $feed
  * @return string
  */
 function render(Angie_Feed $feed)
 {
     $result = "<rss version=\"2.0\">\n";
     //$result  = "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
     $result .= "<channel>\n";
     $feed_url = externalUrl(clean($feed->getLink()));
     //$result .= "<atom:link href=\"$feed_url\" rel=\"self\" type=\"application/rss+xml\" />\n";
     $result .= '<title>' . clean($feed->getTitle()) . "</title>\n";
     $result .= '<link>' . $feed_url . "</link>\n";
     if ($description = trim($feed->getDescription())) {
         $description = "empty";
     }
     // if
     $result .= '<description>' . clean($description) . "</description>\n";
     if ($language = trim($feed->getLanguage())) {
         $result .= '<language>' . clean($language) . "</language>\n";
     }
     // if
     foreach ($feed->getItems() as $feed_item) {
         $result .= $this->renderItem($feed_item) . "\n";
     }
     // foreach
     $result .= "</channel>\n</rss>";
     return $result;
 }
コード例 #2
0
 /**
 * Render feed
 * 
 * Render RSS 2.0 feed (spec: http://blogs.law.harvard.edu/tech/rss)
 *
 * @param Angie_Feed $feed
 * @return string
 */
 function render(Angie_Feed $feed) {
   $result  = "<rss version=\"2.0\">\n<channel>\n";
   $result .= '<title>' . clean($feed->getTitle()) . "</title>\n";
   $result .= '<link>' . clean($feed->getLink()) . "</link>\n";
   if($description = trim($feed->getDescription())) {
     $result .= '<description>' . clean($description) . "</description>\n";
   } // if
   if($language = trim($feed->getLanguage())) {
     $result .= '<language>' . clean($language) . "</language>\n";
   } // if
   
   foreach($feed->getItems() as $feed_item) {
     $result .= $this->renderItem($feed_item) . "\n";
   } // foreach
   
   $result .= "</channel>\n</rss>";
   return $result;
 } // render