From: Subin Siby Date: Sat, 3 Dec 2016 08:01:49 +0000 (+0530) Subject: Replaced Linker::link() usage with LinkRenderer in some special pages X-Git-Tag: 1.31.0-rc.0~4674^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=ded8a172d98ca558f2db39b0c7047e5f5d1c5ef8;p=lhc%2Fweb%2Fwiklou.git Replaced Linker::link() usage with LinkRenderer in some special pages Bug: T149346 Change-Id: I73c2b7402012a49e4419b6214f1d03f2e819220b --- diff --git a/includes/specials/SpecialMostlinkedtemplates.php b/includes/specials/SpecialMostlinkedtemplates.php index 7fcb9d869c..d10279163a 100644 --- a/includes/specials/SpecialMostlinkedtemplates.php +++ b/includes/specials/SpecialMostlinkedtemplates.php @@ -104,7 +104,7 @@ class MostlinkedTemplatesPage extends QueryPage { } return $this->getLanguage()->specialList( - Linker::link( $title ), + $this->getLinkRenderer()->makeLink( $title ), $this->makeWlhLink( $title, $result ) ); } @@ -118,9 +118,9 @@ class MostlinkedTemplatesPage extends QueryPage { */ private function makeWlhLink( $title, $result ) { $wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ); - $label = $this->msg( 'ntransclusions' )->numParams( $result->value )->escaped(); + $label = $this->msg( 'ntransclusions' )->numParams( $result->value )->text(); - return Linker::link( $wlh, $label ); + return $this->getLinkRenderer()->makeLink( $wlh, $label ); } protected function getGroupName() { diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 706a1d7794..37006d8f7a 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -133,7 +133,7 @@ class SpecialPagesWithProp extends QueryPage { */ function formatResult( $skin, $result ) { $title = Title::newFromRow( $result ); - $ret = Linker::link( $title, null, [], [], [ 'known' ] ); + $ret = $this->getLinkRenderer()->makeKnownLink( $title ); if ( $result->pp_value !== '' ) { // Do not show very long or binary values on the special page $valueLength = strlen( $result->pp_value ); diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index c800d96c78..fa9033cb31 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -84,7 +84,7 @@ class SpecialProtectedtitles extends SpecialPage { ) . "\n"; } - $link = Linker::link( $title ); + $link = $this->getLinkRenderer()->makeLink( $title ); $description_items = []; // Messages: restriction-level-sysop, restriction-level-autoconfirmed $protType = $this->msg( 'restriction-level-' . $row->pt_create_perm )->escaped(); diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 86f1e2080c..3342c32bbf 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -112,18 +112,20 @@ class SpecialStatistics extends SpecialPage { * @return string */ private function getPageStats() { + $linkRenderer = $this->getLinkRenderer(); + $specialAllPagesTitle = SpecialPage::getTitleFor( 'Allpages' ); $pageStatsHtml = Xml::openElement( 'tr' ) . Xml::tags( 'th', [ 'colspan' => '2' ], $this->msg( 'statistics-header-pages' ) ->parse() ) . Xml::closeElement( 'tr' ) . - $this->formatRow( Linker::linkKnown( $specialAllPagesTitle, - $this->msg( 'statistics-articles' )->parse(), [], [ 'hideredirects' => 1 ] ), + $this->formatRow( $linkRenderer->makeKnownLink( $specialAllPagesTitle, + $this->msg( 'statistics-articles' )->text(), [], [ 'hideredirects' => 1 ] ), $this->getLanguage()->formatNum( $this->good ), [ 'class' => 'mw-statistics-articles' ], 'statistics-articles-desc' ) . - $this->formatRow( Linker::linkKnown( $specialAllPagesTitle, - $this->msg( 'statistics-pages' )->parse() ), + $this->formatRow( $linkRenderer->makeKnownLink( $specialAllPagesTitle, + $this->msg( 'statistics-pages' )->text() ), $this->getLanguage()->formatNum( $this->total ), [ 'class' => 'mw-statistics-pages' ], 'statistics-pages-desc' ); @@ -131,8 +133,8 @@ class SpecialStatistics extends SpecialPage { // Show the image row only, when there are files or upload is possible if ( $this->images !== 0 || $this->getConfig()->get( 'EnableUploads' ) ) { $pageStatsHtml .= $this->formatRow( - Linker::linkKnown( SpecialPage::getTitleFor( 'MediaStatistics' ), - $this->msg( 'statistics-files' )->parse() ), + $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'MediaStatistics' ), + $this->msg( 'statistics-files' )->text() ), $this->getLanguage()->formatNum( $this->images ), [ 'class' => 'mw-statistics-files' ] ); } @@ -166,9 +168,9 @@ class SpecialStatistics extends SpecialPage { [ 'class' => 'mw-statistics-users' ] ) . $this->formatRow( $this->msg( 'statistics-users-active' )->parse() . ' ' . - Linker::linkKnown( + $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'Activeusers' ), - $this->msg( 'listgrouprights-members' )->escaped() + $this->msg( 'listgrouprights-members' )->text() ), $this->getLanguage()->formatNum( $this->activeUsers ), [ 'class' => 'mw-statistics-users-active' ], @@ -178,6 +180,7 @@ class SpecialStatistics extends SpecialPage { } private function getGroupStats() { + $linkRenderer = $this->getLinkRenderer(); $text = ''; foreach ( $this->getConfig()->get( 'GroupPermissions' ) as $group => $permissions ) { # Skip generic * and implicit groups @@ -200,17 +203,17 @@ class SpecialStatistics extends SpecialPage { $linkTarget = Title::newFromText( $grouppageLocalized ); if ( $linkTarget ) { - $grouppage = Linker::link( + $grouppage = $linkRenderer->makeLink( $linkTarget, - htmlspecialchars( $groupnameLocalized ) + $groupnameLocalized ); } else { $grouppage = htmlspecialchars( $groupnameLocalized ); } - $grouplink = Linker::linkKnown( + $grouplink = $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'Listusers' ), - $this->msg( 'listgrouprights-members' )->escaped(), + $this->msg( 'listgrouprights-members' )->text(), [], [ 'group' => $group ] ); diff --git a/includes/specials/SpecialTrackingCategories.php b/includes/specials/SpecialTrackingCategories.php index 4c6a3457db..8ff052785e 100644 --- a/includes/specials/SpecialTrackingCategories.php +++ b/includes/specials/SpecialTrackingCategories.php @@ -89,19 +89,21 @@ class SpecialTrackingCategories extends SpecialPage { Hooks::run( 'SpecialTrackingCategories::preprocess', [ $this, $trackingCategories ] ); + $linkRenderer = $this->getLinkRenderer(); + foreach ( $trackingCategories as $catMsg => $data ) { $allMsgs = []; $catDesc = $catMsg . '-desc'; - $catMsgTitleText = Linker::link( + $catMsgTitleText = $linkRenderer->makeLink( $data['msg'], - htmlspecialchars( $catMsg ) + $catMsg ); foreach ( $data['cats'] as $catTitle ) { - $html = Linker::link( + $html = $linkRenderer->makeLink( $catTitle, - htmlspecialchars( $catTitle->getText() ) + $catTitle->getText() ); Hooks::run( 'SpecialTrackingCategories::generateCatLink', diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index cff8bf463a..326a1fa1e1 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -119,14 +119,14 @@ class SpecialUnblock extends SpecialPage { $fields['Target']['type'] = 'hidden'; switch ( $type ) { case Block::TYPE_IP: - $fields['Name']['default'] = Linker::linkKnown( + $fields['Name']['default'] = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'Contributions', $target->getName() ), $target->getName() ); $fields['Name']['raw'] = true; break; case Block::TYPE_USER: - $fields['Name']['default'] = Linker::link( + $fields['Name']['default'] = $this->getLinkRenderer()->makeLink( $target->getUserPage(), $target->getName() ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index efac615324..04f5be46ca 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -997,14 +997,15 @@ class SpecialUndelete extends SpecialPage { $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) ); + $linkRenderer = $this->getLinkRenderer(); $undelete = $this->getPageTitle(); $out->addHTML( "