コード例 #1
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<feed version=\"0.1\" xmlns=\"http://www.tbray.org/ongoing/pie/0.1/pie.rnc\">\n";
     $feed .= "    <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->title), 100) . "</title>\n";
     $this->truncSize = 500;
     $feed .= "    <subtitle>" . $this->getDescription() . "</subtitle>\n";
     $feed .= "    <link>" . $this->link . "</link>\n";
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "    <entry>\n";
         $feed .= "        <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n";
         $feed .= "        <link>" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "</link>\n";
         $itemDate = new FeedDate($this->items[$i]->date);
         $feed .= "        <created>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</created>\n";
         $feed .= "        <issued>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</issued>\n";
         $feed .= "        <modified>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</modified>\n";
         $feed .= "        <id>" . FeedCreator::htmlspecialchars($this->items[$i]->guid) . "</id>\n";
         if ($this->items[$i]->author != "") {
             $feed .= "        <author>\n";
             $feed .= "            <name>" . FeedCreator::htmlspecialchars($this->items[$i]->author) . "</name>\n";
             if ($this->items[$i]->authorEmail != "") {
                 $feed .= "            <email>" . $this->items[$i]->authorEmail . "</email>\n";
             }
             $feed .= "        </author>\n";
         }
         $feed .= "        <content type=\"text/html\" xml:lang=\"en-us\">\n";
         $feed .= "            <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() . "</div>\n";
         $feed .= "        </content>\n";
         $feed .= "    </entry>\n";
     }
     $feed .= "</feed>\n";
     return $feed;
 }
コード例 #2
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
     if (!empty($this->language)) {
         $feed .= " xml:lang=\"" . $this->language . "\"";
     }
     $feed .= ">\n";
     $feed .= "    <title>" . FeedCreator::htmlspecialchars($this->title) . "</title>\n";
     $feed .= "    <subtitle>" . FeedCreator::htmlspecialchars($this->description) . "</subtitle>\n";
     $feed .= "    <link rel=\"alternate\" type=\"text/html\" href=\"" . FeedCreator::htmlspecialchars($this->link) . "\"/>\n";
     $feed .= "    <id>" . FeedCreator::htmlspecialchars($this->link) . "</id>\n";
     $now = new FeedDate();
     $feed .= "    <updated>" . FeedCreator::htmlspecialchars($now->iso8601()) . "</updated>\n";
     if (!empty($this->editor)) {
         $feed .= "    <author>\n";
         $feed .= "        <name>" . $this->editor . "</name>\n";
         if (!empty($this->editorEmail)) {
             $feed .= "        <email>" . $this->editorEmail . "</email>\n";
         }
         $feed .= "    </author>\n";
     }
     $feed .= "    <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
     $feed .= "<link rel=\"self\" type=\"application/atom+xml\" href=\"" . $this->syndicationURL . "\" />\n";
     $feed .= $this->_createAdditionalElements($this->additionalElements, "    ");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "    <entry>\n";
         $feed .= "        <title>" . FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n";
         $feed .= "        <link rel=\"alternate\" type=\"text/html\" href=\"" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "\"/>\n";
         if ($this->items[$i]->date == "") {
             $this->items[$i]->date = time();
         }
         $itemDate = new FeedDate($this->items[$i]->date);
         $feed .= "        <published>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</published>\n";
         $feed .= "        <updated>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</updated>\n";
         $feed .= "        <id>" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "</id>\n";
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
         if (!empty($this->items[$i]->author)) {
             $feed .= "        <author>\n";
             $feed .= "            <name>" . FeedCreator::htmlspecialchars($this->items[$i]->author) . "</name>\n";
             $feed .= "        </author>\n";
         }
         if (!empty($this->items[$i]->description)) {
             $feed .= "        <summary type=\"html\">" . FeedCreator::htmlspecialchars($this->items[$i]->description) . "</summary>\n";
         }
         if (!empty($this->items[$i]->enclosure)) {
             $feed .= "        <link rel=\"enclosure\" href=\"" . $this->items[$i]->enclosure->url . "\" type=\"" . $this->items[$i]->enclosure->type . "\"  length=\"" . $this->items[$i]->enclosure->length . "\" />\n";
         }
         $feed .= "    </entry>\n";
     }
     $feed .= "</feed>\n";
     return $feed;
 }
