Add support for Number grouping(commafy) based on CLDR number grouping patterns like...
[lhc/web/wiklou.git] / includes / FeedUtils.php
index 7e841f3..b6df0c6 100644 (file)
@@ -31,16 +31,15 @@ class FeedUtils {
         * @return Boolean
         */
        public static function checkFeedOutput( $type ) {
-               global $wgFeed, $wgFeedClasses;
+               global $wgOut, $wgFeed, $wgFeedClasses;
 
                if ( !$wgFeed ) {
-                       global $wgOut;
                        $wgOut->addWikiMsg( 'feed-unavailable' );
                        return false;
                }
 
                if( !isset( $wgFeedClasses[$type] ) ) {
-                       wfHttpError( 500, "Internal Server Error", "Unsupported feed type." );
+                       $wgOut->addWikiMsg( 'feed-invalid' );
                        return false;
                }
 
@@ -86,7 +85,7 @@ class FeedUtils {
         * @return String
         */
        public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='' ) {
-               global $wgFeedDiffCutoff, $wgContLang, $wgUser;
+               global $wgFeedDiffCutoff, $wgLang, $wgUser;
                wfProfileIn( __METHOD__ );
 
                $skin = $wgUser->getSkin();
@@ -108,23 +107,23 @@ class FeedUtils {
                                wfProfileIn( __METHOD__."-dodiff" );
 
                                #$diffText = $de->getDiff( wfMsg( 'revisionasof',
-                               #       $wgContLang->timeanddate( $timestamp ),
-                               #       $wgContLang->date( $timestamp ),
-                               #       $wgContLang->time( $timestamp ) ),
+                               #       $wgLang->timeanddate( $timestamp ),
+                               #       $wgLang->date( $timestamp ),
+                               #       $wgLang->time( $timestamp ) ),
                                #       wfMsg( 'currentrev' ) );
-                               
+
                                // Don't bother generating the diff if we won't be able to show it
                                if ( $wgFeedDiffCutoff > 0 ) {
                                        $de = new DifferenceEngine( $title, $oldid, $newid );
                                        $diffText = $de->getDiff(
                                                wfMsg( 'previousrevision' ), // hack
                                                wfMsg( 'revisionasof',
-                                                       $wgContLang->timeanddate( $timestamp ),
-                                                       $wgContLang->date( $timestamp ),
-                                                       $wgContLang->time( $timestamp ) ) );
+                                                       $wgLang->timeanddate( $timestamp ),
+                                                       $wgLang->date( $timestamp ),
+                                                       $wgLang->time( $timestamp ) ) );
                                }
 
-                               if ( ( strlen( $diffText ) > $wgFeedDiffCutoff ) || ( $wgFeedDiffCutoff <= 0 ) ) {
+                               if ( $wgFeedDiffCutoff <= 0 || ( strlen( $diffText ) > $wgFeedDiffCutoff ) ) {
                                        // Omit large diffs
                                        $diffLink = $title->escapeFullUrl(
                                                'diff=' . $newid .
@@ -167,7 +166,6 @@ class FeedUtils {
         *
         * @param $text String: diff's HTML output
         * @return String: modified HTML
-        * @private
         */
        public static function applyDiffStyle( $text ) {
                $styles = array(