<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[PHP生成RSS的类：FeedCreator]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Mon, 22 Jan 2007 06:41:50 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	　　这个类是直接使用PHP生成RSS，方便好用，支持目前流行的所有RSS格式。<br/><div class="code">&lt;?php<br/>/***************************************************************************<br/><br/>FeedCreator class v1.7.2<br/>originally (c) Kai Blankenhorn<br/>www.bitfolge.de<br/>kaib@bitfolge.de<br/>v1.3 work by Scott Reynen (scott@randomchaos.com) and Kai Blankenhorn<br/>v1.5 OPML support by Dirk Clemens<br/><br/>This library is free software; you can redistribute it and/or<br/>modify it under the terms of the GNU Lesser General Public<br/>License as published by the Free Software Foundation; either<br/>version 2.1 of the License, or (at your option) any later version.<br/><br/>This library is distributed in the hope that it will be useful,<br/>but WITHOUT ANY WARRANTY; without even the implied warranty of<br/>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &nbsp;See the GNU<br/>Lesser General Public License for more details.<br/><br/>You should have received a copy of the GNU Lesser General Public<br/>License along with this library; if not, write to the Free Software<br/>Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA &nbsp;02111-1307 &nbsp;USA<br/><br/>****************************************************************************<br/><br/><br/>Changelog:<br/><br/>v1.7.2 &nbsp;10-11-04<br/> &nbsp;license changed to LGPL<br/><br/>v1.7.1<br/> &nbsp;fixed a syntax bug<br/> &nbsp;fixed left over debug code<br/><br/>v1.7 &nbsp;07-18-04<br/> &nbsp;added HTML and JavaScript feeds (configurable via CSS) (thanks to Pascal Van Hecke)<br/> &nbsp;added HTML descriptions for all feed formats (thanks to Pascal Van Hecke)<br/> &nbsp;added a switch to select an external stylesheet (thanks to Pascal Van Hecke)<br/> &nbsp;changed default content-type to application/xml<br/> &nbsp;added character encoding setting<br/> &nbsp;fixed numerous smaller bugs (thanks to S鰎en Fuhrmann of golem.de)<br/> &nbsp;improved changing ATOM versions handling (thanks to August Trometer)<br/> &nbsp;improved the UniversalFeedCreator&#039;s useCached method (thanks to S鰎en Fuhrmann of golem.de)<br/> &nbsp;added charset output in HTTP headers (thanks to S鰎en Fuhrmann of golem.de)<br/> &nbsp;added Slashdot namespace to RSS 1.0 (thanks to S鰎en Fuhrmann of golem.de)<br/><br/>v1.6 &nbsp;05-10-04<br/> &nbsp;added stylesheet to RSS 1.0 feeds<br/> &nbsp;fixed generator comment (thanks Kevin L. Papendick and Tanguy Pruvot)<br/> &nbsp;fixed RFC822 date bug (thanks Tanguy Pruvot)<br/> &nbsp;added TimeZone customization for RFC8601 (thanks Tanguy Pruvot)<br/> &nbsp;fixed Content-type could be empty (thanks Tanguy Pruvot)<br/> &nbsp;fixed author/creator in RSS1.0 (thanks Tanguy Pruvot)<br/><br/>v1.6 beta &nbsp;02-28-04<br/> &nbsp;added Atom 0.3 support (not all features, though)<br/> &nbsp;improved OPML 1.0 support (hopefully - added more elements)<br/> &nbsp;added support for arbitrary additional elements (use with caution)<br/> &nbsp;code beautification :-)<br/> &nbsp;considered beta due to some internal changes<br/><br/>v1.5.1 &nbsp;01-27-04<br/> &nbsp;fixed some RSS 1.0 glitches (thanks to St閜hane Vanpoperynghe)<br/> &nbsp;fixed some inconsistencies between documentation and code (thanks to Timothy Martin)<br/><br/>v1.5 &nbsp;01-06-04<br/> &nbsp;added support for OPML 1.0<br/> &nbsp;added more documentation<br/><br/>v1.4 &nbsp;11-11-03<br/> &nbsp;optional feed saving and caching<br/> &nbsp;improved documentation<br/> &nbsp;minor improvements<br/><br/>v1.3 &nbsp; &nbsp;10-02-03<br/> &nbsp;renamed to FeedCreator, as it not only creates RSS anymore<br/> &nbsp;added support for mbox<br/> &nbsp;tentative support for echo/necho/atom/pie/???<br/> &nbsp; &nbsp; &nbsp; &nbsp;<br/>v1.2 &nbsp; &nbsp;07-20-03<br/> &nbsp;intelligent auto-truncating of RSS 0.91 attributes<br/> &nbsp;don&#039;t create some attributes when they&#039;re not set<br/> &nbsp;documentation improved<br/> &nbsp;fixed a real and a possible bug with date conversions<br/> &nbsp;code cleanup<br/><br/>v1.1 &nbsp; &nbsp;06-29-03<br/> &nbsp;added images to feeds<br/> &nbsp;now includes most RSS 0.91 attributes<br/> &nbsp;added RSS 2.0 feeds<br/><br/>v1.0 &nbsp; &nbsp;06-24-03<br/> &nbsp;initial release<br/><br/><br/><br/>***************************************************************************/<br/><br/>/*** GENERAL USAGE *********************************************************<br/><br/>include(&quot;feedcreator.class.php&quot;); <br/><br/>$rss = new UniversalFeedCreator(); <br/>$rss-&gt;useCached(); // use cached version if age&lt;1 hour<br/>$rss-&gt;title = &quot;PHP news&quot;; <br/>$rss-&gt;description = &quot;daily news from the PHP scripting world&quot;; <br/><br/>//optional<br/>$rss-&gt;descriptionTruncSize = 500;<br/>$rss-&gt;descriptionHtmlSyndicated = true;<br/><br/>$rss-&gt;link = &quot;http://www.dailyphp.net/news&quot;; <br/>$rss-&gt;syndicationURL = &quot;http://www.dailyphp.net/&quot;.$_SERVER&#91;&quot;PHP_SELF&quot;&#93;; <br/><br/>$image = new FeedImage(); <br/>$image-&gt;title = &quot;dailyphp.net logo&quot;; <br/>$image-&gt;url = &quot;http://www.dailyphp.net/images/logo.gif&quot;; <br/>$image-&gt;link = &quot;http://www.dailyphp.net&quot;; <br/>$image-&gt;description = &quot;Feed provided by dailyphp.net. Click to visit.&quot;; <br/><br/>//optional<br/>$image-&gt;descriptionTruncSize = 500;<br/>$image-&gt;descriptionHtmlSyndicated = true;<br/><br/>$rss-&gt;image = $image; <br/><br/>// get your news items from somewhere, e.g. your database: <br/>mysql_select_db($dbHost, $dbUser, $dbPass); <br/>$res = mysql_query(&quot;SELECT * FROM news ORDER BY newsdate DESC&quot;); <br/>while ($data = mysql_fetch_object($res)) { <br/> &nbsp; &nbsp;$item = new FeedItem(); <br/> &nbsp; &nbsp;$item-&gt;title = $data-&gt;title; <br/> &nbsp; &nbsp;$item-&gt;link = $data-&gt;url; <br/> &nbsp; &nbsp;$item-&gt;description = $data-&gt;short; <br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;//optional<br/> &nbsp; &nbsp;item-&gt;descriptionTruncSize = 500;<br/> &nbsp; &nbsp;item-&gt;descriptionHtmlSyndicated = true;<br/><br/> &nbsp; &nbsp;$item-&gt;date = $data-&gt;newsdate; <br/> &nbsp; &nbsp;$item-&gt;source = &quot;http://www.dailyphp.net&quot;; <br/> &nbsp; &nbsp;$item-&gt;author = &quot;John Doe&quot;; <br/> &nbsp; &nbsp; <br/> &nbsp; &nbsp;$rss-&gt;addItem($item); <br/>} <br/><br/>// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),<br/>// MBOX, OPML, ATOM, ATOM0.3, HTML, JS<br/>echo $rss-&gt;saveFeed(&quot;RSS1.0&quot;, &quot;news/feed.xml&quot;);<br/><br/><br/>***************************************************************************<br/>* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;A little setup &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br/>**************************************************************************/<br/><br/>// your local timezone, set to &quot;&quot; to disable or for GMT<br/>define(&quot;TIME_ZONE&quot;,&quot;+01:00&quot;);<br/><br/><br/><br/><br/>/**<br/> * Version string.<br/> **/<br/>define(&quot;FEEDCREATOR_VERSION&quot;, &quot;FeedCreator 1.7.2&quot;);<br/><br/><br/><br/>/**<br/> * A FeedItem is a part of a FeedCreator feed.<br/> *<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> * @since 1.3<br/> */<br/>class FeedItem extends HtmlDescribable {<br/> &nbsp;/**<br/> &nbsp; * Mandatory attributes of an item.<br/> &nbsp; */<br/> &nbsp;var $title, $description, $link;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Optional attributes of an item.<br/> &nbsp; */<br/> &nbsp;var $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Publishing date of an item. May be in one of the following formats:<br/> &nbsp; *<br/> &nbsp; * &nbsp;RFC 822:<br/> &nbsp; * &nbsp;&quot;Mon, 20 Jan 03 18:05:41 +0400&quot;<br/> &nbsp; * &nbsp;&quot;20 Jan 03 18:05:41 +0000&quot;<br/> &nbsp; *<br/> &nbsp; * &nbsp;ISO 8601:<br/> &nbsp; * &nbsp;&quot;2003-01-20T18:05:41+04:00&quot;<br/> &nbsp; *<br/> &nbsp; * &nbsp;Unix:<br/> &nbsp; * &nbsp;1043082341<br/> &nbsp; */<br/> &nbsp;var $date;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Any additional elements to include as an assiciated array. All $key =&gt; $value pairs<br/> &nbsp; * will be included unencoded in the feed item in the form<br/> &nbsp; * &nbsp; &nbsp; &lt;$key&gt;$value&lt;/$key&gt;<br/> &nbsp; * Again: No encoding will be used! This means you can invalidate or enhance the feed<br/> &nbsp; * if $value contains markup. This may be abused to embed tags not implemented by<br/> &nbsp; * the FeedCreator class used.<br/> &nbsp; */<br/> &nbsp;var $additionalElements = Array();<br/><br/> &nbsp;// on hold<br/> &nbsp;// var $source;<br/>}<br/><br/><br/><br/>/**<br/> * An FeedImage may be added to a FeedCreator feed.<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> * @since 1.3<br/> */<br/>class FeedImage extends HtmlDescribable {<br/> &nbsp;/**<br/> &nbsp; * Mandatory attributes of an image.<br/> &nbsp; */<br/> &nbsp;var $title, $url, $link;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Optional attributes of an image.<br/> &nbsp; */<br/> &nbsp;var $width, $height, $description;<br/>}<br/><br/><br/><br/>/**<br/> * An HtmlDescribable is an item within a feed that can have a description that may<br/> * include HTML markup.<br/> */<br/>class HtmlDescribable {<br/> &nbsp;/**<br/> &nbsp; * Indicates whether the description field should be rendered in HTML.<br/> &nbsp; */<br/> &nbsp;var $descriptionHtmlSyndicated;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Indicates whether and to how many characters a description should be truncated.<br/> &nbsp; */<br/> &nbsp;var $descriptionTruncSize;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Returns a formatted description field, depending on descriptionHtmlSyndicated and<br/> &nbsp; * $descriptionTruncSize properties<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the formatted description &nbsp;<br/> &nbsp; */<br/> &nbsp;function getDescription() {<br/> &nbsp; &nbsp;$descriptionField = new FeedHtmlField($this-&gt;description);<br/> &nbsp; &nbsp;$descriptionField-&gt;syndicateHtml = $this-&gt;descriptionHtmlSyndicated;<br/> &nbsp; &nbsp;$descriptionField-&gt;truncSize = $this-&gt;descriptionTruncSize;<br/> &nbsp; &nbsp;return $descriptionField-&gt;output();<br/> &nbsp;}<br/><br/>}<br/><br/><br/>/**<br/> * An FeedHtmlField describes and generates<br/> * a feed, item or image html field (probably a description). Output is <br/> * generated based on $truncSize, $syndicateHtml properties.<br/> * @author Pascal Van Hecke &lt;feedcreator.class.php@vanhecke.info&gt;<br/> * @version 1.6<br/> */<br/>class FeedHtmlField {<br/> &nbsp;/**<br/> &nbsp; * Mandatory attributes of a FeedHtmlField.<br/> &nbsp; */<br/> &nbsp;var $rawFieldContent;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Optional attributes of a FeedHtmlField.<br/> &nbsp; * <br/> &nbsp; */<br/> &nbsp;var $truncSize, $syndicateHtml;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates a new instance of FeedHtmlField.<br/> &nbsp; * @param &nbsp;$string: if given, sets the rawFieldContent property<br/> &nbsp; */<br/> &nbsp;function FeedHtmlField($parFieldContent) {<br/> &nbsp; &nbsp;if ($parFieldContent) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;rawFieldContent = $parFieldContent;<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates the right output, depending on $truncSize, $syndicateHtml properties.<br/> &nbsp; * @return string &nbsp; &nbsp;the formatted field<br/> &nbsp; */<br/> &nbsp;function output() {<br/> &nbsp; &nbsp;// when field available and syndicated in html we assume <br/> &nbsp; &nbsp;// - valid html in $rawFieldContent and we enclose in CDATA tags<br/> &nbsp; &nbsp;// - no truncation (truncating risks producing invalid html)<br/> &nbsp; &nbsp;if (!$this-&gt;rawFieldContent) {<br/> &nbsp; &nbsp; &nbsp;$result = &quot;&quot;;<br/> &nbsp; &nbsp;} &nbsp;elseif ($this-&gt;syndicateHtml) {<br/> &nbsp; &nbsp; &nbsp;$result = &quot;&lt;!&#91;CDATA&#91;&quot;.$this-&gt;rawFieldContent.&quot;&#93;&#93;&gt;&quot;;<br/> &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;truncSize and is_int($this-&gt;truncSize)) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$result = FeedCreator::iTrunc(htmlspecialchars($this-&gt;rawFieldContent),$this-&gt;truncSize);<br/> &nbsp; &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$result = htmlspecialchars($this-&gt;rawFieldContent);<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;return $result;<br/> &nbsp;}<br/><br/>}<br/><br/><br/><br/>/**<br/> * UniversalFeedCreator lets you choose during runtime which<br/> * format to build.<br/> * For general usage of a feed class, see the FeedCreator class<br/> * below or the example above.<br/> *<br/> * @since 1.3<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class UniversalFeedCreator extends FeedCreator {<br/> &nbsp;var $_feed;<br/> &nbsp;<br/> &nbsp;function _setFormat($format) {<br/> &nbsp; &nbsp;switch (strtoupper($format)) {<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;2.0&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;// fall through<br/> &nbsp; &nbsp; &nbsp;case &quot;RSS2.0&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new RSSCreator20();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;1.0&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;// fall through<br/> &nbsp; &nbsp; &nbsp;case &quot;RSS1.0&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new RSSCreator10();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;0.91&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;// fall through<br/> &nbsp; &nbsp; &nbsp;case &quot;RSS0.91&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new RSSCreator091();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;PIE0.1&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new PIECreator01();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;MBOX&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new MBOXCreator();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;OPML&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new OPMLCreator();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;ATOM&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;// fall through: always the latest ATOM version<br/> &nbsp; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;ATOM0.3&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new AtomCreator03();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;HTML&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new HTMLCreator();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;case &quot;JS&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;// fall through<br/> &nbsp; &nbsp; &nbsp;case &quot;JAVASCRIPT&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new JSCreator();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;default:<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed = new RSSCreator091();<br/> &nbsp; &nbsp; &nbsp; &nbsp;break;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp;$vars = get_object_vars($this);<br/> &nbsp; &nbsp;foreach ($vars as $key =&gt; $value) {<br/> &nbsp; &nbsp; &nbsp;// prevent overwriting of properties &quot;contentType&quot;, &quot;encoding&quot;; do not copy &quot;_feed&quot; itself<br/> &nbsp; &nbsp; &nbsp;if (!in_array($key, array(&quot;_feed&quot;, &quot;contentType&quot;, &quot;encoding&quot;))) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_feed-&gt;{$key} = $this-&gt;{$key};<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates a syndication feed based on the items previously added.<br/> &nbsp; *<br/> &nbsp; * @see &nbsp; &nbsp; &nbsp; &nbsp;FeedCreator::addItem()<br/> &nbsp; * @param &nbsp; &nbsp;string &nbsp; &nbsp;format &nbsp; &nbsp;format the feed should comply to. Valid values are:<br/> &nbsp; * &nbsp; &nbsp; &nbsp;&quot;PIE0.1&quot;, &quot;mbox&quot;, &quot;RSS0.91&quot;, &quot;RSS1.0&quot;, &quot;RSS2.0&quot;, &quot;OPML&quot;, &quot;ATOM0.3&quot;, &quot;HTML&quot;, &quot;JS&quot;<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the contents of the feed.<br/> &nbsp; */<br/> &nbsp;function createFeed($format = &quot;RSS0.91&quot;) {<br/> &nbsp; &nbsp;$this-&gt;_setFormat($format);<br/> &nbsp; &nbsp;return $this-&gt;_feed-&gt;createFeed();<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect<br/> &nbsp; * header may be sent to redirect the use to the newly created file.<br/> &nbsp; * @since 1.4<br/> &nbsp; * <br/> &nbsp; * @param &nbsp;string &nbsp;format &nbsp;format the feed should comply to. Valid values are:<br/> &nbsp; * &nbsp; &nbsp; &nbsp;&quot;PIE0.1&quot; (deprecated), &quot;mbox&quot;, &quot;RSS0.91&quot;, &quot;RSS1.0&quot;, &quot;RSS2.0&quot;, &quot;OPML&quot;, &quot;ATOM&quot;, &quot;ATOM0.3&quot;, &quot;HTML&quot;, &quot;JS&quot;<br/> &nbsp; * @param &nbsp;string &nbsp;filename &nbsp;optional &nbsp;the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER&#91;&quot;PHP_SELF&quot;&#93; with the extension changed to .xml (see _generateFilename()).<br/> &nbsp; * @param &nbsp;boolean &nbsp;displayContents &nbsp;optional &nbsp;send the content of the file or not. If true, the file will be sent in the body of the response.<br/> &nbsp; */<br/> &nbsp;function saveFeed($format=&quot;RSS0.91&quot;, $filename=&quot;&quot;, $displayContents=true) {<br/> &nbsp; &nbsp;$this-&gt;_setFormat($format);<br/> &nbsp; &nbsp;$this-&gt;_feed-&gt;saveFeed($filename, $displayContents);<br/> &nbsp;}<br/><br/><br/> &nbsp; /**<br/> &nbsp; &nbsp;* Turns on caching and checks if there is a recent version of this feed in the cache.<br/> &nbsp; &nbsp;* If there is, an HTTP redirect header is sent.<br/> &nbsp; &nbsp;* To effectively use caching, you should create the FeedCreator object and call this method<br/> &nbsp; &nbsp;* before anything else, especially before you do the time consuming task to build the feed<br/> &nbsp; &nbsp;* (web fetching, for example).<br/> &nbsp; &nbsp;*<br/> &nbsp; &nbsp;* @param &nbsp; string &nbsp; format &nbsp; format the feed should comply to. Valid values are:<br/> &nbsp; &nbsp;* &nbsp; &nbsp; &nbsp; &quot;PIE0.1&quot; (deprecated), &quot;mbox&quot;, &quot;RSS0.91&quot;, &quot;RSS1.0&quot;, &quot;RSS2.0&quot;, &quot;OPML&quot;, &quot;ATOM0.3&quot;.<br/> &nbsp; &nbsp;* @param filename &nbsp; string &nbsp; optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER&#91;&quot;PHP_SELF&quot;&#93; with the extension changed to .xml (see _generateFilename()).<br/> &nbsp; &nbsp;* @param timeout int &nbsp; &nbsp; &nbsp;optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)<br/> &nbsp; &nbsp;*/<br/> &nbsp; function useCached($format=&quot;RSS0.91&quot;, $filename=&quot;&quot;, $timeout=3600) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;_setFormat($format);<br/> &nbsp; &nbsp; &nbsp;$this-&gt;_feed-&gt;useCached($filename, $timeout);<br/> &nbsp; }<br/><br/>}<br/><br/><br/>/**<br/> * FeedCreator is the abstract base implementation for concrete<br/> * implementations that implement a specific format of syndication.<br/> *<br/> * @abstract<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> * @since 1.4<br/> */<br/>class FeedCreator extends HtmlDescribable {<br/><br/> &nbsp;/**<br/> &nbsp; * Mandatory attributes of a feed.<br/> &nbsp; */<br/> &nbsp;var $title, $description, $link;<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Optional attributes of a feed.<br/> &nbsp; */<br/> &nbsp;var $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays;<br/><br/> &nbsp;/**<br/> &nbsp;* The url of the external xsl stylesheet used to format the naked rss feed.<br/> &nbsp;* Ignored in the output when empty.<br/> &nbsp;*/<br/> &nbsp;var $xslStyleSheet = &quot;&quot;;<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;var $items = Array();<br/> &nbsp; <br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * This feed&#039;s MIME content type.<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;var $contentType = &quot;application/xml&quot;;<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * This feed&#039;s character encoding.<br/> &nbsp; * @since 1.6.1<br/> &nbsp; **/<br/> &nbsp;var $encoding = &quot;ISO-8859-1&quot;;<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Any additional elements to include as an assiciated array. All $key =&gt; $value pairs<br/> &nbsp; * will be included unencoded in the feed in the form<br/> &nbsp; * &nbsp; &nbsp; &lt;$key&gt;$value&lt;/$key&gt;<br/> &nbsp; * Again: No encoding will be used! This means you can invalidate or enhance the feed<br/> &nbsp; * if $value contains markup. This may be abused to embed tags not implemented by<br/> &nbsp; * the FeedCreator class used.<br/> &nbsp; */<br/> &nbsp;var $additionalElements = Array();<br/> &nbsp; <br/> &nbsp; &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Adds an FeedItem to the feed.<br/> &nbsp; *<br/> &nbsp; * @param object FeedItem $item The FeedItem to add to the feed.<br/> &nbsp; * @access public<br/> &nbsp; */<br/> &nbsp;function addItem($item) {<br/> &nbsp; &nbsp;$this-&gt;items&#91;&#93; = $item;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Truncates a string to a certain length at the most sensible point.<br/> &nbsp; * First, if there&#039;s a &#039;.&#039; character near the end of the string, the string is truncated after this character.<br/> &nbsp; * If there is no &#039;.&#039;, the string is truncated after the last &#039; &#039; character.<br/> &nbsp; * If the string is truncated, &quot; ...&quot; is appended.<br/> &nbsp; * If the string is already shorter than $length, it is returned unchanged.<br/> &nbsp; * <br/> &nbsp; * @static<br/> &nbsp; * @param string &nbsp; &nbsp;string A string to be truncated.<br/> &nbsp; * @param int &nbsp; &nbsp; &nbsp; &nbsp;length the maximum length the string should be truncated to<br/> &nbsp; * @return string &nbsp; &nbsp;the truncated string<br/> &nbsp; */<br/> &nbsp;function iTrunc($string, $length) {<br/> &nbsp; &nbsp;if (strlen($string)&lt;=$length) {<br/> &nbsp; &nbsp; &nbsp;return $string;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;$pos = strrpos($string,&quot;.&quot;);<br/> &nbsp; &nbsp;if ($pos&gt;=$length-4) {<br/> &nbsp; &nbsp; &nbsp;$string = substr($string,0,$length-4);<br/> &nbsp; &nbsp; &nbsp;$pos = strrpos($string,&quot;.&quot;);<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($pos&gt;=$length*0.4) {<br/> &nbsp; &nbsp; &nbsp;return substr($string,0,$pos+1).&quot; ...&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;$pos = strrpos($string,&quot; &quot;);<br/> &nbsp; &nbsp;if ($pos&gt;=$length-4) {<br/> &nbsp; &nbsp; &nbsp;$string = substr($string,0,$length-4);<br/> &nbsp; &nbsp; &nbsp;$pos = strrpos($string,&quot; &quot;);<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($pos&gt;=$length*0.4) {<br/> &nbsp; &nbsp; &nbsp;return substr($string,0,$pos).&quot; ...&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;return substr($string,0,$length-4).&quot; ...&quot;;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates a comment indicating the generator of this feed.<br/> &nbsp; * The format of this comment seems to be recognized by<br/> &nbsp; * Syndic8.com.<br/> &nbsp; */<br/> &nbsp;function _createGeneratorComment() {<br/> &nbsp; &nbsp;return &quot;&lt;!-- generator=&amp;amp;#92;&quot;&quot;.FEEDCREATOR_VERSION.&quot;&amp;amp;#92;&quot; --&gt;&#92;n&quot;;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates a string containing all additional elements specified in<br/> &nbsp; * $additionalElements.<br/> &nbsp; * @param &nbsp;elements &nbsp;array &nbsp;an associative array containing key =&gt; value pairs<br/> &nbsp; * @param indentString &nbsp;string &nbsp;a string that will be inserted before every generated line<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the XML tags corresponding to $additionalElements<br/> &nbsp; */<br/> &nbsp;function _createAdditionalElements($elements, $indentString=&quot;&quot;) {<br/> &nbsp; &nbsp;$ae = &quot;&quot;;<br/> &nbsp; &nbsp;if (is_array($elements)) {<br/> &nbsp; &nbsp; &nbsp;foreach($elements AS $key =&gt; $value) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$ae.= $indentString.&quot;&lt;$key&gt;$value&lt;/$key&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;return $ae;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;function _createStylesheetReferences() {<br/> &nbsp; &nbsp;$xml = &quot;&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;cssStyleSheet) $xml .= &quot;&lt;?xml-stylesheet href=&#92;&quot;&quot;.$this-&gt;cssStyleSheet.&quot;&#92;&quot; type=&#92;&quot;text/css&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;xslStyleSheet) $xml .= &quot;&lt;?xml-stylesheet href=&#92;&quot;&quot;.$this-&gt;xslStyleSheet.&quot;&#92;&quot; type=&#92;&quot;text/xsl&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $xml;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Builds the feed&#039;s text.<br/> &nbsp; * @abstract<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the feed&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() {<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Generate a filename for the feed cache file. The result will be $_SERVER&#91;&quot;PHP_SELF&quot;&#93; with the extension changed to .xml.<br/> &nbsp; * For example:<br/> &nbsp; * <br/> &nbsp; * echo $_SERVER&#91;&quot;PHP_SELF&quot;&#93;.&quot;&#92;n&quot;;<br/> &nbsp; * echo FeedCreator::_generateFilename();<br/> &nbsp; * <br/> &nbsp; * would produce:<br/> &nbsp; * <br/> &nbsp; * /rss/latestnews.php<br/> &nbsp; * latestnews.xml<br/> &nbsp; *<br/> &nbsp; * @return string the feed cache filename<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _generateFilename() {<br/> &nbsp; &nbsp;$fileInfo = pathinfo($_SERVER&#91;&quot;PHP_SELF&quot;&#93;);<br/> &nbsp; &nbsp;return substr($fileInfo&#91;&quot;basename&quot;&#93;,0,-(strlen($fileInfo&#91;&quot;extension&quot;&#93;)+1)).&quot;.xml&quot;;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _redirect($filename) {<br/> &nbsp; &nbsp;// attention, heavily-commented-out-area<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;// maybe use this in addition to file time checking<br/> &nbsp; &nbsp;//Header(&quot;Expires: &quot;.date(&quot;r&quot;,time()+$this-&gt;_timeout));<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;/* no caching at all, doesn&#039;t seem to work as good:<br/> &nbsp; &nbsp;Header(&quot;Cache-Control: no-cache&quot;);<br/> &nbsp; &nbsp;Header(&quot;Pragma: no-cache&quot;);<br/> &nbsp; &nbsp;*/<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;// HTTP redirect, some feed readers&#039; simple HTTP implementations don&#039;t follow it<br/> &nbsp; &nbsp;//Header(&quot;Location: &quot;.$filename);<br/><br/> &nbsp; &nbsp;Header(&quot;Content-Type: &quot;.$this-&gt;contentType.&quot;; charset=&quot;.$this-&gt;encoding.&quot;; filename=&quot;.basename($filename));<br/> &nbsp; &nbsp;Header(&quot;Content-Disposition: inline; filename=&quot;.basename($filename));<br/> &nbsp; &nbsp;readfile($filename, &quot;r&quot;);<br/> &nbsp; &nbsp;die();<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Turns on caching and checks if there is a recent version of this feed in the cache.<br/> &nbsp; * If there is, an HTTP redirect header is sent.<br/> &nbsp; * To effectively use caching, you should create the FeedCreator object and call this method<br/> &nbsp; * before anything else, especially before you do the time consuming task to build the feed<br/> &nbsp; * (web fetching, for example).<br/> &nbsp; * @since 1.4<br/> &nbsp; * @param filename &nbsp;string &nbsp;optional &nbsp;the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER&#91;&quot;PHP_SELF&quot;&#93; with the extension changed to .xml (see _generateFilename()).<br/> &nbsp; * @param timeout &nbsp;int &nbsp; &nbsp;optional &nbsp;the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)<br/> &nbsp; */<br/> &nbsp;function useCached($filename=&quot;&quot;, $timeout=3600) {<br/> &nbsp; &nbsp;$this-&gt;_timeout = $timeout;<br/> &nbsp; &nbsp;if ($filename==&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$filename = $this-&gt;_generateFilename();<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if (file_exists($filename) AND (time()-filemtime($filename) &lt; $timeout)) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;_redirect($filename);<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Saves this feed as a file on the local disk. After the file is saved, a redirect<br/> &nbsp; * header may be sent to redirect the user to the newly created file.<br/> &nbsp; * @since 1.4<br/> &nbsp; * <br/> &nbsp; * @param filename &nbsp;string &nbsp;optional &nbsp;the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER&#91;&quot;PHP_SELF&quot;&#93; with the extension changed to .xml (see _generateFilename()).<br/> &nbsp; * @param redirect &nbsp;boolean &nbsp;optional &nbsp;send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file.<br/> &nbsp; */<br/> &nbsp;function saveFeed($filename=&quot;&quot;, $displayContents=true) {<br/> &nbsp; &nbsp;if ($filename==&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$filename = $this-&gt;_generateFilename();<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feedFile = fopen($filename, &quot;w+&quot;);<br/> &nbsp; &nbsp;if ($feedFile) {<br/> &nbsp; &nbsp; &nbsp;fputs($feedFile,$this-&gt;createFeed());<br/> &nbsp; &nbsp; &nbsp;fclose($feedFile);<br/> &nbsp; &nbsp; &nbsp;if ($displayContents) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;_redirect($filename);<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp;echo &quot;&lt;br /&gt;&lt;b&gt;Error creating feed file, please check write permissions.&lt;/b&gt;&lt;br /&gt;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/> &nbsp;<br/>}<br/><br/><br/>/**<br/> * FeedDate is an internal class that stores a date for a feed or feed item.<br/> * Usually, you won&#039;t need to use this.<br/> */<br/>class FeedDate {<br/> &nbsp;var $unix;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Creates a new instance of FeedDate representing a given date.<br/> &nbsp; * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps.<br/> &nbsp; * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used.<br/> &nbsp; */<br/> &nbsp;function FeedDate($dateString=&quot;&quot;) {<br/> &nbsp; &nbsp;if ($dateString==&quot;&quot;) $dateString = date(&quot;r&quot;);<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;if (is_integer($dateString)) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;unix = $dateString;<br/> &nbsp; &nbsp; &nbsp;return;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if (preg_match(&quot;~(?:(?:Mon&amp;#124;Tue&amp;#124;Wed&amp;#124;Thu&amp;#124;Fri&amp;#124;Sat&amp;#124;Sun),&#92;&#92;s+)?(&#92;&#92;d{1,2})&#92;&#92;s+(&#91;a-zA-Z&#93;{3})&#92;&#92;s+(&#92;&#92;d{4})&#92;&#92;s+(&#92;&#92;d{2}):(&#92;&#92;d{2}):(&#92;&#92;d{2})&#92;&#92;s+(.*)~&quot;,$dateString,$matches)) {<br/> &nbsp; &nbsp; &nbsp;$months = Array(&quot;Jan&quot;=&gt;1,&quot;Feb&quot;=&gt;2,&quot;Mar&quot;=&gt;3,&quot;Apr&quot;=&gt;4,&quot;May&quot;=&gt;5,&quot;Jun&quot;=&gt;6,&quot;Jul&quot;=&gt;7,&quot;Aug&quot;=&gt;8,&quot;Sep&quot;=&gt;9,&quot;Oct&quot;=&gt;10,&quot;Nov&quot;=&gt;11,&quot;Dec&quot;=&gt;12);<br/> &nbsp; &nbsp; &nbsp;$this-&gt;unix = mktime($matches&#91;4&#93;,$matches&#91;5&#93;,$matches&#91;6&#93;,$months&#91;$matches&#91;2&#93;&#93;,$matches&#91;1&#93;,$matches&#91;3&#93;);<br/> &nbsp; &nbsp; &nbsp;if (substr($matches&#91;7&#93;,0,1)==&#039;+&#039; OR substr($matches&#91;7&#93;,0,1)==&#039;-&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = (substr($matches&#91;7&#93;,0,3) * 60 + substr($matches&#91;7&#93;,-2)) * 60;<br/> &nbsp; &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;if (strlen($matches&#91;7&#93;)==1) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$oneHour = 3600;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ord = ord($matches&#91;7&#93;);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($ord &lt; ord(&quot;M&quot;)) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = (ord(&quot;A&quot;) - $ord - 1) * $oneHour;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} elseif ($ord &gt;= ord(&quot;M&quot;) AND $matches&#91;7&#93;!=&quot;Z&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = ($ord - ord(&quot;M&quot;)) * $oneHour;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} elseif ($matches&#91;7&#93;==&quot;Z&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = 0;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp; &nbsp;switch ($matches&#91;7&#93;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case &quot;UT&quot;:<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case &quot;GMT&quot;: &nbsp;$tzOffset = 0;<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$this-&gt;unix += $tzOffset;<br/> &nbsp; &nbsp; &nbsp;return;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if (preg_match(&quot;~(&#92;&#92;d{4})-(&#92;&#92;d{2})-(&#92;&#92;d{2})T(&#92;&#92;d{2}):(&#92;&#92;d{2}):(&#92;&#92;d{2})(.*)~&quot;,$dateString,$matches)) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;unix = mktime($matches&#91;4&#93;,$matches&#91;5&#93;,$matches&#91;6&#93;,$matches&#91;2&#93;,$matches&#91;3&#93;,$matches&#91;1&#93;);<br/> &nbsp; &nbsp; &nbsp;if (substr($matches&#91;7&#93;,0,1)==&#039;+&#039; OR substr($matches&#91;7&#93;,0,1)==&#039;-&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = (substr($matches&#91;7&#93;,0,3) * 60 + substr($matches&#91;7&#93;,-2)) * 60;<br/> &nbsp; &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;if ($matches&#91;7&#93;==&quot;Z&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tzOffset = 0;<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$this-&gt;unix += $tzOffset;<br/> &nbsp; &nbsp; &nbsp;return;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$this-&gt;unix = 0;<br/> &nbsp;}<br/><br/> &nbsp;/**<br/> &nbsp; * Gets the date stored in this FeedDate as an RFC 822 date.<br/> &nbsp; *<br/> &nbsp; * @return a date in RFC 822 format<br/> &nbsp; */<br/> &nbsp;function rfc822() {<br/> &nbsp; &nbsp;//return gmdate(&quot;r&quot;,$this-&gt;unix);<br/> &nbsp; &nbsp;$date = gmdate(&quot;D, d M Y H:i:s&quot;, $this-&gt;unix);<br/> &nbsp; &nbsp;if (TIME_ZONE!=&quot;&quot;) $date .= &quot; &quot;.str_replace(&quot;:&quot;,&quot;&quot;,TIME_ZONE);<br/> &nbsp; &nbsp;return $date;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Gets the date stored in this FeedDate as an ISO 8601 date.<br/> &nbsp; *<br/> &nbsp; * @return a date in ISO 8601 format<br/> &nbsp; */<br/> &nbsp;function iso8601() {<br/> &nbsp; &nbsp;$date = gmdate(&quot;Y-m-d&#92;TH:i:sO&quot;,$this-&gt;unix);<br/> &nbsp; &nbsp;$date = substr($date,0,22) . &#039;:&#039; . substr($date,-2);<br/> &nbsp; &nbsp;if (TIME_ZONE!=&quot;&quot;) $date = str_replace(&quot;+00:00&quot;,TIME_ZONE,$date);<br/> &nbsp; &nbsp;return $date;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Gets the date stored in this FeedDate as unix time stamp.<br/> &nbsp; *<br/> &nbsp; * @return a date as a unix time stamp<br/> &nbsp; */<br/> &nbsp;function unix() {<br/> &nbsp; &nbsp;return $this-&gt;unix;<br/> &nbsp;}<br/>}<br/><br/><br/>/**<br/> * RSSCreator10 is a FeedCreator that implements RDF Site Summary (RSS) 1.0.<br/> *<br/> * @see http://www.purl.org/rss/1.0/<br/> * @since 1.3<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class RSSCreator10 extends FeedCreator {<br/><br/> &nbsp;/**<br/> &nbsp; * Builds the RSS feed&#039;s text. The feed will be compliant to RDF Site Summary (RSS) 1.0.<br/> &nbsp; * The feed will contain all items previously added in the same order.<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the feed&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() { &nbsp; &nbsp; <br/> &nbsp; &nbsp;$feed = &quot;&lt;?xml version=&#92;&quot;1.0&#92;&quot; encoding=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createGeneratorComment();<br/> &nbsp; &nbsp;if ($this-&gt;cssStyleSheet==&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$cssStyleSheet = &quot;http://www.w3.org/2000/08/w3c-synd/style.css&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createStylesheetReferences();<br/> &nbsp; &nbsp;$feed.= &quot;&lt;rdf:RDF&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;xmlns=&#92;&quot;http://purl.org/rss/1.0/&#92;&quot;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;xmlns:rdf=&#92;&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#92;&quot;&#92;n&quot;; <br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;xmlns:slash=&#92;&quot;http://purl.org/rss/1.0/modules/slash/&#92;&quot;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;xmlns:dc=&#92;&quot;http://purl.org/dc/elements/1.1/&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;channel rdf:about=&#92;&quot;&quot;.$this-&gt;syndicationURL.&quot;&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.htmlspecialchars($this-&gt;title).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;description&gt;&quot;.htmlspecialchars($this-&gt;description).&quot;&lt;/description&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.$this-&gt;link.&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;image!=null) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;image rdf:resource=&#92;&quot;&quot;.$this-&gt;image-&gt;url.&quot;&#92;&quot; /&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$now = new FeedDate();<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &lt;dc:date&gt;&quot;.htmlspecialchars($now-&gt;iso8601()).&quot;&lt;/dc:date&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;items&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;rdf:Seq&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;rdf:li rdf:resource=&#92;&quot;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&#92;&quot;/&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/rdf:Seq&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/items&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/channel&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;image!=null) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;image rdf:about=&#92;&quot;&quot;.$this-&gt;image-&gt;url.&quot;&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.$this-&gt;image-&gt;title.&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.$this-&gt;image-&gt;link.&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;url&gt;&quot;.$this-&gt;image-&gt;url.&quot;&lt;/url&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/image&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;additionalElements, &quot; &nbsp; &nbsp;&quot;);<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;item rdf:about=&#92;&quot;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;//$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;dc:type&gt;Posting&lt;/dc:type&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;dc:format&gt;text/html&lt;/dc:format&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;date!=null) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$itemDate = new FeedDate($this-&gt;items&#91;$i&#93;-&gt;date);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;dc:date&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/dc:date&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;source!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;dc:source&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;source).&quot;&lt;/dc:source&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;author!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;dc:creator&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;author).&quot;&lt;/dc:creator&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.htmlspecialchars(strip_tags(strtr($this-&gt;items&#91;$i&#93;-&gt;title,&quot;&#92;n&#92;r&quot;,&quot; &nbsp;&quot;))).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;description&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;description).&quot;&lt;/description&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;items&#91;$i&#93;-&gt;additionalElements, &quot; &nbsp; &nbsp; &nbsp; &nbsp;&quot;);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/item&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot;&lt;/rdf:RDF&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/>}<br/><br/><br/><br/>/**<br/> * RSSCreator091 is a FeedCreator that implements RSS 0.91 Spec, revision 3.<br/> *<br/> * @see http://my.netscape.com/publish/formats/rss-spec-0.91.html<br/> * @since 1.3<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class RSSCreator091 extends FeedCreator {<br/><br/> &nbsp;/**<br/> &nbsp; * Stores this RSS feed&#039;s version number.<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;var $RSSVersion;<br/><br/> &nbsp;function RSSCreator091() {<br/> &nbsp; &nbsp;$this-&gt;_setRSSVersion(&quot;0.91&quot;);<br/> &nbsp; &nbsp;$this-&gt;contentType = &quot;application/rss+xml&quot;;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Sets this RSS feed&#039;s version number.<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _setRSSVersion($version) {<br/> &nbsp; &nbsp;$this-&gt;RSSVersion = $version;<br/> &nbsp;}<br/><br/> &nbsp;/**<br/> &nbsp; * Builds the RSS feed&#039;s text. The feed will be compliant to RDF Site Summary (RSS) 1.0.<br/> &nbsp; * The feed will contain all items previously added in the same order.<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the feed&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() {<br/> &nbsp; &nbsp;$feed = &quot;&lt;?xml version=&#92;&quot;1.0&#92;&quot; encoding=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createGeneratorComment();<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createStylesheetReferences();<br/> &nbsp; &nbsp;$feed.= &quot;&lt;rss version=&#92;&quot;&quot;.$this-&gt;RSSVersion.&quot;&#92;&quot;&gt;&#92;n&quot;; <br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;channel&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;title),100).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$this-&gt;descriptionTruncSize = 500;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;description&gt;&quot;.$this-&gt;getDescription().&quot;&lt;/description&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.$this-&gt;link.&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$now = new FeedDate();<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;lastBuildDate&gt;&quot;.htmlspecialchars($now-&gt;rfc822()).&quot;&lt;/lastBuildDate&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;generator&gt;&quot;.FEEDCREATOR_VERSION.&quot;&lt;/generator&gt;&#92;n&quot;;<br/><br/> &nbsp; &nbsp;if ($this-&gt;image!=null) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;image&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;url&gt;&quot;.$this-&gt;image-&gt;url.&quot;&lt;/url&gt;&#92;n&quot;; <br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;image-&gt;title),100).&quot;&lt;/title&gt;&#92;n&quot;; <br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.$this-&gt;image-&gt;link.&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;image-&gt;width!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;width&gt;&quot;.$this-&gt;image-&gt;width.&quot;&lt;/width&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;image-&gt;height!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;height&gt;&quot;.$this-&gt;image-&gt;height.&quot;&lt;/height&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;image-&gt;description!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;description&gt;&quot;.$this-&gt;image-&gt;getDescription().&quot;&lt;/description&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/image&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;language!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;language&gt;&quot;.$this-&gt;language.&quot;&lt;/language&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;copyright!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;copyright&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;copyright),100).&quot;&lt;/copyright&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;editor!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;managingEditor&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;editor),100).&quot;&lt;/managingEditor&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;webmaster!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;webMaster&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;webmaster),100).&quot;&lt;/webMaster&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;pubDate!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$pubDate = new FeedDate($this-&gt;pubDate);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;pubDate&gt;&quot;.htmlspecialchars($pubDate-&gt;rfc822()).&quot;&lt;/pubDate&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;category!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;category&gt;&quot;.htmlspecialchars($this-&gt;category).&quot;&lt;/category&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;docs!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;docs&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;docs),500).&quot;&lt;/docs&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;ttl!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;ttl&gt;&quot;.htmlspecialchars($this-&gt;ttl).&quot;&lt;/ttl&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;rating!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;rating&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;rating),500).&quot;&lt;/rating&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;skipHours!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;skipHours&gt;&quot;.htmlspecialchars($this-&gt;skipHours).&quot;&lt;/skipHours&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;skipDays!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;skipDays&gt;&quot;.htmlspecialchars($this-&gt;skipDays).&quot;&lt;/skipDays&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;additionalElements, &quot; &nbsp; &nbsp;&quot;);<br/><br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;item&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this-&gt;items&#91;$i&#93;-&gt;title)),100).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;description&gt;&quot;.$this-&gt;items&#91;$i&#93;-&gt;getDescription().&quot;&lt;/description&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;author!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;author&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;author).&quot;&lt;/author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;/*<br/> &nbsp; &nbsp; &nbsp;// on hold<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;source!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;source&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;source).&quot;&lt;/source&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;*/<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;category!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;category&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;category).&quot;&lt;/category&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;comments!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;comments&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;comments).&quot;&lt;/comments&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;date!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$itemDate = new FeedDate($this-&gt;items&#91;$i&#93;-&gt;date);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;pubDate&gt;&quot;.htmlspecialchars($itemDate-&gt;rfc822()).&quot;&lt;/pubDate&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;guid!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;guid&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;guid).&quot;&lt;/guid&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;items&#91;$i&#93;-&gt;additionalElements, &quot; &nbsp; &nbsp; &nbsp; &nbsp;&quot;);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/item&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/channel&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot;&lt;/rss&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/>}<br/><br/><br/><br/>/**<br/> * RSSCreator20 is a FeedCreator that implements RDF Site Summary (RSS) 2.0.<br/> *<br/> * @see http://backend.userland.com/rss<br/> * @since 1.3<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class RSSCreator20 extends RSSCreator091 {<br/><br/> &nbsp; &nbsp;function RSSCreator20() {<br/> &nbsp; &nbsp; &nbsp; &nbsp;parent::_setRSSVersion(&quot;2.0&quot;);<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/>}<br/><br/><br/>/**<br/> * PIECreator01 is a FeedCreator that implements the emerging PIE specification,<br/> * as in http://intertwingly.net/wiki/pie/Syntax.<br/> *<br/> * @deprecated<br/> * @since 1.3<br/> * @author Scott Reynen &lt;scott@randomchaos.com&gt; and Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class PIECreator01 extends FeedCreator {<br/> &nbsp;<br/> &nbsp;function PIECreator01() {<br/> &nbsp; &nbsp;$this-&gt;encoding = &quot;utf-8&quot;;<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;function createFeed() {<br/> &nbsp; &nbsp;$feed = &quot;&lt;?xml version=&#92;&quot;1.0&#92;&quot; encoding=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createStylesheetReferences();<br/> &nbsp; &nbsp;$feed.= &quot;&lt;feed version=&#92;&quot;0.1&#92;&quot; xmlns=&#92;&quot;http://example.com/newformat#&#92;&quot;&gt;&#92;n&quot;; <br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;title&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars($this-&gt;title),100).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$this-&gt;truncSize = 500;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;subtitle&gt;&quot;.$this-&gt;getDescription().&quot;&lt;/subtitle&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;link&gt;&quot;.$this-&gt;link.&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;entry&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this-&gt;items&#91;$i&#93;-&gt;title)),100).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&lt;/link&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$itemDate = new FeedDate($this-&gt;items&#91;$i&#93;-&gt;date);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;created&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/created&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;issued&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/issued&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;modified&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/modified&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;id&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;guid).&quot;&lt;/id&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;author!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;author).&quot;&lt;/name&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;authorEmail!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;email&gt;&quot;.$this-&gt;items&#91;$i&#93;-&gt;authorEmail.&quot;&lt;/email&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.=&quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;content type=&#92;&quot;text/html&#92;&quot; xml:lang=&#92;&quot;en-us&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div xmlns=&#92;&quot;http://www.w3.org/1999/xhtml&#92;&quot;&gt;&quot;.$this-&gt;items&#91;$i&#93;-&gt;getDescription().&quot;&lt;/div&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/content&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/entry&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot;&lt;/feed&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/>}<br/><br/><br/>/**<br/> * AtomCreator03 is a FeedCreator that implements the atom specification,<br/> * as in http://www.intertwingly.net/wiki/pie/FrontPage.<br/> * Please note that just by using AtomCreator03 you won&#039;t automatically<br/> * produce valid atom files. For example, you have to specify either an editor<br/> * for the feed or an author for every single feed item.<br/> *<br/> * Some elements have not been implemented yet. These are (incomplete list):<br/> * author URL, item author&#039;s email and URL, item contents, alternate links, <br/> * other link content types than text/html. Some of them may be created with<br/> * AtomCreator03::additionalElements.<br/> *<br/> * @see FeedCreator#additionalElements<br/> * @since 1.6<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;, Scott Reynen &lt;scott@randomchaos.com&gt;<br/> */<br/>class AtomCreator03 extends FeedCreator {<br/><br/> &nbsp;function AtomCreator03() {<br/> &nbsp; &nbsp;$this-&gt;contentType = &quot;application/atom+xml&quot;;<br/> &nbsp; &nbsp;$this-&gt;encoding = &quot;utf-8&quot;;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;function createFeed() {<br/> &nbsp; &nbsp;$feed = &quot;&lt;?xml version=&#92;&quot;1.0&#92;&quot; encoding=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createGeneratorComment();<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createStylesheetReferences();<br/> &nbsp; &nbsp;$feed.= &quot;&lt;feed version=&#92;&quot;0.3&#92;&quot; xmlns=&#92;&quot;http://purl.org/atom/ns#&#92;&quot;&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;language!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; xml:lang=&#92;&quot;&quot;.$this-&gt;language.&quot;&#92;&quot;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot;&gt;&#92;n&quot;; <br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;title&gt;&quot;.htmlspecialchars($this-&gt;title).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;tagline&gt;&quot;.htmlspecialchars($this-&gt;description).&quot;&lt;/tagline&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;link rel=&#92;&quot;alternate&#92;&quot; type=&#92;&quot;text/html&#92;&quot; href=&#92;&quot;&quot;.htmlspecialchars($this-&gt;link).&quot;&#92;&quot;/&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;id&gt;&quot;.htmlspecialchars($this-&gt;link).&quot;&lt;/id&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$now = new FeedDate();<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;modified&gt;&quot;.htmlspecialchars($now-&gt;iso8601()).&quot;&lt;/modified&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;editor!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;&quot;.$this-&gt;editor.&quot;&lt;/name&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;editorEmail!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;email&gt;&quot;.$this-&gt;editorEmail.&quot;&lt;/email&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;generator&gt;&quot;.FEEDCREATOR_VERSION.&quot;&lt;/generator&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;additionalElements, &quot; &nbsp; &nbsp;&quot;);<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;entry&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.htmlspecialchars(strip_tags($this-&gt;items&#91;$i&#93;-&gt;title)).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;link rel=&#92;&quot;alternate&#92;&quot; type=&#92;&quot;text/html&#92;&quot; href=&#92;&quot;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&#92;&quot;/&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;date==&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$this-&gt;items&#91;$i&#93;-&gt;date = time();<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$itemDate = new FeedDate($this-&gt;items&#91;$i&#93;-&gt;date);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;created&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/created&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;issued&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/issued&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;modified&gt;&quot;.htmlspecialchars($itemDate-&gt;iso8601()).&quot;&lt;/modified&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;id&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&lt;/id&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= $this-&gt;_createAdditionalElements($this-&gt;items&#91;$i&#93;-&gt;additionalElements, &quot; &nbsp; &nbsp; &nbsp; &nbsp;&quot;);<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;author!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;author).&quot;&lt;/name&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/author&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;description!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;summary&gt;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;description).&quot;&lt;/summary&gt;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/entry&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot;&lt;/feed&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/>}<br/><br/><br/>/**<br/> * MBOXCreator is a FeedCreator that implements the mbox format<br/> * as described in http://www.qmail.org/man/man5/mbox.html<br/> *<br/> * @since 1.3<br/> * @author Kai Blankenhorn &lt;kaib@bitfolge.de&gt;<br/> */<br/>class MBOXCreator extends FeedCreator {<br/><br/> &nbsp;function MBOXCreator() {<br/> &nbsp; &nbsp;$this-&gt;contentType = &quot;text/plain&quot;;<br/> &nbsp; &nbsp;$this-&gt;encoding = &quot;ISO-8859-15&quot;;<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;function qp_enc($input = &quot;&quot;, $line_max = 76) { <br/> &nbsp; &nbsp;$hex = array(&#039;0&#039;,&#039;1&#039;,&#039;2&#039;,&#039;3&#039;,&#039;4&#039;,&#039;5&#039;,&#039;6&#039;,&#039;7&#039;,&#039;8&#039;,&#039;9&#039;,&#039;A&#039;,&#039;B&#039;,&#039;C&#039;,&#039;D&#039;,&#039;E&#039;,&#039;F&#039;); <br/> &nbsp; &nbsp;$lines = preg_split(&quot;/(?:&#92;r&#92;n&amp;#124;&#92;r&amp;#124;&#92;n)/&quot;, $input); <br/> &nbsp; &nbsp;$eol = &quot;&#92;r&#92;n&quot;; <br/> &nbsp; &nbsp;$escape = &quot;=&quot;; <br/> &nbsp; &nbsp;$output = &quot;&quot;; <br/> &nbsp; &nbsp;while( list(, $line) = each($lines) ) { <br/> &nbsp; &nbsp; &nbsp;//$line = rtrim($line); // remove trailing white space -&gt; no =20&#92;r&#92;n necessary <br/> &nbsp; &nbsp; &nbsp;$linlen = strlen($line); <br/> &nbsp; &nbsp; &nbsp;$newline = &quot;&quot;; <br/> &nbsp; &nbsp; &nbsp;for($i = 0; $i &lt; $linlen; $i++) { <br/> &nbsp; &nbsp; &nbsp; &nbsp;$c = substr($line, $i, 1); <br/> &nbsp; &nbsp; &nbsp; &nbsp;$dec = ord($c); <br/> &nbsp; &nbsp; &nbsp; &nbsp;if ( ($dec == 32) &amp;&amp; ($i == ($linlen - 1)) ) { // convert space at eol only <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$c = &quot;=20&quot;; <br/> &nbsp; &nbsp; &nbsp; &nbsp;} elseif ( ($dec == 61) &amp;#124;&amp;#124; ($dec &lt; 32 ) &amp;#124;&amp;#124; ($dec &gt; 126) ) { // always encode &quot;&#92;t&quot;, which is *not* required <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$h2 = floor($dec/16); $h1 = floor($dec%16); <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$c = $escape.$hex&#91;&quot;$h2&quot;&#93;.$hex&#91;&quot;$h1&quot;&#93;; <br/> &nbsp; &nbsp; &nbsp; &nbsp;} <br/> &nbsp; &nbsp; &nbsp; &nbsp;if ( (strlen($newline) + strlen($c)) &gt;= $line_max ) { // CRLF is not counted <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$output .= $newline.$escape.$eol; // soft line break; &quot; =&#92;r&#92;n&quot; is okay <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$newline = &quot;&quot;; <br/> &nbsp; &nbsp; &nbsp; &nbsp;} <br/> &nbsp; &nbsp; &nbsp; &nbsp;$newline .= $c; <br/> &nbsp; &nbsp; &nbsp;} // end of for <br/> &nbsp; &nbsp; &nbsp;$output .= $newline.$eol; <br/> &nbsp; &nbsp;} <br/> &nbsp; &nbsp;return trim($output); <br/> &nbsp;}<br/> &nbsp;<br/><br/> &nbsp;/**<br/> &nbsp; * Builds the MBOX contents.<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the feed&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() {<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;author!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$from = $this-&gt;items&#91;$i&#93;-&gt;author;<br/> &nbsp; &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$from = $this-&gt;title;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$itemDate = new FeedDate($this-&gt;items&#91;$i&#93;-&gt;date);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;From &quot;.strtr(MBOXCreator::qp_enc($from),&quot; &quot;,&quot;_&quot;).&quot; &quot;.date(&quot;D M d H:i:s Y&quot;,$itemDate-&gt;unix()).&quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;Content-Type: text/plain;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp;charset=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;Content-Transfer-Encoding: quoted-printable&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;Content-Type: text/plain&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;From: &#92;&quot;&quot;.MBOXCreator::qp_enc($from).&quot;&#92;&quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;Date: &quot;.$itemDate-&gt;rfc822().&quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;Subject: &quot;.MBOXCreator::qp_enc(FeedCreator::iTrunc($this-&gt;items&#91;$i&#93;-&gt;title,100)).&quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$body = chunk_split(MBOXCreator::qp_enc($this-&gt;items&#91;$i&#93;-&gt;description));<br/> &nbsp; &nbsp; &nbsp;$feed.= preg_replace(&quot;~&#92;nFrom (&#91;^&#92;n&#93;*)(&#92;n?)~&quot;,&quot;&#92;n&gt;From $1$2&#92;n&quot;,$body);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;&#92;n&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types.<br/> &nbsp; * @return string the feed cache filename<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _generateFilename() {<br/> &nbsp; &nbsp;$fileInfo = pathinfo($_SERVER&#91;&quot;PHP_SELF&quot;&#93;);<br/> &nbsp; &nbsp;return substr($fileInfo&#91;&quot;basename&quot;&#93;,0,-(strlen($fileInfo&#91;&quot;extension&quot;&#93;)+1)).&quot;.mbox&quot;;<br/> &nbsp;}<br/>}<br/><br/><br/>/**<br/> * OPMLCreator is a FeedCreator that implements OPML 1.0.<br/> * <br/> * @see http://opml.scripting.com/spec<br/> * @author Dirk Clemens, Kai Blankenhorn<br/> * @since 1.5<br/> */<br/>class OPMLCreator extends FeedCreator {<br/><br/> &nbsp;function OPMLCreator() {<br/> &nbsp; &nbsp;$this-&gt;encoding = &quot;utf-8&quot;;<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;function createFeed() { &nbsp; &nbsp; <br/> &nbsp; &nbsp;$feed = &quot;&lt;?xml version=&#92;&quot;1.0&#92;&quot; encoding=&#92;&quot;&quot;.$this-&gt;encoding.&quot;&#92;&quot;?&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createGeneratorComment();<br/> &nbsp; &nbsp;$feed.= $this-&gt;_createStylesheetReferences();<br/> &nbsp; &nbsp;$feed.= &quot;&lt;opml xmlns:xsd=&#92;&quot;http://www.w3.org/2001/XMLSchema&#92;&quot; xmlns:xsi=&#92;&quot;http://www.w3.org/2001/XMLSchema-instance&#92;&quot;&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;head&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&quot;.htmlspecialchars($this-&gt;title).&quot;&lt;/title&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;if ($this-&gt;pubDate!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$date = new FeedDate($this-&gt;pubDate);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &lt;dateCreated&gt;&quot;.$date-&gt;rfc822().&quot;&lt;/dateCreated&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;lastBuildDate!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$date = new FeedDate($this-&gt;lastBuildDate);<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &lt;dateModified&gt;&quot;.$date-&gt;rfc822().&quot;&lt;/dateModified&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;editor!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ownerName&gt;&quot;.$this-&gt;editor.&quot;&lt;/ownerName&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;editorEmail!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ownerEmail&gt;&quot;.$this-&gt;editorEmail.&quot;&lt;/ownerEmail&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/head&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;body&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;outline type=&#92;&quot;rss&#92;&quot; &quot;;<br/> &nbsp; &nbsp; &nbsp;$title = htmlspecialchars(strip_tags(strtr($this-&gt;items&#91;$i&#93;-&gt;title,&quot;&#92;n&#92;r&quot;,&quot; &nbsp;&quot;)));<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; title=&#92;&quot;&quot;.$title.&quot;&#92;&quot;&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; text=&#92;&quot;&quot;.$title.&quot;&#92;&quot;&quot;;<br/> &nbsp; &nbsp; &nbsp;//$feed.= &quot; description=&#92;&quot;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;description).&quot;&#92;&quot;&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot; url=&#92;&quot;&quot;.htmlspecialchars($this-&gt;items&#91;$i&#93;-&gt;link).&quot;&#92;&quot;&quot;;<br/> &nbsp; &nbsp; &nbsp;$feed.= &quot;/&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;$feed.= &quot; &nbsp; &nbsp;&lt;/body&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;$feed.= &quot;&lt;/opml&gt;&#92;n&quot;;<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/>}<br/><br/><br/><br/>/**<br/> * HTMLCreator is a FeedCreator that writes an HTML feed file to a specific <br/> * location, overriding the createFeed method of the parent FeedCreator.<br/> * The HTML produced can be included over http by scripting languages, or serve<br/> * as the source for an IFrame.<br/> * All output by this class is embedded in &lt;div&gt;&lt;/div&gt; tags to enable formatting<br/> * using CSS. <br/> *<br/> * @author Pascal Van Hecke<br/> * @since 1.7<br/> */<br/>class HTMLCreator extends FeedCreator {<br/><br/> &nbsp;var $contentType = &quot;text/html&quot;;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Contains HTML to be output at the start of the feed&#039;s html representation.<br/> &nbsp; */<br/> &nbsp;var $header;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Contains HTML to be output at the end of the feed&#039;s html representation.<br/> &nbsp; */<br/> &nbsp;var $footer ;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Contains HTML to be output between entries. A separator is only used in <br/> &nbsp; * case of multiple entries.<br/> &nbsp; */<br/> &nbsp;var $separator;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Used to prefix the stylenames to make sure they are unique <br/> &nbsp; * and do not clash with stylenames on the users&#039; page.<br/> &nbsp; */<br/> &nbsp;var $stylePrefix;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Determines whether the links open in a new window or not.<br/> &nbsp; */<br/> &nbsp;var $openInNewWindow = true;<br/> &nbsp;<br/> &nbsp;var $imageAlign =&quot;right&quot;;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * In case of very simple output you may want to get rid of the style tags,<br/> &nbsp; * hence this variable. &nbsp;There&#039;s no equivalent on item level, but of course you can <br/> &nbsp; * add strings to it while iterating over the items ($this-&gt;stylelessOutput .= ...)<br/> &nbsp; * and when it is non-empty, ONLY the styleless output is printed, the rest is ignored<br/> &nbsp; * in the function createFeed().<br/> &nbsp; */<br/> &nbsp;var $stylelessOutput =&quot;&quot;;<br/><br/> &nbsp;/**<br/> &nbsp; * Writes the HTML.<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the scripts&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() {<br/> &nbsp; &nbsp;// if there is styleless output, use the content of this variable and ignore the rest<br/> &nbsp; &nbsp;if ($this-&gt;stylelessOutput!=&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;return $this-&gt;stylelessOutput;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;//if no stylePrefix is set, generate it yourself depending on the script name<br/> &nbsp; &nbsp;if ($this-&gt;stylePrefix==&quot;&quot;) {<br/> &nbsp; &nbsp; &nbsp;$this-&gt;stylePrefix = str_replace(&quot;.&quot;, &quot;_&quot;, $this-&gt;_generateFilename()).&quot;_&quot;;<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;//set an openInNewWindow_token_to be inserted or not<br/> &nbsp; &nbsp;if ($this-&gt;openInNewWindow) {<br/> &nbsp; &nbsp; &nbsp;$targetInsert = &quot; target=&#039;_blank&#039;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;// use this array to put the lines in and implode later with &quot;document.write&quot; javascript<br/> &nbsp; &nbsp;$feedArray = array();<br/> &nbsp; &nbsp;if ($this-&gt;image!=null) {<br/> &nbsp; &nbsp; &nbsp;$imageStr = &quot;&lt;a href=&#039;&quot;.$this-&gt;image-&gt;link.&quot;&#039;&quot;.$targetInsert.&quot;&gt;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;img src=&#039;&quot;.$this-&gt;image-&gt;url.&quot;&#039; border=&#039;0&#039; alt=&#039;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FeedCreator::iTrunc(htmlspecialchars($this-&gt;image-&gt;title),100).<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&#039; align=&#039;&quot;.$this-&gt;imageAlign.&quot;&#039; &quot;;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;image-&gt;width) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$imageStr .=&quot; width=&#039;&quot;.$this-&gt;image-&gt;width. &quot;&#039; &quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;image-&gt;height) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$imageStr .=&quot; height=&#039;&quot;.$this-&gt;image-&gt;height.&quot;&#039; &quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;$imageStr .=&quot;/&gt;&lt;/a&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = $imageStr;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;if ($this-&gt;title) {<br/> &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = &quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;title&#039;&gt;&lt;a href=&#039;&quot;.$this-&gt;link.&quot;&#039; &quot;.$targetInsert.&quot; class=&#039;&quot;.$this-&gt;stylePrefix.&quot;title&#039;&gt;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp;FeedCreator::iTrunc(htmlspecialchars($this-&gt;title),100).&quot;&lt;/a&gt;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;getDescription()) {<br/> &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = &quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;description&#039;&gt;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp;str_replace(&quot;&#93;&#93;&gt;&quot;, &quot;&quot;, str_replace(&quot;&lt;!&#91;CDATA&#91;&quot;, &quot;&quot;, $this-&gt;getDescription())).<br/> &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;if ($this-&gt;header) {<br/> &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = &quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;header&#039;&gt;&quot;.$this-&gt;header.&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;for ($i=0;$i&lt;count($this-&gt;items);$i++) {<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;separator and $i &gt; 0) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = &quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;separator&#039;&gt;&quot;.$this-&gt;separator.&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;title) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;link) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;item_title&#039;&gt;&lt;a href=&#039;&quot;.$this-&gt;items&#91;$i&#93;-&gt;link.&quot;&#039; class=&#039;&quot;.$this-&gt;stylePrefix.<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;item_title&#039;&quot;.$targetInsert.&quot;&gt;&quot;.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this-&gt;items&#91;$i&#93;-&gt;title)),100).<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;/a&gt;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;item_title&#039;&gt;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FeedCreator::iTrunc(htmlspecialchars(strip_tags($this-&gt;items&#91;$i&#93;-&gt;title)),100).<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp;if ($this-&gt;items&#91;$i&#93;-&gt;getDescription()) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = <br/> &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;item_description&#039;&gt;&quot;.<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;str_replace(&quot;&#93;&#93;&gt;&quot;, &quot;&quot;, str_replace(&quot;&lt;!&#91;CDATA&#91;&quot;, &quot;&quot;, $this-&gt;items&#91;$i&#93;-&gt;getDescription())).<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;if ($this-&gt;footer) {<br/> &nbsp; &nbsp; &nbsp;$feedArray&#91;&#93; = &quot;&lt;div class=&#039;&quot;.$this-&gt;stylePrefix.&quot;footer&#039;&gt;&quot;.$this-&gt;footer.&quot;&lt;/div&gt;&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;$feed= &quot;&quot;.join($feedArray, &quot;&#92;r&#92;n&quot;);<br/> &nbsp; &nbsp;return $feed;<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Overrrides parent to produce .html extensions<br/> &nbsp; *<br/> &nbsp; * @return string the feed cache filename<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _generateFilename() {<br/> &nbsp; &nbsp;$fileInfo = pathinfo($_SERVER&#91;&quot;PHP_SELF&quot;&#93;);<br/> &nbsp; &nbsp;return substr($fileInfo&#91;&quot;basename&quot;&#93;,0,-(strlen($fileInfo&#91;&quot;extension&quot;&#93;)+1)).&quot;.html&quot;;<br/> &nbsp;}<br/>} &nbsp;<br/><br/><br/>/**<br/> * JSCreator is a class that writes a js file to a specific <br/> * location, overriding the createFeed method of the parent HTMLCreator.<br/> *<br/> * @author Pascal Van Hecke<br/> */<br/>class JSCreator extends HTMLCreator {<br/> &nbsp;var $contentType = &quot;text/javascript&quot;;<br/> &nbsp;<br/> &nbsp;/**<br/> &nbsp; * writes the javascript<br/> &nbsp; * @return &nbsp; &nbsp;string &nbsp; &nbsp;the scripts&#039;s complete text <br/> &nbsp; */<br/> &nbsp;function createFeed() <br/> &nbsp;{<br/> &nbsp; &nbsp;$feed = parent::createFeed();<br/> &nbsp; &nbsp;$feedArray = explode(&quot;&#92;n&quot;,$feed);<br/> &nbsp; &nbsp;<br/> &nbsp; &nbsp;$jsFeed = &quot;&quot;;<br/> &nbsp; &nbsp;foreach ($feedArray as $value) {<br/> &nbsp; &nbsp; &nbsp;$jsFeed .= &quot;document.write(&#039;&quot;.trim(addslashes($value)).&quot;&#039;);&#92;n&quot;;<br/> &nbsp; &nbsp;}<br/> &nbsp; &nbsp;return $jsFeed;<br/> &nbsp;}<br/> &nbsp; &nbsp;<br/> &nbsp;/**<br/> &nbsp; * Overrrides parent to produce .js extensions<br/> &nbsp; *<br/> &nbsp; * @return string the feed cache filename<br/> &nbsp; * @since 1.4<br/> &nbsp; * @access private<br/> &nbsp; */<br/> &nbsp;function _generateFilename() {<br/> &nbsp; &nbsp;$fileInfo = pathinfo($_SERVER&#91;&quot;PHP_SELF&quot;&#93;);<br/> &nbsp; &nbsp;return substr($fileInfo&#91;&quot;basename&quot;&#93;,0,-(strlen($fileInfo&#91;&quot;extension&quot;&#93;)+1)).&quot;.js&quot;;<br/> &nbsp;}<br/> &nbsp;<br/>} &nbsp;<br/><br/><br/><br/>/*** TEST SCRIPT *********************************************************<br/><br/>//include(&quot;feedcreator.class.php&quot;); <br/><br/>$rss = new UniversalFeedCreator(); <br/>$rss-&gt;useCached(); <br/>$rss-&gt;title = &quot;PHP news&quot;; <br/>$rss-&gt;description = &quot;daily news from the PHP scripting world&quot;; <br/><br/>//optional<br/>//$rss-&gt;descriptionTruncSize = 500;<br/>//$rss-&gt;descriptionHtmlSyndicated = true;<br/>//$rss-&gt;xslStyleSheet = &quot;http://feedster.com/rss20.xsl&quot;;<br/><br/>$rss-&gt;link = &quot;http://www.dailyphp.net/news&quot;; <br/>$rss-&gt;feedURL = &quot;http://www.dailyphp.net/&quot;.$PHP_SELF; <br/><br/>$image = new FeedImage(); <br/>$image-&gt;title = &quot;dailyphp.net logo&quot;; <br/>$image-&gt;url = &quot;http://www.dailyphp.net/images/logo.gif&quot;; <br/>$image-&gt;link = &quot;http://www.dailyphp.net&quot;; <br/>$image-&gt;description = &quot;Feed provided by dailyphp.net. Click to visit.&quot;; <br/><br/>//optional<br/>$image-&gt;descriptionTruncSize = 500;<br/>$image-&gt;descriptionHtmlSyndicated = true;<br/><br/>$rss-&gt;image = $image; <br/><br/>// get your news items from somewhere, e.g. your database: <br/>//mysql_select_db($dbHost, $dbUser, $dbPass); <br/>//$res = mysql_query(&quot;SELECT * FROM news ORDER BY newsdate DESC&quot;); <br/>//while ($data = mysql_fetch_object($res)) { <br/> &nbsp;$item = new FeedItem(); <br/> &nbsp;$item-&gt;title = &quot;This is an the test title of an item&quot;; <br/> &nbsp;$item-&gt;link = &quot;http://localhost/item/&quot;; <br/> &nbsp;$item-&gt;description = &quot;&lt;b&gt;description in &lt;/b&gt;<br/>HTML&quot;; <br/> &nbsp;<br/> &nbsp;//optional<br/> &nbsp;//item-&gt;descriptionTruncSize = 500;<br/> &nbsp;$item-&gt;descriptionHtmlSyndicated = true;<br/> &nbsp;<br/> &nbsp;$item-&gt;date = time(); <br/> &nbsp;$item-&gt;source = &quot;http://www.dailyphp.net&quot;; <br/> &nbsp;$item-&gt;author = &quot;John Doe&quot;; <br/> &nbsp; <br/> &nbsp;$rss-&gt;addItem($item); <br/>//} <br/><br/>// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS<br/>echo $rss-&gt;saveFeed(&quot;RSS0.91&quot;, &quot;feed.xml&quot;); <br/><br/><br/><br/>***************************************************************************/<br/><br/>?&gt;</div><br/><br/>注意下面的使用条件：<br/>1.$item->data 传进去的值应该是int型的timestamp<br/>>>如果是从mysql里取出来的，即便是整型（事实上也是字符串，在php程序中用会自动转换类型），也要用 intval 强制转换一下。<br/><br/>2.需要设一下文件中的时区<br/>>>时区改这里：define("TIME_ZONE", "+08:00");<br/><br/>3.如果中文页面用的是gb2312或者utf-8需要相应的把默认的encoding改掉 <br/>>>编码改这里：var $encoding = "GBK"; 不过事实这里只是一个默认值，调用时可以改的。<br/><br/><a href="http://www.bitfolge.de/download/feedcreator_172.zip">点击这里下载文件</a><br/>Tags - <a href="tag.php?tag=php" rel="tag">php</a> , <a href="tag.php?tag=rss" rel="tag">rss</a> , <a href="tag.php?tag=feedcreator" rel="tag">feedcreator</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] PHP生成RSS的类：FeedCreator]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>