r89152 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89151‎ | r89152 | r89153 >
Date:06:53, 30 May 2011
Author:aaron
Status:ok
Tags:
Comment:
* Use arrays for CGI params more
* Added diffOnlyCGI() check to RC links
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsLogView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/PendingChanges_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ProblemChanges_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php
@@ -393,14 +393,16 @@
394394
395395 /**
396396 * Get the 'diffonly=' value for diff URLs. Either ('1','0','')
397 - * @return string
 397+ * @return array
398398 */
399399 public static function diffOnlyCGI() {
400400 $val = trim( wfMsgForContent( 'flaggedrevs-diffonly' ) );
401 - if ( $val === '&diffonly=1' || $val === '&diffonly=0' ) {
402 - return $val;
403 - }
404 - return '';
 401+ if ( strpos( $val, '&diffonly=1' ) !== false ) {
 402+ return array( 'diffonly' => 1 );
 403+ } elseif ( strpos( $val, '&diffonly=0' ) !== false ) {
 404+ return array( 'diffonly' => 0);
 405+ }
 406+ return array();
405407 }
406408
407409 # ################ Permission functions #################
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
@@ -567,7 +567,8 @@
568568 $title,
569569 wfMsgHtml( 'revreview-reviewlink' ),
570570 array( 'title' => wfMsg( 'revreview-reviewlink-title' ) ),
571 - array( 'oldid' => $rc->mAttribs['fp_stable'], 'diff' => 'cur' )
 571+ array( 'oldid' => $rc->mAttribs['fp_stable'], 'diff' => 'cur' ) +
 572+ FlaggedRevs::diffOnlyCGI()
572573 );
573574 $css = 'flaggedrevs-pending';
574575 }
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/PendingChanges_body.php
@@ -220,7 +220,8 @@
221221 $review = $this->skin->linkKnown( $title,
222222 wfMsg( 'pendingchanges-diff' ),
223223 array(),
224 - 'diff=cur&oldid=' . (int)$row->stable . FlaggedRevs::diffOnlyCGI() );
 224+ array( 'diff' => 'cur', 'oldid' => $row->stable ) + FlaggedRevs::diffOnlyCGI()
 225+ );
225226 # Show quality level if there are several
226227 if ( FlaggedRevs::qualityVersions() ) {
227228 $quality = $row->quality
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ProblemChanges_body.php
@@ -185,10 +185,11 @@
186186
187187 $title = Title::newFromRow( $row );
188188 $link = $this->skin->link( $title );
189 - $review = $this->skin->knownLink( $title,
 189+ $review = $this->skin->linkKnown( $title,
190190 wfMsg( 'pendingchanges-diff' ),
191191 array(),
192 - 'diff=cur&oldid=' . (int)$row->stable . FlaggedRevs::diffOnlyCGI() );
 192+ array( 'diff' => 'cur', 'oldid' => $row->stable ) + FlaggedRevs::diffOnlyCGI()
 193+ );
193194 # Show quality level if there are several
194195 if ( FlaggedRevs::qualityVersions() ) {
195196 $quality = $row->quality
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
@@ -1492,7 +1492,7 @@
14931493 $review = $wgUser->getSkin()->makeKnownLinkObj(
14941494 $article->getTitle(),
14951495 wfMsgHtml( 'review-diff2stable' ),
1496 - 'oldid=' . $srev->getRevId() . '&diff=cur' . FlaggedRevs::diffOnlyCGI()
 1496+ array( 'oldid' => $srev->getRevId(), 'diff' => 'cur' ) + FlaggedRevs::diffOnlyCGI()
14971497 );
14981498 $review = wfMsgHtml( 'parentheses', $review );
14991499 $review = "<div class='fr-diff-to-stable' align='center'>$review</div>";
@@ -1648,21 +1648,19 @@
16491649 if ( !$frev || !$this->article->revsArePending() ) {
16501650 return true; // only for pages with pending edits
16511651 }
 1652+ $params = array();
16521653 // If the edit was not autoreviewed, and the user can actually make a
16531654 // new stable version, then go to the diff...
16541655 if ( $frev->userCanSetFlags( $wgUser ) ) {
1655 - $extraQuery .= $extraQuery ? '&' : '';
1656 - // Override diffonly setting to make sure the content is shown
1657 - $extraQuery .= 'oldid=' . $frev->getRevId() .
1658 - '&diff=cur' . FlaggedRevs::diffOnlyCGI() . '&shownotice=1';
 1656+ $params += array( 'oldid' => $frev->getRevId(), 'diff' => 'cur', 'shownotice' => 1 );
 1657+ $params += FlaggedRevs::diffOnlyCGI();
16591658 // ...otherwise, go to the draft revision after completing an edit.
16601659 // This allows for users to immediately see their changes.
16611660 } else {
1662 - $extraQuery .= $extraQuery ? '&' : '';
1663 - $extraQuery .= 'stable=0';
 1661+ $params += array( 'stable' => 0 );
16641662 // Show a notice at the top of the page for non-reviewers...
16651663 if ( !$wgUser->isAllowed( 'review' ) && $this->article->isStableShownByDefault() ) {
1666 - $extraQuery .= '&shownotice=1';
 1664+ $params += array( 'shownotice' => 1 );
16671665 if ( $sectionAnchor ) {
16681666 // Pass a section parameter in the URL as needed to add a link to
16691667 // the "your changes are pending" box on the top of the page...
@@ -1670,11 +1668,12 @@
16711669 array( ':' , '.' ), array( '%3A', '%' ), // hack: reverse encoding
16721670 substr( $sectionAnchor, 1 ) // remove the '#'
16731671 );
1674 - $extraQuery .= '&fromsection=' . $section;
 1672+ $params += array('fromsection' => $section );
16751673 $sectionAnchor = ''; // go to the top of the page to see notice
16761674 }
16771675 }
16781676 }
 1677+ $extraQuery = wfAppendQuery( $extraQuery, $params );
16791678 return true;
16801679 }
16811680
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsLogView.php
@@ -126,7 +126,7 @@
127127 $links .= $wgUser->getSkin()->makeKnownLinkObj(
128128 $title,
129129 wfMsgHtml( 'review-logentry-id', $revId, $time ),
130 - "oldid={$revId}&diff=prev" . FlaggedRevs::diffOnlyCGI()
 130+ array( 'oldid' => $revId, 'diff' => 'prev' ) + FlaggedRevs::diffOnlyCGI()
131131 );
132132 $links .= ')';
133133 }

Status & tagging log