diff options
Diffstat (limited to 'includes/WikiMap.php')
-rw-r--r-- | includes/WikiMap.php | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/includes/WikiMap.php b/includes/WikiMap.php index e12f7abe..458718ee 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -18,7 +18,7 @@ class WikiMap { list( $major, $minor ) = $wgConf->siteFromDB( $wikiID ); if( isset( $major ) ) { - $server = $wgConf->get( 'wgServer', $wikiID, $major, + $server = $wgConf->get( 'wgCanonicalServer', $wikiID, $major, array( 'lang' => $minor, 'site' => $major ) ); $path = $wgConf->get( 'wgArticlePath', $wikiID, $major, array( 'lang' => $minor, 'site' => $major ) ); @@ -65,9 +65,6 @@ class WikiMap { * @return String: HTML link or false if the wiki was not found */ public static function makeForeignLink( $wikiID, $page, $text=null ) { - global $wgUser; - $sk = $wgUser->getSkin(); - if ( !$text ) { $text = $page; } @@ -77,7 +74,7 @@ class WikiMap { return false; } - return $sk->makeExternalLink( $url, $text ); + return Linker::makeExternalLink( $url, $text ); } /** @@ -132,17 +129,19 @@ class WikiReference { */ public function getDisplayName() { $url = $this->getUrl( '' ); - $url = preg_replace( '!^https?://!', '', $url ); - $url = preg_replace( '!/index\.php(\?title=|/)$!', '/', $url ); - $url = preg_replace( '!/wiki/$!', '/', $url ); - $url = preg_replace( '!/$!', '', $url ); - return $url; + $parsed = wfParseUrl( $url ); + if ( $parsed ) { + return $parsed['host']; + } else { + // Invalid URL. There's no sane thing to do here, so just return it + return $url; + } } /** * Helper function for getUrl() * - * @todo FIXME: this may be generalized... + * @todo FIXME: This may be generalized... * @param $page String: page name (must be normalised before calling this function!) * @return String: Url fragment */ |