Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -212,13 +212,14 @@ |
213 | 213 | |
214 | 214 | if ( method_exists( $options, 'getUserLang' ) ) { |
215 | 215 | $userLangCode = $options->getUserLang(); |
216 | | - $sk = false; |
217 | 216 | } else { // Backward compat for MediaWiki 1.17 |
218 | 217 | global $wgLang; |
219 | 218 | $userLangCode = $wgLang->getCode(); |
220 | | - $sk = $options->getSkin(); |
221 | 219 | } |
222 | 220 | |
| 221 | + // BC for <1.19 |
| 222 | + $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker; |
| 223 | + |
223 | 224 | $languages = array(); |
224 | 225 | foreach ( $status as $code => $percent ) { |
225 | 226 | $name = TranslateUtils::getLanguageName( $code, false, $userLangCode ); |
— | — | @@ -248,19 +249,9 @@ |
249 | 250 | if ( $parser->getTitle()->getText() === $_title->getText() ) { |
250 | 251 | $languages[] = Html::rawElement( 'b', null, "*$name* $percent" ); |
251 | 252 | } 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" ) ); |
258 | 254 | } 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" ); |
265 | 256 | } |
266 | 257 | } |
267 | 258 | |
— | — | @@ -429,7 +420,7 @@ |
430 | 421 | $ready = $page->getReadyTag(); |
431 | 422 | |
432 | 423 | $title = $page->getTitle(); |
433 | | - $sk = $wgUser->getSkin(); |
| 424 | + $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker; |
434 | 425 | |
435 | 426 | $latest = $title->getLatestRevId(); |
436 | 427 | $canmark = $ready === $latest && $marked !== $latest; |
— | — | @@ -445,7 +436,7 @@ |
446 | 437 | |
447 | 438 | $translate = SpecialPage::getTitleFor( 'Translate' ); |
448 | 439 | $linkDesc = wfMsgHtml( 'translate-tag-translate-link-desc' ); |
449 | | - $actions[] = $sk->link( $translate, $linkDesc, array(), $par ); |
| 440 | + $actions[] = $linker->link( $translate, $linkDesc, array(), $par ); |
450 | 441 | } |
451 | 442 | |
452 | 443 | if ( $canmark ) { |
— | — | @@ -457,7 +448,7 @@ |
458 | 449 | // This page has never been marked |
459 | 450 | if ( $marked === false ) { |
460 | 451 | $linkDesc = wfMsgHtml( 'translate-tag-markthis' ); |
461 | | - $actions[] = $sk->link( $translate, $linkDesc, array(), $par ); |
| 452 | + $actions[] = $linker->link( $translate, $linkDesc, array(), $par ); |
462 | 453 | } else { |
463 | 454 | $markUrl = $translate->getFullUrl( $par ); |
464 | 455 | $actions[] = wfMsgExt( 'translate-tag-markthisagain', 'parseinline', $diffUrl, $markUrl ); |
— | — | @@ -587,8 +578,9 @@ |
588 | 579 | |
589 | 580 | public static function replaceSubtitle( &$subpages, $skin = null , $out = null ) { |
590 | 581 | global $wgOut, $wgUser; |
| 582 | + // $out was only added in some MW version |
591 | 583 | if ( $out === null ) $out = $wgOut; |
592 | | - if ( $skin === null ) $skin = $wgUser->getSkin(); |
| 584 | + $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker; |
593 | 585 | |
594 | 586 | if ( !TranslatablePage::isTranslationPage( $out->getTitle() ) |
595 | 587 | && !TranslatablePage::isSourcePage( $out->getTitle() ) ) { |
— | — | @@ -615,7 +607,7 @@ |
616 | 608 | $linkObj = Title::newFromText( $growinglink ); |
617 | 609 | |
618 | 610 | if ( is_object( $linkObj ) && $linkObj->exists() ) { |
619 | | - $getlink = $skin->linkKnown( |
| 611 | + $getlink = $linker->linkKnown( |
620 | 612 | SpecialPage::getTitleFor( 'MyLanguage', $growinglink ), |
621 | 613 | htmlspecialchars( $display ) |
622 | 614 | ); |