Extension:LastFm
From MediaWiki.org
|
LastFm Release status: unknown |
|
|---|---|
| Implementation | Tag |
| Description | Adds Last.fm player to a page with the <lastfm> tag. |
| Author(s) | Guy Taylor |
| Last version | 0.2 |
| License | No license specified |
| Download | see below |
|
Check usage (experimental) |
|
[edit] Last.fm Button
It will only get better with feedback
<?php /** * LastFm extension for MediaWiki * * @author Guy Taylor * @copyright © Guy Taylor * @version 0.2 * @link http://www.mediawiki.org/wiki/Extension:LastFm */ $wgExtensionFunctions[] = 'wfLastFm'; // Extension credits that show up on Special:Version $wgExtensionCredits['parserhook'][] = array( 'name' => 'LastFm', 'author' => 'Guy Taylor', 'version' => '0.2', 'url' => 'http://www.mediawiki.org/wiki/Extension:LastFm', 'description' => 'Adds Last.fm player to a page with the <tt><lastfm></tt> tag.' ); function wfLastFm() { global $wgParser; $wgParser->setHook( 'lastfm', 'renderLastFm' ); } # The callback function for converting the input text to HTML output function renderLastFm( $input ) { $output = "<!-- Last.fm http://www.last.fm/ -->"; $output = "<a href=\"http://www.last.fm/user/"; $output .= htmlspecialchars($input); $output .= "/?chartstyle=tracks\">"; $output .= "<img src=\"http://imagegen.last.fm/tracks/artists/"; $output .= htmlspecialchars($input); $output .= ".gif\" border=\"0\" alt=\""; $output .= htmlspecialchars($input); $output .= "'s Last.fm Weekly Artists Chart\" /></a>"; return $output; }
[edit] Installation
- Copy the code into a file (e.g. LastFm.php) case matters
- Save the file in the extensions directory of your MediaWiki folder
- Add the line
require_once('extensions/LastFm.php');to the your LocalSettings.php file - Installation can now be verified through Special:Version on your wiki
[edit] Usage
Now you can use the extension with <lastfm>Last.fm-Username</lastfm> in the wiki
