Extension:VideoFlash

VideoFlash VideoFlash is an extension that displays videos from Youtube, GoogleVideo, Dailymotion, Sevenload, Revver and similar services based on FLV video format.

This extension is based on Extension:YouTube (Iubito) extension.

Source
Copy the following code into extensions/videoflash.php :

<?php

/*******************************************************************************
 * VideoFlash Extension by Alberto Sarullo, based on YouTube (Iubito) extension *
 * http://www.mediawiki.org/wiki/Extension:VideoFlash                          *
 * Tag :                                                                       *
 * v                                                *
 * Ex :                                                                        *
 * from url http://www.youtube.com/watch?v=4lhyH5TsuPg                       *
 * 4lhyH5TsuPg                                      *
 * Ex:                                                                         *
 * from url http://video.google.it/videoplay?docid=1811233136844420765       *
 * 1811233136844420765           *
 * Ex:                                                                         *
 * from url http://en.sevenload.com/videos/7DQGFhH/Sexy-Tussis               *
 * 7DQGFhH                         *
 * Ex:                                                                         *
 * from url http://one.revver.com/watch/138657                               *
 * 138657                             *
 * Ex:                                                                         *
 * from url http://en.sevenload.com/videos/7DQGFhH/Sexy-Tussis               *
 * 7DQGFhH                         *
 * Ex:                                                                         *
 * from url http://one.revver.com/watch/138657                               *
 * 138657                             *
 * 138657                             *

$wgExtensionFunctions[] = 'wfVideoFlash'; $wgExtensionCredits['parserhook'][] = array(       'name' => 'VideoFlash',        'description' => 'VideoFlash (YouTube, GoogleVideo, Dailymotion, sevenload...)',        'author' => 'Alberto Sarullo',        'url' => 'http://www.mediawiki.org/wiki/Extension:VideoFlash' );

function wfVideoFlash { global $wgParser; $wgParser->setHook('videoflash', 'renderVideoFlash'); }

function renderVideoFlash($input, $args) { $input = htmlspecialchars($input);
 * 1) The callback function for converting the input text to HTML output

$type = "youtube"; $params = explode ("|", $input); $id = $params[0]; $width = 425; $height = 350; $style = ''; $url['youtube']    = 'http://www.youtube.com/v/'.$id; $url['googlevideo'] = 'http://video.google.com/googleplayer.swf?docId='.$id; $url['dailymotion'] = 'http://www.dailymotion.com/swf/'.$id; $url['sevenload']  = 'http://en.sevenload.com/pl/'. $id .'/'. $width .'x'. $height .'/swf'; $url['revver']     = 'http://flash.revver.com/player/1.0/player.swf?mediaId='.$id; // add here other similar services

if(count($args)>0 && $args['type'] && $url[$args['type']]){ $type = htmlspecialchars($args['type']); }

if (count($params) > 1) { $width = $params[1]; if (count($params) > 2) { $height = $params[2]; if (count($params) > 3) { $style = $params[3]; }          }        }        $output= '' .' ' .' ' .' '; return $output; }

?>

Installation
require_once("extensions/videoflash.php");
 * Create the file videoflash.php and paste the code shown above.
 * Upload videoflash.php to your wiki/extension directory.
 * Add the following lines at the end of LocalSettings.php:

Youtube
Original url: http://www.youtube.com/watch?v=4lhyH5TsuPg

Wiki code:

4lhyH5TsuPg

or (with width and height):

WZpeeRSk-0A|200|100

GoogleVideo
Original url: http://video.google.it/videoplay?docid=1811233136844420765

Wiki code:

1811233136844420765

or (with width and height):

1811233136844420765|200|150

DailyMotion
Original url: http://www.dailymotion.com/video/xi23l_geris-game

Wiki code: 7fiHlJPCjcqK73xbb

or (with width and height):

7fiHlJPCjcqK73xbb|640|480

Sevenload
Original url: http://en.sevenload.com/videos/Eh4mjir/Bewegungen-der-Natur

Wiki code: Eh4mjir

or (with width and height):

Eh4mjir|640|480

Revver
Original url: http://one.revver.com/watch/138657

Wiki code: 138657

or (with width and height):

138657|640|480

History

 * 1.1 - 2007-03-24 - Added Revver support; fixed xss vulnerability (tnx Jimbojw)
 * 1.0 - 2007-01-23 - First release

Authors

 * Alberto Sarullo, main developer. - My Website (bike, kite, photos, ...)
 * CeLe - english teacher ;)

MediaWiki Version

 * Successfully tested on MediaWiki 1.6.9 and MediaWiki 1.8.4.

Full Screen
/*******************************************************************************
 * Simple "View in fullscreen" addon by xiandos.info.                          *
 * At the end, before the output is returned, add:                             *
 * At the end, before the output is returned, add:                             *
 * At the end, before the output is returned, add:                             *

if (strstr($type, "googlevideo")){ $output .= ' View the video in fullscreen '; }

return $output;

Wikis using videoflash
If you use this extension, please add your website here.


 * GreatCuba.com Cuba Travel Wiki
 * aessenet.org wiki
 * Quadratus.ws
 * xiandos.info (example)
 * Dikt (Norwegian)
 * German Green Party (Neustadt - Bremen) (and use "revverflash" to display videos from Revver - Example)