Пример #1
0
 /**
  * Builds the MBOX contents.
  * @return    string    the feed's complete text 
  */
 function createFeed()
 {
     $feed = '';
     for ($i = 0; $i < count($this->items); $i++) {
         if ($this->items[$i]->author != "") {
             $from = $this->items[$i]->author;
         } else {
             $from = $this->title;
         }
         $itemDate = new FeedDate($this->items[$i]->date);
         $feed .= "From " . strtr(MBOX::qp_enc($from), " ", "_") . " " . $itemDate->v0002() . "\n";
         $feed .= "Content-Type: text/plain;\n";
         $feed .= "\tcharset=\"" . $this->encoding . "\"\n";
         $feed .= "Content-Transfer-Encoding: quoted-printable\n";
         $feed .= "Content-Type: text/plain\n";
         $feed .= "From: \"" . MBOX::qp_enc($from) . "\"\n";
         $feed .= "Date: " . $itemDate->rfc822() . "\n";
         $feed .= "Subject: " . MBOX::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "\n";
         $feed .= "\n";
         $body = chunk_split(MBOX::qp_enc($this->items[$i]->description));
         $feed .= preg_replace("~\nFrom ([^\n]*)(\n?)~", "\n>From \$1\$2\n", $body);
         $feed .= "\n";
         $feed .= "\n";
     }
     return $feed;
 }
Пример #2
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\" version=\"1.0\">\n";
     $feed .= "\t<head>\n";
     $feed .= "\t\t<title>" . $this->htmlspecialchars($this->title) . "</title>\n";
     if ($this->pubDate != "") {
         $date = new FeedDate($this->pubDate);
         $feed .= "\t\t <dateCreated>" . $date->rfc822() . "</dateCreated>\n";
     }
     if ($this->lastBuildDate != "") {
         $date = new FeedDate($this->lastBuildDate);
         $feed .= "\t\t <dateModified>" . $date->rfc822() . "</dateModified>\n";
     }
     if ($this->editor != "") {
         $feed .= " \t\t<ownerName>" . $this->htmlspecialchars($this->editor) . "</ownerName>\n";
     }
     if ($this->editorEmail != "") {
         $feed .= "\t\t <ownerEmail>" . $this->htmlspecialchars($this->editorEmail) . "</ownerEmail>\n";
     }
     $feed .= "\t</head>\n";
     $feed .= "\t<body>\n";
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "\t<outline type=\"link\" ";
         $title = $this->htmlspecialchars(strtr($this->items[$i]->title, "\n\r", "  "));
         $feed .= " title=\"" . $title . "\"";
         $feed .= " text=\"" . $title . "\"";
         $feed .= " url=\"" . $this->htmlspecialchars($this->items[$i]->link) . "\"";
         if ($this->items[$i]->date != "") {
             $itemDate = new FeedDate($this->items[$i]->date);
             $feed .= " created=\"" . $this->htmlspecialchars($itemDate->rfc822()) . "\"";
         }
         $feed .= "/>\n";
     }
     $feed .= "\t</body>\n";
     $feed .= "</opml>\n";
     return $feed;
 }
Пример #3
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;
 }
Пример #4
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $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>" . htmlspecialchars($this->title, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</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 = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", "  ")), ENT_COMPAT | ENT_HTML401, $this->encoding);
         $feed .= " title=\"" . $title . "\"";
         $feed .= " text=\"" . $title . "\"";
         $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link, ENT_COMPAT | ENT_HTML401, $this->encoding) . "\"";
         $feed .= "/>\n";
     }
     $feed .= "    </body>\n";
     $feed .= "</opml>\n";
     return $feed;
 }
