| 1 |
<?php |
<?php |
| 2 |
//$Id: common.inc,v 1.2.4.8 2009/09/20 07:58:54 heshanmw Exp $ |
//$Id: common.inc,v 1.2.4.9 2009/10/08 16:47:28 heshanmw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Add some common functions for the various video types supported |
* Add some common functions for the various video types supported |
| 14 |
* Get the object for the suitable player for the parameter resource |
* Get the object for the suitable player for the parameter resource |
| 15 |
*/ |
*/ |
| 16 |
function _video_common_get_player($node) { |
function _video_common_get_player($node) { |
| 17 |
switch (_video_get_filetype($node->vidfile)) { |
$op = ($node->vtype == "upload")? _video_get_filetype($node->vidfile) : $node->vtype; |
| 18 |
|
switch ($op) { |
| 19 |
case 'divx': |
case 'divx': |
| 20 |
return theme('video_play_divx', $node); |
return theme('video_play_divx', $node); |
| 21 |
case 'mov': |
case 'mov': |
| 65 |
* string of content to display |
* string of content to display |
| 66 |
*/ |
*/ |
| 67 |
function theme_video_play_flash($node) { |
function theme_video_play_flash($node) { |
|
|
|
|
|
|
| 68 |
$url = _video_get_fileurl($node->vidfile); |
$url = _video_get_fileurl($node->vidfile); |
| 69 |
$file = basename($url); |
$file = basename($url); |
| 70 |
$base_url = substr($url, 0, strrpos($url, '/')); |
$base_url = substr($url, 0, strrpos($url, '/')); |
| 439 |
return $output; |
return $output; |
| 440 |
} |
} |
| 441 |
|
|
| 442 |
|
/** |
| 443 |
|
* Play videos hosted on youtube.com |
| 444 |
|
* Allows users to host videos on youtube.com and then use the video ID to post it in the module. |
| 445 |
|
* In the future it could also use the youtube developer API to get info and comments of the video. |
| 446 |
|
* |
| 447 |
|
* @param $node |
| 448 |
|
* object with node information |
| 449 |
|
* |
| 450 |
|
* @return |
| 451 |
|
* string of content to display |
| 452 |
|
*/ |
| 453 |
|
function theme_video_play_youtube($node) { |
| 454 |
|
$width = ($node->video_scaled_x ? $node->video_scaled_x : '425'); |
| 455 |
|
$height = ($node->video_scaled_y ? $node->video_scaled_y : '350'); |
| 456 |
|
|
| 457 |
|
$id = _video_youtube_get_id(check_plain($node->vidfile)); |
| 458 |
|
|
| 459 |
|
// related video setting |
| 460 |
|
$rel = variable_get('video_youtube_related', false) ? '1' : '0'; |
| 461 |
|
|
| 462 |
|
// this will be executed by not Internet Explorer browsers |
| 463 |
|
$output = '<!--[if !IE]> <--> |
| 464 |
|
<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
| 465 |
|
data="http://www.youtube.com/v/' . $id . '&rel='.$rel.'"> |
| 466 |
|
<!--> <![endif]-->' . "\n"; |
| 467 |
|
|
| 468 |
|
// this will be executed by Internet Explorer |
| 469 |
|
$output .= '<!--[if IE]> |
| 470 |
|
<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
| 471 |
|
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" |
| 472 |
|
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> |
| 473 |
|
<![endif]-->' . "\n"; |
| 474 |
|
|
| 475 |
|
// params will be passed to both IE or not IE browsers |
| 476 |
|
$output .= '<param name="movie" value="http://www.youtube.com/v/' . $id . '&rel='.$rel.'" />' . "\n" |
| 477 |
|
. '<param name="wmode" value="transparent" />' . "\n" |
| 478 |
|
. _video_get_parameters($node) . |
| 479 |
|
'<p>'. t('Your browser is not able to display this multimedia content.') .'</p> |
| 480 |
|
</object>'; |
| 481 |
|
|
| 482 |
|
|
| 483 |
|
$output = theme('video_format_play', $output, t('http://www.google.com/support/youtube'), t('Link to youtube.com'), t('youtube.com')); |
| 484 |
|
return $output; |
| 485 |
|
} |