====== dailymotion plugin ====== ---- plugin ---- description: Creates an embedded object of Dailymotion VideoZap widget. author : Bruno Duyé email : bruno.duye _AT_ gmail _DOT_ com type : syntax lastupdate : 2008-12-08 compatible : depends : conflicts : similar : dailymotion, youtube, flowplay, flashplayer, video tags : !obsolete, media, video, embed, flash ---- Flash is not available anymore in browsers. Embedding videos from many video sites like Dailymotion can be done with [[vshare]] plugin. =====Summary===== This DokuWiki plugin creates an embedded Dailymotion VideoZap widget in an Wiki page from a Dailymotion playlist. User can embed many movies just specifying the playlist ID with simple syntax. This plugin is based on the [[Dailymotion]] plugin written by Christophe Benz. {{:plugin:dailymotion_videozap.png}} =====Syntax===== Basic syntax: {{dailymotion_videozap>Id}} Extended syntax: {{dailymotion_videozap>Id:Params}} * **Id** : Dailymotion playlist Id * **Params** : Dailymotion params Please note that if you change the parameters cols and rows, you will need to change total size, too (fixed to 2x5 videos (604px x 355px) for the moment, see TODO list). ====Example==== Wiki syntax {{dailymotion>xqs4d_les-nous_la-fin-du-monde}} =====How to get the Playlist Id ?===== To get that Id : * login into Dailymotion, then click on **playlists** into the personal nav bar (the bar where there is freinds, groups, comments, etc). * click on a playlist to open it * the playlist Id is now on the adress bar =====Screenshot===== {{http://brunetton.tuxfamily.org/PRIVE/dailymotion_videozap_plugin.png|This is a (reduced) screenshot of the plugin in action}} =====Source code===== Here is the source code: Id}} where Id is Dailymotion playlist Id (see the online doc for details) * {{dailymotion_videozap>Id:Params}} * */ if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_dailymotion_videozap extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Bruno Duyé', 'email' => 'bruno.duye gmail com', 'date' => '2008-12-08', 'name' => 'Dailymotion::VideoZap Plugin', 'desc' => 'Dailymotion videozap from a playlist', 'url' => '', ); } function getType() { return 'substition'; } function getSort() { return 159; } function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{dailymotion_videozap>[^}]*\}\}', $mode, 'plugin_dailymotion_videozap'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ $params = substr($match, strlen('{{dailymotion_videozap>'), - strlen('}}') ); // Strip markup return array($state, explode(':', $params)); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml'){ list($state, $params) = $data; list($playlist_id, $videozap_params) = $params; if(preg_match('/^[-0-9a-z_]+$/', $playlist_id) == 0) { $renderer->doc .= 'Error: Playlist ID must be alphanumeric characters or \'-\' or \'_\'. Given value: ' . htmlentities($playlist_id); return false; } $url = 'http://www.dailymotion.com/videozap/playlist/'; $code .= ''; $renderer->doc .= $code; return true; } return false; } } ?> PS: do not add a newline at the end of file =====Installation===== Paste the source code in a new file : ''lib/plugins/dailymotion_videozap/syntax.php'' in your DokuWiki installation directory. =====TODO===== ====total size calculation from params==== {{dailymotion>xqs4d_les-nous_la-fin-du-monde:2:4}} for 2x4 video grid