(bug 15543) fix for r38139: don't include $wgUser->mTouched and smaxage=0 in query...
[lhc/web/wiklou.git] / includes / Feed.php
index 9b4816b..21e8f08 100644 (file)
@@ -1,6 +1,5 @@
 <?php
-# Basic support for outputting syndication feeds in RSS, other formats
-#
+
 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
 # http://www.mediawiki.org/
 #
 #
 # You should have received a copy of the GNU General Public License along
 # with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 # http://www.gnu.org/copyleft/gpl.html
 
 /**
+ * Basic support for outputting syndication feeds in RSS, other formats.
  * Contain a feed class as well as classes to build rss / atom ... feeds
  * Available feeds are defined in Defines.php
- * @package MediaWiki
  */
 
-
 /**
- * @todo document
- * @package MediaWiki
+ * A base class for basic support for outputting syndication feeds in RSS and other formats.
  */
 class FeedItem {
        /**#@+
         * @var string
-        * @access private
+        * @private
         */
        var $Title = 'Wiki';
        var $Description = '';
@@ -44,8 +41,9 @@ class FeedItem {
 
        /**#@+
         * @todo document
+        * @param $Url URL uniquely designating the item.
         */
-       function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
+       function __construct( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
                $this->Title = $Title;
                $this->Description = $Description;
                $this->Url = $Url;
@@ -54,9 +52,6 @@ class FeedItem {
                $this->Comments = $Comments;
        }
 
-       /**
-        * @static
-        */
        function xmlEncode( $string ) {
                $string = str_replace( "\r\n", "\n", $string );
                $string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', '', $string );
@@ -77,8 +72,7 @@ class FeedItem {
 }
 
 /**
- * @todo document
- * @package MediaWiki
+ * @todo document (needs one-sentence top-level class description).
  */
 class ChannelFeed extends FeedItem {
        /**#@+
@@ -117,7 +111,7 @@ class ChannelFeed extends FeedItem {
         * This should be called from the outHeader() method,
         * but can also be called separately.
         *
-        * @access public
+        * @public
         */
        function httpHeaders() {
                global $wgOut;
@@ -134,7 +128,7 @@ class ChannelFeed extends FeedItem {
         * Return an internet media type to be sent in the headers.
         *
         * @return string
-        * @access private
+        * @private
         */
        function contentType() {
                global $wgRequest;
@@ -146,22 +140,21 @@ class ChannelFeed extends FeedItem {
        /**
         * Output the initial XML headers with a stylesheet for legibility
         * if someone finds it in a browser.
-        * @access private
+        * @private
         */
        function outXmlHeader() {
-               global $wgServer, $wgStylePath;
+               global $wgStylePath, $wgStyleVersion;
 
                $this->httpHeaders();
                echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
                echo '<?xml-stylesheet type="text/css" href="' .
-                       htmlspecialchars( "$wgServer$wgStylePath/common/feed.css" ) . '"?' . ">\n";
+                       htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
+                       '"?' . ">\n";
        }
 }
 
 /**
  * Generate a RSS feed
- * @todo document
- * @package MediaWiki
  */
 class RSSFeed extends ChannelFeed {
 
@@ -221,8 +214,6 @@ class RSSFeed extends ChannelFeed {
 
 /**
  * Generate an Atom feed
- * @todo document
- * @package MediaWiki
  */
 class AtomFeed extends ChannelFeed {
        /**
@@ -234,7 +225,7 @@ class AtomFeed extends ChannelFeed {
        }
 
        /**
-        * @todo document
+        * Outputs a basic header for Atom 1.0 feeds.
         */
        function outHeader() {
                global $wgVersion;
@@ -259,7 +250,7 @@ class AtomFeed extends ChannelFeed {
         * have to change the id? Maybe? Maybe not.
         *
         * @return string
-        * @access private
+        * @private
         */
        function getFeedId() {
                return $this->getSelfUrl();
@@ -268,7 +259,7 @@ class AtomFeed extends ChannelFeed {
        /**
         * Atom 1.0 requests a self-reference to the feed.
         * @return string
-        * @access private
+        * @private
         */
        function getSelfUrl() {
                global $wgRequest;
@@ -276,7 +267,8 @@ class AtomFeed extends ChannelFeed {
        }
 
        /**
-        * @todo document
+        * Output a given item.
+        * @param $item
         */
        function outItem( $item ) {
                global $wgMimeType;
@@ -299,11 +291,9 @@ class AtomFeed extends ChannelFeed {
        }
 
        /**
-        * @todo document
+        * Outputs the footer for Atom 1.0 feed (basicly '\</feed\>').
         */
        function outFooter() {?>
        </feed><?php
        }
 }
-
-?>