Add atom feed <link> when syndication is on.
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 28 Apr 2004 06:14:49 +0000 (06:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 28 Apr 2004 06:14:49 +0000 (06:14 +0000)
Fix language marker on Atom feed head element.
Comment out empty dead fields in <author> in atom output.

includes/Feed.php
includes/OutputPage.php

index 9a7198a..95f8e8c 100644 (file)
@@ -147,7 +147,7 @@ class AtomFeed extends ChannelFeed {
                $wgOut->sendCacheControl();
                
                print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
-               ?><feed version="0.3" xml:lang="<?php print $this->getLanguage()."-".$this->getLanguage() ?>">  
+               ?><feed version="0.3" xml:lang="<?php print $this->getLanguage() ?>">   
                <title><?php print $this->getTitle() ?></title>
                <link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/>
                <modified><?php print $this->formatTime( wfTimestampNow() ) ?>Z</modified>
@@ -158,17 +158,18 @@ class AtomFeed extends ChannelFeed {
        }
        
        function outItem( $item ) {
+               global $wgMimeType;
        ?>
        <entry>
                <title><?php print $item->getTitle() ?></title>
-               <link rel="alternate" type="text/html" href="<?php print $item->getUrl() ?>"/>
+               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/>
                <?php if( $item->getDate() ) { ?>
                <modified><?php print $this->formatTime( $item->getDate() ) ?>Z</modified>
                <issued><?php print $this->formatTime( $item->getDate() ) ?></issued>
                <created><?php print $this->formatTime( $item->getDate() ) ?>Z</created><?php } ?>
        
                <summary type="text/plain"><?php print $item->getDescription() ?></summary>
-               <?php if( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor() ?></name><url></url><email></email></author><?php }?>
+               <?php if( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor() ?></name><!-- <url></url><email></email> --></author><?php }?>
                <comment>foobar</comment>
        </entry>
 
index 6f09926..1e0e423 100644 (file)
@@ -699,8 +699,11 @@ class OutputPage {
                        $ret .= " />\n";
                }
                if( $this->isSyndicated() ) {
+                       # FIXME: centralize the mime-type and name information in Feed.php
                        $link = $wgRequest->escapeAppendQuery( "feed=rss" );
-                       $ret .= "<link rel='alternate' type='application/rss+xml' title='RSS' href='$link' />\n";
+                       $ret .= "<link rel='alternate' type='application/rss+xml' title='RSS 2.0' href='$link' />\n";
+                       $link = $wgRequest->escapeAppendQuery( "feed=atom" );
+                       $ret .= "<link rel='alternate' type='application/rss+atom' title='Atom 0.3' href='$link' />\n";
                }
                # FIXME: get these working
                # $fix = htmlspecialchars( $wgStylePath . "/ie-png-fix.js" );