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 emvideo_umapper_info() { $features = array( array(t('Full screen mode'), t('Yes'), t('You may customize the player to enable or disable full screen playback. Full screen mode is enabled by default.')), ); return array( 'provider' => 'umapper', 'name' => t('UMapper'), 'url' => EMVIDEO_UMAPPER_MAIN_URL, 'settings_description' => t('These settings specifically affect maps displayed from UMapper.', array('@umapper' => EMVIDEO_UMAPPER_MAIN_URL)), 'supported_features' => $features, ); } /** * hook emvideo_PROVIDER_settings * this should return a subform to be added to the emvideo_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 emvideo_umapper_settings() { $form['umapper']['map_options'] = array( '#type' => 'fieldset', '#title' => t('Embedded UMapper map options'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['umapper']['map_options']['emvideo_umapper_full_screen'] = array( '#type' => 'checkbox', '#title' => t('Allow fullscreen'), '#default_value' => variable_get('emvideo_umapper_full_screen', 1), '#description' => t('Allow users to view maps using the entire computer screen.'), ); return $form; } /** * hook emvideo_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 emvideo_umapper_extract($embed = '') { if ($embed && preg_match('@umapper\.com/maps/view/id/([A-Za-z0-9]+)@i', $embed, $matches)) { return $matches[1]; } if ($embed && preg_match('@umapper\.s3\.amazonaws\.com/maps/kml/([A-Za-z0-9]+)@i', $embed, $matches)) { return $matches[1]; } } /** * hook emvideo_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 emvideo_umapper_embedded_link($video_code) { return 'http://www.umapper.com/maps/view/id/'. $video_code; } /** * The embedded flash displaying the umapper video. */ function theme_emvideo_umapper_flash($embed, $width, $height, $options = array()) { static $count; $output = ''; if ($embed) { $id = isset($options['id']) ? $options['id'] : 'video-cck-umapper-flash-'. (++$count); $div_id = isset($options['div_id']) ? $options['div_id'] : 'video-cck-umapper-flash-wrapper-'. $count; $url = "http://www.umapper.com/maps/view/id/$embed"; $movie = 'http://umapper.s3.amazonaws.com/templates/swf/embed.swf'; if (variable_get('emfield_swfobject', FALSE) && (module_exists('swfobject_api') || variable_get('emfield_swfobject_location', ''))) { if (module_exists('swfobject_api')) { $params['width'] = $width; $params['height'] = $height; $params['div_id'] = $id; $params['allowFullScreen'] = $fullscreen_value; $options['kmlPath'] = "http://umapper.s3.amazonaws.com/maps/kml/$embed.kml"; $output .= theme('swfobject_api', $movie, $params, $options, $id); } else { drupal_add_js(variable_get('emfield_swfobject_location', '')); $output .= << Sorry, you need to install flash to see this content. FLASH; } } else { $output .= << FLASH; } } return $output; } /** * hook emvideo_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 emvideo_umapper_thumbnail($field, $item, $formatter, $node, $width, $height) { // unfortunately, umapper doesn't offer a standard API for getting a thumbnail yet $tn = ''; return $tn; } /** * hook emvideo_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 emvideo_umapper_video($embed, $width, $height, $field, $item, &$node) { $output = theme('emvideo_umapper_flash', $embed, $width, $height); return $output; } /** * hook emvideo_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 emvideo_umapper_preview($embed, $width, $height, $field, $item, &$node) { $output = theme('emvideo_vuvox_flash', $embed, $width, $height); return $output; } /** * Implementation of hook_emfield_subtheme. */ function emvideo_umapper_emfield_subtheme() { return array( 'emvideo_umapper_flash' => array( 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL), 'file' => 'providers/umapper.inc' ) ); }