Extension:GoogleVideo

From MediaWiki.org

Jump to: navigation, search

         

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

Release status: unknown

Implementation  Tag
Description This extension allows to display Google Videos in your wiki.
Author(s)  Sylvain Machefert (IubitoTalk)
Last Version  1.0
License No license specified
Download see below
Example  Balkan Party 2006

check usage (experimental)

GoogleVideo extension displays videos from Google Video. Upload your videos to Google and then share them in your wiki!

View a demo at Balkan Party 2006 on my wiki.

Contents


[edit] Installation

Add this line at the end of LocalSettings.php:

require_once("$IP/extensions/GoogleVideo.php");

Copy the following code into $IP/extensions/GoogleVideo.php:

[edit] Code

<?php
/**
 * GoogleVideo extension
 * Tag: <googlevideo>docid</googlevideo>
 * Example: from url http://video.google.com/videoplay?docid=6444586097901795775
 * <googlevideo>6444586097901795775</googlevideo>
 *
 * @author Sylvain Machefert
 * @version 1.0
 * @link http://www.mediawiki.org/wiki/Extension:GoogleVideo
 */
 
$wgExtensionFunctions[] = 'wfGoogleVideo';
$wgExtensionCredits['parserhook'][] = array(
	'name' => 'Google Video',
        'version' => '1.0',
	'description' => 'Display Google Video',
	'author' => 'Sylvain Machefert',
	'url' => 'http://www.mediawiki.org/wiki/Extension:GoogleVideo'
);
 
function wfGoogleVideo() {
	global $wgParser;
	$wgParser->setHook('googlevideo', 'renderGoogleVideo');
}
 
# The callback function for converting the input text to HTML output
function renderGoogleVideo($input) {
	//$input = "6444586097901795775"
	$width = 425;
	$height = 350;
 
	$output = '<embed style="width:'.$width.'px; height:'.$height.'px;" '
		.'id="VideoPlayback" type="application/x-shockwave-flash" '
		.'src="http://video.google.com/googleplayer.swf?docId='
		.htmlspecialchars($input).'"> </embed>';
	return $output;
}

That's all :-)

[edit] Usage

Usage is as follows: <googlevideo>docid</googlevideo>

[edit] See also