コード例 #3
0
 function createFeed()
 {
     global $config, $lang;
     $now = new FeedDate();
     $this->descriptionTruncSize = 500;
     $feed = $this->_createGeneratorComment();
     $feed .= '<klip>' . "\n";
     $feed .= '	<owner>' . "\n";
     $feed .= '		<author>' . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->editor), 100) . '</author>' . "\n";
     $feed .= '		<copyright>' . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->copyright), 100) . '</copyright>' . "\n";
     if (!empty($this->editorEmail)) {
         $feed .= '		<email>' . $this->editorEmail . '</email>' . "\n";
     }
     $feed .= '		<web>' . $this->link . '</web>' . "\n";
     $feed .= '	</owner>' . "\n";
     $feed .= '	<identity>' . "\n";
     $feed .= '		<title>' . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->title), 100) . '</title>' . "\n";
     $feed .= '		<uniqueid>' . md5($config['cryptkey']) . '</uniqueid>' . "\n";
     $feed .= '		<version>1.0</version>' . "\n";
     $feed .= '		<lastmodified>' . FeedCreator::htmlspecialchars($now->v0001()) . '</lastmodified>' . "\n";
     $feed .= '		<description>' . $this->getDescription() . '</description>' . "\n";
     $feed .= '		<keywords>Viscacha ' . FeedCreator::htmlspecialchars($this->title) . '</keywords>' . "\n";
     $feed .= '	</identity>' . "\n";
     $feed .= '	<locations>' . "\n";
     $feed .= '		<defaultlink>' . $this->link . '</defaultlink>' . "\n";
     $feed .= '		<contentsource>' . $config['furl'] . '/external.php?action=KLIPFOOD</contentsource>' . "\n";
     $feed .= '		<icon>' . $config['furl'] . '/' . $config['syndication_klipfolio_icon'] . '</icon>' . "\n";
     $feed .= '		<banner>' . $config['furl'] . '/' . $config['syndication_klipfolio_banner'] . '</banner>' . "\n";
     $feed .= '		<help></help>' . "\n";
     $feed .= '		<kliplocation>' . $config['furl'] . '/external.php?action=KLIPFOLIO</kliplocation>' . "\n";
     $feed .= '	</locations>' . "\n";
     $feed .= '	<setup>' . "\n";
     $feed .= '		<refresh>' . FeedCreator::htmlspecialchars($this->ttl) . '</refresh>' . "\n";
     if (!check_hp($_SERVER['HTTP_REFERER'])) {
         $_SERVER['HTTP_REFERER'] = $this->link;
     }
     $feed .= '		<referer>' . FeedCreator::htmlspecialchars($_SERVER['HTTP_REFERER']) . '</referer>' . "\n";
     $feed .= '		<country>' . $this->language . '</country>' . "\n";
     $feed .= '		<language>' . $this->language . '</language>' . "\n";
     $feed .= '	</setup>' . "\n";
     $feed .= '	<messages>' . "\n";
     $feed .= '		<loading>Getting data...</loading>' . "\n";
     $feed .= '		<nodata>No items to display.</nodata>' . "\n";
     $feed .= '	</messages>' . "\n";
     $feed .= "</klip>\n";
     return $feed;
 }
