From 8041073c8d74e5d24e3b9f10143f3e4bd04db2de Mon Sep 17 00:00:00 2001 From: Heshan Wanigasooriya Date: Tue, 23 Mar 2010 04:17:29 +0000 Subject: removing old files and commenting new file field and other files to the vidoe module page. --- types/video_google/video_google.module | 245 --------------------------------- 1 file changed, 245 deletions(-) delete mode 100644 types/video_google/video_google.module (limited to 'types/video_google/video_google.module') diff --git a/types/video_google/video_google.module b/types/video_google/video_google.module deleted file mode 100644 index 280275e..0000000 --- a/types/video_google/video_google.module +++ /dev/null @@ -1,245 +0,0 @@ - - * @author Heshan Wanigasooriya - * @todo - */ - - -/** - * Implementation of hook_menu -*/ -function video_google_menu() { - $items = array(); - $items['node/add/video/google'] = array( - 'title' => 'Google', - 'access arguments' => array('create video') - ); - return $items; -} - - -/** - * Implementation of hook_v_help -*/ -function video_google_v_help() { - - $help = array(); - $help['google']['data'] = '' . t('Google Video support') . ''; - $help['google']['children'] = array(t('You can host videos on video.google.com and put them on your site. - To do this, after you upload the video on Google video you just have to get the URL of the video.')); - - return $help; -} - - -/** - * Implementation of hook_v_info() -*/ -function video_google_v_info() { - $info['google'] = array( - '#name' => 'Google Video', - '#description' => t('Post a video available on !link to this website.', array('!link' => l(t('Google Video'), 'http://video.google.com'), NULL, NULL, NULL, TRUE)), - '#autothumbable' => true, - '#autoresolution' => true, - '#autoplaytime' => false, // seems that thereisn't a video lenght field in the google video xml - ); - - return $info; -} - - -/** - * Implementation of hook_v_form() -*/ -function video_google_v_form(&$node, &$form) { - - $form['video']['vidfile'] = array( - '#type' => 'textfield', - '#title' => t('Google Video URL'), - '#default_value' => $node->vidfile, - '#maxlength' => 700, - '#required' => TRUE, - '#weight' => -20, - '#description' => t('Insert the URL to the google video. ') . l(t('More information.'), 'video/help', array('fragment' => 'videofile'))); - - return $form; -} - - - -/** - * implementation of hook_v_validate -*/ -function video_google_v_validate($node) { - // TODO: use youtube REST or XML-RPC to query youtube: check video available and embeddable - if(!preg_match("/^http:\/\/video\.google\.com\/videoplay\?docid=/", $node->vidfile)) { - form_set_error('vidfile', t('The Google Video URL field must be similar to http://video.google.com/videoplay?docid=1806507480014945777')); - } - else { - //get the video id - $id = _video_google_get_id($node->vidfile); - - $response = _video_apiclient_google_request($id); - if(count($response) == 0) { // google video wasn't able to find the video - form_set_error('vidfile', t('The system was not able to find this video on Google Video. Please check the URL of your Google video.')); - } - } -} - - -/** - * Implementation of hook_v_play -*/ -function video_google_v_play($node) { - return theme('video_google_play', $node); -} - - - -/** AUTOTHUMBNAILING LOGIC */ - -define('VIDEO_GOOGLE_XML', 'http://video.google.com/videofeed'); - -function _video_apiclient_google_request($id, $cacheable = TRUE) { - $args = array('docid' => $id); - return _video_apiclient_request_xml('google', VIDEO_GOOGLE_XML, $args, $cacheable); -} - -function _video_apiclient_google_get_thumbnail_url($id) { - - $xml = _video_apiclient_google_request($id); - - // we *should* be able to use media:thumbnail - // but unfortunately, that is stripped out from the request hook - // so instead, we'll parse it from the description, where it's repeated. - // TODO: look into how to fix this... - $desc = $xml['ITEM']['DESCRIPTION'][0]; - $regex = '@vidfile) { - _video_image_thumbnail_debug(t('No new video to thumbnail')); - return NULL; - } - if ($_POST['tempimage']['fids']['_original']) { - _video_image_thumbnail_debug(t('Video already thumbnailed')); - return NULL; - } - } - // let's include apiclient logic - - //get the video id - if (!$node->vidfile && count($_POST)) { - $vidfile = $_POST['vidfile']; - } else { - $vidfile = $node->vidfile; - } - $id = _video_google_get_id($vidfile); - // get thumbnail url - $thumbnail_url = _video_apiclient_google_get_thumbnail_url($id); - - return _video_image_get_thumb_file_object($thumbnail_url, $id); -} - - -/** - * Implementation of hook_v_auto_resolution -*/ -function video_google_v_auto_resolution(&$node) { - // we set google videos to 400x326 by default - return array(400, 326); -} - - - -/** THEMEABLE FUNCTIONS */ - -/** - * Play videos hosted on video.google.com - * Allows users to host videos on video.google.com and then use the video ID to post it in the module. - * - * @param $node - * object with node information - * - * @return - * string of content to display - */ -function theme_video_google_play($node) { - $width = ($node->video_scaled_x ? $node->video_scaled_x : '425'); - $height = ($node->video_scaled_y ? $node->video_scaled_y : '350'); - // Strip heading "google:" - $videoid = _video_google_get_id(check_plain($node->vidfile)); - //$videoid = substr($node->vidfile, 7); - - // this will be executed by not Internet Explorer browsers - $output = ' - - ' . "\n"; - - // this will be executed by Internet Explorer - $output .= '' . "\n"; - - // params will be passed to both IE or not IE browsers - $output .= '' . "\n"; - // following a list of params simply copied from old embed tag params. I don't know if this are really needed. - $output .= ' - - - - - - ' - . _video_get_parameters($node) . - '

'. t('Your browser is not able to display this multimedia content.') .'

-
'; - - - $output = theme('video_format_play', $output, t('http://video.google.com/support'), t('Link to video.google.com'), t('video.google.com')); - return $output; -} - - - -/** HELPER FUNCTIONS */ - -/** - * Get the docid from an URL -*/ -function _video_google_get_id($url) { - $pattern = '/-?[0-9]+/'; // maybe too weak? some id have a leading - - preg_match_all($pattern, $url, $matches, PREG_PATTERN_ORDER); - return $matches[0][0]; -} - -/** - * Implementation of hook_theme(). - */ -function video_google_theme() { - return array( - 'video_google_play' => array( - 'arguments' => array('node' => NULL), - ), - ); -} - -module_load_include('inc', 'video', 'includes/apiclient'); -- cgit v1.2.3