Index: trunk/extensions/ReplaceText/SpecialReplaceText.php |
— | — | @@ -38,6 +38,18 @@ |
39 | 39 | return $selected_namespaces; |
40 | 40 | } |
41 | 41 | |
| 42 | + /** |
| 43 | + * Helper function to generate a link. |
| 44 | + */ |
| 45 | + static function linkToTitle( $skin, $title, $linkText ) { |
| 46 | + // link() method was added in MW 1.16 |
| 47 | + if ( method_exists( $skin, 'link' ) ) { |
| 48 | + return $skin->link( $title, $linkText ); |
| 49 | + } else { |
| 50 | + return $skin->makeKnownLinkObj( $title, $linkText ); |
| 51 | + } |
| 52 | + } |
| 53 | + |
42 | 54 | function doSpecialReplaceText() { |
43 | 55 | global $wgUser, $wgOut, $wgRequest, $wgLang; |
44 | 56 | |
— | — | @@ -93,7 +105,7 @@ |
94 | 106 | |
95 | 107 | // Link back |
96 | 108 | $sk = $this->user->getSkin(); |
97 | | - $wgOut->addHTML( $sk->makeKnownLinkObj( $this->getTitle(), wfMsgHtml( 'replacetext_return' ) ) ); |
| 109 | + $wgOut->addHTML( $this->linkToTitle( $sk, $this->getTitle(), wfMsgHtml( 'replacetext_return' ) ) ); |
98 | 110 | return; |
99 | 111 | } elseif ( $wgRequest->getCheck( 'target' ) ) { // very long elseif, look for "end elseif" |
100 | 112 | // first, check that at least one namespace has been |
— | — | @@ -153,7 +165,7 @@ |
154 | 166 | } |
155 | 167 | if ( $bad_cat_name ) { |
156 | 168 | //FIXME: raw html message |
157 | | - $wgOut->addHTML( wfMsg( 'replacetext_nosuchcategory', $sk->link( $category_title, ucfirst( $this->category ) ) ) ); |
| 169 | + $wgOut->addHTML( wfMsg( 'replacetext_nosuchcategory', $this->linkToTitle( $sk, $category_title, ucfirst( $this->category ) ) ) ); |
158 | 170 | } else { |
159 | 171 | if ( $this->edit_pages ) |
160 | 172 | $wgOut->addWikiMsg( 'replacetext_noreplacement', "<tt><nowiki>{$this->target}</nowiki></tt>" ); |
— | — | @@ -162,7 +174,7 @@ |
163 | 175 | } |
164 | 176 | // link back to starting form |
165 | 177 | //FIXME: raw html message |
166 | | - $wgOut->addHTML( '<p>' . $sk->makeKnownLinkObj( $this->getTitle(), wfMsg( 'replacetext_return' ) ) . '</p>' ); |
| 178 | + $wgOut->addHTML( '<p>' . $this->linkToTitle( $sk, $this->getTitle(), wfMsg( 'replacetext_return' ) ) . '</p>' ); |
167 | 179 | } else { |
168 | 180 | // Show a warning message if the replacement |
169 | 181 | // string is either blank or found elsewhere on |
— | — | @@ -370,7 +382,7 @@ |
371 | 383 | list( $title, $context ) = $title_and_context; |
372 | 384 | $wgOut->addHTML( |
373 | 385 | Xml::check( $title->getArticleID(), true ) . |
374 | | - $skin->makeKnownLinkObj( $title, $title->getPrefixedText() ) . " - <small>$context</small><br />\n" |
| 386 | + $this->linkToTitle( $skin, $title, $title->getPrefixedText() ) . " - <small>$context</small><br />\n" |
375 | 387 | ); |
376 | 388 | } |
377 | 389 | $wgOut->addHTML( '<br />' ); |
— | — | @@ -419,7 +431,7 @@ |
420 | 432 | $wgOut->addWikiMsg( 'replacetext_cannotmove', $wgLang->formatNum( count( $unmoveable_titles ) ) ); |
421 | 433 | $text = "<ul>\n"; |
422 | 434 | foreach ( $unmoveable_titles as $title ) { |
423 | | - $text .= "<li>{$skin->makeKnownLinkObj( $title, $title->getPrefixedText() )}<br />\n"; |
| 435 | + $text .= "<li>{$this->linkToTitle( $skin, $title, $title->getPrefixedText() )}<br />\n"; |
424 | 436 | } |
425 | 437 | $text .= "</ul>\n"; |
426 | 438 | $wgOut->addHTML( $text ); |