With &debugmsg=1, PHP output a warning because the link trail no longer
[lhc/web/wiklou.git] / includes / Feed.php
index 0f654af..b0d208b 100644 (file)
 # http://www.gnu.org/copyleft/gpl.html
 
 $wgFeedClasses = array(
-       "rss" => "RSSFeed",
-       "atom" => "AtomFeed",
+       'rss' => 'RSSFeed',
+       'atom' => 'AtomFeed',
        );
 
 class FeedItem {
-       var $Title = "Wiki";
-       var $Description = "";
-       var $Url = "";
-       var $Date = "";
-       var $Author = "";
+       var $Title = 'Wiki';
+       var $Description = '';
+       var $Url = '';
+       var $Date = '';
+       var $Author = '';
        
-       function FeedItem( $Title, $Description, $Url, $Date = "", $Author = "", $Comments = "" ) {
+       function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
                $this->Title = $Title;
                $this->Description = $Description;
                $this->Url = $Url;
@@ -44,8 +44,8 @@ class FeedItem {
        function xmlEncode( $string ) {
                global $wgInputEncoding, $wgLang;
                $string = str_replace( "\r\n", "\n", $string );
-               if( strcasecmp( $wgInputEncoding, "utf-8" ) != 0 ) {
-                       $string = $wgLang->iconv( $wgInputEncoding, "utf-8", $string );
+               if( strcasecmp( $wgInputEncoding, 'utf-8' ) != 0 ) {
+                       $string = $wgLang->iconv( $wgInputEncoding, 'utf-8', $string );
                }
                return htmlspecialchars( $string );
        }
@@ -85,7 +85,7 @@ class ChannelFeed extends FeedItem {
                # print "</feed>";
        }
        
-       function outXmlHeader( $mimetype="application/xml" ) {
+       function outXmlHeader( $mimetype='application/xml' ) {
                global $wgServer, $wgStylePath, $wgOut;
                
                # We take over from $wgOut, excepting its cache header info
@@ -102,14 +102,14 @@ class ChannelFeed extends FeedItem {
 class RSSFeed extends ChannelFeed {
 
        function formatTime( $ts ) {
-               return gmdate( "D, d M Y H:i:s \G\M\T", wfTimestamp2Unix( $ts ) );
+               return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp2Unix( $ts ) );
        }
        
        function outHeader() {
                global $wgVersion;
                
                $this->outXmlHeader();
-               ?><rss version="2.0">
+               ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
        <channel>
                <title><?php print $this->getTitle() ?></title>
                <link><?php print $this->getUrl() ?></link>
@@ -127,7 +127,7 @@ class RSSFeed extends ChannelFeed {
                        <link><?php print $item->getUrl() ?></link>
                        <description><?php print $item->getDescription() ?></description>
                        <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?>
-                       <?php if( $item->getAuthor() ) { ?><author><?php print $item->getAuthor() ?></author><?php }?>
+                       <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?>
                        <?php if( $item->getComments() ) { ?><comments><?php print $item->getComments() ?></comments><?php }?>
                </item>
 <?php
@@ -143,7 +143,7 @@ class RSSFeed extends ChannelFeed {
 class AtomFeed extends ChannelFeed {
        function formatTime( $ts ) {
                // need to use RFC 822 time format at least for rss2.0
-               return gmdate( "Y-m-d\TH:i:s", wfTimestamp2Unix( $ts ) );
+               return gmdate( 'Y-m-d\TH:i:s', wfTimestamp2Unix( $ts ) );
        }
 
        function outHeader() {
@@ -186,4 +186,4 @@ class AtomFeed extends ChannelFeed {
        }
 }
 
-?>
\ No newline at end of file
+?>