dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18f5bf2
)
Instead of using some hacky regexes, just use wfParseUrl() in WikiMap::getDisplayName...
author
Roan Kattouw
<catrope@users.mediawiki.org>
Fri, 12 Aug 2011 19:19:34 +0000
(19:19 +0000)
committer
Roan Kattouw
<catrope@users.mediawiki.org>
Fri, 12 Aug 2011 19:19:34 +0000
(19:19 +0000)
includes/WikiMap.php
patch
|
blob
|
history
diff --git
a/includes/WikiMap.php
b/includes/WikiMap.php
index
ec0a4ab
..
545e6a3
100644
(file)
--- a/
includes/WikiMap.php
+++ b/
includes/WikiMap.php
@@
-129,11
+129,13
@@
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;
+ }
}
/**