Howto embed flv in mediawiki

728x15 ad here

出自Guoshuang Wiki

跳转到: 导航, 搜索

Here are the steps to make it work:

  • Go to the MediaWiki Extension page for dhflashplayer
  • Create a directory on your site for the player ("player" is a good name)
  • In this directory place the ufo.js script and the flvplayer.swf (or mediaplayer.swf) files
  • Place the dhflashplayer.php file in your MediaWiki extensions folder
  • Edit the dhflashplayer.php file in the following ways:
  1. Look for the line "// Final Output return", and edit the path to your location of the ufo.js script.
  2. Further into this section look for "var FO = { movie:" and supply the path to your movie player (flvplayer.swf) file.
  3. Save this file
  • Modify the LocalSettings.php file in the root of the MediaWiki directory, by adding this line of code: include("extensions/DhFlashPlayer.php");
  • Now you can simply place the following code in your wiki editing space:
<dhflashplayer>file=your.flv|width=320|height=240| path=http://www.yourwebserver.com/yourmediafolder/</dhflashplayer> 

You can get the ufo.js javascript at the Unobtrusive Flash Objects site.

The Flash Video Player is available at Jeroen Wijering's site. There is also a Flash Media Player that plays MP3,FLV,SWF,JPG,PNG or GIF files, also from Jeroen's site


ow to embed flash (e.g. google video or youtube content) into mediawiki (based on MW 1.6.7, but should work in other versions, too)

i probably could have written a mediawiki extension but i’m too stupid for that. so we’ll have to live with a mediawiki hack. working example.

do the following:

1. find the file Sanitizer.php in the folder /includes of your mediawiki installation

2. find the function removeHTMLtags in that file. below that you’ll find a list of whitelisted HTML tags. add the tag embed to the list.

3. find the function setupAttributeWhitelist in the same file. several lines below you will find HTML-attributes being whitelisted for each HTML tag. so you add a new line (maybe below the line that defines span):

‘embed’ => array( ’style’, ‘id’, ‘type’, ’src’, ‘width’, ‘height’ ),

take care to replace the typographic ‘-quotes by straight ones when doing copy&paste. (wordpress converts the quotes on this blog, so you need to convert them back.)

you’re done. now you can copy the HTML-code provided by google or youtube into your wiki textbox and it’ll work. (make sure to make backups and document so you know what you’ve changed. when upgrading you’ll have to repeat the process. no warranties for possibile security leaks resulting from the hack.)

update april 2007: i just tested, this hack also works with mediawiki 1.9.2, just that you need to add embed to $htmlpairs. (note: in case the embed-code you want to use has the format <embed /> you now have to convert it to <embed> </embed> before posting it to your wiki.) i also would recommend to paste the last line of code near br instead of span (the file has got rearranged a bit).

个人工具
125x125 ad here
Advertisement
120x600 ad here