summaryrefslogtreecommitdiff
path: root/includes/WikiMap.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/WikiMap.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/WikiMap.php')
-rw-r--r--includes/WikiMap.php21
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
*/