Index: trunk/phase3/includes/WikiMap.php |
— | — | @@ -129,11 +129,13 @@ |
130 | 130 | */ |
131 | 131 | public function getDisplayName() { |
132 | 132 | $url = $this->getUrl( '' ); |
133 | | - $url = preg_replace( '!^https?://!', '', $url ); |
134 | | - $url = preg_replace( '!/index\.php(\?title=|/)$!', '/', $url ); |
135 | | - $url = preg_replace( '!/wiki/$!', '/', $url ); |
136 | | - $url = preg_replace( '!/$!', '', $url ); |
137 | | - return $url; |
| 133 | + $parsed = wfParseUrl( $url ); |
| 134 | + if ( $parsed ) { |
| 135 | + return $parsed['host']; |
| 136 | + } else { |
| 137 | + // Invalid URL. There's no sane thing to do here, so just return it |
| 138 | + return $url; |
| 139 | + } |
138 | 140 | } |
139 | 141 | |
140 | 142 | /** |