Methods replaced are Linker::link() and ::linkKnown() and ::getDefaultInstance
in SkinFactory with mediawiki services.
Change-Id: Ifc170abc958add28a2fe08aa0c44af83c6f7cad8
* @return array Associative array of strings
*/
static function getSkinNames() {
* @return array Associative array of strings
*/
static function getSkinNames() {
- return SkinFactory::getDefaultInstance()->getSkinNames();
+ $skinFactory = MediaWikiServices::getInstance()->getSkinFactory();
+ return $skinFactory->getSkinNames();
function getCategoryLinks() {
$out = $this->getOutput();
$allCats = $out->getCategoryLinks();
function getCategoryLinks() {
$out = $this->getOutput();
$allCats = $out->getCategoryLinks();
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $allCats === [] ) {
return '';
if ( $allCats === [] ) {
return '';
if ( !empty( $allCats['normal'] ) ) {
$t = $embed . implode( $pop . $embed, $allCats['normal'] ) . $pop;
if ( !empty( $allCats['normal'] ) ) {
$t = $embed . implode( $pop . $embed, $allCats['normal'] ) . $pop;
- $msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped();
+ $msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) );
$linkPage = $this->msg( 'pagecategorieslink' )->inContentLanguage()->text();
$title = Title::newFromText( $linkPage );
$linkPage = $this->msg( 'pagecategorieslink' )->inContentLanguage()->text();
$title = Title::newFromText( $linkPage );
- $link = $title ? Linker::link( $title, $msg ) : $msg;
+ $link = $title ? $linkRenderer->makeLink( $title, $msg->text() ) : $msg->escaped();
$s .= '<div id="mw-normal-catlinks" class="mw-normal-catlinks">' .
$link . $colon . '<ul>' . $t . '</ul></div>';
}
$s .= '<div id="mw-normal-catlinks" class="mw-normal-catlinks">' .
$link . $colon . '<ul>' . $t . '</ul></div>';
}
*/
function drawCategoryBrowser( $tree ) {
$return = '';
*/
function drawCategoryBrowser( $tree ) {
$return = '';
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
foreach ( $tree as $element => $parent ) {
if ( empty( $parent ) ) {
foreach ( $tree as $element => $parent ) {
if ( empty( $parent ) ) {
# add our current element to the list
$eltitle = Title::newFromText( $element );
# add our current element to the list
$eltitle = Title::newFromText( $element );
- $return .= Linker::link( $eltitle, htmlspecialchars( $eltitle->getText() ) );
+ $return .= $linkRenderer->makeLink( $eltitle, $eltitle->getText() );
function getUndeleteLink() {
$action = $this->getRequest()->getVal( 'action', 'view' );
$title = $this->getTitle();
function getUndeleteLink() {
$action = $this->getRequest()->getVal( 'action', 'view' );
$title = $this->getTitle();
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( ( !$title->exists() || $action == 'history' ) &&
$title->quickUserCan( 'deletedhistory', $this->getUser() )
if ( ( !$title->exists() || $action == 'history' ) &&
$title->quickUserCan( 'deletedhistory', $this->getUser() )
}
return $this->msg( $msg )->rawParams(
}
return $this->msg( $msg )->rawParams(
+ $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
- $this->msg( 'restorelink' )->numParams( $n )->escaped() )
+ $this->msg( 'restorelink' )->numParams( $n )->text() )
* @return string
*/
function subPageSubtitle( $out = null ) {
* @return string
*/
function subPageSubtitle( $out = null ) {
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $out === null ) {
$out = $this->getOutput();
}
if ( $out === null ) {
$out = $this->getOutput();
}
$linkObj = Title::newFromText( $growinglink );
if ( is_object( $linkObj ) && $linkObj->isKnown() ) {
$linkObj = Title::newFromText( $growinglink );
if ( is_object( $linkObj ) && $linkObj->isKnown() ) {
- $getlink = Linker::linkKnown(
- $linkObj,
- htmlspecialchars( $display )
+ $getlink = $linkRenderer->makeKnownLink(
+ $linkObj, $display
* @return string
*/
function getCopyright( $type = 'detect' ) {
* @return string
*/
function getCopyright( $type = 'detect' ) {
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $type == 'detect' ) {
if ( !$this->isRevisionCurrent()
&& !$this->msg( 'history_copyright' )->inContentLanguage()->isDisabled()
if ( $type == 'detect' ) {
if ( !$this->isRevisionCurrent()
&& !$this->msg( 'history_copyright' )->inContentLanguage()->isDisabled()
if ( $config->get( 'RightsPage' ) ) {
$title = Title::newFromText( $config->get( 'RightsPage' ) );
if ( $config->get( 'RightsPage' ) ) {
$title = Title::newFromText( $config->get( 'RightsPage' ) );
- $link = Linker::linkKnown( $title, $config->get( 'RightsText' ) );
+ $link = $linkRenderer->makeKnownLink(
+ $title, new HtmlArmor( $config->get( 'RightsText' ) )
+ );
} elseif ( $config->get( 'RightsUrl' ) ) {
$link = Linker::makeExternalLink( $config->get( 'RightsUrl' ), $config->get( 'RightsText' ) );
} elseif ( $config->get( 'RightsText' ) ) {
} elseif ( $config->get( 'RightsUrl' ) ) {
$link = Linker::makeExternalLink( $config->get( 'RightsUrl' ), $config->get( 'RightsText' ) );
} elseif ( $config->get( 'RightsText' ) ) {
* @return string
*/
function mainPageLink() {
* @return string
*/
function mainPageLink() {
- $s = Linker::linkKnown(
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+ $s = $linkRenderer->makeKnownLink(
- $this->msg( 'mainpage' )->escaped()
+ $this->msg( 'mainpage' )->text()
*/
public function footerLink( $desc, $page ) {
$title = $this->footerLinkTitle( $desc, $page );
*/
public function footerLink( $desc, $page ) {
$title = $this->footerLinkTitle( $desc, $page );
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( !$title ) {
return '';
}
if ( !$title ) {
return '';
}
- return Linker::linkKnown(
+ return $linkRenderer->makeKnownLink(
- $this->msg( $desc )->escaped()
+ $this->msg( $desc )->text()
$user = $this->getUser();
$newtalks = $user->getNewMessageLinks();
$out = $this->getOutput();
$user = $this->getUser();
$newtalks = $user->getNewMessageLinks();
$out = $this->getOutput();
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
// Allow extensions to disable or modify the new messages alert
if ( !Hooks::run( 'GetNewMessagesAlert', [ &$newMessagesAlert, $newtalks, $user, $out ] ) ) {
// Allow extensions to disable or modify the new messages alert
if ( !Hooks::run( 'GetNewMessagesAlert', [ &$newMessagesAlert, $newtalks, $user, $out ] ) ) {
// 999 signifies "more than one revision". We don't know how many, and even if we did,
// the number of revisions or authors is not necessarily the same as the number of
// "messages".
// 999 signifies "more than one revision". We don't know how many, and even if we did,
// the number of revisions or authors is not necessarily the same as the number of
// "messages".
- $newMessagesLink = Linker::linkKnown(
+ $newMessagesLink = $linkRenderer->makeKnownLink(
- $this->msg( 'newmessageslinkplural' )->params( $plural )->escaped(),
+ $this->msg( 'newmessageslinkplural' )->params( $plural )->text(),
[],
$uTalkTitle->isRedirect() ? [ 'redirect' => 'no' ] : []
);
[],
$uTalkTitle->isRedirect() ? [ 'redirect' => 'no' ] : []
);
- $newMessagesDiffLink = Linker::linkKnown(
+ $newMessagesDiffLink = $linkRenderer->makeKnownLink(
- $this->msg( 'newmessagesdifflinkplural' )->params( $plural )->escaped(),
+ $this->msg( 'newmessagesdifflinkplural' )->params( $plural )->text(),
[],
$lastSeenRev !== null
? [ 'oldid' => $lastSeenRev->getId(), 'diff' => 'cur' ]
[],
$lastSeenRev !== null
? [ 'oldid' => $lastSeenRev->getId(), 'diff' => 'cur' ]
$result = '<span class="mw-editsection"><span class="mw-editsection-bracket">[</span>';
$result = '<span class="mw-editsection"><span class="mw-editsection-bracket">[</span>';
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
$linksHtml = [];
foreach ( $links as $k => $linkDetails ) {
$linksHtml = [];
foreach ( $links as $k => $linkDetails ) {
- $linksHtml[] = Linker::linkKnown(
+ $linksHtml[] = $linkRenderer->makeKnownLink(
$linkDetails['targetTitle'],
$linkDetails['targetTitle'],
- htmlspecialchars( $linkDetails['text'] ),
$linkDetails['attribs'],
$linkDetails['query']
);
$linkDetails['attribs'],
$linkDetails['query']
);
*/
private function getRestrictionListHTML( stdClass $row ) {
$items = [];
*/
private function getRestrictionListHTML( stdClass $row ) {
$items = [];
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
foreach ( $this->restrictions as $restriction ) {
if ( $restriction->getBlockId() !== (int)$row->ipb_id ) {
foreach ( $this->restrictions as $restriction ) {
if ( $restriction->getBlockId() !== (int)$row->ipb_id ) {
$items[$restriction->getType()][] = Html::rawElement(
'li',
[],
$items[$restriction->getType()][] = Html::rawElement(
'li',
[],
- Linker::link( $restriction->getTitle() )
+ $linkRenderer->makeLink( $restriction->getTitle() )
);
}
break;
case NamespaceRestriction::TYPE:
$text = $restriction->getValue() === NS_MAIN
);
}
break;
case NamespaceRestriction::TYPE:
$text = $restriction->getValue() === NS_MAIN
- ? $this->msg( 'blanknamespace' )
+ ? $this->msg( 'blanknamespace' )->text()
: $this->getLanguage()->getFormattedNsText(
$restriction->getValue()
);
$items[$restriction->getType()][] = Html::rawElement(
'li',
[],
: $this->getLanguage()->getFormattedNsText(
$restriction->getValue()
);
$items[$restriction->getType()][] = Html::rawElement(
'li',
[],
+ $linkRenderer->makeLink(
SpecialPage::getTitleValueFor( 'Allpages' ),
$text,
[],
SpecialPage::getTitleValueFor( 'Allpages' ),
$text,
[],
// link to the group description page, if it exists
$linkTitle = self::getGroupPage( $group );
// link to the group description page, if it exists
$linkTitle = self::getGroupPage( $group );
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $linkTitle ) {
if ( $format === 'wiki' ) {
$linkPage = $linkTitle->getFullText();
$groupLink = "[[$linkPage|$groupName]]";
} else {
if ( $linkTitle ) {
if ( $format === 'wiki' ) {
$linkPage = $linkTitle->getFullText();
$groupLink = "[[$linkPage|$groupName]]";
} else {
- $groupLink = Linker::link( $linkTitle, htmlspecialchars( $groupName ) );
+ $groupLink = $linkRenderer->makeLink( $linkTitle, $groupName );
}
} else {
$groupLink = htmlspecialchars( $groupName );
}
} else {
$groupLink = htmlspecialchars( $groupName );