* Document a bit
[lhc/web/wiklou.git] / includes / FeedUtils.php
index 4ed47d5..072c00b 100644 (file)
@@ -1,8 +1,20 @@
 <?php
 
-// TODO: document
+/**
+ * Helper functions for feeds
+ *
+ * @ingroup Feed
+ */
 class FeedUtils {
 
+       /**
+        * Check whether feed's cache should be cleared; for changes feeds
+        * If the feed should be purged; $timekey and $key will be removed from
+        * $messageMemc
+        *
+        * @param $timekey String: cache key of the timestamp of the last item
+        * @param $key String: cache key of feed's content
+        */
        public static function checkPurge( $timekey, $key ) {
                global $wgRequest, $wgUser, $messageMemc;
                $purge = $wgRequest->getVal( 'action' ) === 'purge';
@@ -12,6 +24,12 @@ class FeedUtils {
                }
        }
 
+       /**
+        * Check whether feeds can be used and that $type is a valid feed type
+        *
+        * @param $type String: feed type, as requested by the user
+        * @return Boolean
+        */
        public static function checkFeedOutput( $type ) {
                global $wgFeed, $wgFeedClasses;
 
@@ -30,8 +48,11 @@ class FeedUtils {
        }
 
        /**
-       * Format a diff for the newsfeed
-       */
+        * Format a diff for the newsfeed
+        *
+        * @param $row Object: row from the recentchanges table
+        * @return String
+        */
        public static function formatDiff( $row ) {
                global $wgUser;
 
@@ -53,6 +74,17 @@ class FeedUtils {
                        $actiontext );
        }
 
+       /**
+        * Really format a diff for the newsfeed
+        *
+        * @param $title Title object
+        * @param $oldid Integer: old revision's id
+        * @param $newid Integer: new revision's id
+        * @param $timestamp Integer: new revision's timestamp
+        * @param $comment String: new revision's comment
+        * @param $actiontext String: text of the action; in case of log event
+        * @return String
+        */
        public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='' ) {
                global $wgFeedDiffCutoff, $wgContLang, $wgUser;
                wfProfileIn( __FUNCTION__ );
@@ -129,14 +161,14 @@ class FeedUtils {
        }
 
        /**
-       * Hacky application of diff styles for the feeds.
-       * Might be 'cleaner' to use DOM or XSLT or something,
-       * but *gack* it's a pain in the ass.
-       *
-       * @param $text String:
-       * @return string
-       * @private
-       */
+        * Hacky application of diff styles for the feeds.
+        * Might be 'cleaner' to use DOM or XSLT or something,
+        * but *gack* it's a pain in the ass.
+        *
+        * @param $text String: diff's HTML output
+        * @return String: modified HTML
+        * @private
+        */
        public static function applyDiffStyle( $text ) {
                $styles = array(
                        'diff'             => 'background-color: white; color:black;',