<?php

function _video_init() {
  return $reptags['video'] = array(
    "#{GOOGLEVIDEO (.*?)}#se"      => "_rep_googlevideo('\\1', 400, 350);",
    "#{MYSPACEVIDEO (.*?)}#se"      => "_rep_myspacevideo('\\1');",
    "#{YOUTUBE (.*?)}#se"      => "_rep_youtubevideo('\\1', 400, 350);",
  );
}

$reptags_info['video'] = array(t('Video embedding tags.'), FALSE);
$reptags_help['video'] = array(
  "{GOOGLEVIDEO id}"           => "Replace id with the docid from your Google video. Ex: {GOOGLEVIDEO -8212746971473469832}",
  "{YOUTUBE id}"           => "Replace id with the 'v' id from your youtube video.",
  "{MYSPACEVIDEO id}"           => "Replace id with the 'videoid' id from your myspace video.",
);


function _rep_googlevideo($googleid, $width, $height){
  $out=<<< EOF
  <embed style="width:${width}px; height:${height}px;"
  id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=$googleid&hl=en" flashvars="">
  </embed>
EOF;

  return $out;
}

function _rep_youtubevideo($youtubeid, $width, $height){
  $out=<<< EOF
  <object width="$width" height="$height"><param name="movie" value="http://www.youtube.com/v/$youtubeid"></param><param name="wmode" value="transparent">
  </param><embed src="http://www.youtube.com/v/$youtubeid"
  type="application/x-shockwave-flash" wmode="transparent" width="$width" height="$height">
  </embed></object>
EOF;

  return $out;
}

function _rep_myspacevideo($videoid){
  $out=<<< EOF
  <embed src="http://lads.myspace.com/videos/vplayer.swf"
  flashvars="m=$videoid&type=video" type="application/x-shockwave-flash"
  width="430" height="346"></embed><br>
EOF;

  return $out;
}
?>
