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_vzaar_info() { $features = array( array(t('Autoplay'), t('Yes'), ''), array(t('RSS Attachment'), t('Yes'), ''), ); return array( 'provider' => 'vzaar', 'name' => t('vzaar'), 'url' => EMVIDEO_VZAAR_MAIN_URL, 'settings_description' => t('These settings specifically affect videos displayed from !provider. You can also read more about its !api.', array('!provider' => l(t('vzaar.com'), EMVIDEO_VZAAR_MAIN_URL), '!api' => l(t("developer's API"), EMVIDEO_VZAAR_API_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 set will already be provided at $form['example'], * so if you want specific provider settings within that field set, you should * add the elements to that form array element. */ function emvideo_vzaar_settings() { $form = array(); $form['vzaar']['player_options'] = array( '#type' => 'fieldset', '#title' => t('Embedded video player options'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); // This is an option to set the video to full screen. $form['vzaar']['player_options']['emvideo_vzaar_full_screen'] = array( '#type' => 'checkbox', '#title' => t('Allow fullscreen'), '#default_value' => variable_get('emvideo_vzaar_full_screen', 1), '#description' => t('Allow users to view video 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_vzaar_extract($embed = '') { //http://view.vzaar.com/123456.flashplayer $view_domain = preg_quote(EMVIDEO_VZAAR_VIEW_DOMAIN, '@'); if ($embed && preg_match('@/' . $view_domain . '/([0-9]+)@i', $embed, $matches)) { return $matches[1]; } return FALSE; } /** * Implement hook emvideo_PROVIDER_data_version(). */ function emvideo_vzaar_data_version() { return EMVIDEO_VZAAR_DATA_VERSION; } /** * hook emfield_PROVIDER_data * * provides an array to be serialised and made available with $item elsewhere */ function emvideo_vzaar_data($field, $item) { $data = array(); // adding the version control $data['emvideo_vzaar_data_version'] = EMVIDEO_VZAAR_DATA_VERSION; // This stores a URL to the video's thumbnail. $data['thumbnail'] = 'http://' . EMVIDEO_VZAAR_VIEW_DOMAIN . '/' . $item['value'] . '.thumb'; return $data; } /** * hook emfield_PROVIDER_rss * * This attaches a file to an RSS feed. */ function emvideo_vzaar_rss($item, $teaser = NULL) { if ($item['value']) { $file['thumbnail']['filepath'] = $item['data']['thumbnail']; return $file; } } /** * 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_vzaar_embedded_link($video_code) { return _emvideo_vzaar_path($video_code, 'flashplayer'); } function _emvideo_vzaar_path($id, $ext) { return 'http://' . EMVIDEO_VZAAR_VIEW_DOMAIN . '/' . $id . '.' .$ext; } /** * The embedded flash displaying the video. */ function theme_emvideo_vzaar_embedded_video($item, $width, $height, $autoplay) { $output = ''; if ($item['embed']) { $autoplay = $autoplay ? 'true' : 'false'; $fullscreen = variable_get('emvideo_vzaar_full_screen', 1) ? 'true' : 'false'; $output = ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; // "toFit" ? $output .= ''; $output .= ''; //$output .= ''; $output .= ''; } return $output; } /** * hook emvideo_PROVIDER_thumbnail * Returns the external url for a thumbnail of a specific video. * @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_vzaar_thumbnail($field, $item, $formatter, $node, $width, $height) { return $data['thumbnail']; } /** * 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_vzaar_video($embed, $width, $height, $field, $item, $node, $autoplay) { $output = theme('emvideo_vzaar_embedded_video', $item, $width, $height, $autoplay); 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_vzaar_preview($code, $width, $height, $field, $item, $node, $autoplay, $options = array()) { $output = theme('emvideo_vzaar_embedded_video', $item, $width, $height, $autoplay); return $output; } /** * Implementation of hook_emfield_subtheme. */ function emvideo_vzaar_emfield_subtheme() { return array( 'emvideo_vzaar_embedded_video' => array( 'arguments' => array('item' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL), 'file' => 'providers/vzaar.inc' ) ); }