コード例 #4
0
 function createFeed()
 {
     global $config, $lang;
     $now = new FeedDate();
     $this->descriptionTruncSize = 500;
     $feed = $this->_createGeneratorComment();
     $feed .= '<?xml version="1.0"?>' . "\n";
     $feed .= '<klipfood>' . "\n";
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= '	<item>' . "\n";
         $feed .= '		<title>' . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . '</title>' . "\n";
         $feed .= '		<link>' . FeedCreator::htmlspecialchars($this->items[$i]->link) . '</link>' . "\n";
         $feed .= '		<note>' . $this->items[$i]->getDescription() . '</note>' . "\n";
         $feed .= '	</item>' . "\n";
     }
     $feed .= '</klipfood>' . "\n";
     return $feed;
 }
コード例 #5
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n";
     $feed .= "    <head>\n";
     $feed .= "        <title>" . FeedCreator::htmlspecialchars($this->title) . "</title>\n";
     if ($this->pubDate != "") {
         $date = new FeedDate($this->pubDate);
         $feed .= "         <dateCreated>" . $date->rfc822() . "</dateCreated>\n";
     }
     if ($this->lastBuildDate != "") {
         $date = new FeedDate($this->lastBuildDate);
         $feed .= "         <dateModified>" . $date->rfc822() . "</dateModified>\n";
     }
     if ($this->editor != "") {
         $feed .= "         <ownerName>" . $this->editor . "</ownerName>\n";
     }
     if ($this->editorEmail != "") {
         $feed .= "         <ownerEmail>" . $this->editorEmail . "</ownerEmail>\n";
     }
     $feed .= "    </head>\n";
     $feed .= "    <body>\n";
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "    <outline type=\"rss\" ";
         $title = FeedCreator::htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", "  ")));
         $feed .= " title=\"" . $title . "\"";
         $feed .= " text=\"" . $title . "\"";
         //$feed.= " description=\"".FeedCreator::htmlspecialchars($this->items[$i]->description)."\"";
         $feed .= " url=\"" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "\"";
         $feed .= "/>\n";
     }
     $feed .= "    </body>\n";
     $feed .= "</opml>\n";
     return $feed;
 }
