Merge "Fixed some @params documentation (includes/[file...|upload])"
[lhc/web/wiklou.git] / includes / FeedUtils.php
index 5e4b24e..22cb52b 100644 (file)
@@ -59,7 +59,7 @@ class FeedUtils {
                        return false;
                }
 
-               if( !isset( $wgFeedClasses[$type] ) ) {
+               if ( !isset( $wgFeedClasses[$type] ) ) {
                        $wgOut->addWikiMsg( 'feed-invalid' );
                        return false;
                }
@@ -77,14 +77,14 @@ class FeedUtils {
                $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
                $timestamp = wfTimestamp( TS_MW, $row->rc_timestamp );
                $actiontext = '';
-               if( $row->rc_type == RC_LOG ) {
+               if ( $row->rc_type == RC_LOG ) {
                        $rcRow = (array)$row; // newFromRow() only accepts arrays for RC rows
                        $actiontext = LogFormatter::newFromRow( $rcRow )->getActionText();
                }
                return self::formatDiffRow( $titleObj,
                        $row->rc_last_oldid, $row->rc_this_oldid,
                        $timestamp,
-                       ($row->rc_deleted & Revision::DELETED_COMMENT)
+                       $row->rc_deleted & Revision::DELETED_COMMENT
                                ? wfMessage( 'rev-deleted-comment' )->escaped()
                                : $row->rc_comment,
                        $actiontext
@@ -106,7 +106,7 @@ class FeedUtils {
                global $wgFeedDiffCutoff, $wgLang;
                wfProfileIn( __METHOD__ );
 
-               # log enties
+               // log entries
                $completeText = '<p>' . implode( ' ',
                        array_filter(
                                array(
@@ -115,19 +115,19 @@ class FeedUtils {
 
                // NOTE: Check permissions for anonymous users, not current user.
                //       No "privileged" version should end up in the cache.
-               //       Most feed readers will not log in anway.
+               //       Most feed readers will not log in anyway.
                $anon = new User();
                $accErrors = $title->getUserPermissionsErrors( 'read', $anon, true );
 
                // Can't diff special pages, unreadable pages or pages with no new revision
                // to compare against: just return the text.
-               if( $title->getNamespace() < 0 || $accErrors || !$newid ) {
+               if ( $title->getNamespace() < 0 || $accErrors || !$newid ) {
                        wfProfileOut( __METHOD__ );
                        return $completeText;
                }
 
-               if( $oldid ) {
-                       wfProfileIn( __METHOD__."-dodiff" );
+               if ( $oldid ) {
+                       wfProfileIn( __METHOD__ . "-dodiff" );
 
                        #$diffText = $de->getDiff( wfMessage( 'revisionasof',
                        #       $wgLang->timeanddate( $timestamp ),
@@ -168,10 +168,10 @@ class FeedUtils {
                                $diffText = UtfNormal::cleanUp( $diffText );
                                $diffText = self::applyDiffStyle( $diffText );
                        }
-                       wfProfileOut( __METHOD__."-dodiff" );
+                       wfProfileOut( __METHOD__ . "-dodiff" );
                } else {
                        $rev = Revision::newFromId( $newid );
-                       if( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
+                       if ( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
                                $newContent = ContentHandler::getForTitle( $title )->makeEmptyContent();
                        } else {
                                $newContent = $rev->getContent();
@@ -220,10 +220,11 @@ class FeedUtils {
         * @return string
         */
        protected static function getDiffLink( Title $title, $newid, $oldid = null ) {
-               $queryParameters = ($oldid == null)
-                       ? "diff={$newid}"
-                       : "diff={$newid}&oldid={$oldid}";
-               $diffUrl = $title->getFullUrl( $queryParameters );
+               $queryParameters = array( 'diff' => $newid );
+               if ( $oldid != null ) {
+                       $queryParameters['oldid'] = $oldid;
+               }
+               $diffUrl = $title->getFullURL( $queryParameters );
 
                $diffLink = Html::element( 'a', array( 'href' => $diffUrl ),
                        wfMessage( 'showdiff' )->inContentLanguage()->text() );
@@ -250,7 +251,7 @@ class FeedUtils {
                        'diffchange'       => 'font-weight: bold; text-decoration: none;',
                );
 
-               foreach( $styles as $class => $style ) {
+               foreach ( $styles as $class => $style ) {
                        $text = preg_replace( "/(<[^>]+)class=(['\"])$class\\2([^>]*>)/",
                                "\\1style=\"$style\"\\3", $text );
                }