/
openlaszlo.php
51 lines (39 loc) · 1.83 KB
/
openlaszlo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
////////////////////////////////////////////////////////////////////////
// OpenLaszlo MediaWiki Plug-In
// By Don Hopkins.
// Licensed under GPL v3.
//
// To install, add the following to your LocalSettings.php:
// require_once("extensions/openlaszlo/openlaszlo.php");
$wgExtensionFunctions[] = 'OpenLaszloExtension';
$wgExtensionCredits['parserhook'][] = array(
'name'=>'OpenLaslzo',
'author'=>'Don Hopkins',
'url'=>'http://www.DonHopkins.com',
'description'=>'Embed OpenLaszlo applications in MediaWiki.'
);
function OpenLaszloExtension() {
global $wgParser;
//install parser hook for <openlaszlo> tags
$wgParser->sethook('openlaszlo','DoOpenLaszlo');
}
function DoOpenLaszlo($input, $argv, &$parser) {
if (!$parser) {
$parser =& $GLOBALS['wgParser'];
}
global $wgOutputEncoding;
$DefaultEncoding='ISO-8859-1';
$src = htmlspecialchars(@$argv['src']);
$width = htmlspecialchars(@$argv['width']);
$height = htmlspecialchars(@$argv['height']);
$flashvars = htmlspecialchars(@$argv['flashvars']);
$out =
"<object type=\"application/x-shockwave-flash\" data=\"$src\" width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"$src\"><param name=\"FlashVars\" value=\"$flashvars\"><p>This is supposed to be a flash animation. You'll need the flash plugin and a browser that supports it to view it.</object>";
if (!isset($openlaszloUsed)) {
$out .=
"<div style=\"height:0;outline;0;padding:0;margin:0;overflow:hidden;\"><object type=\"application/x-shockwave-flash\" width=\"1\" height=\"1\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\"><param name=\"pluginspage\" value=\"http://www.macromedia.com/go/getflashplayer\"></object></div>";
}
$GLOBALS['openlaszloUsed'] = true;
return $out;
}