From 7d96219479483e4391f7e39da1cb9d5414a5b64c Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Mon, 18 Dec 2006 00:20:21 +0000 Subject: [PATCH] fix localized aliasing of various links from skin to special pages with subpages --- includes/Skin.php | 9 +++++++-- includes/SkinTemplate.php | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index d417f57252..651c0e9896 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -758,8 +758,8 @@ END; $msg = 'viewdeleted'; } return wfMsg( $msg, - $this->makeKnownLink( - $wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ), + $this->makeKnownLinkObj( + SpecialPage::getTitleFor( 'Undelete', $wgTitle->getPrefixedDBkey() ), wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) ); } return ''; @@ -1501,6 +1501,11 @@ END; return $title->getLocalURL( $urlaction ); } + static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) { + $title = SpecialPage::getTitleFor( $name, $subpage ); + return $title->getLocalURL( $urlaction ); + } + static function makeI18nUrl( $name, $urlaction = '' ) { $title = Title::newFromText( wfMsgForContent( $name ) ); self::checkTitle( $title, $name ); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index ab0e4b1b72..ac020b7365 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -517,7 +517,7 @@ class SkinTemplate extends Skin { 'href' => $href, 'active' => ( $href == $pageurl ) ); - $href = self::makeSpecialUrl( "Contributions/$this->username" ); + $href = self::makeSpecialUrlSubpage( 'Contributions', $this->username ); $personal_urls['mycontris'] = array( 'text' => wfMsg( 'mycontris' ), 'href' => $href, @@ -886,11 +886,11 @@ class SkinTemplate extends Skin { if($id || $ip) { # both anons and non-anons have contri list $nav_urls['contributions'] = array( - 'href' => self::makeSpecialUrl( 'Contributions/' . $this->mTitle->getText() ) + 'href' => self::makeSpecialUrlSubpage( 'Contributions', $this->mTitle->getText() ) ); if ( $wgUser->isAllowed( 'block' ) ) { $nav_urls['blockip'] = array( - 'href' => self::makeSpecialUrl( 'Blockip/' . $this->mTitle->getText() ) + 'href' => self::makeSpecialUrlSubpage( 'Blockip', $this->mTitle->getText() ) ); } else { $nav_urls['blockip'] = false; @@ -902,7 +902,7 @@ class SkinTemplate extends Skin { $nav_urls['emailuser'] = false; if( $this->showEmailUser( $id ) ) { $nav_urls['emailuser'] = array( - 'href' => self::makeSpecialUrl( 'Emailuser/' . $this->mTitle->getText() ) + 'href' => self::makeSpecialUrlSubpage( 'Emailuser', $this->mTitle->getText() ) ); } wfProfileOut( $fname ); -- 2.20.1