uploaded filename.mp3 or external link # uploaded filename.mp3 or external link|download adds an icon with link to download the mp3 # Requires : # dewplayer.swf at the same level of index.php # /images/download.gif : an image of your choice # # To activate the extension : # - include it at the end of your LocalSettings.php : include("extensions/mp3.php"); # - add .mp3 in the extension upload list : # $wgFileExtensions = array('png','gif',...,'mp3'); # # Enjoy ! $wgExtensionFunctions[] = 'wfMp3'; $wgExtensionCredits['other'][] = array( 'name' => 'mp3', 'description' => '[http://www.estvideo.com/dew/index/2005/12/03/603-dewplayer-reloaded ' . 'Flash dewplayer] is light and streams your mp3', 'author' => 'Sylvain Machefert' ); function wfMp3() { global $wgParser; $wgParser->setHook('mp3', 'renderMp3'); } # The callback function for converting the input text to HTML output function renderMp3($input) { //$input = "filename.mp3" $arr = explode('|', trim($input)); $addDLlink = isset($arr[1]) && ($arr[1] == 'download'); $input = $arr[0]; $img = Image::newFromName($input); $mp3 = ''; //The parameters for object and embed # File uploaded or external link ? if (!$img->exists()) { //must be http://... URL if (substr($input,0,7) == 'http://') $mp3 = $input; } else $mp3 = $img->getURL(); if ($mp3 == '') return '
Fichier manquant : '.$input.'
' .'Missing ressource: '.$input.'
'; unset($img); $output = '' . '' . '' . '' . '' . '' .'' .''; if ($addDLlink) { $output .= '' .'Downlaod' .''; } return $output; } ?>