| Current Path : /var/www/element/data/www/wiki.element.ru/extensions/ |
| Current File : /var/www/element/data/www/wiki.element.ru/extensions/flash.php |
<?php
// MediaWiki Swf Extension Ver 0.1
// Set up MediaWiki to react to the "<swf>" tag
// Original file by Brigitte Jellinek
// Modified by Daniel Mustieles <daniel.mustieles@ie.edu> to allow local swf files
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Flash Extension',
'author' => 'Brigitte Jellinek (w/Daniel Mustieles)',
'description' => 'Allows (simple) embedding of flash in MediaWiki pages by using <nowiki><swf></swf></nowiki>-tags',
'url' => 'http://www.mediawiki.org/wiki/Extension:Flash_Extension',
);
$wgExtensionFunctions[] = "wfSwf";
function wfSwf() {
global $wgParser;
$wgParser->setHook( "swf", "RenderSwf" );
}
function RenderSwf( $input, $argv ) {
global $wgScriptPath;
$output = "";
// external URL
if ( strpos($input , "http") === 0 && strpos($input, ".swf") == strlen($input)-4 ) {
$url = $input;
}
// internal Media:
else {
$url = $input;
}
$width = isset($argv['width']) ? $argv['width'] : 550;
$height = isset($argv['height'])? $argv['height'] : 400;
$id = basename($input, ".swf");
$output .=<<<EOM
<object width="$width" height="$height"><param name="movie" value="$url">
</param><embed src="$url" type="application/x-shockwave-flash" width="$width" height="$height"></embed></object>
EOM;
$output = str_replace("\n", "", $output);
return $output;
}