the translated name of the provider * 'url' => the url to the main page for the provider * 'settings_description' => a description of the provider that will be posted in the admin settings form * 'supported_features' => an array of rows describing the state of certain supported features by the provider. * These will be rendered in a table, with the columns being 'Feature', 'Supported', 'Notes'. */ function video_cck_wattv_info() { $name = t('Wat Tv'); $features = array( array(t('Thumbnails'), t('Yes'), t('')), ); return array( 'provider' => 'wattv', 'name' => $name, 'url' => VIDEO_CCK_WATTV_MAIN_URL, 'settings_description' => t('These settings specifically affect videos displayed from !wattv. ', array('!wattv' => l($name, VIDEO_CCK_WATTV_MAIN_URL, array('target' => '_blank')))), 'supported_features' => $features, ); } /** * hook video_cck_PROVIDER_settings * this should return a subform to be added to the video_cck_settings() admin settings page. * note that a form field will already be provided, at $form['PROVIDER'] (such as $form['youtube']) * so if you want specific provider settings within that field, you can add the elements to that form field. */ function video_cck_wattv_settings() { $form = array(); //no any additional settings return $form; } /** * hook video_cck_PROVIDER_extract * this is called to extract the video code from a pasted URL or embed code. * @param $embed * an optional string with the pasted URL or embed code * @return * either an array of regex expressions to be tested, or a string with the video code to be used * if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array. * otherwise, the calling function will handle testing the embed code against each regex string in the returned array. */ function video_cck_wattv_extract($embed = '') { //http://www.wat.tv/playlist/664475 - playlist //http://www.wat.tv/swf2/176176dDXr1rR1336357/664475 - playlist //http://www.wat.tv/video/hillary-clinton-en-pleurs-gwp7_dnxs_.html //http://www.wat.tv/swf2/302889bHF5FpT788875 if (preg_match('@src="http://www\.wat\.tv/swf2/([0-9a-z]+)"@i', $embed, $matches)) { return $matches[1]; } elseif (preg_match('@http://www\.wat\.tv/video/(.+?\.html)@i', $embed, $matches)) { //try read wat tv for determening id of file $data = @file('http://www.wat.tv/video/' . $matches[1]); if ($data) { $data = implode("\n", $data); if (preg_match('@@i', $data, $matches2)) { return $matches2[1]; } } } } /** * hook video_cck_PROVIDER_embedded_link($video_code) * returns a link to view the video at the provider's site * @param $video_code * the string containing the video to watch * @return * a string containing the URL to view the video at the original provider's site */ function video_cck_wattv_embedded_link($video_code) { return 'http:www.wat.tv/video/' . _video_cck_wattv_get_real_id($video_code); } /** * hook video_cck_PROVIDER_thumbnail * returns the external url for a thumbnail of a specific video * TODO: make the args: ($embed, $field, $item), with $field/$item provided if we need it, but otherwise simplifying things * @param $field * the field of the requesting node * @param $item * the actual content of the field from the requesting node * @return * a URL pointing to the thumbnail */ function video_cck_wattv_thumbnail($field, $item) { $video_id = _video_cck_wattv_get_real_id($item['value']); return 'http://s.wat.tv/media/dyn/pre/90x70/' . substr($video_id, strlen($video_id) - 4, 2) . '/' . substr($video_id, strlen($video_id) - 2, 2) . '/' . $video_id .'.jpg?' . mt_rand(100000, 999999); } /** * hook video_cck_PROVIDER_video * this actually displays the full/normal-sized video we want, usually on the default page view * @param $embed * the video code for the video to embed * @param $width * the width to display the video * @param $height * the height to display the video * @param $field * the field info from the requesting node * @param $item * the actual content from the field * @return * the html of the embedded video */ function video_cck_wattv_video($embed, $width, $height, $field, $item, $autoplay) { $output = theme('video_cck_wattv_flash', $embed, $width, $height, $autoplay); return $output; } /** * hook video_cck_PROVIDER_video * this actually displays the preview-sized video we want, commonly for the teaser * @param $embed * the video code for the video to embed * @param $width * the width to display the video * @param $height * the height to display the video * @param $field * the field info from the requesting node * @param $item * the actual content from the field * @return * the html of the embedded video */ function video_cck_wattv_preview($embed, $width, $height, $field, $item, $autoplay) { $output = theme('video_cck_wattv_flash', $embed, $width, $height, $autoplay); return $output; } function theme_video_cck_wattv_flash($embed, $width, $height, $autoplay) { $output = ''; if ($embed) { $output.= '