Пример #5
0
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createStylesheetReferences();
     $feed .= "<rss version=\"" . $this->RSSVersion . "\" xmlns:mtree=\"http://www.mosets.com/tree/rss/\">\n";
     $feed .= "<channel>\n";
     $feed .= "<title>" . FeedCreator::iTrunc(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>" . htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n";
     $feed .= "<generator>" . FEEDCREATOR_VERSION . "</generator>\n";
     if ($this->image != null) {
         $feed .= "<image>\n";
         $feed .= "\t<url>" . $this->image->url . "</url>\n";
         $feed .= "\t<title>" . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) . "</title>\n";
         $feed .= "\t<link>" . $this->image->link . "</link>\n";
         if ($this->image->width != "") {
             $feed .= "\t<width>" . $this->image->width . "</width>\n";
         }
         if ($this->image->height != "") {
             $feed .= "\t<height>" . $this->image->height . "</height>\n";
         }
         if ($this->image->description != "") {
             $feed .= "\t<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(htmlspecialchars($this->copyright), 100) . "</copyright>\n";
     }
     if ($this->editor != "") {
         $feed .= "<managingEditor>" . FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) . "</managingEditor>\n";
     }
     if ($this->webmaster != "") {
         $feed .= "<webMaster>" . FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) . "</webMaster>\n";
     }
     if ($this->pubDate != "") {
         $pubDate = new FeedDate($this->pubDate);
         $feed .= "<pubDate>" . htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n";
     }
     if ($this->category != "") {
         $feed .= "<category>" . htmlspecialchars($this->category) . "</category>\n";
     }
     if ($this->docs != "") {
         $feed .= "<docs>" . FeedCreator::iTrunc(htmlspecialchars($this->docs), 500) . "</docs>\n";
     }
     if ($this->ttl != "") {
         $feed .= "<ttl>" . htmlspecialchars($this->ttl) . "</ttl>\n";
     }
     if (isset($this->rating_count) && $this->rating_count > 0) {
         $rating = round($this->rating_sum / $this->rating_count);
         $feed .= "<rating>" . FeedCreator::iTrunc(htmlspecialchars($rating), 500) . "</rating>\n";
     }
     if ($this->skipHours != "") {
         $feed .= "<skipHours>" . htmlspecialchars($this->skipHours) . "</skipHours>\n";
     }
     if ($this->skipDays != "") {
         $feed .= "<skipDays>" . htmlspecialchars($this->skipDays) . "</skipDays>\n";
     }
     $feed .= $this->_createAdditionalElements($this->additionalElements, "\t");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "<item>\n";
         $feed .= "\t<title>" . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n";
         $feed .= "\t<link>" . htmlspecialchars($this->items[$i]->link) . "</link>\n";
         $feed .= "\t<description>" . $this->items[$i]->getDescription() . "</description>\n";
         if ($this->items[$i]->author != "") {
             $feed .= "\t<author>" . htmlspecialchars($this->items[$i]->author) . "</author>\n";
         }
         if ($this->items[$i]->category != "") {
             $feed .= "\t<category>" . htmlspecialchars($this->items[$i]->category) . "</category>\n";
         }
         if ($this->items[$i]->comments != "") {
             $feed .= "\t<comments>" . htmlspecialchars($this->items[$i]->comments) . "</comments>\n";
         }
         if ($this->items[$i]->date != "") {
             $itemDate = new FeedDate($this->items[$i]->date);
             $feed .= "\t<pubDate>" . htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n";
         }
         if ($this->items[$i]->guid != "") {
             $feed .= "\t<guid>" . htmlspecialchars($this->items[$i]->guid) . "</guid>\n";
         }
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "\t");
         $feed .= "</item>\n";
     }
     $feed .= "</channel>\n";
     $feed .= "</rss>\n";
     return $feed;
 }
 function createFeed()
 {
     $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
     $feed .= $this->_createGeneratorComment();
     $feed .= $this->_createStylesheetReferences();
     //changed by D
     //$feed.= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0\">\n";
     $feed .= "<opml xmlns:opml=\"http://www.opml.org/spec2\" version=\"1.0\">\n";
     $feed .= "    <head>\n";
     $feed .= "        <title>" . 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 = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", "  ")));
         $feed .= " title=\"" . $title . "\"";
         $feed .= " text=\"" . $title . "\"";
         //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\"";
         $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link) . "\"";
         //print_r($this->items);
         if ($this->syndicationURL != "") {
             $feed .= " xmlUrl=\"" . htmlspecialchars($this->syndicationURL) . "\"";
         }
         $feed .= " />\n";
     }
     $feed .= "    </body>\n";
     $feed .= "</opml>\n";
     return $feed;
 }
