r112425 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112424‎ | r112425 | r112426 >
Date:12:02, 26 February 2012
Author:siebrand
Status:ok
Tags:i18nreview 
Comment:
Follow-up r112014: Remove 1.17 BC linker usage.
Modified paths:
  • /trunk/extensions/Translate/TranslateHooks.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialManageGroups.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialMessageGroupStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslate.php (modified) (history)
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageTable.php (modified) (history)
  • /trunk/extensions/Translate/utils/StatsTable.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -241,7 +241,6 @@
242242 public function listPages() {
243243 global $wgOut;
244244 $out = $wgOut;
245 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
246245
247246 $res = $this->loadPagesFromDB();
248247 $allpages = $this->buildPageArray( $res );
@@ -257,7 +256,7 @@
258257 $wgOut->addWikiMsg( 'tpt-new-pages', count( $pages ) );
259258 $out->addHtml( '<ol>' );
260259 foreach ( $pages as $page ) {
261 - $link = $linker->link( $page['title'] );
 260+ $link = Linker::link( $page['title'] );
262261 $acts = $this->actionLinks( $page, 'proposed' );
263262 $out->addHtml( "<li>$link $acts</li>" );
264263 }
@@ -270,7 +269,7 @@
271270 $out->addWikiMsg( 'tpt-old-pages', count( $pages ) );
272271 $out->addHtml( '<ol>' );
273272 foreach ( $pages as $page ) {
274 - $link = $linker->link( $page['title'] );
 273+ $link = Linker::link( $page['title'] );
275274 if ( $page['tp:mark'] !== $page['tp:tag'] ) {
276275 $link = "<b>$link</b>";
277276 }
@@ -287,7 +286,7 @@
288287 $out->addWikiMsg( 'tpt-other-pages', count( $pages ) );
289288 $out->addHtml( '<ol>' );
290289 foreach ( $pages as $page ) {
291 - $link = $linker->link( $page['title'] );
 290+ $link = Linker::link( $page['title'] );
292291 $acts = $this->actionLinks( $page, 'broken' );
293292 $out->addHtml( "<li>$link $acts</li>" );
294293 }
@@ -300,7 +299,7 @@
301300 $out->addWikiMsg( 'tpt-discouraged-pages', count( $pages ) );
302301 $out->addHtml( '<ol>' );
303302 foreach ( $pages as $page ) {
304 - $link = $linker->link( $page['title'] );
 303+ $link = Linker::link( $page['title'] );
305304 if ( $page['tp:mark'] !== $page['tp:tag'] ) {
306305 $link = "<b>$link</b>";
307306 }
@@ -320,7 +319,6 @@
321320 */
322321 protected function actionLinks( array $page, $type ) {
323322 $actions = array();
324 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
325323
326324 $title = $page['title'];
327325
@@ -329,7 +327,7 @@
330328
331329 $pending = $type === 'active' && $page['latest'] !== $page['tp:mark'];
332330 if ( $type === 'proposed' || $pending ) {
333 - $actions[] = $linker->link(
 331+ $actions[] = Linker::link(
334332 $this->getTitle(),
335333 wfMsgHtml( 'tpt-rev-mark' ),
336334 array( 'title' => wfMsg( 'tpt-rev-mark-tooltip' ) ),
@@ -341,7 +339,7 @@
342340 )
343341 );
344342 } elseif ( $type === 'broken' ) {
345 - $actions[] = $linker->link(
 343+ $actions[] = Linker::link(
346344 $this->getTitle(),
347345 wfMsgHtml( 'tpt-rev-unmark' ),
348346 array( 'title' => wfMsg( 'tpt-rev-unmark-tooltip' ) ),
@@ -355,7 +353,7 @@
356354 }
357355
358356 if ( $type === 'active' ) {
359 - $actions[] = $linker->link(
 357+ $actions[] = Linker::link(
360358 $this->getTitle(),
361359 wfMsgHtml( 'tpt-rev-discourage' ),
362360 array( 'title' => wfMsg( 'tpt-rev-discourage-tooltip' ) ),
@@ -367,7 +365,7 @@
368366 )
369367 );
370368 } elseif ( $type === 'discouraged' ) {
371 - $actions[] = $linker->link(
 369+ $actions[] = Linker::link(
372370 $this->getTitle(),
373371 wfMsgHtml( 'tpt-rev-encourage' ),
374372 array( 'title' => wfMsg( 'tpt-rev-encourage-tooltip' ) ),
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -205,9 +205,6 @@
206206
207207 $userLangCode = $options->getUserLang();
208208
209 - // BC for <1.19
210 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
211 -
212209 $languages = array();
213210 foreach ( $status as $code => $percent ) {
214211 $name = TranslateUtils::getLanguageName( $code, false, $userLangCode );
@@ -241,7 +238,7 @@
242239 if ( $code === $userLangCode ) {
243240 $name = Html::rawElement( 'span', array( 'class' => 'mw-pt-languages-ui' ), $name );
244241 }
245 - $languages[] = $linker->linkKnown( $_title, "$name $percent" );
 242+ $languages[] = Linker::linkKnown( $_title, "$name $percent" );
246243 }
247244 }
248245
@@ -405,7 +402,6 @@
406403 $ready = $page->getReadyTag();
407404
408405 $title = $page->getTitle();
409 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
410406
411407 $latest = $title->getLatestRevId();
412408 $canmark = $ready === $latest && $marked !== $latest;
@@ -421,7 +417,7 @@
422418
423419 $translate = SpecialPage::getTitleFor( 'Translate' );
424420 $linkDesc = wfMsgHtml( 'translate-tag-translate-link-desc' );
425 - $actions[] = $linker->link( $translate, $linkDesc, array(), $par );
 421+ $actions[] = Linker::link( $translate, $linkDesc, array(), $par );
426422 }
427423
428424 if ( $canmark ) {
@@ -433,7 +429,7 @@
434430 // This page has never been marked
435431 if ( $marked === false ) {
436432 $linkDesc = wfMsgHtml( 'translate-tag-markthis' );
437 - $actions[] = $linker->link( $translate, $linkDesc, array(), $par );
 433+ $actions[] = Linker::link( $translate, $linkDesc, array(), $par );
438434 } else {
439435 $markUrl = $translate->getFullUrl( $par );
440436 $actions[] = wfMsgExt( 'translate-tag-markthisagain', 'parseinline', $diffUrl, $markUrl );
@@ -575,8 +571,9 @@
576572 public static function replaceSubtitle( &$subpages, $skin = null , $out = null ) {
577573 global $wgOut;
578574 // $out was only added in some MW version
579 - if ( $out === null ) $out = $wgOut;
580 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
 575+ if ( $out === null ) {
 576+ $out = $wgOut;
 577+ }
581578
582579 if ( !TranslatablePage::isTranslationPage( $out->getTitle() )
583580 && !TranslatablePage::isSourcePage( $out->getTitle() ) ) {
@@ -603,7 +600,7 @@
604601 $linkObj = Title::newFromText( $growinglink );
605602
606603 if ( is_object( $linkObj ) && $linkObj->exists() ) {
607 - $getlink = $linker->linkKnown(
 604+ $getlink = Linker::linkKnown(
608605 SpecialPage::getTitleFor( 'MyLanguage', $growinglink ),
609606 htmlspecialchars( $display )
610607 );
Index: trunk/extensions/Translate/TranslateHooks.php
@@ -313,11 +313,10 @@
314314 global $wgLang, $wgContLang;
315315
316316 $language = $forUI === null ? $wgContLang : $wgLang;
317 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
318317
319318 if ( $action === 'message' ) {
320319 $link = $forUI ?
321 - $linker->link( $title, null, array(), array( 'oldid' => $params[0] ) ) :
 320+ Linker::link( $title, null, array(), array( 'oldid' => $params[0] ) ) :
322321 $title->getPrefixedText();
323322 return wfMessage( 'logentry-translationreview-message' )->params(
324323 '', // User link in the new system
@@ -339,7 +338,7 @@
340339 $newState = $newStateMessage->isBlank() ? $newState : $newStateMessage->text();
341340
342341 $link = $forUI ?
343 - $linker->link( $title, $groupLabel, array(), array( 'language' => $languageCode ) ) :
 342+ Linker::link( $title, $groupLabel, array(), array( 'language' => $languageCode ) ) :
344343 $groupLabel;
345344
346345 return wfMessage( 'logentry-groupreview-message' )->params(
Index: trunk/extensions/Translate/utils/MessageTable.php
@@ -128,8 +128,7 @@
129129 global $wgLang;
130130 $niceTitle = htmlspecialchars( $wgLang->truncate( $title->getPrefixedText(), -35 ) );
131131
132 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker() : new Linker();
133 - $tools['edit'] = $linker->link(
 132+ $tools['edit'] = Linker::link(
134133 $title,
135134 $niceTitle,
136135 TranslationEditPage::jsEdit( $title, $this->group->getId() ),
Index: trunk/extensions/Translate/utils/StatsTable.php
@@ -231,8 +231,7 @@
232232 'title' => $this->getGroupDescription( $group )
233233 );
234234
235 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
236 - $translateGroupLink = $linker->link(
 235+ $translateGroupLink = Linker::link(
237236 $this->translate, $this->getGroupLabel( $group ), $attributes, $queryParameters
238237 );
239238
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -684,8 +684,7 @@
685685 $this->mustHaveDefinition();
686686 $en = $this->getDefinition();
687687
688 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
689 - $title = $linker->link(
 688+ $title = Linker::link(
690689 SpecialPage::getTitleFor( 'Translate' ),
691690 htmlspecialchars( $this->group->getLabel() ),
692691 array(),
@@ -1288,8 +1287,7 @@
12891288
12901289 $jsEdit = TranslationEditPage::jsEdit( $target, $groupId );
12911290
1292 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker() : new Linker();
1293 - return $linker->link( $target, $text, $jsEdit, $params );
 1291+ return Linker::link( $target, $text, $jsEdit, $params );
12941292 }
12951293
12961294 /**
Index: trunk/extensions/Translate/specials/SpecialManageGroups.php
@@ -44,7 +44,6 @@
4545
4646 public function execute( $par ) {
4747 global $wgRequest;
48 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
4948
5049 $this->out->setPageTitle( htmlspecialchars( wfMsg( 'translate-managegroups' ) ) );
5150
@@ -102,7 +101,7 @@
103102 wfDebug( __METHOD__ . ": {$group->getId()}\n" );
104103
105104 $id = $group->getId();
106 - $link = $linker->link( $this->getTitle(), $group->getLabel(),
 105+ $link = Linker::link( $this->getTitle(), $group->getLabel(),
107106 array( 'id' => "mw-group-$id" ), array( 'group' => $id ) );
108107 $out = $link . $separator;
109108
@@ -417,8 +416,7 @@
418417 if ( $code === 'en' ) {
419418 $this->doModLangs( $group );
420419 } else {
421 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
422 - $this->out->addHTML( '<p>' . $linker->link(
 420+ $this->out->addHTML( '<p>' . Linker::link(
423421 $this->getTitle(),
424422 wfMsgHtml( 'translate-manage-return-to-group' ),
425423 array(),
@@ -447,8 +445,7 @@
448446 continue;
449447 }
450448
451 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
452 - $link = $linker->link(
 449+ $link = Linker::link(
453450 $this->getTitle(),
454451 htmlspecialchars( TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() ) . " ($code)" ),
455452 array(),
@@ -498,14 +495,13 @@
499496 */
500497 protected function setSubtitle( $group, $code ) {
501498 global $wgLang;
502 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
503499
504 - $links[] = $linker->link(
 500+ $links[] = Linker::link(
505501 $this->getTitle(),
506502 wfMsgHtml( 'translate-manage-subtitle' )
507503 );
508504
509 - $links[] = $linker->link(
 505+ $links[] = Linker::link(
510506 $this->getTitle(),
511507 htmlspecialchars( $group->getLabel() ),
512508 array(),
@@ -515,7 +511,7 @@
516512 // Do not show language part for English.
517513 if ( $code !== 'en' ) {
518514 $langname = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
519 - $links[] = $linker->link(
 515+ $links[] = Linker::link(
520516 $this->getTitle(),
521517 htmlspecialchars( $langname ),
522518 array(),
Index: trunk/extensions/Translate/specials/SpecialTranslate.php
@@ -123,10 +123,9 @@
124124 if ( in_array( $taskid, array( 'untranslated', 'reviewall' ), true ) ) {
125125 $hasOptional = count( $this->group->getTags( 'optional' ) );
126126 if ( $hasOptional ) {
127 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
128127 $linktext = wfMessage( 'translate-page-description-hasoptional-open' )->escaped();
129128 $params = array( 'task' => 'optional' ) + $this->nondefaults;
130 - $link = $linker->link( $this->getTitle(), $linktext, array(), $params );
 129+ $link = Linker::link( $this->getTitle(), $linktext, array(), $params );
131130 $note = wfMessage( 'translate-page-description-hasoptional' )->rawParams( $link )->parseAsBlock();
132131
133132 if ( $description ) {
@@ -471,14 +470,12 @@
472471 }
473472
474473 private function makeOffsetLink( $label, $offset ) {
475 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
476 -
477474 $query = array_merge(
478475 $this->nondefaults,
479476 array( 'offset' => $offset )
480477 );
481478
482 - $link = $linker->link(
 479+ $link = Linker::link(
483480 $this->getTitle(),
484481 $label,
485482 array(),
@@ -547,9 +544,7 @@
548545 'taction' => $this->options['taction'],
549546 );
550547
551 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
552 -
553 - $label = $linker->link(
 548+ $label = Linker::link(
554549 $title,
555550 htmlspecialchars( $block->getLabel() ),
556551 array(),
Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php
@@ -215,8 +215,7 @@
216216 );
217217
218218 $text = htmlspecialchars( "$code: {$this->names[$code]}" );
219 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
220 - $link = $linker->link( $this->translate, $text, array(), $queryParameters );
 219+ $link = Linker::link( $this->translate, $text, array(), $queryParameters );
221220 return Html::rawElement( 'td', array(), $link );
222221 }
223222 }
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -225,9 +225,8 @@
226226 protected function outputIntroduction() {
227227 global $wgOut, $wgLang, $wgUser;
228228
229 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
230229 $languageName = TranslateUtils::getLanguageName( $this->target, false, $wgLang->getCode() );
231 - $rcInLangLink = $linker->link(
 230+ $rcInLangLink = Linker::link(
232231 SpecialPage::getTitleFor( 'Translate', '!recent' ),
233232 wfMsgHtml( 'languagestats-recenttranslations' ),
234233 array(),

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112014Remove some no longer needed uses of User::getSkin(). Use static linker metho...siebrand13:41, 21 February 2012

Status & tagging log