2012-09-23 21:18:12 +00:00
< ? php
class VideoFileHandlerTheme extends Themelet {
public function display_image ( Page $page , Image $image ) {
$data_href = get_base_href ();
$ilink = $image -> get_image_link ();
$ext = strtolower ( $image -> get_ext ());
if ( $ext == " mp4 " ) {
2014-04-28 04:57:49 +00:00
$html = " Video not playing? <a href=' " . $image -> parse_link_template ( make_link ( 'image/$id/$id%20-%20$tags.$ext' )) . " '>Click here</a> to download the file.<br/>
< script language = 'JavaScript' type = 'text/javascript' >
2012-09-23 21:18:12 +00:00
if ( navigator . userAgent . match ( / Firefox / i ) ||
navigator . userAgent . match ( / Opera / i ) ||
( navigator . userAgent . match ( / MSIE / i ) && parseFloat ( navigator . appVersion . split ( 'MSIE' )[ 1 ]) < 9 )){
2014-04-28 04:57:49 +00:00
document . write ( \ " <object data=' { $data_href } /lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height=' " . strval ( $image -> height + 1 ) . " px' width=' " . strval ( $image -> width ) . " px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source= $ilink &type=video&streamtype=file&controltype=0' name='flashvars'></object> \" );
2012-09-23 21:18:12 +00:00
}
else {
2014-04-28 04:57:49 +00:00
document . write ( \ " <video controls autoplay loop'> \" );
2012-09-23 21:18:12 +00:00
document . write ( \ " <source src=' " . make_link ( " /image/ " . $image -> id ) . " ' type='video/mp4' /> \" );
2014-04-28 04:57:49 +00:00
document . write ( \ " <object data=' { $data_href } /lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height=' " . strval ( $image -> height + 1 ) . " px' width=' " . strval ( $image -> width ) . " px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source= $ilink &type=video&streamtype=file&controltype=0' name='flashvars'></object> \" );
2012-09-23 21:18:12 +00:00
}
</ script >
< noscript > Javascript appears to be disabled . Please enable it and try again .</ noscript > " ;
} elseif ( $ext == " flv " ) {
2014-04-28 04:57:49 +00:00
$html = " Video not playing? <a href=' " . $image -> parse_link_template ( make_link ( 'image/$id/$id%20-%20$tags.$ext' )) . " '>Click here</a> to download the file.<br/>
< object data = '{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id = 'VideoPlayer' type = 'application/x-shockwave-flash' height = '" . strval($image->height + 1). "px' width = '" . strval($image->width) . "px' >
< param value = '#000000' name = 'bgcolor' >
< param name = 'allowFullScreen' value = 'true' >
< param value = 'high' name = 'quality' >
< param value = 'opaque' name = 'wmode' >
< param value = 'source={$ilink}&type=video&streamtype=file&controltype=0' name = 'flashvars' >
</ object > " ;
2012-09-23 21:18:12 +00:00
} elseif ( $ext == " ogv " ) {
2014-04-28 04:57:49 +00:00
$html = " Video not playing? <a href=' " . $image -> parse_link_template ( make_link ( 'image/$id/$id%20-%20$tags.$ext' )) . " '>Click here</a> to download the file.<br/>
< video controls autoplay loop >
2012-09-23 21:18:12 +00:00
< source src = '" . make_link("/image/" . $image->id) . "' type = 'video/ogg' />
</ video > " ;
} elseif ( $ext == " webm " ) {
2014-04-18 22:47:14 +00:00
$ie_only = " <!--[if IE]><p>To view webm files with IE, please <a href='http://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]--> " ;
2014-04-28 04:57:49 +00:00
$html = $ie_only . " Video not playing? <a href=' " . $image -> parse_link_template ( make_link ( 'image/$id/$id%20-%20$tags.$ext' )) . " '>Click here</a> to download the file.<br/>
< video controls autoplay loop >
2012-09-23 21:18:12 +00:00
< source src = '" . make_link("/image/" . $image->id) . "' type = 'video/webm' />
</ video > " ;
}
2014-04-06 19:47:01 +00:00
else {
$html = " Video type ' $ext ' not recognised " ;
}
2012-09-23 21:18:12 +00:00
$page -> add_block ( new Block ( " Video " , $html , " main " , 10 ));
}
}
2014-04-25 02:28:53 +00:00