예제 #1
0
파일: Item.php 프로젝트: nuclearman/yiifeed
 public function __toString()
 {
     $out = "\t\t<item>\n";
     $out .= Feed::renderTag('title', Feed::cdata($this->title), 3);
     $out .= Feed::renderTag('link', $this->link, 3);
     $out .= Feed::renderTag('description', Feed::cdata($this->description), 3);
     $out .= Feed::renderTag('guid', $this->guid, 3);
     $out .= Feed::renderTag('pubDate', Feed::convertTime($this->pubDate), 3);
     $out .= Feed::renderTag('author', $this->author[0] . ' (' . $this->author[1] . ')', 2);
     return $out . "\t\t</item>\n";
 }
예제 #2
0
파일: Feed.php 프로젝트: nuclearman/yiifeed
 public function fetch()
 {
     $this->validateChannel();
     $out = '<?xml version="1.0"?>' . "\n";
     $out .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
     $out .= "\t<channel>\n";
     $out .= Feed::renderTag('title', Feed::cdata($this->title), 2);
     $out .= Feed::renderTag('link', $this->link, 2);
     if (!empty($this->selfLink)) {
         $out .= "\t\t" . '<atom:link href="' . $this->selfLink . '" rel="self" type="application/rss+xml" />' . "\n";
     }
     $out .= Feed::renderTag('description', $this->description, 2);
     $out .= Feed::renderTag('language', $this->language, 2);
     $out .= Feed::renderTag('pubDate', Feed::convertTime($this->pubDate), 2);
     $out .= Feed::renderTag('lastBuildDate', Feed::convertTime($this->lastBuildDate), 2);
     $out .= Feed::renderTag('docs', $this->docs, 2);
     $out .= Feed::renderTag('generator', $this->generator, 2);
     $out .= Feed::renderTag('managingEditor', $this->managingEditor[0] . ' (' . $this->managingEditor[1] . ')', 2);
     $out .= Feed::renderTag('webMaster', $this->webMaster[0] . ' (' . $this->webMaster[1] . ')', 2);
     foreach ($this->items as $item) {
         $out .= $item;
     }
     $out .= "\t</channel>\n";
     $out .= '</rss>';
     return $out;
 }