Patching MediaWiki for fun and profit
Inspired by Peter Saint-Andre’s blog post, we decided to patch MediaWiki to make it recognize the spotify: URI scheme. (And we threw xmpp: in there as well, because we use it internally for instant messaging.)
First we added spotify: and xmpp: lines to the $wgUrlProtocols array in LocalSettings.php:
$wgUrlProtocols = array(
’http://’,
’https://’,
’spotify:’,
’xmpp:’,
’ftp://’,
’irc://’,
’gopher://’,
’telnet://’, // Well if we’re going to support the above.. -Ævar
’nntp://’, // @bug 3808 RFC 1738
’worldwind://’,
’mailto:’,
’news:’,
’file:’
);
See also the MediaWiki manual!
Then we added some styling to MediaWiki:Common.css to get the nice icons:
#bodyContent a[href ^="spotify:"],
.link-spotify {
background: url(”spotify-external-link-tag-icon.png”) center right no-repeat;
padding-right: 11px;
}
#bodyContent a[href ^="xmpp:"],
.link-xmpp {
background: url(”xmpp-external-link-tag-icon.png”) center right no-repeat;
padding-right: 11px;
}
This is the result:
Nice, huh? Well, it’s Friday after all.



