PHP generates RSS subscriptions for program code

Source: Internet
Author: User
Tags cdata generator ord php class resource strlen vars xmlns


RSS, also called aggregated content, is a format for describing and synchronizing web site content. The following code to generate an RSS subscription:
RSS XML Structure

<?xml version= "1.0" encoding= "Utf-8"?> <rss version=
"2.0" >
<channel>
<title> Website name </title>
<link>http://www.111cn.net/</link>
<description> website Description!</ description>
<item>
<title>rss tutorial</title>
<link> website address/rss</link >
<description>new RSS tutorial on w3school</description>
</item>
<item>
<title>xml tutorial</title>
<link> website address/xml</link>
<description> New XML tutorial on w3school</description>
</item>
</channel>
</rss>

RSS instances

&lt;?php class&nbsp;rss&nbsp;{public&nbsp;function&nbsp;createfeed () &nbsp;{//rss head $webUrl &nbsp;=&nbsp; ' http://' $_server[' Http_host '];//website address $webName &nbsp;=&nbsp; ' website name '; &nbsp;&nbsp;&nbsp;&nbsp;//website name $webDesc &nbsp;=&nbsp; '
Description of the Web site $html &nbsp;=&nbsp; ' &lt;?xml&nbsp;version= ' 1.0 ' &nbsp;encoding= ' utf-8 ' &nbsp;&nbsp;&nbsp;&nbsp;// &lt;rss&nbsp;version= "2.0" &gt; &lt;channel&gt; &lt;title&gt; '. $webName. ' &lt;/title&gt; &lt;link&gt; '. $webUrl. ' &lt;/link&gt; &lt;description&gt; '. $webDesc. '
&lt;/description&gt; $this-&gt;createitem (). ' &lt;/channel&gt; &lt;/rss&gt; ';
echo&nbsp; $html; Private&nbsp;function&nbsp;createitem () &nbsp;{//rss&nbsp;item//$data can be replaced with their own data $html &nbsp;=&nbsp; ';//Article Data $data &nbsp;=&nbsp;array (' id ' &nbsp;=&gt;&nbsp;1, ' Date ' &nbsp;=&gt;&nbsp;date (' R ', &nbsp;time ()), ' title ' &nbsp;=&gt; &nbsp; ' article title ', ' Link ' &nbsp;=&gt;&nbsp; ' http://www.111cn.net ', &nbsp;&nbsp;&nbsp;&nbsp;//article address ' description ' &nbsp;=
&gt;&nbsp; ' website description '); For ($i &nbsp;=&nbsp;0;&nbsp; $i &nbsp;&lt;&nbsp;6;&nbsp; $i+ +) &nbsp;{$html &nbsp;.=&nbsp; ' &lt;item&gt; &lt;title&gt; '. $data [' title ']. ' &lt;/title&gt; &lt;link&gt; '. $data [' link ']. ' &lt;/link&gt; &lt;pubDate&gt; '. $data [' Date ']. ' &lt;/pubDate&gt; &lt;description&gt;&lt;! [cdata['. $data [' description '].]
&gt;&lt;/description&gt; &lt;/item&gt; ';
} return&nbsp; $html;
} header ("Content-type:&nbsp;text/xml;&nbsp;charset=utf-8");
$rss &nbsp;=&nbsp;new&nbsp;rss ();
$rss-&gt;createfeed (); Exit;?&gt;

After the RSS feed is generated, how to set up to add RSS to the website? and have Firefox, IE7, or other Feed bots automatically discovered? Simply add a specific Link tag to the head section of the page, as follows:
<link rel= "Alternate" type= "Application/rss+xml" title= "website name RSS feed" href= "http://www.111cn.net"/>
Set title as feed title, href as feed address, everything OK!


Example 2

<?xml version= "1.0" encoding= "Utf-8"?> <rss version=

"2.0" >

<channel>

<title> PHP Programmer Tutorial Network </title>

<link>http://www.111cn.net/</link>

<description> This site is a PHP programmer working Life notes!</description>

<item>

<title>rss tutorial</title>

< link> Web address/rss</link>

<description>new RSS tutorial on w3school</description>

</ item>

<item>

<title>xml tutorial</title>

<link> website address/xml</link>

<description>new XML tutorial on w3school</description>

</item>

</channel>

</rss>

