r107589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107588‎ | r107589 | r107590 >
Date:19:17, 29 December 2011
Author:ialex
Status:ok
Tags:
Comment:
Use local context to get messages
Modified paths:
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -31,11 +31,11 @@
3232 var $messages, $target;
3333 var $namespace = '', $mDb;
3434
35 - function __construct( $target, $namespace = false ) {
36 - parent::__construct();
 35+ function __construct( IContextSource $context, $target, $namespace = false ) {
 36+ parent::__construct( $context );
3737 $msgs = array( 'deletionlog', 'undeleteviewlink', 'diff' );
3838 foreach( $msgs as $msg ) {
39 - $this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities') );
 39+ $this->messages[$msg] = $this->msg( $msg )->escaped();
4040 }
4141 $this->target = $target;
4242 $this->namespace = $namespace;
@@ -98,10 +98,10 @@
9999 $lang = $this->getLanguage();
100100 $fmtLimit = $lang->formatNum( $this->mLimit );
101101 $linkTexts = array(
102 - 'prev' => wfMsgExt( 'pager-newer-n', array( 'escape', 'parsemag' ), $fmtLimit ),
103 - 'next' => wfMsgExt( 'pager-older-n', array( 'escape', 'parsemag' ), $fmtLimit ),
104 - 'first' => wfMsgHtml( 'histlast' ),
105 - 'last' => wfMsgHtml( 'histfirst' )
 102+ 'prev' => $this->msg( 'pager-newer-n', $fmtLimit )->escaped(),
 103+ 'next' => $this->msg( 'pager-older-n', $fmtLimit )->escaped(),
 104+ 'first' => $this->msg( 'histlast' )->escaped(),
 105+ 'last' => $this->msg( 'histfirst' )->escaped()
106106 );
107107
108108 $pagingLinks = $this->getPagingLinks( $linkTexts );
@@ -109,7 +109,7 @@
110110 $limits = $lang->pipeList( $limitLinks );
111111
112112 $this->mNavigationBar = "(" . $lang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " .
113 - wfMsgExt( 'viewprevnext', array( 'parsemag', 'escape', 'replaceafter' ), $pagingLinks['prev'], $pagingLinks['next'], $limits );
 113+ $this->msg( 'viewprevnext' )->rawParams( $pagingLinks['prev'], $pagingLinks['next'], $limits )->escaped();
114114 return $this->mNavigationBar;
115115 }
116116
@@ -217,14 +217,15 @@
218218 $tools = Html::rawElement(
219219 'span',
220220 array( 'class' => 'mw-deletedcontribs-tools' ),
221 - wfMsg( 'parentheses', $this->getLanguage()->pipeList( array( $last, $dellog, $reviewlink ) ) )
 221+ $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->pipeList(
 222+ array( $last, $dellog, $reviewlink ) ) )->escaped()
222223 );
223224
224225 $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
225226
226227 # Denote if username is redacted for this edit
227228 if( $rev->isDeleted( Revision::DELETED_USER ) ) {
228 - $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
 229+ $ret .= " <strong>" . $this->msg( 'rev-deleted-user-contribs' )->escaped() . "</strong>";
229230 }
230231
231232 $ret = Html::rawElement( 'li', array(), $ret ) . "\n";
@@ -306,7 +307,7 @@
307308
308309 $out->addHTML( $this->getForm( $options ) );
309310
310 - $pager = new DeletedContribsPager( $target, $options['namespace'] );
 311+ $pager = new DeletedContribsPager( $this->getContext(), $target, $options['namespace'] );
