r91262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91261‎ | r91262 | r91263 >
Date:12:59, 1 July 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Get rid of skin, only linker is used in this file
Modified paths:
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -212,13 +212,14 @@
213213
214214 if ( method_exists( $options, 'getUserLang' ) ) {
215215 $userLangCode = $options->getUserLang();
216 - $sk = false;
217216 } else { // Backward compat for MediaWiki 1.17
218217 global $wgLang;
219218 $userLangCode = $wgLang->getCode();
220 - $sk = $options->getSkin();
221219 }
222220
 221+ // BC for <1.19
 222+ $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
 223+
223224 $languages = array();
224225 foreach ( $status as $code => $percent ) {
225226 $name = TranslateUtils::getLanguageName( $code, false, $userLangCode );
@@ -248,19 +249,9 @@
249250 if ( $parser->getTitle()->getText() === $_title->getText() ) {
250251 $languages[] = Html::rawElement( 'b', null, "*$name* $percent" );
251252 } elseif ( $code === $userLangCode ) {
252 - // Backward compat for MediaWiki 1.17
253 - if( $sk ) {
254 - $languages[] = $sk->linkKnown( $_title, Html::rawElement( 'b', null, "$name $percent" ) );
255 - } else {
256 - $languages[] = Linker::linkKnown( $_title, Html::rawElement( 'b', null, "$name $percent" ) );
257 - }
 253+ $languages[] = $linker->linkKnown( $_title, Html::rawElement( 'b', null, "$name $percent" ) );
258254 } else {
259 - // Backward compat for MediaWiki 1.17
260 - if( $sk ) {
261 - $languages[] = $sk->linkKnown( $_title, "$name $percent" );
262 - } else {
263 - $languages[] = Linker::linkKnown( $_title, "$name $percent" );
264 - }
 255+ $languages[] = $linker->linkKnown( $_title, "$name $percent" );
265256 }
266257 }
267258
@@ -429,7 +420,7 @@
430421 $ready = $page->getReadyTag();
431422
432423 $title = $page->getTitle();
433 - $sk = $wgUser->getSkin();
 424+ $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
434425
435426 $latest = $title->getLatestRevId();
436427 $canmark = $ready === $latest && $marked !== $latest;
@@ -445,7 +436,7 @@
446437
447438 $translate = SpecialPage::getTitleFor( 'Translate' );
448439 $linkDesc = wfMsgHtml( 'translate-tag-translate-link-desc' );
449 - $actions[] = $sk->link( $translate, $linkDesc, array(), $par );
 440+ $actions[] = $linker->link( $translate, $linkDesc, array(), $par );
450441 }
451442
452443 if ( $canmark ) {
@@ -457,7 +448,7 @@
458449 // This page has never been marked
459450 if ( $marked === false ) {
460451 $linkDesc = wfMsgHtml( 'translate-tag-markthis' );
461 - $actions[] = $sk->link( $translate, $linkDesc, array(), $par );
 452+ $actions[] = $linker->link( $translate, $linkDesc, array(), $par );
462453 } else {
463454 $markUrl = $translate->getFullUrl( $par );
464455 $actions[] = wfMsgExt( 'translate-tag-markthisagain', 'parseinline', $diffUrl, $markUrl );
@@ -587,8 +578,9 @@
588579
589580 public static function replaceSubtitle( &$subpages, $skin = null , $out = null ) {
590581 global $wgOut, $wgUser;
 582+ // $out was only added in some MW version
591583 if ( $out === null ) $out = $wgOut;
592 - if ( $skin === null ) $skin = $wgUser->getSkin();
 584+ $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
593585
594586 if ( !TranslatablePage::isTranslationPage( $out->getTitle() )
595587 && !TranslatablePage::isSourcePage( $out->getTitle() ) ) {
@@ -615,7 +607,7 @@
616608 $linkObj = Title::newFromText( $growinglink );
617609
618610 if ( is_object( $linkObj ) && $linkObj->exists() ) {
619 - $getlink = $skin->linkKnown(
 611+ $getlink = $linker->linkKnown(
620612 SpecialPage::getTitleFor( 'MyLanguage', $growinglink ),
621613 htmlspecialchars( $display )
622614 );

Status & tagging log