X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FFeedUtils.php;h=22cb52beba36f823a0551a1ea709957e0806b16f;hb=d4ae43bb9fc535956b10c3ac2545e8aff1cf106d;hp=4842c38e1b131e1d39b93a18813ad9c4f9e5b9fc;hpb=853f21b42e95b16c876c94245a5a4645dd982e93;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 4842c38e1b..22cb52beba 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -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 @@ -121,12 +121,12 @@ class FeedUtils { // 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 ) { + if ( $oldid ) { wfProfileIn( __METHOD__ . "-dodiff" ); #$diffText = $de->getDiff( wfMessage( 'revisionasof', @@ -171,7 +171,7 @@ class FeedUtils { 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,9 +220,10 @@ class FeedUtils { * @return string */ protected static function getDiffLink( Title $title, $newid, $oldid = null ) { - $queryParameters = ($oldid == null) - ? "diff={$newid}" - : "diff={$newid}&oldid={$oldid}"; + $queryParameters = array( 'diff' => $newid ); + if ( $oldid != null ) { + $queryParameters['oldid'] = $oldid; + } $diffUrl = $title->getFullURL( $queryParameters ); $diffLink = Html::element( 'a', array( 'href' => $diffUrl ), @@ -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 ); }