====== dailymotion plugin ======
---- plugin ----
description: Plugin that creates a link or an embed object of Dailymotion movie.
author : Christophe Benz
email : christophe.benz@gmail.com
type : syntax
lastupdate : 2008-01-17
compatible :
depends :
conflicts :
similar : youtube, flowplay, youtubev2, google_video, flashplayer, video
tags : dailymotion, movie, flash, video, embed
securityissue: XSS vulnerability allows arbitrary JavaScript insertion. Author informed on 2008-02-25.
----
=====Summary=====
This DokuWiki plugin creates a link and embed a Dailymotion movie in an Wiki page. User can embed movies just specifying the movie ID with simple syntax.
This plugin is based on the [[Youtube]] plugin written by Ikuo Obataya.
=====Syntax=====
{{dailymotion>ID:SIZE}}
ID is given by Dailymotion.
SIZE is either small, medium or large. Default: medium.
====Example====
Wiki syntax
{{dailymotion>x29kjo}}
{{dailymotion>x29kjo:small}}
{{dailymotion>x29kjo:medium}}
{{dailymotion>x29kjo:large}}
=====Source code=====
Here is the source code:
'Christophe Benz',
'email' => 'christophe.benz@gmail.com',
'date' => '2008-01-17',
'name' => 'Dailymotion Plugin',
'desc' => 'Dailymotion link and object',
'url' => '',
);
}
function getType() { return 'substition'; }
function getSort() { return 159; }
function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{dailymotion>[^}]*\}\}', $mode, 'plugin_dailymotion'); }
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler){
$params = substr($match, strlen('{{dailymotion>'), - strlen('}}') ); // Strip markup
return array($state, explode(':', $params));
}
/**
* Create output
*/
function render($mode, &$renderer, $data) {
if($mode == 'xhtml'){
list($state, $params) = $data;
list($dailymotion_id, $video_size) = $params;
if(is_null($video_size)) {
$video_size = 'medium';
}
$url = 'http://www.dailymotion.com/swf/';
$obj_dimensions['small'] = array('w' => 200, 'h' => 166);
$obj_dimensions['medium'] = array('w' => 420, 'h' => 331);
$obj_dimensions['large'] = array('w' => 520, 'h' => 406);
$width = $obj_dimensions[$video_size]['w'];
$height = $obj_dimensions[$video_size]['h'];
$obj = '
';
$obj .= '';
$obj .= '
';
$renderer->doc .= $obj;
return true;
}
return false;
}
}
?>
====Installation====
Paste the source code in a file named ''syntax.php'' and put it the ''lib/plugins/dailymotion'' directory of your DokuWiki installation.