Пример #7
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 .= "\t<channel>\n";
     $feed .= "\t\t<title>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->title, 100)) . "</title>\n";
     $feed .= "\t\t<description>" . $this->getDescription($this->encoding) . "</description>\n";
     $feed .= "\t\t<link>{$this->link}</link>\n";
     $now = new FeedDate();
     $feed .= "\t\t<lastBuildDate>" . $this->htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n";
     $feed .= "\t\t<generator>" . FEEDCREATOR_VERSION . "</generator>\n";
     if ($this->image != null) {
         $feed .= "\t\t<image>\n";
         $feed .= "\t\t\t<url>{$this->image->url}</url>\n";
         $feed .= "\t\t\t<title>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->image->title, 100)) . "</title>\n";
         $feed .= "\t\t\t<link>{$this->image->link}</link>\n";
         if (!empty($this->image->width)) {
             $feed .= "\t\t\t<width>{$this->image->width}</width>\n";
         }
         if (!empty($this->image->height)) {
             $feed .= "\t\t\t<height>{$this->image->height}</height>\n";
         }
         if (!empty($this->image->description)) {
             $feed .= "\t\t\t<description>" . $this->image->getDescription($this->encoding) . "</description>\n";
         }
         $feed .= "\t\t</image>\n";
     }
     if ($this->language != "") {
         $feed .= "\t\t<language>{$this->language}</language>\n";
     }
     if ($this->copyright != "") {
         $feed .= "\t\t<copyright>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->copyright, 100)) . "</copyright>\n";
     }
     if (!empty($this->editor) && !empty($this->editorEmail)) {
         $feed .= "\t\t<managingEditor>" . $this->htmlspecialchars($this->editorEmail) . " (" . $this->htmlspecialchars(FeedCreator::iTrunc($this->editor, 100)) . ")</managingEditor>\n";
     }
     if ($this->webmaster != "") {
         $feed .= "\t\t<webMaster>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->webmaster, 100)) . "</webMaster>\n";
     }
     if ($this->pubDate != "") {
         $pubDate = new FeedDate($this->pubDate);
         $feed .= "\t\t<pubDate>" . $this->htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n";
     }
     if ($this->category != "") {
         $feed .= "\t\t<category>" . $this->htmlspecialchars($this->category) . "</category>\n";
     }
     if ($this->docs != "") {
         $feed .= "\t\t<docs>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->docs, 500)) . "</docs>\n";
     }
     if ($this->ttl != "") {
         $feed .= "\t\t<ttl>" . $this->htmlspecialchars($this->ttl) . "</ttl>\n";
     }
     if ($this->rating != "") {
         $feed .= "\t\t<rating>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->rating, 500)) . "</rating>\n";
     }
     if ($this->skipHours != "") {
         $feed .= "\t\t<skipHours>" . $this->htmlspecialchars($this->skipHours) . "</skipHours>\n";
     }
     if ($this->skipDays != "") {
         $feed .= "\t\t<skipDays>" . $this->htmlspecialchars($this->skipDays) . "</skipDays>\n";
     }
     $feed .= $this->_createAdditionalElements($this->additionalElements, "\t");
     for ($i = 0; $i < count($this->items); $i++) {
         $feed .= "\t\t<item>\n";
         $feed .= "\t\t\t<title>" . $this->htmlspecialchars(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "</title>\n";
         $feed .= "\t\t\t<link>" . $this->htmlspecialchars($this->items[$i]->link) . "</link>\n";
         $feed .= "\t\t\t<description>" . $this->items[$i]->getDescription($this->encoding) . "</description>\n";
         if (!empty($this->items[$i]->author) && !empty($this->items[$i]->authorEmail)) {
             $feed .= "\t\t\t<author>" . $this->htmlspecialchars($this->items[$i]->author) . " &lt;" . $this->htmlspecialchars($this->items[$i]->authorEmail) . "&gt;</author>\n";
         }
         if ($this->items[$i]->category != "") {
             $feed .= "\t\t\t<category>" . $this->htmlspecialchars($this->items[$i]->category) . "</category>\n";
         }
         if ($this->items[$i]->comments != "") {
             $feed .= "\t\t\t<comments>" . $this->htmlspecialchars($this->items[$i]->comments) . "</comments>\n";
         }
         if ($this->items[$i]->date != "") {
             $itemDate = new FeedDate($this->items[$i]->date);
             $feed .= "\t\t\t<pubDate>" . $this->htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n";
         }
         if ($this->items[$i]->guid != "") {
             $feed .= "\t\t\t<guid>" . $this->htmlspecialchars($this->items[$i]->guid) . "</guid>\n";
         }
         $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "\t\t");
         $feed .= "\t\t</item>\n";
     }
     $feed .= "\t</channel>\n";
     $feed .= "</rss>\n";
     return $feed;
 }