Extension:Flashow/Flashow v0.01

<?php $wgExtensionFunctions[] = "wfFlashowExtension";
 * 1) FlashOnWeb-Stream Mediawiki extension
 * 2) derivated from RSS-Feed Mediawiki extension by Eric Larcher 23.09.2006
 * 3) RSS-Feed Mediawiki extension authors: original by mutante 25.03.2005
 * 4) extended by Duesentrieb 30.04.2005
 * 5) extended by Rdb78 07.07.2005
 * 6) extended by Mafs  10.07.2005, 24.07.2005
 * 7) extended by User:Arcy  07.09.2005
 * 8) Updated for MediaWiki 1.6 by User:piku 13.06.2006
 * 9) Update for Wikicode output, by User:cogdog 14.jul.2006
 * 10) Adding Date output, by User:Arcy 30. 07. 2006
 * 11) Installation:
 * 12)  * put this file (flashow.php) into the extension directory of your mediawiki installation
 * 13)  * add the following to the end of LocalSettings.php: include("extensions/flashow.php");
 * 14)  * make sure magpie can be found by PHP.
 * 15) Usage:
 * 16)  Use one section between -tags for each feed. The flashow section may contain parameters
 * 17)  separated by a pipe ("|"), just like links and templates. These parameters should be supported:
 * 18)    * width=px or % (Modify the width of the object)
 * 19)    * height=px or a% (Modify the height of the object)
 * 20)    * play=true/false (Start playing the file or wait at first frame, default:true)
 * 21)    * loop=true/false (Loop the animation, default:true)
 * 22)    * quality=low/autolow/medium/high/autohigh/best (Predefine the quality)
 * 23)    * devicefont=true/false (Change the look of the text used in flash file)
 * 24)    * bgcolor=#?????? (? -> Hexadecimal integer: 1-9, A-F)
 * 25)    * scale=showall/noborder/exactfit (Automatically adjust content to width and height)
 * 26)    * menu=true/false (Show or hide the menu on right-click)
 * 27)    * align
 * 28)    * salign
 * 29)    * base
 * 30)    * wmode
 * 31)    * SeamlessTabbing
 * 32)    * flashvars
 * 33)    * name (object-specific)
 * 34)    * id (embed-specific)
 * 35)    * movie (object-specific)
 * 36)    * src (embed-specific)
 * 37)    * charset=...             The charset used by the feed. iconv is used to convert this.
 * 38) Example:
 * 39)    file=happy.swf|width=10%|height=30|quality=best
 * 40)    Shows the movie with the best quality with a width of 10% and a height of 30 pixels.
 * 41)    file=cool.swf|width=200|height=300|bgcolor=#FDE742|scale=exactfit
 * 42)    Shows the movie with a width of 200 and a height of 300. The background color is light-yellow (#FDE742). The content of the movie is stretched to the size of 200x300.
 * 43) install extension hook
 * 1)    file=happy.swf|width=10%|height=30|quality=best
 * 2)    Shows the movie with the best quality with a width of 10% and a height of 30 pixels.
 * 3)    file=cool.swf|width=200|height=300|bgcolor=#FDE742|scale=exactfit
 * 4)    Shows the movie with a width of 200 and a height of 300. The background color is light-yellow (#FDE742). The content of the movie is stretched to the size of 200x300.
 * 5) install extension hook
 * 1) install extension hook

function wfFlashowExtension { global $wgParser;
 * 1) extension hook callback function

#install parser hook for tags $wgParser->setHook( "flashow", "renderFlashow" ); }

function renderFlashow($input, $argv, $parser = null) { if (!$parser) $parser =& $GLOBALS['wgParser']; global $wgOutputEncoding;
 * 1) parser hook callback function

$DefaultEncoding = "ISO-8859-1";

# $input = mysql_escape_string($input);

if (!$input) return ""; #if -section is empty, return nothing

#parse fields in flashow-section $fields= explode("|",$input); $url= @$fields[0];

$args= array; for ($i=1; $i<sizeof($fields); $i++) { $f= $fields[$i];

if (strpos($f,"=")===False) $args[strtolower(trim($f))]= False; else { list($k,$v)= explode("=",$f,2); if (trim($v)==False) $args[strtolower(trim($k))] = False; else $args[strtolower(trim($k))]= trim($v); } }

#get charset from argument-array $charset= @$args["charset"]; if (!$charset) $charset= $DefaultEncoding;

#get parameters from argument-array $width = @$args["width"]; $height = @$args["height"];

/* Final Output */ $output= ""; #to insert check for errors. ini_set("allow_url_fopen", true)...    # return "Flash stream error"; #localize...     #return " Failed to play Flash stream from $url: "." "; #localize...

$output = '  ' . ' ';  return $output; }

?>