| 1 |
<?php |
<?php |
| 2 |
//$Id: video_youtube.module,v 1.2.4.2 2009/07/25 03:30:50 heshanmw Exp $ |
//$Id: video_youtube.module,v 1.2.4.3 2009/11/07 04:56:56 heshanmw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Enable Youtube support for video module. |
* Enable Youtube support for video module. |
| 13 |
// let's include apiclient logic |
// let's include apiclient logic |
| 14 |
module_load_include('inc', 'video', 'includes/apiclient'); |
module_load_include('inc', 'video', 'includes/apiclient'); |
| 15 |
|
|
| 16 |
|
|
| 17 |
/** |
/** |
| 18 |
* Implementation of hook_menu |
* Implementation of hook_menu |
| 19 |
*/ |
*/ |
| 20 |
function video_youtube_menu() { |
function video_youtube_menu() { |
| 21 |
$items = array(); |
$items = array(); |
| 22 |
$maycache=true; |
$maycache=true; |
| 23 |
if($maycache) { |
if($maycache) { |
| 24 |
$items['node/add/video/youtube'] = array( |
$items['node/add/video/youtube'] = array( |
| 25 |
'title' => 'Youtube', |
'title' => 'Youtube', |
| 26 |
'access arguments' => array('create video') |
'access arguments' => array('create video') |
| 27 |
); |
); |
| 28 |
|
|
| 29 |
$items['admin/settings/video/youtube'] = array( |
$items['admin/settings/video/youtube'] = array( |
| 30 |
'title' => 'Youtube', |
'title' => 'Youtube', |
| 31 |
'description' => 'Configure various settings of the video Youtube plugin.', |
'description' => 'Configure various settings of the video Youtube plugin.', |
| 32 |
'access arguments' => array('administer site configuration'), |
'access arguments' => array('administer site configuration'), |
| 33 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 34 |
'page arguments' => array('video_youtube_admin_settings'), |
'page arguments' => array('video_youtube_admin_settings'), |
| 35 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 36 |
); |
); |
| 37 |
} |
} |
| 38 |
|
|
| 42 |
|
|
| 43 |
/** |
/** |
| 44 |
* Setting form for video_upload |
* Setting form for video_upload |
| 45 |
*/ |
*/ |
| 46 |
function video_youtube_admin_settings() { |
function video_youtube_admin_settings() { |
| 47 |
$form = array(); |
$form = array(); |
|
|
|
| 48 |
$form['video_youtube_auto_thumbnail'] = array( |
$form['video_youtube_auto_thumbnail'] = array( |
| 49 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 50 |
'#title' => t('Enable auto thumbnailing for youtube videos'), |
'#title' => t('Enable auto thumbnailing for youtube videos'), |
| 51 |
'#default_value' => variable_get('video_youtube_auto_thumbnail', false) |
'#default_value' => variable_get('video_youtube_auto_thumbnail', false) |
| 52 |
); |
); |
| 53 |
$form['video_youtube_related'] = array( |
$form['video_youtube_related'] = array( |
| 54 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 55 |
'#title' => t('Enable related videos'), |
'#title' => t('Enable related videos'), |
| 56 |
'#default_value' => variable_get('video_youtube_related', false), |
'#default_value' => variable_get('video_youtube_related', false), |
| 57 |
'#description' => t('If you enable related videos the Youtube player will display a list of related videos once the video completes playing.'), |
'#description' => t('If you enable related videos the Youtube player will display a list of related videos once the video completes playing.'), |
| 58 |
); |
); |
| 59 |
$form['video_youtube_validation'] = array( |
$form['video_youtube_validation'] = array( |
| 60 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 61 |
'#title' => t('Enable validation'), |
'#title' => t('Enable validation'), |
| 62 |
'#default_value' => variable_get('video_youtube_validation', false), |
'#default_value' => variable_get('video_youtube_validation', false), |
| 63 |
'#description' => t('If you enable validation, on each youtube video submission, you web server will contact Youtube to check that the inserted video is available and embeddable.'), |
'#description' => t('If you enable validation, on each youtube video submission, you web server will contact Youtube to check that the inserted video is available and embeddable.'), |
| 64 |
); |
); |
| 65 |
$form['video_youtube_api_key'] = array( |
$form['video_youtube_api_key'] = array( |
| 66 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 67 |
'#title' => t('Developer Key'), |
'#title' => t('Developer Key'), |
| 68 |
'#description' => t('Insert here the developer Key. You can get one from <a href="http://www.youtube.com/my_profile_dev">Youtube Development pages</a>.'), |
'#description' => t('Insert here the developer Key. You can get one from <a href="http://www.youtube.com/my_profile_dev">Youtube Development pages</a>.'), |
| 69 |
'#default_value' =>variable_get('video_youtube_api_key', ''), |
'#default_value' =>variable_get('video_youtube_api_key', ''), |
| 70 |
); |
); |
| 71 |
// jlampton added: new youtube optional client id |
// jlampton added: new youtube optional client id |
| 72 |
$form['video_youtube_client_id'] = array( |
$form['video_youtube_client_id'] = array( |
| 73 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 74 |
'#title' => t('Client ID'), |
'#title' => t('Client ID'), |
| 75 |
'#description' => t('Insert here the client ID. You can get one from <a href="http://www.youtube.com/my_profile_dev">Youtube Development pages</a>.'), |
'#description' => t('Insert here the client ID. You can get one from <a href="http://www.youtube.com/my_profile_dev">Youtube Development pages</a>.'), |
| 76 |
'#default_value' =>variable_get('video_youtube_client_id', ''), |
'#default_value' =>variable_get('video_youtube_client_id', ''), |
| 77 |
); |
); |
| 78 |
return system_settings_form($form); |
return system_settings_form($form); |
| 79 |
} |
} |
| 81 |
|
|
| 82 |
/** |
/** |
| 83 |
* Validate settings |
* Validate settings |
| 84 |
*/ |
*/ |
| 85 |
function video_youtube_admin_settings_validate($form, &$form_state) { |
function video_youtube_admin_settings_validate($form, &$form_state) { |
| 86 |
if ($form_state['values']['video_youtube_auto_thumbnail']) { // autothumbnailing is active |
if ($form_state['values']['video_youtube_auto_thumbnail']) { // autothumbnailing is active |
| 87 |
// let's check we have a valid dev key |
// let's check we have a valid dev key |
| 88 |
if($form_state['values']['video_youtube_api_key'] == '') { |
if($form_state['values']['video_youtube_api_key'] == '') { |
| 89 |
form_set_error('video_youtube_api_key', t('You have to insert a valid Youtube Developer Key for auto thumbnailing to work')); |
form_set_error('video_youtube_api_key', t('You have to insert a valid Youtube Developer Key for auto thumbnailing to work')); |
| 90 |
} |
} |
| 94 |
|
|
| 95 |
/** |
/** |
| 96 |
* Implementation of hook_v_help |
* Implementation of hook_v_help |
| 97 |
*/ |
*/ |
| 98 |
function video_youtube_v_help() { |
function video_youtube_v_help() { |
| 99 |
|
|
| 100 |
$help = array(); |
$help = array(); |
| 107 |
|
|
| 108 |
/** |
/** |
| 109 |
* Implementation of hook_v_info() |
* Implementation of hook_v_info() |
| 110 |
*/ |
*/ |
| 111 |
function video_youtube_v_info() { |
function video_youtube_v_info() { |
| 112 |
$info['youtube'] = array( |
$info['youtube'] = array( |
| 113 |
'#name' => 'Youtube Video', |
'#name' => 'Youtube Video', |
| 114 |
'#description' => t('Post a video available on !link to this website.', array('!link' => l(t('Youtube'), 'http://www.youtube.com'), NULL, NULL, NULL, TRUE)), |
'#description' => t('Post a video available on !link to this website.', array('!link' => l(t('Youtube'), 'http://www.youtube.com'), NULL, NULL, NULL, TRUE)), |
| 115 |
'#autothumbable' => variable_get('video_youtube_auto_thumbnail', false), |
'#autothumbable' => variable_get('video_youtube_auto_thumbnail', false), |
| 116 |
'#autoresolution' => true, |
'#autoresolution' => true, |
| 117 |
'#autoplaytime' => true, |
'#autoplaytime' => true, |
| 118 |
); |
); |
| 119 |
|
|
| 120 |
return $info; |
return $info; |
| 123 |
|
|
| 124 |
/** |
/** |
| 125 |
* Implementation of hook_v_form() |
* Implementation of hook_v_form() |
| 126 |
*/ |
*/ |
| 127 |
function video_youtube_v_form(&$node, &$form) { |
function video_youtube_v_form(&$node, &$form) { |
| 128 |
|
|
| 129 |
$form['video']['vidfile'] = array( |
$form['video']['vidfile'] = array( |
| 130 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 131 |
'#title' => t('Youtube Video URL'), |
'#title' => t('Youtube Video URL'), |
| 132 |
'#default_value' => $node->vidfile, |
'#default_value' => $node->vidfile, |
| 133 |
'#maxlength' => 700, |
'#maxlength' => 700, |
| 134 |
'#required' => TRUE, |
'#required' => TRUE, |
| 135 |
'#weight' => -20, |
'#weight' => -20, |
| 136 |
'#description' => t('Insert the URL to the youtube video. ') . l(t('More information.'), 'video/help', array('fragment' => 'videofile'))); |
'#description' => t('Insert the URL to the youtube video. ') . l(t('More information.'), 'video/help', array('fragment' => 'videofile'))); |
| 137 |
|
|
| 138 |
return $form; |
return $form; |
| 139 |
} |
} |
| 141 |
|
|
| 142 |
/** |
/** |
| 143 |
* implementation of hook_v_validate |
* implementation of hook_v_validate |
| 144 |
*/ |
*/ |
| 145 |
function video_youtube_v_validate($node) { |
function video_youtube_v_validate($node) { |
| 146 |
if(!preg_match("/^http:\/\/([a-z]{2,3}\.)?youtube\.com\/watch\?v=/", $node->vidfile)) { |
if(!preg_match("/^http:\/\/([a-z]{2,3}\.)?youtube\.com\/watch\?v=/", $node->vidfile)) { |
| 147 |
form_set_error('vidfile', t('The Youtube Video URL field must be similar to <em>http://youtube.com/watch?v=IICWFx7sKmw</em>, <em>http://www.youtube.com/watch?v=IICWFx7sKmw</em> or <em>http://it.youtube.com/watch?v=IICWFx7sKmw</em>')); |
form_set_error('vidfile', t('The Youtube Video URL field must be similar to <em>http://youtube.com/watch?v=IICWFx7sKmw</em>, <em>http://www.youtube.com/watch?v=IICWFx7sKmw</em> or <em>http://it.youtube.com/watch?v=IICWFx7sKmw</em>')); |
| 148 |
} |
} |
| 149 |
else if(variable_get('video_youtube_validation', false)){ |
else if(variable_get('video_youtube_validation', false)) { |
| 150 |
// we have a good URL. Let's check that the video is available on Youtube and that it is embeddable. |
// we have a good URL. Let's check that the video is available on Youtube and that it is embeddable. |
| 151 |
// the approach used here is to return errors only if Youtube explicitely says "an error has occurred" |
// the approach used here is to return errors only if Youtube explicitely says "an error has occurred" |
| 152 |
$id = _video_youtube_get_id($node->vidfile); |
$id = _video_youtube_get_id($node->vidfile); |
| 153 |
// jlampton changed the youtube validation url |
// jlampton changed the youtube validation url |
| 154 |
$response = _video_apiclient_youtube_request('gdata.youtube.com/feeds/api/videos', array('video_id' => $id)); |
//$response = _video_apiclient_youtube_request('gdata.youtube.com/feeds/api/videos', array('video_id' => $id)); |
| 155 |
if(isset($response['ERROR'])) { |
// if(isset($response['ERROR'])) { |
| 156 |
form_set_error('vidfile', t('The Youtube Video URL validation has failed for some reason. Please check the URL and try again.<br />If the error persists please contact %site_name administrators.', array('%site_name' => variable_get('site_name', 'Drupal')))); |
// form_set_error('vidfile', t('The Youtube Video URL validation has failed for some reason. Please check the URL and try again.<br />If the error persists please contact %site_name administrators.', array('%site_name' => variable_get('site_name', 'Drupal')))); |
| 157 |
if(isset($response['ERROR']['DESCRIPTION'][0])) { |
// if(isset($response['ERROR']['DESCRIPTION'][0])) { |
| 158 |
drupal_set_message(t('The Youtube validation service reported the following error: %error', array('%error'=>$response['ERROR']['DESCRIPTION'][0])), 'error'); |
// drupal_set_message(t('The Youtube validation service reported the following error: %error', array('%error'=>$response['ERROR']['DESCRIPTION'][0])), 'error'); |
| 159 |
} |
// } |
| 160 |
} |
// } |
| 161 |
else if(isset($response['VIDEO_DETAILS']['EMBED_STATUS'][0]) |
// else if(isset($response['VIDEO_DETAILS']['EMBED_STATUS'][0]) |
| 162 |
&& $response['VIDEO_DETAILS']['EMBED_STATUS'][0] != 'ok') { |
// && $response['VIDEO_DETAILS']['EMBED_STATUS'][0] != 'ok') { |
| 163 |
// embedding has been disabled. we let the video pass but we warn the user |
// // embedding has been disabled. we let the video pass but we warn the user |
| 164 |
drupal_set_message(t('The video authors have disabled embedding on Youtube. This means that this video will only be playable directly on Youtube.')); |
// drupal_set_message(t('The video authors have disabled embedding on Youtube. This means that this video will only be playable directly on Youtube.')); |
| 165 |
|
// } |
| 166 |
|
// else { // if youtube did not explicetely said "an error has occurred" we accept the video |
| 167 |
|
// ; |
| 168 |
|
// } |
| 169 |
} |
} |
|
else { // if youtube did not explicetely said "an error has occurred" we accept the video |
|
|
; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Implementation of hook_v_play |
|
|
*/ |
|
|
function video_youtube_v_play($node) { |
|
|
return theme('video_youtube_play', $node); |
|
| 170 |
} |
} |
| 171 |
|
|
| 172 |
|
|
| 178 |
|
|
| 179 |
|
|
| 180 |
/** |
/** |
| 181 |
* this is a wrapper for _video_apiclient_request_xml that includes youtube's api key |
* this is a wrapper for _video_apiclient_request_xml that includes youtube's api key |
| 182 |
*/ |
*/ |
| 183 |
function _video_apiclient_youtube_request($method, $args = array(), $cacheable = TRUE) { |
function _video_apiclient_youtube_request($method, $args = array(), $cacheable = TRUE) { |
| 184 |
$args['dev_id'] = trim(variable_get('video_youtube_api_key', '')); |
$args['dev_id'] = trim(variable_get('video_youtube_api_key', '')); |
| 185 |
$args['method'] = $method; |
$args['method'] = $method; |
| 186 |
|
|
| 187 |
return _video_apiclient_request_xml('youtube', VIDEO_YOUTUBE_REST_ENDPOINT, $args, $cacheable); |
return _video_apiclient_request_xml('youtube', VIDEO_YOUTUBE_REST_ENDPOINT, $args, $cacheable); |
| 188 |
} |
} |
| 189 |
|
|
| 190 |
/** |
/** |
| 191 |
* returns the external url for a thumbnail of a specific video |
* returns the external url for a thumbnail of a specific video |
| 192 |
* @param $id |
* @param $id |
| 193 |
* the youtube id of the specific video |
* the youtube id of the specific video |
| 194 |
* @return |
* @return |
| 195 |
* a URL pointing to the thumbnail |
* a URL pointing to the thumbnail |
| 196 |
*/ |
*/ |
| 197 |
function _video_apiclient_youtube_get_thumbnail_url($id) { |
function _video_apiclient_youtube_get_thumbnail_url($id) { |
| 198 |
$response = _video_apiclient_youtube_request('youtube.videos.get_details', array('video_id' => $id)); |
$video_entry = _video_apiclient_youtube_video_entry($id); |
| 199 |
print_r($response); |
|
| 200 |
exit; |
// echo "Thumbnails:\n"; |
| 201 |
if(isset($response['THUMBNAIL_URL'][0]) && $response['THUMBNAIL_URL'][0] != '') { |
$video_thumbnails = $video_entry->getVideoThumbnails(); |
| 202 |
return $response['THUMBNAIL_URL'][0]; |
|
| 203 |
|
foreach($video_thumbnails as $video_thumbnail) { |
| 204 |
|
//echo $videoThumbnail['time'] . ' - ' . $videoThumbnail['url']; |
| 205 |
|
//echo ' height=' . $videoThumbnail['height']; |
| 206 |
|
//echo ' width=' . $videoThumbnail['width'] . "\n"; |
| 207 |
} |
} |
| 208 |
return false; |
//exit; |
| 209 |
|
|
| 210 |
|
return $video_thumbnail['url'] ; |
| 211 |
} |
} |
| 212 |
|
|
| 213 |
|
|
| 214 |
/** |
/** |
| 215 |
* Implementation of hook_v_auto_thumbnail |
* Implementation of hook_v_auto_thumbnail |
| 216 |
*/ |
*/ |
| 217 |
function video_youtube_v_auto_thumbnail($node) { |
function video_youtube_v_auto_thumbnail($node) { |
| 218 |
if (count($_POST)) { |
if (count($_POST)) { |
| 219 |
if ($_POST['vidfile'] == $node->vidfile) { |
if ($_POST['vidfile'] == $node->vidfile) { |
| 228 |
} else { |
} else { |
| 229 |
$vidfile = $node->vidfile; |
$vidfile = $node->vidfile; |
| 230 |
} |
} |
| 231 |
|
|
| 232 |
//get the video id |
//get the video id |
| 233 |
$id = _video_youtube_get_id($vidfile); |
$id = _video_youtube_get_id($vidfile); |
| 234 |
// get thumbnail url |
// get thumbnail url |
| 240 |
|
|
| 241 |
/** |
/** |
| 242 |
* Implementation of hook_v_auto_resolution |
* Implementation of hook_v_auto_resolution |
| 243 |
*/ |
*/ |
| 244 |
function video_youtube_v_auto_resolution(&$node) { |
function video_youtube_v_auto_resolution(&$node) { |
| 245 |
// we set youtube videos to 425x350 by default |
// we set youtube videos to 425x350 by default |
| 246 |
return array(425, 350); |
return array(425, 350); |
| 247 |
} |
} |
| 248 |
|
|
| 249 |
|
|
| 250 |
/** |
/** |
| 251 |
* Implementation of hook_v_auto_playtime |
* Implementation of hook_v_auto_playtime |
| 252 |
*/ |
*/ |
| 253 |
function video_youtube_v_auto_playtime(&$node) { |
function video_youtube_v_auto_playtime(&$node) { |
| 254 |
$id = _video_youtube_get_id($node->vidfile); |
$id = _video_youtube_get_id($node->vidfile); |
| 255 |
$response = _video_apiclient_youtube_request('youtube.videos.get_details', array('video_id' => $id)); // NOTE: here we already passed validation so we expect a valid response |
// $response = _video_apiclient_youtube_request('youtube.videos.get_details', array('video_id' => $id)); // NOTE: here we already passed validation so we expect a valid response |
| 256 |
|
// |
| 257 |
return $response['VIDEO_DETAILS']['LENGTH_SECONDS'][0]; // return the lenght in seconds |
// return $response['VIDEO_DETAILS']['LENGTH_SECONDS'][0]; // return the lenght in seconds |
| 258 |
|
$video_entry = _video_apiclient_youtube_video_entry($id); |
| 259 |
|
return $video_entry->getVideoDuration(); |
| 260 |
} |
} |
| 261 |
|
|
| 262 |
|
|
| 263 |
/** THEMEABLE FUNCTIONS */ |
/** THEMEABLE FUNCTIONS */ |
| 264 |
|
|
| 265 |
/** |
//function theme_video_youtube_play($node) { |
| 266 |
* Play videos hosted on youtube.com |
// $width = ($node->video_scaled_x ? $node->video_scaled_x : '425'); |
| 267 |
* Allows users to host videos on youtube.com and then use the video ID to post it in the module. |
// $height = ($node->video_scaled_y ? $node->video_scaled_y : '350'); |
| 268 |
* In the future it could also use the youtube developer API to get info and comments of the video. |
// |
| 269 |
* |
// $id = _video_youtube_get_id(check_plain($node->vidfile)); |
| 270 |
* @param $node |
// |
| 271 |
* object with node information |
// // related video setting |
| 272 |
* |
// $rel = variable_get('video_youtube_related', false) ? '1' : '0'; |
| 273 |
* @return |
// |
| 274 |
* string of content to display |
// // this will be executed by not Internet Explorer browsers |
| 275 |
*/ |
// $output = '<!--[if !IE]> <--> |
| 276 |
function theme_video_youtube_play($node) { |
//<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
| 277 |
$width = ($node->video_scaled_x ? $node->video_scaled_x : '425'); |
//data="http://www.youtube.com/v/' . $id . '&rel='.$rel.'"> |
| 278 |
$height = ($node->video_scaled_y ? $node->video_scaled_y : '350'); |
//<!--> <![endif]-->' . "\n"; |
| 279 |
|
// |
| 280 |
$id = _video_youtube_get_id(check_plain($node->vidfile)); |
// // this will be executed by Internet Explorer |
| 281 |
|
// $output .= '<!--[if IE]> |
| 282 |
// related video setting |
//<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
| 283 |
$rel = variable_get('video_youtube_related', false) ? '1' : '0'; |
//classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" |
| 284 |
|
//codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> |
| 285 |
// this will be executed by not Internet Explorer browsers |
//<![endif]-->' . "\n"; |
| 286 |
$output = '<!--[if !IE]> <--> |
// |
| 287 |
<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
// // params will be passed to both IE or not IE browsers |
| 288 |
data="http://www.youtube.com/v/' . $id . '&rel='.$rel.'"> |
// $output .= '<param name="movie" value="http://www.youtube.com/v/' . $id . '&rel='.$rel.'" />' . "\n" |
| 289 |
<!--> <![endif]-->' . "\n"; |
// . '<param name="wmode" value="transparent" />' . "\n" |
| 290 |
|
// . _video_get_parameters($node) . |
| 291 |
// this will be executed by Internet Explorer |
// '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> |
| 292 |
$output .= '<!--[if IE]> |
//</object>'; |
| 293 |
<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" |
// |
| 294 |
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" |
// |
| 295 |
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> |
// $output = theme('video_format_play', $output, t('http://www.google.com/support/youtube'), t('Link to youtube.com'), t('youtube.com')); |
| 296 |
<![endif]-->' . "\n"; |
// return $output; |
| 297 |
|
//} |
|
// params will be passed to both IE or not IE browsers |
|
|
$output .= '<param name="movie" value="http://www.youtube.com/v/' . $id . '&rel='.$rel.'" />' . "\n" |
|
|
. '<param name="wmode" value="transparent" />' . "\n" |
|
|
. _video_get_parameters($node) . |
|
|
'<p>'. t('Your browser is not able to display this multimedia content.') .'</p> |
|
|
</object>'; |
|
|
|
|
|
|
|
|
$output = theme('video_format_play', $output, t('http://www.google.com/support/youtube'), t('Link to youtube.com'), t('youtube.com')); |
|
|
return $output; |
|
|
} |
|
| 298 |
|
|
| 299 |
|
|
| 300 |
/** HELPER FUNCTIONS */ |
/** HELPER FUNCTIONS */ |
| 301 |
|
|
| 302 |
/** |
/** |
| 303 |
* Get the id from an URL |
* Get the id from an URL |
| 304 |
*/ |
*/ |
| 305 |
function _video_youtube_get_id($url) { |
function _video_youtube_get_id($url) { |
| 306 |
$parsed_url = parse_url($url); |
$parsed_url = parse_url($url); |
| 307 |
parse_str($parsed_url['query'], $parsed_query);; |
parse_str($parsed_url['query'], $parsed_query);; |
| 313 |
*/ |
*/ |
| 314 |
function video_youtube_theme() { |
function video_youtube_theme() { |
| 315 |
return array( |
return array( |
| 316 |
'video_youtube_play' => array( |
'video_play_youtube' => array( |
| 317 |
'arguments' => array('node' => NULL), |
'arguments' => array('node' => NULL), |
| 318 |
), |
), |
| 319 |
); |
); |
| 320 |
} |
} |
| 321 |
|
|
| 322 |
|
/** |
| 323 |
|
* Implementation of hook_v_play |
| 324 |
|
*/ |
| 325 |
|
function video_youtube_v_play($node) { |
| 326 |
|
module_load_include('inc', 'video', 'includes/common'); |
| 327 |
|
return _video_common_get_player($node); |
| 328 |
|
} |