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

/*  copyright 2007 Anno 
    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 YouTube movies into
    wiki pages. simply use (:youtube 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.teachertube.com/view_video.php?viewkey=d9fe611d5a8e90fefdc9
    
    then you'd write (:teachertube d9fe611d5a8e90fefdc9:).

*/
# Version date
$RecipeInfo['TeacherTube']['Version'] = '2007-03-26';

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

function ShowTeacherTube($url) {
      $out ='<embed src="http://www.teachertube.com/flvplayer.swf" 
	  FlashVars="config=http://www.teachertube.com/flvplayer.php?viewkey='.$url.'
	  &quality="high" bgcolor="#000000" wmode="transparent" width="450" height="350" loop="false" align="middle" 
	  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>';
      return Keep($out);
  }