#3354 : LanguagePt update by Get_it
[lhc/web/wiklou.git] / includes / Feed.php
index e66032f..a798ce4 100644 (file)
@@ -42,7 +42,7 @@ class FeedItem {
        var $Author = '';
        /**#@-*/
        
-       /**
+       /**#@+
         * @todo document
         */
        function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
@@ -56,7 +56,6 @@ class FeedItem {
        
        /**
         * @static
-        * @todo document
         */
        function xmlEncode( $string ) {
                $string = str_replace( "\r\n", "\n", $string );
@@ -64,37 +63,17 @@ class FeedItem {
                return htmlspecialchars( $string );
        }
        
-       /**
-        * @todo document
-        */
        function getTitle() { return $this->xmlEncode( $this->Title ); }
-       /**
-        * @todo document
-        */
        function getUrl() { return $this->xmlEncode( $this->Url ); }
-       /**
-        * @todo document
-        */
        function getDescription() { return $this->xmlEncode( $this->Description ); }
-       /**
-        * @todo document
-        */
        function getLanguage() {
                global $wgContLanguageCode;
                return $wgContLanguageCode;
        }
-       /**
-        * @todo document
-        */
        function getDate() { return $this->Date; }
-       /**
-        * @todo document
-        */
        function getAuthor() { return $this->xmlEncode( $this->Author ); }
-       /**
-        * @todo document
-        */
        function getComments() { return $this->xmlEncode( $this->Comments ); }
+       /**#@-*/
 }
 
 /**
@@ -158,7 +137,10 @@ class ChannelFeed extends FeedItem {
         * @access private
         */
        function contentType() {
-               return 'application/xml';
+               global $wgRequest;
+               $ctype = $wgRequest->getVal('ctype','application/xml');
+               $allowedctypes = array('application/xml','text/xml','application/rss+xml','application/atom+xml');
+               return (in_array($ctype, $allowedctypes) ? $ctype : 'application/xml');
        }
        
        /**
@@ -170,8 +152,8 @@ class ChannelFeed extends FeedItem {
                global $wgServer, $wgStylePath;
                
                $this->httpHeaders();
-               print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
-               print '<' . '?xml-stylesheet type="text/css" href="' .
+               echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
+               echo '<?xml-stylesheet type="text/css" href="' .
                        htmlspecialchars( "$wgServer$wgStylePath/common/feed.css" ) . '"?' . ">\n";
        }
 }