コード例 #6
0
 /**
  * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
  * The feed will contain all items previously added in the same order.
  * @return    string    the feed's complete text
  */
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<rss version=\"" . $this->RSSVersion . "\">\n";
     $feed .= "    <channel>\n";
     $feed .= "        <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->title), 100) . "</title>\n";
     $this->descriptionTruncSize = 500;
     $feed .= "        <description>" . $this->getDescription() . "</description>\n";
     $feed .= "        <link>" . $this->link . "</link>\n";
     $now = new FeedDate();
     $feed .= "        <lastBuildDate>" . FeedCreator::htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n";
     $feed .= "        <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
     if ($this->image != null) {
         $feed .= "        <image>\n";
         $feed .= "            <url>" . $this->image->url . "</url>\n";
         $feed .= "            <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->image->title), 100) . "</title>\n";
         $feed .= "            <link>" . $this->image->link . "</link>\n";
         if ($this->image->width != "") {
             $feed .= "            <width>" . $this->image->width . "</width>\n";
         }
         if ($this->image->height != "") {
             $feed .= "            <height>" . $this->image->height . "</height>\n";
         }
         if ($this->image->description != "") {
             $feed .= "            <description>" . $this->image->getDescription() . "</description>\n";
         }
         $feed .= "        </image>\n";
     }
     if ($this->language != "") {
         $feed .= "        <language>" . $this->language . "</language>\n";
     }
     if ($this->copyright != "") {
         $feed .= "        <copyright>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->copyright), 100) . "</copyright>\n";
     }
     if (!empty($this->editor) && !empty($this->editorEmail)) {
         $feed .= "        <managingEditor>" . FeedCreator::htmlspecialchars($this->editorEmail) . " (" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->editor), 100) . ")</managingEditor>\n";
     }
     if ($this->webmaster != "") {
         $feed .= "        <webMaster>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->webmaster), 100) . "</webMaster>\n";
     }
     if ($this->pubDate != "") {
         $pubDate = new FeedDate($this->pubDate);
         $feed .= "        <pubDate>" . FeedCreator::htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n";
     }
     if ($this->category != "") {
         $feed .= "        <category>" . FeedCreator::htmlspecialchars($this->category) . "</category>\n";
     }
     if ($this->docs != "") {
         $feed .= "        <docs>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->docs), 500) . "</docs>\n";
     }
     if ($this->ttl != "") {
         $feed .= "        <ttl>" . FeedCreator::htmlspecialchars($this->ttl) . "</ttl>\n";
     }
     if ($this->rating != "") {
         $feed .= "        <rating>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->rating), 500) . "</rating>\n";
     }
     if ($this->skipHours != "") {
         $feed .= "        <skipHours>" . FeedCreator::htmlspecialchars($this->skipHours) . "</skipHours>\n";
     }
     if ($this->skipDays != "") {
         $feed .= "        <skipDays>" . FeedCreator::htmlspecialchars($this->skipDays) . "</skipDays>\n";
     }
     $feed .= $this->_createAdditionalElements($this->additionalElements, "    ");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "        <item>\n";
         $feed .= "            <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n";
         $feed .= "            <link>" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "</link>\n";
         $feed .= "            <description>" . $this->items[$i]->getDescription() . "</description>\n";
         if (!empty($this->items[$i]->author) && !empty($this->items[$i]->authorEmail)) {
             $feed .= "            <author>" . FeedCreator::htmlspecialchars($this->items[$i]->author) . " &lt;" . $this->items[$i]->authorEmail . "&gt;</author>\n";
         }
         /*
         // on hold
         if ($this->items[$i]->source!="") {
         		$feed.= "            <source>".FeedCreator::htmlspecialchars($this->items[$i]->source)."</source>\n";
         }
         */
         if ($this->items[$i]->category != "") {
             $feed .= "            <category>" . FeedCreator::htmlspecialchars($this->items[$i]->category) . "</category>\n";
         }
         if ($this->items[$i]->comments != "") {
             $feed .= "            <comments>" . FeedCreator::htmlspecialchars($this->items[$i]->comments) . "</comments>\n";
         }
         if ($this->items[$i]->date != "") {
             $itemDate = new FeedDate($this->items[$i]->date);
             $feed .= "            <pubDate>" . FeedCreator::htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n";
         }
         if ($this->items[$i]->guid != "") {
             $feed .= "            <guid>" . FeedCreator::htmlspecialchars($this->items[$i]->guid) . "</guid>\n";
         }
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
         $feed .= "        </item>\n";
     }
     $feed .= "    </channel>\n";
     $feed .= "</rss>\n";
     return $feed;
 }
コード例 #7
0
 /**
  * Writes the HTML.
  * @return    string    the scripts's complete text
  */
 function createFeed()
 {
     // if there is styleless output, use the content of this variable and ignore the rest
     if ($this->stylelessOutput != "") {
         return $this->stylelessOutput;
     }
     //set an openInNewWindow_token_to be inserted or not
     if ($this->openInNewWindow) {
         $targetInsert = " target='_blank'";
     }
     // use this array to put the lines in and implode later with "document.write" javascript
     $feedArray = array();
     if ($this->image != null) {
         $imageStr = "<a href='" . $this->image->link . "'" . $targetInsert . ">" . "<img src='" . $this->image->url . "' border='0' alt='" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->image->title), 100) . "' align='" . $this->imageAlign . "' ";
         if ($this->image->width) {
             $imageStr .= " width='" . $this->image->width . "' ";
         }
         if ($this->image->height) {
             $imageStr .= " height='" . $this->image->height . "' ";
         }
         $imageStr .= "/></a>";
         $feedArray[] = $imageStr;
     }
     if ($this->title) {
         $feedArray[] = "<div class='" . $this->stylePrefix . "title'><a href='" . $this->link . "' " . $targetInsert . " class='" . $this->stylePrefix . "title'>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->title), 100) . "</a></div>";
     }
     if ($this->getDescription()) {
         $feedArray[] = "<div class='" . $this->stylePrefix . "description'>" . str_replace("]]>", "", str_replace("<![CDATA[", "", $this->getDescription())) . "</div>";
     }
     if ($this->header) {
         $feedArray[] = "<div class='" . $this->stylePrefix . "header'>" . $this->header . "</div>";
     }
     for ($i = 0; $i < count($this->items); $i++) {
         if ($this->separator and $i > 0) {
             $feedArray[] = "<div class='" . $this->stylePrefix . "separator'>" . $this->separator . "</div>";
         }
         if ($this->items[$i]->title) {
             if ($this->items[$i]->link) {
                 $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'><a href='" . $this->items[$i]->link . "' class='" . $this->stylePrefix . "item_title'" . $targetInsert . ">" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</a></div>";
             } else {
                 $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</div>";
             }
         }
         if ($this->items[$i]->getDescription()) {
             $feedArray[] = "<div class='" . $this->stylePrefix . "item_description'>" . str_replace("]]>", "", str_replace("<![CDATA[", "", $this->items[$i]->getDescription())) . "</div>";
         }
     }
     if ($this->footer) {
         $feedArray[] = "<div class='" . $this->stylePrefix . "footer'>" . $this->footer . "</div>";
     }
     $feed = "" . join($feedArray, "\r\n");
     return $feed;
 }
