Extension:Flash Extension

From MediaWiki.org

Jump to: navigation, search
Zeichen 206.svg WARNING: the code or configuration described here poses a major security risk.

Problem: Vulnerable to Cross-site scripting attacks, because it passes user input directly to the browser. This may lead to user accounts being hijacked, among other things.
Solution: strictly validate user input and/or apply escaping to all characters that have a special meaning in HTML
Signed: Max Semenik 20:12, 14 January 2010 (UTC)

   

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Flash Extension

Release status: unknown

Implementation  Tag
Description embeds widget that displays flash movies
License No license specified
Download below

check usage (experimental)

Flash Extension is just another Flash extension (obviously ;-) ) for MediaWiki. See also Flash and Flashow. It's based in Flash swf extension, but this revision allows to use local swf files located in your webserver (Modifications made by Daniel Mustieles <daniel.mustieles[NO-SPAM]@ie.edu).

Contents

[edit] Syntax

The Flash extension uses <swf></swf> tags.

[edit] Sample

Give the URL of the swf-file as the content of the swf-tag, specify width and hight as attributes. (default to width=550, height=400)

 <swf width="50" height="50">https://multimediaart.at/mmawiki/images/b/bb/Mini.swf</swf>

If you have a local swf file you can use this syntax:

 <swf width="50" height="50">/wiki/images/Mini.swf</swf>

Note that you don't have to write DocumentRoot's path inside <swf> tags

[edit] Installation

You need to drop flash.php into your extensions folder (usually /wiki/extensions/), and place require_once("extensions/flash.php"); inside LocalSettings.php. Would not work unless the require was placed at the end of the LocalSettings.php file.


Important: Before EOM must not be any whitespace. E must be first character in that line.

The code for 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;
}

[edit] Alternatives