Share the following code example for dynamically generating RSS using PHP:

&lt;?php/** **&nbsp;php&nbsp; Dynamic Generation &nbsp;RSS&nbsp; class **/define ("Time_zone", "");
Define ("Feedcreator_version", "www.111cn.net");//Your website class&nbsp;feeditem&nbsp;extends&nbsp;htmldescribable{
&nbsp;var&nbsp; $title, $description, $link;
&nbsp;var&nbsp; $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator;
&nbsp;var&nbsp; $date;
&nbsp;var&nbsp; $additionalElements =array (); class&nbsp;feedimage&nbsp;extends&nbsp;htmldescribable{&nbsp;var&nbsp; $title, $url, $link &nbsp;var&nbsp; $width
, $height, $description;
class&nbsp;htmldescribable{&nbsp;var&nbsp; $descriptionHtmlSyndicated &nbsp;var&nbsp; $descriptionTruncSize; &nbsp;function&nbsp;getdescription () {&nbsp;&nbsp; $descriptionField =new&nbsp;feedhtmlfield ($this-&gt;
Description);
&nbsp;&nbsp; $descriptionField-&gt;syndicatehtml= $this-&gt;descriptionhtmlsyndicated;
&nbsp;&nbsp; $descriptionField-&gt;truncsize= $this-&gt;descriptiontruncsize;
&nbsp;&nbsp;return&nbsp; $descriptionField-&gt;output (); &NBSP}} class&nbsp;feedhtmlfield{&NBsp;var&nbsp; $rawFieldContent;
&nbsp;var&nbsp; $truncSize, $syndicateHtml; &nbsp;function&nbsp;feedhtmlfield ($parFieldContent) {&nbsp;&nbsp;if ($parFieldContent) {&nbsp;&nbsp;&nbsp; $this-
&gt;rawfieldcontent= $parFieldContent; &NBSP;&NBSP} &nbsp} &nbsp;function&nbsp;output () {&nbsp;&nbsp;if (! $this-&gt;rawfieldcontent) {&nbsp;&nbsp;&nbsp;
$result = ""; &nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;elseif ($this-&gt;syndicatehtml) {&nbsp;&nbsp;&nbsp; $result = "&lt;![ cdata[". $this-&gt;rawfieldcontent."]]
&gt; "; &nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;if ($this-&gt;truncsize&nbsp;and&nbsp;is_int ($this-&gt;truncsize)) {&nbsp; &nbsp;&nbsp;&nbsp; $result =feedcreator::itrunc (htmlspecialchars ($this-&gt;rawfieldcontent), $this-&gt;truncsize)
; &nbsp;&nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;&nbsp; $result =htmlspecialchars ($this-&gt;rawfieldcontent); &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;} &nbsp;&nbsp;return&nbsp; $result; &NBSP}} class&nbsp;universalfeedcreator&nbsp;extends&nbsp;feedcreator{&nbsp;var&nbsp;$_feed; &nbsp;function& nbsp; _setformat ($format) {&nbsp;&nbsp;switch&nbsp; (Strtoupper ($format)) {&nbsp;&nbsp;&nbsp;case&nbsp; "2.0": &nbsp; &nbsp;&nbsp;&nbsp;//&nbsp;fall&nbsp;through &nbsp;&nbsp;&nbsp;case&nbsp; "RSS2.0": &nbsp;&nbsp;&nbsp;&nbsp; $this-
&gt;_feed=new&nbsp;rsscreator20 ();
&nbsp;&nbsp;&nbsp;&nbsp;break; &nbsp;&nbsp;&nbsp;case&nbsp; "0.91": &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;fall&nbsp;through &nbsp;&nbsp;&nbsp;case
&nbsp; "RSS0.91": &nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_feed=new&nbsp;rsscreator091 ();
&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;default: &nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_feed=new&nbsp;rsscreator091 ();
&nbsp;&nbsp;&nbsp;&nbsp;break;
&NBSP;&NBSP} &nbsp;&nbsp; $vars =get_object_vars ($this); &nbsp;&nbsp;foreach&nbsp; ($vars &nbsp;as&nbsp; $key &nbsp;=&gt;&nbsp; $value) {&nbsp;&nbsp;&nbsp;//&nbsp;prevent &nbsp;overwriting&nbsp;of&nbsp;properties&nbsp; "ContentType", "Encoding";&nbsp;do&nbsp;not&nbsp;copy&nbsp; "_ Feed "&nbsp;itself &nbsp;&nbsp;&nbsp;if (!in_array ($key, &nbsp;array (" _feed "," ContentType "," Encodi ")Ng ")) {&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_feed-&gt;{$key}= $this-&gt;{$key}; &nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;} &NBSP} &nbsp;function&nbsp;createfeed ($format = "RSS0.91") {&nbsp;&nbsp; $this-&gt;_setformat ($format); &nbsp;
&nbsp;return&nbsp; $this-&gt;_feed-&gt;createfeed (); &NBSP} &nbsp;function&nbsp;savefeed ($format = "RSS0.91", $filename = "", $displayContents =true) {&nbsp;&nbsp; $this-
&gt;_setformat ($format);
&nbsp;&nbsp; $this-&gt;_feed-&gt;savefeed ($filename, $displayContents); &NBSP} &nbsp;function&nbsp;usecached ($format = "RSS0.91", $filename = "", $timeout =3600) {&nbsp;&nbsp; $this-&gt;_
SetFormat ($format);
&nbsp;&nbsp; $this-&gt;_feed-&gt;usecached ($filename, $timeout);
&NBSP} class&nbsp;feedcreator&nbsp;extends&nbsp;htmldescribable{&nbsp;var&nbsp; $title, $description, $link; &nbsp;var&nbsp; $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $
Webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays;
&nbsp;var&nbsp; $xslStyleSheet = ""; &nbsp;var&nbsp; $items =aRray ();
&nbsp;var&nbsp; $contentType = "Application/xml";
&nbsp;var&nbsp; $encoding = "Utf-8";
&nbsp;var&nbsp; $additionalElements =array (); &nbsp;function&nbsp;additem ($item) {&nbsp;&nbsp; $this-&gt;items[]= $item; &nbsp} &nbsp;function&nbsp; Clearitem2null () {&nbsp;&nbsp; $this-&gt;items=array (); &nbsp;} &nbsp;function&nbsp;itrunc ($string, $length) {&nbsp; &nbsp;if (strlen ($string) &lt;= $length) {&nbsp;&nbsp;&nbsp;return&nbsp; $string; &nbsp;&nbsp;} &nbsp;&nbsp; $pos =
Strrpos ($string, "."); &nbsp;&nbsp;if ($pos &gt;= $length-4) {&nbsp;&nbsp;&nbsp; $string =substr ($string, 0, $length-4); &nbsp;&nbsp;&nbsp;$
Pos=strrpos ($string, "."); &NBSP;&NBSP} &nbsp;&nbsp;if ($pos &gt;= $length *0.4) {&nbsp;&nbsp;&nbsp;return&nbsp;substr ($string, 0, $pos + 1). "
&nbsp; ... ";
&NBSP;&NBSP} &nbsp;&nbsp; $pos =strrpos ($string, "&nbsp;"); &nbsp;&nbsp;if ($pos &gt;= $length-4) {&nbsp;&nbsp;&nbsp; $string =substr ($string, 0, $length-4); &nbsp;&nbsp;&nbsp;$
Pos=strrpos ($string, "&nbsp;"); &NBSP;&NBSP} &nbsp;&nbsp;if ($pos &gt;= $length *0.4) {&NBSP;&NBSP;&NBsp;return&nbsp;substr ($string, 0, $pos). "
&nbsp; ... "; &NBSP;&NBSP} &nbsp;&nbsp;return&nbsp;substr ($string, 0, $length-4). "
&nbsp; ... "; &NBSP} &nbsp;function&nbsp;_creategeneratorcomment () {&nbsp;&nbsp;return&nbsp; &lt;!--&nbsp;generator=\ "". Feedcreator_version. "
\ "&nbsp;--&gt;\n"; &NBSP} &nbsp;function&nbsp;_createadditionalelements ($elements, $indentString = "") {&nbsp;&nbsp; $ae = ""; &nbsp;
&nbsp;if (Is_array ($elements)) {&nbsp;&nbsp;&nbsp;foreach ($elements &nbsp;AS&nbsp; $key &nbsp;=&gt;&nbsp; $value) { &nbsp;&nbsp;&nbsp;&nbsp; $ae .=&nbsp; $indentString. "
&lt; $key &gt; $value &lt;/$key &gt;\n ";
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;} &nbsp;&nbsp;return&nbsp; $ae; &NBSP} &nbsp;function&nbsp;_createstylesheetreferences () {&nbsp;&nbsp; $xml = ""; &nbsp;&nbsp;if ($this-&gt; Cssstylesheet) &nbsp; $xml &nbsp;.=&nbsp; "&lt;?xml-stylesheet&nbsp;href=\" ". $this-&gt;cssstylesheet."
\ "&nbsp;type=\" text/css\ "&gt;\n"; &nbsp;&nbsp;if ($this-&gt;xslstylesheet) &nbsp; $xml &nbsp;.=&nbsp; "&lt;?xml-stylesheet&nbsp;href=\". $this-&gt; XslstylEsheet. "
\ "&nbsp;type=\" text/xsl\ "&gt;\n";
&nbsp;&nbsp;return&nbsp; $xml; &NBSP} &nbsp;function&nbsp;createfeed () {} &nbsp;function&nbsp;_generatefilename () {&nbsp;&nbsp; $fileInfo =
PathInfo ($_server["php_self"]); &nbsp;&nbsp;return&nbsp;substr ($fileInfo ["basename"],0,-(strlen ($fileInfo ["extension"]) +1). ".
XML "; &NBSP} &nbsp;function&nbsp;_redirect ($filename) {&nbsp;&nbsp;header ("content-type:&nbsp;". $this-&gt;contenttype ."; &nbsp;charset= ". $this-&gt;encoding.";
&nbsp;filename= ". basename ($filename));
&nbsp;&nbsp;header ("Content-disposition:&nbsp;inline;&nbsp;filename=". BaseName ($filename));
&nbsp;&nbsp;readfile ($filename, "R");
&nbsp;&nbsp;die ();
&NBSP} &nbsp;function&nbsp;usecached ($filename = "", $timeout =3600) {&nbsp;&nbsp; $this-&gt;_timeout= $timeout; &nbsp;&nbsp;if ($filename = = "") {&nbsp;&nbsp;&nbsp; $filename = $this-&gt;_generatefilename (); &nbsp;&nbsp;} &nbsp;
&nbsp;if (file_exists ($filename) &nbsp;&amp;&amp;&nbsp; (Time ()-filemtime ($filename) &nbsp;&lt;&nbsp; $timeout)) { &nbsp;&nbsp;&nbsp; $this-&gt;_redirect ($filename); &NBSP;&NBSP} &nbsp} &nbsp;function&nbsp;savefeed ($filename = "", $displayContents =true) {&nbsp;&nbsp;if ($filename = = "") {&nbsp;&nbsp;&nbsp; $filename = $this-&gt;_generatefilename () &nbsp;&nbsp;} &nbsp;&nbsp; $feedFile =fopen ($
FileName, "w+"); &nbsp;&nbsp;if ($feedFile) {&nbsp;&nbsp;&nbsp;fputs ($feedFile, $this-&gt;createfeed ()); &nbsp;&nbsp;&nbsp;fclose ($
Feedfile); &nbsp;&nbsp;&nbsp;if ($displayContents) {&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_redirect ($filename); &nbsp;&nbsp; &NBSP} &nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;echo&nbsp; "&lt;br&nbsp;/&gt;&lt;b&gt;error&nbsp;creating&nbsp;feed
&nbsp;file,&nbsp;please&nbsp;check&nbsp;write&nbsp;permissions.&lt;/b&gt;&lt;br&nbsp;/&gt; ";
&NBSP;&NBSP} &nbsp} class&nbsp;feeddate{&nbsp;var&nbsp; $unix; &nbsp;function&nbsp;feeddate ($dateString = "") {
&nbsp;&nbsp;if ($dateString = = "") &nbsp; $dateString =date ("R");
&nbsp;&nbsp;if (Is_integer ($dateString)) {&nbsp;&nbsp;&nbsp; $this-&gt;unix= $dateString; &nbsp;&nbsp;&nbsp;return; &nbsp;&nbsp;} &Nbsp;&nbsp;if (Preg_match,:(?: mon| tue| wed| thu| fri| Sat| Sun), \\s+)? (\\d{1,2}) \\s+ ([a-za-z]{3}) \\s+ (\\d{4}) \\s+ (\\d{2}):(\\d{2}):(\\d{2}) \\s+ (. *) ~ ", $dateString, $matches)) {&nbsp; &nbsp;&nbsp; $months =array ("The =&gt;1", "Feb" =&gt;2, "Mar" =&gt;3, "APR" =&gt;4, "may" =&gt;5, "June" =&gt;6, "" "=&gt;7,
"Aug" =&gt;8, "Sep" =&gt;9, "Oct" =&gt;10, "Nov" =&gt;11, "Dec" =&gt;12); &nbsp;&nbsp;&nbsp; $this-&gt;unix=mktime ($matches [4], $matches [5], $matches [6], $months [$matches [2]], $matches [1],$
MATCHES[3]); &nbsp;&nbsp;&nbsp;if (substr ($matches [7],0,1) = = ' + ' &nbsp;or&nbsp;substr ($matches [7],0,1) = = '] {&nbsp;&nbsp; &nbsp;&nbsp; $tzOffset = (substr ($matches [7],0,3) &nbsp;*&nbsp;60&nbsp;+&nbsp;substr ($matches [7],-2)] &nbsp;*&nbsp;
60; &nbsp;&nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;&nbsp;if (strlen ($matches [7]) ==1) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$
onehour=3600;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ord =ord ($matches [7]); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($ord &nbsp;&lt;&nbsp;ord ("M")) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tzOffset = ( Ord ("A") &nbsp;-&nbSP; $ord &nbsp;-&nbsp;1) &nbsp;*&nbsp; $oneHour; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif ($ord &nbsp;&gt;=&nbsp;ord ("M") &nbsp;&amp;&amp;&nbsp; $matches [7]!=] Z
") {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tzOffset = ($ord &nbsp;-&nbsp;ord (" M ")) &nbsp;*&nbsp; $oneHour;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif ($matches [7]== "Z") {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tzOffset = 0;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;&nbsp} &nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp; ($matches [7]) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp; "UT": &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp; "GMT":&nbsp;&nbsp;&nbsp;
&nbsp; $tzOffset = 0;
&NBSP;&NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp &nbsp;&nbsp;&nbsp; $this-&gt;unix&nbsp;+=&nbsp; $tzOffset;
&nbsp;&nbsp;&nbsp;return; &NBSP;&NBSP} &nbsp;&nbsp;if (Preg_match ("~ (\\d{4})-(\\d{2})-(\\d{2}) T (\\d{2}):(\\d{2}):(\\d{2}) (. *) ~", $ DateString, $matches)) {&nbsp;&nbsp;&nbsp; $this-&gt;unix=mktime ($matches [4], $matches [5], $matches [6], $matches [2],
$matches [3], $matches [1]); &nbsp;&nbsp;&nbsp;if (substR ($matches [7],0,1) = = ' + ' &nbsp;or&nbsp;substr ($matches [7],0,1] = = ') {&nbsp;&nbsp;&nbsp;&nbsp; $tzOffset = (substr ($
matches[7],0,3) &nbsp;*&nbsp;60&nbsp;+&nbsp;substr ($matches [7],-2)) &nbsp;*&nbsp;60; &nbsp;&nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;&nbsp;if ($matches [7]== "Z") {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tzOffset =0
;
&NBSP;&NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp &nbsp;&nbsp;&nbsp; $this-&gt;unix&nbsp;+=&nbsp; $tzOffset;
&nbsp;&nbsp;&nbsp;return;
&NBSP;&NBSP} &nbsp;&nbsp; $this-&gt;unix=0; &NBSP} &nbsp;function&nbsp;rfc822 () {&nbsp;&nbsp; $date =gmdate ("Y-m-d&nbsp;h:i:s", $this-&gt;unix); &nbsp;&nbsp;if
(time_zone!= "") &nbsp; $date &nbsp;.=&nbsp; "&nbsp;" Str_replace (":", "", Time_zone);
&nbsp;&nbsp;return&nbsp; $date; &NBSP} &nbsp;function&nbsp;iso8601 () {&nbsp;&nbsp; $date =gmdate ("Y-m-d&nbsp;h:i:s", $this-&gt;unix); &nbsp;&nbsp;$
Date=substr ($date, 0,22) &nbsp;.&nbsp; ': ' &nbsp;.&nbsp;substr ($date,-2);
&nbsp;&nbsp;if (time_zone!= "") &nbsp; $date =str_replace ("+00:00", Time_zone, $date);
&nbsp;&nbsp;return&nbsp; $date; &nbsp;} &nbsp;function&nbsp;unix () {&nbsp;&nbsp;return&nbsp; $this-&gt;unix; &nbsp}} class&nbsp;rsscreator10&nbsp;extends &nbsp;feedcreator{&nbsp;function&nbsp;createfeed () {&nbsp;&nbsp; $feed = "&lt;?xml&nbsp;version=\" 1.0\ &nbsp; Encoding=\ "". $this-&gt;encoding. "
\ "&gt;\n";
&nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_creategeneratorcomment (); &nbsp;&nbsp;if ($this-&gt;cssstylesheet== "") {&nbsp;&nbsp;&nbsp; $cssStyleSheet = "http://www.w3.org/2000/08/
W3c-synd/style.css ";
&NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createstylesheetreferences ();
&nbsp;&nbsp; $feed .=&nbsp; "&lt;rdf:rdf\n";
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;xmlns=\" http://purl.org/rss/1.0/\ "\ n"; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;xmlns:rdf=\" http://www.w3.org/1999/02/22-rdf-syntax-ns#\ "\ n"
;
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;xmlns:slash=\" http://purl.org/rss/1.0/modules/slash/\ "\ n";
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;xmlns:dc=\" http://purl.org/dc/elements/1.1/\ "&gt;\n"; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;channel&nbsp;rdf:about=\" ". $this-&gt;syndicationurl."
\ "&gt;\n"; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;" Htmlspecialchars ($ This-&gt;title). "
&lt;/title&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;". Htmlspecialchars ($this-&gt;description). "
&lt;/description&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link&gt;" $this-&gt;link. "
&lt;/link&gt;\n "; &nbsp;&nbsp;if ($this-&gt;image!=null) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&lt;image&nbsp;rdf:resource=\ "". $this-&gt;image-&gt;url. "
\ "&nbsp;/&gt;\n";
&NBSP;&NBSP} &nbsp;&nbsp; $now =new&nbsp;feeddate (); &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:date&gt;" Htmlspecialchars ($now- &gt;iso8601 ()). "
&lt;/dc:date&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&Nbsp;&lt;items&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rdf:seq
&gt;\n "; &nbsp;&nbsp;for&nbsp; ($i =0 $i &lt;count ($this-&gt;items); $i + +) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&LT;RDF:LI&NBSP;RDF: Resource=\ "". Htmlspecialchars ($this-&gt;items[$i]-&gt;link). "
\ "/&gt;\n"; &NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&lt;/rdf:seq&gt;\n ";
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/items&gt;\n";
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;/channel&gt;\n"; &nbsp;&nbsp;if ($this-&gt;image!=null) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;image&nbsp; Rdf:about=\ "". $this-&gt;image-&gt;url. "
\ "&gt;\n"; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;". $this-&gt; Image-&gt;titLe. "
&lt;/title&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link&gt;". $this-&gt;image- &gt;link. "
&lt;/link&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;url&gt;". $this-&gt;image- &gt;url. "
&lt;/url&gt;\n ";
&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;/image&gt;\n"; &NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createadditionalelements ($this-&gt;additionalelements, "&nbsp;
&nbsp;&nbsp;&nbsp; "); &nbsp;&nbsp;for&nbsp; ($i =0 $i &lt;count ($this-&gt;items); $i + +) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp; &nbsp;&nbsp;&lt;item&nbsp;rdf:about=\ "". Htmlspecialchars ($this-&gt;items[$i]-&gt;link). "
\ "&gt;\n"; &nbsp;&nbsp;&nbsp;//$feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:type&gt;posting&lt;/
Dc:type&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:format&gt;text/html&lt;
/dc:format&gt;\n "; &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;date!=null) {&nbsp;&nbsp;&nbsp;&nbsp; $itemDate =new&nbsp;feeddate ($this-&gt;items[$i]-&gt;date); &nbsp; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:date&gt;". Htmlspecialchars ($itemDate-&gt;iso8601 ()). "
&lt;/dc:date&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;source!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed. = &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:source&gt;" Htmlspecialchars ($this-&gt;items[$i] -&gt;source). "
&lt;/dc:source&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;author!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed. = &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dc:creator&gt;" Htmlspecialchars ($this-&gt;items[$i ]-&gt;author). "
&lt;/dc:creator&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title &gt; ". Htmlspecialchars (Strip_tags (STRTR ($this-&gt;items[$i]-&gt;title," \n\r "," &nbsp;&nbsp; "))." &lt;/titlE&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link&gt;". Htmlspecialchars ($this-&gt;items[$i]-&gt;link). "
&lt;/link&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;". Htmlspecialchars ($this-&gt;items[$i]-&gt;description). "
&lt;/description&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createadditionalelements ($this-&gt;items[$i]-&gt;additionalelements,
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;/item&gt;\n";
&NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; "&lt;/rdf:rdf&gt;\n";
&nbsp;&nbsp;return&nbsp; $feed; &NBSP} class&nbsp;rsscreator091&nbsp;extends&nbsp;feedcreator{&nbsp;var&nbsp; $RSSVersion &nbsp;function&nbsp; RSSCreator091 () {&nbsp;&nbsp; $this-&gt;_setrssversion ("0.91") &nbsp;&nbsp; $this-&gt;contenttype= "application/
Rss+xml "; &NBSP} &nbsp;function&nbsp;_setrssversion ($version) {&nbsp;&nbsp; $this-&gt;rssversion= $version; &NBSP} &nbsp;function&nbsp;createfeed () {&nbsp;&nbsp; $feed = "&lt;?xml&nbsp;version=\" 1.0\ "&nbsp;encoding=\" ". $ This-&gt;encoding. "
\ "&gt;\n";
&nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_creategeneratorcomment ();
&nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createstylesheetreferences (); &nbsp;&nbsp; $feed .=&nbsp; "&lt;rss&nbsp;version=\" ". $this-&gt;rssversion."
\ "&gt;\n";
&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;channel&gt;\n"; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;title), 100). "
&lt;/title&gt;\n ";
&nbsp;&nbsp; $this-&gt;descriptiontruncsize=500; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;". $this-&gt; GetDescription (). "
&lt;/description&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link&gt;" $this-&gt;link. "
&lt;/link&gt;\n ";
&nbsp;&nbsp; $now =new&nbsp;feeddate (); &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsP;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;lastbuilddate&gt; ". Htmlspecialchars ($now-&gt;rfc822 ())."
&lt;/lastbuilddate&gt;\n "; &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;generator&gt;". Feedcreator_version. "
&lt;/generator&gt;\n "; &nbsp;&nbsp;if ($this-&gt;image!=null) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&lt;image&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt; Url&gt; ". $this-&gt;image-&gt;url."
&lt;/url&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt; Title&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;image-&gt;title), 100). "
&lt;/title&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt; Link&gt; ". $this-&gt;image-&gt;link."
&lt;/link&gt;\n "; &nbsp;&nbsp;&nbsp;if ($this-&gt;image-&gt;width!= "") {&nbsp;&nbsp;&nbsp;&nbsp;$feed.=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width&gt;". $this-&gt; Image-&gt;width. "
&lt;/width&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;image-&gt;height!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed .=&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height&gt; ". $this-&gt;image-&gt; Height. "
&lt;/height&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;image-&gt;description!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed. = &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;" $this-&gt; Image-&gt;getdescription (). "
&lt;/description&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/image
&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;language!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;language&gt; ". $this-&gt;language."
&lt;/language&gt;\n "; &nbsp;&nbsp;} &nbsp;&nbsp;if ($this-&gt;copyright!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;copyright&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;copyright), 100). "
&lt;/copyright&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;editor!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;managingEditor&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;editor), 100). "
&lt;/managingeditor&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;webmaster!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;webMaster&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;webmaster), 100). "
&lt;/webmaster&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;pubdate!= "") {&nbsp;&nbsp;&nbsp; $pubDate =new&nbsp;feeddate ($this-&gt;
pubdate); &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pubDate&gt;". Htmlspecialchars ($pubDate-&gt;rfc822 ()). "
&lt;/pubdate&gt;\n "; &nbsp;&nbsp;} &nBsp;&nbsp;if ($this-&gt;category!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&lt;category&gt; ". Htmlspecialchars ($this-&gt;category)."
&lt;/category&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;docs!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;docs&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;docs), 500). "
&lt;/docs&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;ttl!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;ttl&gt; ". Htmlspecialchars ($this-&gt;ttl)."
&lt;/ttl&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;rating!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;rating&gt; ". Feedcreator::itrunc (Htmlspecialchars ($this-&gt;rating), 500). "
&lt;/rating&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;skiphours!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;skipHours&gt; ". HtmlspecIalchars ($this-&gt;skiphours). "
&lt;/skiphours&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp;if ($this-&gt;skipdays!= "") {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;skipDays&gt; ". Htmlspecialchars ($this-&gt;skipdays)."
&lt;/skipdays&gt;\n "; &NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createadditionalelements ($this-&gt;additionalelements, "&nbsp;
&nbsp;&nbsp;&nbsp; "); &nbsp;&nbsp;for&nbsp; ($i =0 $i &lt;count ($this-&gt;items); $i + +) {&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt; Title&gt; ". Feedcreator::itrunc (Htmlspecialchars (strip_tags ($this-&gt;items[$i]-&gt;title)), 100. "
&lt;/title&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt; Link&gt; ". Htmlspecialchars ($this-&gt;items[$i]-&gt;link)."
&lt;/link&gt;\n "; &nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&Nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt; ". $this-&gt;items[$i ]-&gt;getdescription (). "
&lt;/description&gt;\n "; &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;author!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;author&gt; ". Htmlspecialchars ($this-&gt;items[$ I]-&gt;author). "
&lt;/author&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;/* &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;on&nbsp;hold &nbsp;&nbsp;&nbsp;&nbsp;if ( $this-&gt;items[$i]-&gt;source!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;source&gt; ". Htmlspecialchars ($this-&gt;items[$i]-&gt;source)."
&lt;/source&gt;\n ";
&NBSP;&NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;category!= "") { &nbsp;&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;category&gt; ".Htmlspecialchars ($this-&gt;items[$i]-&gt;category). "
&lt;/category&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;comments!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed. = &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;comments&gt;". Htmlspecialchars ($this-&gt;items[$i]-&gt;comments). "
&lt;/comments&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;date!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $itemDate =
New&nbsp;feeddate ($this-&gt;items[$i]-&gt;date); &nbsp;&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pubDate&gt; ". Htmlspecialchars ($itemDate-&gt;rfc822 ())."
&lt;/pubdate&gt;\n "; &NBSP;&NBSP;&NBSP} &nbsp;&nbsp;&nbsp;if ($this-&gt;items[$i]-&gt;guid!= "") {&nbsp;&nbsp;&nbsp;&nbsp; $feed. = &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;guid&gt;". Htmlspecialchars ( $this-&gt;items[$i]-&gt;guid). "
&lt;/guid&gt;\n "; &nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp; $feed .=&nbsp; $this-&gt;_createadditionalelements ($this-&gt;items[$i]-&gt;additionalelements, "&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
&nbsp;&nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/item&gt;\n";
&NBSP;&NBSP} &nbsp;&nbsp; $feed .=&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&lt;/channel&gt;\n";
&nbsp;&nbsp; $feed .=&nbsp; "&lt;/rss&gt;\n";
&nbsp;&nbsp;return&nbsp; $feed; &NBSP}} class&nbsp;rsscreator20&nbsp;extends&nbsp;rsscreator091{&nbsp;function&nbsp;rsscreator20 () {&nbsp;
&nbsp;parent::_setrssversion ("2.0"); &NBSP}}

Use examples:

<?php
header (' content-type:text/html; Charset=utf-8 ');
$db =mysql_connect (' 127.0.0.1 ', ' root ', ' 123456 ');
mysql_query ("Set names UTF8");
mysql_select_db (' dbname ', $db);
$brs =mysql_query (' SELECT * from article ORDER by add_time desc limit 0,10 ', $db);
$rss =new universalfeedcreator ();
$rss->title= "page title";
$rss->link= "website http://";
$rss->description= "RSS title";
while ($rowbrs =mysql_fetch_array ($brs)) {
$item =new feeditem ();
$item->title = $rowbrs [' subject '];
$item->link= ' http://www.111cn.net/';
$item->description = $rowbrs [' description '];
$rss->additem ($item);
}
Mysql_close ($db);
$rss->savefeed ("RSS2.0", "Rss.xml");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.