From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/WikiMap.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'includes/WikiMap.php') 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 */ -- cgit v1.2.3-54-g00ecf