From d99fd8f90f80321ae8a13e234ec945b33a30341c Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 17 Sep 2009 17:55:41 +0000 Subject: [PATCH] * process messages with escapenoentities instead of escape to allow for example • as pipe-separator * change string explode to array * remove hard coded parentheses * break long lists of parameters --- includes/specials/SpecialContributions.php | 53 ++++++++++++++-------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index c664166ab9..e7cdb5b413 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -226,11 +226,21 @@ class SpecialContributions extends SpecialPage { $links = $wgLang->pipeList( $tools ); // Show a note if the user is blocked and display the last block log entry. - if ( User::newFromID( $id )->isBlocked() ) - LogEventsList::showLogExtract( $wgOut, 'block', $nt->getPrefixedText(), '', - array( 'lim' => 1, 'showIfEmpty' => false, 'msgKey' => array( 'sp-contributions-blocked-notice' ) ) ); + if ( User::newFromID( $id )->isBlocked() ) { + LogEventsList::showLogExtract( + $wgOut, + 'block', + $nt->getPrefixedText(), + '', + array( + 'lim' => 1, + 'showIfEmpty' => false, + 'msgKey' => array( 'sp-contributions-blocked-notice' ) + ) + ); + } } - + // Old message 'contribsub' had one parameter, but that doesn't work for // languages that want to put the "for" bit right after $user but before // $links. If 'contribsub' is around, use it for reverse compatibility, @@ -418,9 +428,13 @@ class ContribsPager extends ReverseChronologicalPager { function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false ) { parent::__construct(); - foreach( explode( ' ', 'uctop diff newarticle rollbacklink diff hist rev-delundel pipe-separator' ) as $msg ) { - $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') ); + + $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' ); + + foreach( $msgs as $msg ) { + $this->messages[$msg] = wfMsgExt( $msg, 'escapenoentities' ); } + $this->target = $target; $this->namespace = $namespace; $this->tagFilter = $tagFilter; @@ -461,14 +475,16 @@ class ContribsPager extends ReverseChronologicalPager { 'options' => array( 'USE INDEX' => array('revision' => $index) ), 'join_conds' => $join_cond ); - - ChangeTags::modifyDisplayQuery( $queryInfo['tables'], - $queryInfo['fields'], - $queryInfo['conds'], - $queryInfo['join_conds'], - $queryInfo['options'], - $this->tagFilter ); - + + ChangeTags::modifyDisplayQuery( + $queryInfo['tables'], + $queryInfo['fields'], + $queryInfo['conds'], + $queryInfo['join_conds'], + $queryInfo['options'], + $this->tagFilter + ); + wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; } @@ -543,12 +559,13 @@ class ContribsPager extends ReverseChronologicalPager { if( $row->rev_id == $row->page_latest ) { $topmarktext .= '' . $this->messages['uctop'] . ''; if( !$row->page_is_new ) { - $difftext .= '(' . $sk->linkKnown( + $difflink = $sk->linkKnown( $page, $this->messages['diff'], array(), array( 'diff' => 0 ) - ) . ')'; + ); + $difftext .= wfMsg( 'parentheses', $difflink ); # Add rollback link if( $page->quickUserCan( 'rollback') && $page->quickUserCan( 'edit' ) ) { $topmarktext .= ' '.$sk->generateRollback( $rev ); @@ -593,7 +610,7 @@ class ContribsPager extends ReverseChronologicalPager { if( $this->target == 'newbies' ) { $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text ); - $userlink .= ' (' . $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) . ') '; + $userlink .= ' ' . wfMsgExt( 'parentheses', 'escapenoentities', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' '; } else { $userlink = ''; } @@ -614,7 +631,7 @@ class ContribsPager extends ReverseChronologicalPager { // If revision was hidden from sysops if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), - '(' . $this->messages['rev-delundel'] . ')' ) . ' '; + wfMsg( 'parentheses', $this->messages['rev-delundel'] ) ) . ' '; // Otherwise, show the link... } else { $query = array( -- 2.20.1