dailymotion plugin

dailymotion_videozap plugin by Bruno Duyé
Creates an embedded object of Dailymotion VideoZap widget.

Last updated on 2008-12-08. Provides Syntax.
No compatibility info given!

Similar to dailymotion, flashplayer, flowplay, google_video, video, youtube, youtubev2.

Tagged with embed, flash, media, video.

    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.

    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 2×5 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

    This is a (reduced) screenshot of the plugin in action

    Source code

    Here is the source code:

    <?php
    /**
     * Plugin Dailymotion::VideoZap : Create Dailymotion VideoZap from a Dailymotion playlist Id
     * http://www.dokuwiki.org/plugin:dailymotion_videozap
     *
     * @license    GPL v3 (http://www.gnu.org/licenses/gpl.html)
     * @author     Bruno Duyé
     *
     * Based on the Dailymotion plugin written by Christophe Benz
     *
     * Usage : 
     *   {{dailymotion_videozap>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 .= '<iframe marginwidth="0" marginheight="0" width="604" height="355" frameborder="0" scrolling="no" src="' . $url;
          $code .= htmlentities($playlist_id) . '?' . htmlentities($videozap_params) . '"></iframe>';
     
          $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 2×4 video grid

     
    plugin/dailymotion_videozap.txt · Last modified: 2009/10/07 17:54 by laynee
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate