<?php if (!defined('PmWiki')) exit ();

/*  copyright 2007 Jon Haupt. 
    Build on code from swf.php copyright 2004 Patrick R. Michaud
    and from quicktime.php copyright 2006 Sebastian Siedentopf.
    This file is distributed under the terms of the GNU General Public 
    License as published by the Free Software Foundation; either 
    version 2 of the License, or (at your option) any later version.  

    This module enables embedding of Google Video movies into
    wiki pages. simply use (:googlevideo whatever:) where 'whatever' is
    the unique number given to your movie.  so if the URL to play the video
    is http://video.google.com/videoplay?docid=--348928491823948192,
    you would do (:googlevideo -348928491823948192:).

*/
# Version date
$RecipeInfo['GoogleVideo']['Version'] = '2007-02-06';

Markup('googlevideo', '<img', "/\\(:googlevideo (.*?)\\s*:\\)/e", "ShowGoogleVideo('$1')");

function ShowGoogleVideo($url) {

   ## object tag
      $out .= "<object type='application/x-shockwave-flash' ";
      $out .= "data='http://video.google.com/googleplayer.swf?docId=$url' width='400' height='326' class='VideoPlayback'>";
      $out .= "\n  <param name='movie' value='http://video.google.com/googleplayer.swf?docId=$url'/>";
      $out .= "\n  <param name='allowScriptAccess' value='sameDomain' />";
      $out .= "\n  <param name='quality' value='best' />";
      $out .= "\n  <param name='bgcolor' value='#ffffff' />";
      $out .= "\n  <param name='scale' value='noScale' />";
      $out .= "\n  <param name='salign' value='TL' />";
      $out .= "\n  <param name='wmode' value='transparent' />";
      $out .= "\n  <param name='FlashVars' value='playerMode=embedded' />";
      $out .= "\n</object>";
      return Keep($out);
  }