311312 if ( !$pager->getNumRows() ) {
312313 $out->addWikiMsg( 'nocontribs' );
313314 return;
@@ -329,7 +330,7 @@
330331 ? 'sp-contributions-footer-anon'
331332 : 'sp-contributions-footer';
332333
333 - if( !wfMessage( $message )->isDisabled() ) {
 334+ if( !$this->msg( $message )->isDisabled() ) {
334335 $out->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) );
335336 }
336337 }
@@ -352,17 +353,17 @@
353354 $talk = $nt->getTalkPage();
354355 if( $talk ) {
355356 # Talk page link
356 - $tools[] = Linker::link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
 357+ $tools[] = Linker::link( $talk, $this->msg( 'sp-contributions-talk' )->escaped() );
357358 if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
358359 if( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
359360 if ( $userObj->isBlocked() ) {
360361 $tools[] = Linker::linkKnown( # Change block link
361362 SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
362 - wfMsgHtml( 'change-blocklink' )
 363+ $this->msg( 'change-blocklink' )->escaped()
363364 );
364365 $tools[] = Linker::linkKnown( # Unblock link
365366 SpecialPage::getTitleFor( 'BlockList' ),
366 - wfMsgHtml( 'unblocklink' ),
 367+ $this->msg( 'unblocklink' )->escaped(),
367368 array(),
368369 array(
369370 'action' => 'unblock',
@@ -373,14 +374,14 @@
374375 else { # User is not blocked
375376 $tools[] = Linker::linkKnown( # Block link
376377 SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
377 - wfMsgHtml( 'blocklink' )
 378+ $this->msg( 'blocklink' )->escaped()
378379 );
379380 }
380381 }
381382 # Block log link
382383 $tools[] = Linker::linkKnown(
383384 SpecialPage::getTitleFor( 'Log' ),
384 - wfMsgHtml( 'sp-contributions-blocklog' ),
 385+ $this->msg( 'sp-contributions-blocklog' )->escaped(),
385386 array(),
386387 array(
387388 'type' => 'block',
@@ -391,22 +392,23 @@
392393 # Other logs link
393394 $tools[] = Linker::linkKnown(
394395 SpecialPage::getTitleFor( 'Log' ),
395 - wfMsgHtml( 'sp-contributions-logs' ),
 396+ $this->msg( 'sp-contributions-logs' )->escaped(),
396397 array(),
397398 array( 'user' => $nt->getText() )
398399 );
399400 # Link to contributions
400401 $tools[] = Linker::linkKnown(
401402 SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ),
402 - wfMsgHtml( 'sp-deletedcontributions-contribs' )
 403+ $this->msg( 'sp-deletedcontributions-contribs' )->escaped()
403404 );
404405
405406 # Add a link to change user rights for privileged users
406407 $userrightsPage = new UserrightsPage();
 408+ $userrightsPage->setContext( $this->getContext() );
407409 if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
408410 $tools[] = Linker::linkKnown(
409411 SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
410 - wfMsgHtml( 'sp-contributions-userrights' )
 412+ $this->msg( 'sp-contributions-userrights' )->escaped()
411413 );
412414 }
413415
@@ -483,15 +485,15 @@
484486 }
485487
486488 $f .= Xml::openElement( 'fieldset' ) .
487 - Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
488 - Xml::tags( 'label', array( 'for' => 'target' ), wfMsgExt( 'sp-contributions-username', 'parseinline' ) ) . ' ' .
 489+ Xml::element( 'legend', array(), $this->msg( 'sp-contributions-search' )->text() ) .
 490+ Xml::tags( 'label', array( 'for' => 'target' ), $this->msg( 'sp-contributions-username' )->parse() ) . ' ' .
489491 Html::input( 'target', $options['target'], 'text', array(
490492 'size' => '20',
491493 'required' => ''
492494 ) + ( $options['target'] ? array() : array( 'autofocus' ) ) ) . ' '.
493 - Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
 495+ Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) . ' ' .
494496 Xml::namespaceSelector( $options['namespace'], '' ) . ' ' .
495 - Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
 497+ Xml::submitButton( $this->msg( 'sp-contributions-submit' )->text() ) .
496498 Xml::closeElement( 'fieldset' ) .
497499 Xml::closeElement( 'form' );
498500 return $f;

Status & tagging log