コード例 #8
0
 /**
  * Creates the right output, depending on $truncSize, $syndicateHtml properties.
  * @return string    the formatted field
  */
 function output()
 {
     // when field available and syndicated in html we assume
     // - valid html in $rawFieldContent and we enclose in CDATA tags
     // - no truncation (truncating risks producing invalid html)
     if (!$this->rawFieldContent) {
         $result = "";
     } elseif ($this->syndicateHtml) {
         $result = "<![CDATA[" . $this->rawFieldContent . "]]>";
     } else {
         if ($this->truncSize and is_int($this->truncSize)) {
             $result = FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->rawFieldContent), $this->truncSize);
         } else {
             $result = FeedCreator::htmlspecialchars($this->rawFieldContent);
         }
     }
     return $result;
 }
コード例 #9
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= "<!DOCTYPE xbel PUBLIC\n";
     $feed .= '    "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"' . "\n";
     $feed .= '    "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">' . "\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= '<xbel version="1.0"';
     $now = new FeedDate();
     $feed .= ' added="' . FeedCreator::htmlspecialchars($now->iso8601()) . '"';
     if ($this->language != "") {
         $feed .= " xml:lang=\"" . $this->language . "\"";
     }
     $feed .= ">\n";
     if ($this->title != "") {
         $feed .= "  <folder>\n";
         $feed .= "    <title>" . FeedCreator::htmlspecialchars($this->title) . "</title>\n";
         $feed .= "    <desc>" . FeedCreator::htmlspecialchars($this->description) . "</desc>\n";
     }
     $feed .= $this->_createAdditionalElements($this->additionalElements, "    ");
     $ocat = '';
     for ($i = 0; $i < count($this->items); $i++) {
         if ($this->items[$i]->category != $ocat) {
             if ($ocat != '') {
                 $feed .= "    </folder>\n";
             }
             $ocat = $this->items[$i]->category;
             if ($ocat != '') {
                 $feed .= "    <folder>\n";
                 $feed .= "      <title>" . FeedCreator::htmlspecialchars(strip_tags($ocat)) . "</title>\n";
             }
         }
         if (preg_match('/^-+$/', $this->items[$i]->title)) {
             $feed .= "    <separator/>\n";
             continue;
         }
         $feed .= '      <bookmark';
         $feed .= ' href="' . FeedCreator::htmlspecialchars($this->items[$i]->link) . '"';
         if ($this->items[$i]->date == "") {
             $itemDate = $now;
         } else {
             $itemDate = new FeedDate($this->items[$i]->date);
         }
         $feed .= ' added="' . FeedCreator::htmlspecialchars($itemDate->iso8601()) . '"';
         $feed .= ">\n";
         $feed .= "        <title>" . FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n";
         if ($this->items[$i]->description != "") {
             $feed .= "        <desc>" . FeedCreator::htmlspecialchars($this->items[$i]->description) . "</desc>\n";
         }
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
         $feed .= "      </bookmark>\n";
     }
     if ($ocat != '') {
         $feed .= "    </folder>\n";
     }
     if ($this->title != "") {
         $feed .= "  </folder>\n";
     }
     $feed .= "</xbel>\n";
     return $feed;
 }
