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

/*  copyright 2007 Onion production (Kevin Yeung)
    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 GodTube movies into
    wiki pages. simply use (:godtube whatever:) where "whatever" is 
    replaced with the little funny encrypted-looking code of numbers,
    letters, and symbols that is attached to the end of YouTube URLs.
    So for example if the URL to share a video is:
    
    http://www.godtube.com/flvideo/4ee3524ccf035d35b284/1650.flv
    
        then you'd write (:godtube flvideo/4ee3524ccf035d35b284/1650:),
        or
    http://www.godtube.com/flvideo1/20/17395.flv
    
        then you'd write (:godtube flvideo1/20/17395:).
    
  
*/
# Version date
$RecipeInfo['godTube']['Version'] = '2007-07-25';

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

function ShowgodTube($url) {
      $out ='<embed src="http://godtube.com/flvplayer.swf" 
	  FlashVars="flvPath=http://www.godtube.com/'.$url.'.flv"
	  &quality="high" bgcolor="#000000" wmode="transparent" width="330" height="270" loop="false" name="flv_demo" align="middle" allowScriptAccess="sameDomain"
	  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>';
      return Keep($out);
  }