コード例 #10
0
 /**
  * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
  * The feed will contain all items previously added in the same order.
  * @return    string    the feed's complete text
  */
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     if ($this->cssStyleSheet == "") {
         $cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css";
     }
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<rdf:RDF\n";
     $feed .= "    xmlns=\"http://purl.org/rss/1.0/\"\n";
     $feed .= "    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
     $feed .= "    xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n";
     $feed .= "    xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
     $feed .= "    <channel rdf:about=\"" . $this->syndicationURL . "\">\n";
     $feed .= "        <title>" . FeedCreator::htmlspecialchars($this->title) . "</title>\n";
     $feed .= "        <description>" . FeedCreator::htmlspecialchars($this->description) . "</description>\n";
     $feed .= "        <link>" . $this->link . "</link>\n";
     if ($this->image != null) {
         $feed .= "        <image rdf:resource=\"" . $this->image->url . "\" />\n";
     }
     $now = new FeedDate();
     $feed .= "       <dc:date>" . FeedCreator::htmlspecialchars($now->iso8601()) . "</dc:date>\n";
     $feed .= "        <items>\n";
     $feed .= "            <rdf:Seq>\n";
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "                <rdf:li rdf:resource=\"" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "\"/>\n";
     }
     $feed .= "            </rdf:Seq>\n";
     $feed .= "        </items>\n";
     $feed .= "    </channel>\n";
     if ($this->image != null) {
         $feed .= "    <image rdf:about=\"" . $this->image->url . "\">\n";
         $feed .= "        <title>" . $this->image->title . "</title>\n";
         $feed .= "        <link>" . $this->image->link . "</link>\n";
         $feed .= "        <url>" . $this->image->url . "</url>\n";
         $feed .= "    </image>\n";
     }
     $feed .= $this->_createAdditionalElements($this->additionalElements, "    ");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "    <item rdf:about=\"" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "\">\n";
         //$feed.= "        <dc:type>Posting</dc:type>\n";
         $feed .= "        <dc:format>text/html</dc:format>\n";
         if ($this->items[$i]->date != null) {
             $itemDate = new FeedDate($this->items[$i]->date);
             $feed .= "        <dc:date>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n";
         }
         if ($this->items[$i]->source != "") {
             $feed .= "        <dc:source>" . FeedCreator::htmlspecialchars($this->items[$i]->source) . "</dc:source>\n";
         }
         if ($this->items[$i]->author != "") {
             $feed .= "        <dc:creator>" . FeedCreator::htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n";
         }
         $feed .= "        <title>" . FeedCreator::htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", "  "))) . "</title>\n";
         $feed .= "        <link>" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "</link>\n";
         $feed .= "        <description>" . FeedCreator::htmlspecialchars($this->items[$i]->description) . "</description>\n";
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
         // added by Joseph LeBlanc, contact@jlleblanc.com
         if (count($this->items[$i]->enclosures)) {
             foreach ($this->items[$i]->enclosures as $enc) {
                 $feed .= "            <enclosure url=\"" . $enc['url'] . "\" length=\"" . $enc['length'] . "\" type=\"" . $enc['type'] . "\" />";
             }
         }
         // end add, Joseph LeBlanc
         $feed .= "    </item>\n";
     }
     $feed .= "</rdf:RDF>\n";
     return $feed;
 }