diff -urpN contrib/emaudio/changelog.txt contrib/emaudio/changelog.txt
--- contrib/emaudio/changelog.txt 2008-12-09 16:13:48.000000000 -0600
+++ contrib/emaudio/changelog.txt 2008-11-19 21:49:34.000000000 -0600
@@ -1,8 +1,4 @@
-/* $Id: changelog.txt,v 1.1.4.12 2008/12/09 22:13:48 alexua Exp $ */
-
-December 2008
-=============
- * #337997 - Got emaudio up and running (alexua and moonray)
+/* $Id: changelog.txt,v 1.1.4.11 2008/11/20 03:49:34 aaron Exp $ */
November 2008
=============
diff -urpN contrib/emaudio/emaudio.info contrib/emaudio/emaudio.info
--- contrib/emaudio/emaudio.info 2008-12-09 16:13:48.000000000 -0600
+++ contrib/emaudio/emaudio.info 2008-10-08 11:39:08.000000000 -0600
@@ -1,7 +1,7 @@
-; $Id: emaudio.info,v 1.1.4.7 2008/12/09 22:13:48 alexua Exp $
+; $Id: emaudio.info,v 1.1.4.6 2008/10/08 17:39:08 alexua Exp $
name = Embedded Audio Field
description = Defines a field type for displaying third party music, podcasts, and other audio, such as podOmatic and Odeo.
-core = 6.x
+core = 5.x
dependencies[] = emfield
package = CCK
diff -urpN contrib/emaudio/emaudio.install contrib/emaudio/emaudio.install
--- contrib/emaudio/emaudio.install 2008-12-09 17:31:28.000000000 -0600
+++ contrib/emaudio/emaudio.install 2008-07-25 05:45:50.000000000 -0600
@@ -1,5 +1,5 @@
array(
- 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
- 'file' => 'providers/odeo.inc'
- )
- );
-}
diff -urpN contrib/emaudio/providers/podcastalley.inc contrib/emaudio/providers/podcastalley.inc
--- contrib/emaudio/providers/podcastalley.inc 2008-12-09 16:13:49.000000000 -0600
+++ contrib/emaudio/providers/podcastalley.inc 2008-10-08 11:39:08.000000000 -0600
@@ -1,5 +1,5 @@
array(
- 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
- 'file' => 'providers/podcastalley.inc'
- )
- );
-}
\ No newline at end of file
diff -urpN contrib/emaudio/providers/podomatic.inc contrib/emaudio/providers/podomatic.inc
--- contrib/emaudio/providers/podomatic.inc 2008-12-09 16:13:49.000000000 -0600
+++ contrib/emaudio/providers/podomatic.inc 2008-10-11 13:05:26.000000000 -0600
@@ -1,5 +1,5 @@
Click here to get your own player.
- if ($embed) {
- /*
- if ($autoplay) {
+ if ($code) {
+/* if ($autoplay) {
$autoplay_value = '&autostart=1';
- }
- */
- $output .= "
- \n';
}
return $output;
}
@@ -168,11 +165,12 @@ function emaudio_podomatic_preview($embe
/**
* Implementation of hook_emfield_subtheme.
*/
-function emaudio_podomatic_emfield_subtheme() {
+function emaudio_podomatic_subtheme() {
return array (
'emaudio_podomatic_flash' => array(
'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
'file' => 'providers/podomatic.inc'
)
);
-}
\ No newline at end of file
+}
+
diff -urpN contrib/emfield_generic/README.txt contrib/emfield_generic/README.txt
--- contrib/emfield_generic/README.txt 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/README.txt 2008-11-23 12:00:42.000000000 -0600
@@ -0,0 +1,18 @@
+/* $Id: $ */
+
+/***********/
+ Embedded Generic Field
+/***********/
+
+Author:enzo - Eduardo Garcia
+Development Began 2008-10-21
+
+Requires: Drupal 6, Content (CCK), emfield
+Optional: Views
+
+This extensible module will create a field for node content types that can be used to display video,audio or images
+from various third party providers. When entering the content, the user will simply paste the URL or embed code
+of the video,audio or image and the module will automatically determine which content provider is being used. When displaying
+the video,audio or image the proper embedding format will be used.
+
+Questions can be directed to enzo@anexusit.com
diff -urpN contrib/emfield_generic/changelog.txt contrib/emfield_generic/changelog.txt
--- contrib/emfield_generic/changelog.txt 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/changelog.txt 2008-11-23 12:00:44.000000000 -0600
@@ -0,0 +1,180 @@
+/* $Id: changelog.txt,v 1.1.2.7 2008/11/12 17:54:43 aaron Exp $ */
+
+November 2008
+-------------
+ * #333365/chrono325: Allow Emvideo to play Google Video links from RSS feeds (aaron/chrono325).
+
+September 2008
+--------------
+ * Comment some code in upgrade to d6 that might cause a complaint (aaron).
+ * Begin upgrade from d5 to d6 (aaron).
+ * Add drupal_load('module', 'content'); to install/uninstall process (aaron).
+ * Placeholder function to upgrade from video_cck (aaron).
+
+August 2008
+-----------
+ * Add support for swfobject to youtube, taking swfobject_api into account (aaron).
+#297760 - BenKewell fixed thickbox theming issues
+
+2008-07-18
+----------
+Changed name from video_cck to emvideo to comply with new naming standards.
+
+2008-06-23
+----------
+ * Add TODO for thumbnails for spike.tv (aaron).
+ * Add placeholder ifilm.inc to help with updates after ifilm-spike switch (aaron).
+ * Move ifilm.inc to spike.inc (aaron).
+
+2008-06-22
+----------
+ * Move theme functions to video_cck.theme.inc (aaron).
+ * Implement hook_theme (aaron).
+
+2008-05-30
+widget info
+'callbacks' => array('tables' => CONTENT_CALLBACK_DEFAULT, 'arguments' => CONTENT_CALLBACK_DEFAULT, ),
+allow w/h (and other) overrides to thumbnails and other formatters
+case 'database columns': return module_invoke('emfield', 'field_columns', $field);
+content_notify in .install files
+
+2008-05-29
+implement hook_content_is_empty
+
+2008-05-23
+#261999 - chirale fixed XHTML validation errors in YouTube.inc
+
+2008-05-10
+#208963 - robomalo + darrenmUK added Vimeo support
+#249255 - ekes added MRSS support to multiple files
+#170799 - ekes added support for google video URLs from '.com.au', 'co.uk' etc.
+#199189 - vsnguyen + Rysk added support for Veoh
+#253389 - Rysk updated Veoh support + added providers guba and imeem
+
+2008-04-30
+change 'thumbnail' text on widget settings form
+
+2008-04-29
+dailymotion thumbnails
+
+2008-04-07
+support for blip.tv's new player
+added $options=array() to themes for future expansion of options
+
+2008-03-14
+#216796/jhedstrom - extended brightcove support
+ifilm.inc was changed to spike.inc to reflect the change in site name and url, and the provider file was fixed.
+
+2008-03-21
+add support for last.fm videos
+
+2008-02-22
+#217339/fjen fix myspace thumbnails
+myspace now is also myspacetv.com
+fix myspace to use object instead of embed
+
+2008-02-17
+removed goleft support -- no user contributed videos, and no thumbnails.
+add provider views handlers
+
+2008-02-16
+#178299/dalin - modified patch to allow filter by video present
+
+2008-02-09
+#211529 - MrKatz fixed the revver url
+
+2008-02-07
+support for goleft.tv
+
+2008-01-06
+grab random youtube thumbnail
+#200435/jhedstrom - default thumbnail when video thumbnail not available
+
+2008-01-04
+remove bliptv debugging printout on node submission
+dailymotion autoplay support
+added dailymotion support
+#181095:alley youtube thumbnails w/o api or requests
+#177593:anonymous5190 parse new google embed code
+add to youtube & google
+integrate with colorpicker module; add border options for youtube
+#201855;jhedstrom add color options for youtube player
+#184980 cache youtube thumbnails (cache was accidentally left off while debugging)
+#173780;alexua - fix 'Cannot find server or DNS Error' in ie6 for youtube
+add support for emthumb, so that custom thumbnails may be stored and displayed for videos
+
+2007-12-07
+change url for brightcove to .tv
+
+2007-10-17
+#179454 fix youtube's new &rel=1 url structure
+
+2007-09-12
+better support for blip.tv's rss (allow overriding type given)
+
+2007-09-06
+added rss support for blip.tv
+added data versioning to allow nodes to save more data, but respect older nodes
+
+2007-07-27
+ignore case when matching video url's
+don't show 'show video' on thumbnails if no embed code value
+
+2007-06-27
+clean old variables during install, sorry, new update again.
+fix install -- change ncck to emfield
+
+2007-06-19
+add update code to change variables and remove old menu item
+require dependency on ncck
+
+2007-06-09
+fixed embed pasting for blip.tv
+added support for blip.tv
+added serialized data array for extra provider-specific node-level data
+added thumbnail width/height
+
+2007-06-07
+created 'supported features' sections of settings page
+added support for 'related videos' for youtube
+
+2007-06-05
+add 'embed code' filter for views -- note: run update.php to see it
+increase maxlength on embed textfield for better embed code support
+added support for ifilm
+
+2007-06-03
+began support for autoplay (starting with youtube)
+added support for sevenload
+
+2007-04-25
+added support for brightcove videos. thanks, recidive!
+
+2007-04-12
+text link for thumbnail when thumbnail not available
+link thumbnails to node view
+fix youtube thumbnails
+
+2007-04-04
+some code documentation
+
+2007-03-24
+simplified api
+added video link hook to api
+
+2007-03-23
+begin bliptv, but waiting on email re. api
+add google, metacafe, myspace, revver, jumpcut
+change structure to use .inc files for 3rd party providers
+describe api in readme
+
+2007-03-22
+fix bug w/ blank video when no embed code entered
+call youtube api to fetch thumbnails
+parse video code from the YouTube video URL
+
+2007-03-14
+branch to video_cck for more generic video integration
+
+2007-02-23
+began development for YouTube integration; release as youtube_cck
diff -urpN contrib/emfield_generic/emaudio.theme.inc contrib/emfield_generic/emaudio.theme.inc
--- contrib/emfield_generic/emaudio.theme.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emaudio.theme.inc 2008-11-23 16:36:06.000000000 -0600
@@ -0,0 +1,109 @@
+type]['fields'][$field_type]['widget'];
+ print theme('emaudio_audio_embed', $field, $node->{$field_type}[0], 'emaudio_embed', $node);
+ */
+ if ($item['value'] && $item['provider']) {
+ $output = drupal_get_form('emaudio_embed_form', $field, $item, $formatter, $node, $options);
+ }
+
+ return $output;
+}
+
+function theme_emaudio_audio_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ // If we've set $options['thumbnail_url'], then we'll just use that.
+ // Otherwise, if we have emthumb installed, then give it a chance to override our thumbnail
+ $thumbnail_url = $options['thumbnail_url'] ? $options['thumbnail_url'] : module_invoke('emthumb', 'thumbnail_url', $item);
+
+ // if we don't have a custom thumbnail, then see if the provider gives us a thumbnail
+ $thumbnail_url = $thumbnail_url ? $thumbnail_url : _emfield_generic_include_invoke('emfield_generic', 'emaudio', $item['provider'], 'thumbnail', $field, $item, $formatter, $node, $width, $height, $options);
+
+ // If we still don't have a thumbnail, then apply a default thumbnail, if it exists.
+ if (!$thumbnail_url) {
+ $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emaudio_default_thumbnail_path', NULL);
+
+ if ($default_thumbnail_url) {
+ $thumbnail_url = base_path() . $default_thumbnail_url;
+ }
+ }
+ }
+ else {
+ // Seems to be an unknown audio. Apply a default thumbnail, if it exists.
+ if (!$thumbnail_url) {
+ $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emaudio_default_thumbnail_path', NULL);
+ if ($default_thumbnail_url) {
+ $thumbnail_url = base_path() . $default_thumbnail_url;
+ }
+ }
+ }
+
+ $link_url = isset($options['link_url']) ? $options['link_url'] : 'node/'. $node->nid;
+ $link_title = isset($options['link_title']) ? $options['link_title'] : t('See audio');
+ $image_title = isset($options['image_title']) ? $options['image_title'] : $link_title;
+ $image_alt = isset($options['image_alt']) ? $options['image_alt'] : $link_title;
+
+ if ($thumbnail_url) {
+ $width = isset($options['width']) ? $options['width'] : NULL;
+ $width = isset($width) ? $width : ($field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('emaudio_default_thumbnail_width', EMAUDIO_DEFAULT_THUMBNAIL_WIDTH));
+ $height = isset($options['height']) ? $options['height'] : NULL;
+ $height = isset($height) ? $height : ($field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('emaudio_default_thumbnail_height', emaudio_DEFAULT_THUMBNAIL_HEIGHT));
+ if ($no_link) { //thickbox requires the thumbnail returned without the link
+ $output = '';
+ }
+ else {
+ $output = l('', $link_url, array('html'=> true));
+ }
+ }
+ else {
+ // if all else fails, then just print a 'see audio' link.
+ if ($no_link) {
+ $output = ''; //thickbox won't work without a thumbnail
+ }
+ else {
+ $output = l($link_title, $link_url);
+ }
+ }
+
+ return $output;
+}
+
+function theme_emaudio_audio_audio($field, $item, $formatter, $node, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ $embed = $item['value'];
+ $width = isset($options['width']) ? $options['width'] : (isset($field['widget']['audio_width']) ? $field['widget']['audio_width'] : variable_get('emaudio_default_audio_width', EMAUDIO_DEFAULT_AUDIO_WIDTH));
+ $height = isset($options['height']) ? $options['height'] : (isset($field['widget']['audio_height']) ? $field['widget']['audio_height'] : variable_get('emaudio_default_audio_height', EMAUDIO_DEFAULT_AUDIO_HEIGHT));
+ $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $field['widget']['audio_autoplay'];
+ $output = _emfield_generic_include_invoke('emfield_generic', 'emaudio', $item['provider'], 'audio', $embed, $width, $height, $field, $item, $autoplay, $options);
+ }
+
+ return $output;
+}
+
+function theme_emaudio_default($field, $item, $formatter, $node, $options = array()) {
+ return theme('emaudio_audio_audio', $field, $item, $formatter, $node, $options);
+}
+
+function theme_emaudio_audio_preview($field, $item, $formatter, $node, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ $embed = $item['value'];
+ $width = isset($options['width']) ? $options['width'] : (isset($field['widget']['audio_width']) ? $field['widget']['audio_width'] : variable_get('emaudio_default_audio_width', EMAUDIO_DEFAULT_PREVIEW_WIDTH));
+ $height = isset($options['height']) ? $options['height'] : (isset($field['widget']['audio_height']) ? $field['widget']['audio_height'] : variable_get('emaudio_default_audio_height', EMAUDIO_DEFAULT_PREVIEW_HEIGHT));
+ $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $field['widget']['audio_autoplay'];
+ $output = _emfield_generic_include_invoke('emfield_generic', 'emaudio', $item['provider'], 'preview', $embed, $width, $height, $field, $item, $autoplay, $options);
+ }
+
+ return $output;
+}
\ No newline at end of file
diff -urpN contrib/emfield_generic/emfield_generic.info contrib/emfield_generic/emfield_generic.info
--- contrib/emfield_generic/emfield_generic.info 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emfield_generic.info 2008-11-23 12:00:42.000000000 -0600
@@ -0,0 +1,15 @@
+; $Id: emvideo.info,v 1.1.2.2 2008/07/25 11:45:51 alexua Exp $
+
+name = Embedded Generic Field
+description = Defines a field type for displaying third party providers for video,audio or images.
+
+core = 6.x
+dependencies[] = emfield
+package = CCK
+
+;
+version = "6.x-1.x-dev"
+core = "6.x"
+project = "emfield"
+datestamp = ""
+
diff -urpN contrib/emfield_generic/emfield_generic.install contrib/emfield_generic/emfield_generic.install
--- contrib/emfield_generic/emfield_generic.install 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emfield_generic.install 2008-11-27 09:53:44.000000000 -0600
@@ -0,0 +1,75 @@
+name,TRUE);
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function emfield_generic_uninstall() {
+
+ //Delete global variables
+ $providers = drupal_system_listing("\.inc", drupal_get_path('module', 'emfield_generic') ."/providers/", 'name', 0);
+
+ foreach($providers as $provider)
+ variable_del('emfield_emfield_generic_allow_'. $provider->name);
+
+ drupal_load('module', 'content');
+ content_notify('uninstall', 'emfield_generic');
+
+}
+
+/**
+ * Implementation of hook_enable().
+ */
+function emfield_generic_enable() {
+ drupal_load('module', 'content');
+ content_notify('enable', 'emfield_generic');
+}
+
+/**
+ * Implementation of hook_disable().
+ */
+function emfield_generic_disable() {
+ drupal_load('module', 'content');
+ content_notify('disable', 'emfield_generic');
+}
+
+/**
+ * Implementation of hook_requirements().
+ */
+function emfield_generic_requirements($phase) {
+ $requirements = array();
+ // Ensure translations don't break at install time
+ $t = get_t();
+
+ if ($phase == 'install') {
+ if (drupal_get_installed_schema_version('content') < 6000) {
+ drupal_set_message($t("Some updates are still pending. Please return to !update and run the remaining updates.", array('!update' => l($t(), 'update.php', array('query' => 'op=selection')))), 'warning');
+ $requirements['cck'] = array(
+ 'title' => $t('CCK'),
+ 'description' => $t('Updates for content.module need to be run first. Please re-run the update script.'),
+ 'severity' => REQUIREMENT_ERROR,
+ );
+ }
+ }
+
+ return $requirements;
+}
diff -urpN contrib/emfield_generic/emfield_generic.module contrib/emfield_generic/emfield_generic.module
--- contrib/emfield_generic/emfield_generic.module 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emfield_generic.module 2008-11-25 17:52:20.000000000 -0600
@@ -0,0 +1,1024 @@
+ 'emfield_generic_thickbox',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+ }
+
+ return $items;
+}
+
+/**
+ * Implementation of hook_emfield_info().
+ */
+function emfield_generic_emfield_info() {
+ $name = t('Embedded Generic Field');
+ return array(
+ '#name' => $name,
+ '#settings_description' => t('The following settings configure content with any fields controlled by @name.', array('@name' => $name)),
+ );
+}
+
+/**
+ * Implementation of hook_theme().
+ */
+function emfield_generic_theme() {
+ $themes_emaudio = array(
+ 'emaudio_audio_embed' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_audio_flash' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_audio_thumbnail' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_audio_audio' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_audio_preview' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_default' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_audio_embed' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_audio_thumbnail' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_audio_audio' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_audio_preview' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_audio_flash' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ 'emaudio_formatter_default' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emaudio.theme.inc'
+ ),
+ );
+
+ $themes_emimage = array(
+ 'emimage_image' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL,
+ 'code' => NULL,
+ 'width' => NULL,
+ 'height' => NULL,
+ 'title' => NULL,
+ 'link' => NULL
+ ),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_image_embed' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_image_image' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL,
+ 'code' => NULL,
+ 'width' => NULL,
+ 'height' => NULL,
+ 'title' => '',
+ 'link' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_image_thumbnail' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_image_full' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_image_preview' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_default' => array(
+ 'arguments' => array(
+ 'field' => NULL,
+ 'item' => NULL,
+ 'formatter' => NULL,
+ 'node' => NULL),
+ 'file' => 'emimage.theme.inc',
+
+ ),
+ 'emimage_formatter_image_image' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_formatter_image_thumbnail' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_formatter_image_embed' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_formatter_image_preview' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emimage.theme.inc',
+ ),
+ 'emimage_formatter_default' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emimage.theme.inc',
+ )
+ );
+
+ $themes_emvideo = array(
+ 'emvideo_video_embed' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_video_thumbnail' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'no_link' => FALSE, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_video_video' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_default' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_video_preview' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_thickbox' => array(
+ 'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+ 'file' => 'emvideo.theme.inc',
+ ),
+ 'emvideo_formatter_video_video' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ 'emvideo_formatter_video_thumbnail' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ 'emvideo_formatter_video_embed' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ 'emvideo_formatter_video_preview' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ 'emvideo_formatter_default' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ 'emvideo_formatter_thickbox' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emvideo.theme.inc'
+ ),
+ );
+
+ $themes_emfield_generic = array(
+ 'emfield_generic_formatter_video_video' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_video_thumbnail' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_video_embed' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_video_preview' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_default' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_video_flash' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ 'emfield_generic_formatter_thickbox' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'emfield_generic.theme.inc'
+ ),
+ );
+
+ $themes = array_merge($themes_emaudio,$themes_emimage,$themes_emvideo,$themes_emfield_generic);
+
+ $themes += module_invoke('emfield', 'provider_themes', 'emfield_generic');
+
+ return $themes;
+
+}
+
+/**
+ * Implementation of hook_emfield_settings().
+ *
+ * This would be to add any extra settings (besides providers) to the emfield
+ * settings configuration page. Video CCK doesn't require anything at the moment.
+ */
+function emfield_generic_emfield_settings() {
+ $form = array();
+
+ return $form;
+}
+
+/**
+ * Implementation of hook_field_info().
+ */
+function emfield_generic_field_info() {
+ $fields = array(
+ 'emfield_generic' => array(
+ 'label' => t('Generic Embedded Field'),
+ 'description' => t('Automatically parse and display a third party sources from its URL or embed code.'),
+ 'callbacks' => array(
+ 'tables' => CONTENT_CALLBACK_DEFAULT,
+ 'arguments' => CONTENT_CALLBACK_DEFAULT,
+ ),
+ ),
+ );
+
+ return $fields;
+}
+
+/**
+ * Implementation of hook_field_settings
+ */
+function emfield_generic_field_settings($op, $field) {
+ switch ($op) {
+ case 'database columns':
+ return module_invoke('emfield', 'field_columns', $field);
+ }
+}
+
+/**
+ * Implementation of hook_content_is_empty().
+ */
+function emfield_generic_content_is_empty($item, $field) {
+ return module_invoke('emfield', 'emfield_content_is_empty', $item, $field);
+}
+
+/**
+ * Implementation of hook_field().
+ */
+function emfield_generic_field($op, &$node, $field, &$items, $teaser, $page) {
+ if (module_hook('emfield', 'emfield_field')) {
+ return emfield_emfield_field($op, $node, $field, $items, $teaser, $page, 'emfield_generic');
+ }
+}
+
+/**
+ * Implementation of hook_field_formatter_info()
+ */
+function emfield_generic_field_formatter_info() {
+ $types = array('emfield_generic', );
+ $formats = array(
+ 'default' => array(
+ 'label' => t('Default'),
+ 'field types' => $types,
+ ));
+
+ $formats_audio = array(
+ 'audio_audio' => array(
+ 'label' => t('Full Size Audio Player'),
+ 'field types' => $types,
+ ),
+ 'emaudio_preview' => array(
+ 'label' => t('Preview Size Audio Player'),
+ 'field types' => $types,
+ ),
+ 'emaudio_thumbnail' => array(
+ 'label' => t('Audio Image Thumbnail'),
+ 'field types' => $types,
+ ),
+ 'emaudio_embed' => array(
+ 'label' => t('Audio Embed Code'),
+ 'field types' => $types,
+ ),
+ );
+
+ $formats_image = array(
+ 'image_full' => array(
+ 'label' => t('Image Full Size Image'),
+ 'field types' => $types,
+ ),
+ 'image_preview' => array(
+ 'label' => t('Image Preview Size Image'),
+ 'field types' => $types,
+ ),
+ 'image_thumbnail' => array(
+ 'label' => t('Image Thumbnail'),
+ 'field types' => $types,
+ ),
+ 'image_embed' => array(
+ 'label' => t('Image Embed Code'),
+ 'field types' => $types,
+ ),
+ );
+
+ $formats_video = array(
+ 'video_video' => array(
+ 'label' => t('Full Size Video'),
+ 'field types' => $types,
+ ),
+ 'video_preview' => array(
+ 'label' => t('Preview Video'),
+ 'field types' => $types,
+ ),
+ 'video_thumbnail' => array(
+ 'label' => t('Video Image Thumbnail'),
+ 'field types' => $types,
+ ),
+ 'video_embed' => array(
+ 'label' => t('Video Embed Code'),
+ 'field types' => $types,
+ ),
+ );
+
+ $formats = array_merge($formats,$formats_audio,$formats_image,$formats_video);
+
+ // Add thickbox formatter if thickbox module exists.
+ if (module_exists('thickbox')) {
+ $formats['thickbox'] = array(
+ 'label' => t('Thickbox: Image Thumbnail -> Full Size Video'),
+ 'field types' => $types,
+ );
+ }
+
+ return $formats;
+}
+
+/**
+ * Implementation of hook_field_formatter().
+ */
+function emfield_generic_field_formatter($field, $item, $formatter, $node) {
+ $types = array("emaudio","emimage","emvideo");
+ foreach($types as $type){
+ $files = _emfield_generic_system_list('emfield_generic', $type,$item['provider'],FALSE);
+
+ if(!empty($files))
+ $item['type'] = $type;
+ }
+ return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'emfield_generic');
+}
+
+/** Widgets **/
+
+/**
+ * Implementation of hook_widget_info
+ */
+function emfield_generic_widget_info() {
+ return array(
+ 'emfield_generic_textfields' => array(
+ 'label' => '3rd Party files',
+ 'field types' => array('emfield_generic'),
+ 'multiple values' => CONTENT_HANDLE_CORE,
+ 'callbacks' => array(
+ 'default value' => CONTENT_CALLBACK_DEFAULT,
+ ),
+ ),
+ );
+}
+
+function _emfield_generic_system_list($module, $type,$provider = NULL, $load = TRUE) {
+ $override_files = module_invoke_all('emfield_providers', $module, $provider);
+ $files = drupal_system_listing("$provider\.inc", drupal_get_path('module', $module) ."/providers/" . $type , 'name', 0);
+ $files = array_merge($files, $override_files);
+
+ ksort($files);
+
+ if ($load) {
+ foreach ($files as $file) {
+ emfield_include_list($file);
+ }
+ }
+
+ return $files;
+}
+
+/**
+ * Invoke hook in a particular include.
+ *
+ * @param $module
+ * the helper module
+ * @param $provider
+ * The name of the provider (without the .inc extension).
+ * @param $hook
+ * The name of the hook (e.g. "settings", "thumbnail", etc.).
+ * @param ...
+ * Arguments to pass to the hook implementation.
+ * @return
+ * The return value of the hook implementation.
+ */
+function _emfield_generic_include_invoke() {
+ $args = func_get_args();
+ $module = array_shift($args);
+ $type = array_shift($args);
+ $provider = array_shift($args);
+ $hook = array_shift($args);
+ $function = $type .'_'. $provider .'_'. $hook;
+ _emfield_generic_system_list($module, $type,$provider);
+ return emfield_include_hook($type, $provider, $hook) ? call_user_func_array($function, $args) : NULL;
+}
+
+
+function _emfield_generic_widget_settings($op, $widget, $type) {
+ switch ($op) {
+ case 'form':
+ // Make sure to register the new type as supported by this module.
+ emfield_implement_types(FALSE);
+
+ $form = array();
+ $options = array();
+ $providers = _emfield_generic_system_list($module = "emfield_generic",$type);
+
+ global $conf;
+ foreach ($providers as $provider) {
+ if (variable_get('emfield_'. $module . '_allow_'. $provider->name, FALSE)) {
+ $info = _emfield_generic_include_invoke("emfield_generic", $type,$provider->name, 'info');
+ $options[$provider->name] = $info['name'];
+ }
+ }
+ $type_str = substr($type,2);
+ $form_options = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Providers ' . $type_str),
+ '#default_value' => empty($widget['providers_' . $type_str]) ? array() : $widget['providers_' . $type_str],
+ '#options' => $options,
+ );
+
+ /*foreach (module_implements('emfield_widget_settings_extra') as $module) {
+ $form[$module] = module_invoke($module, 'emfield_widget_settings_extra', 'form', $widget);
+ }*/
+
+ return $form_options;
+
+ case 'save':
+ $columns = array('providers'); //, 'helper_module', );
+ foreach (module_implements('emfield_widget_settings_extra') as $module) {
+ $columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));
+ }
+
+ return $columns;
+ }
+}
+
+function emfield_generic_widget_settings($op, $widget) {
+ switch ($op) {
+ case 'form':
+ if ($widget['type'] == 'emfield_generic_textfields') {
+
+ $form['provider_list'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Providers Supported'),
+ '#description' => t('Select which third party providers you wish to allow for this content type from the list below. If no checkboxes are checked, then all providers will be supported. When a user submits new content, the URL they enter will be matched to the provider, assuming that provider is allowed here.'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ );
+ //Audio Section
+ $form['provider_list']['providers_audio'] = (array)_emfield_generic_widget_settings('form', $widget, 'emaudio');
+ $width = variable_get('emaudio_default_audio_width', EMAUDIO_DEFAULT_AUDIO_WIDTH);
+ $height = variable_get('emaudio_default_audio_height', EMAUDIO_DEFAULT_AUDIO_HEIGHT);
+ $form['audio'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Audio Display Settings'),
+ '#description' => t('These settings control how this audio player is displayed in its full size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['audio']['audio_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Audio display width'),
+ '#default_value' => empty($widget['audio_width']) ? $width : $widget['audio_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the audio. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['audio']['audio_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Audio display height'),
+ '#default_value' => empty($widget['audio_height']) ? $height : $widget['audio_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the audio. It defaults to @height.', array('@height' => $height)),
+ );
+ $form['audio']['audio_autoplay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Autoplay'),
+ '#default_value' => empty($widget['audio_autoplay']) ? '' : $widget['audio_autoplay'],
+ '#description' => t('If supported by the provider, checking this box will cause the audio player to automatically begin after it loads when in its full size.'),
+ );
+
+ $width = variable_get('emaudio_default_preview_width', EMAUDIO_DEFAULT_PREVIEW_WIDTH);
+ $height = variable_get('emaudio_default_preview_height', EMAUDIO_DEFAULT_PREVIEW_HEIGHT);
+ $form['audio_preview'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Audio Preview Settings'),
+ '#description' => t('These settings control how this audio is displayed in its preview size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['audio_preview']['audio_preview_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Audio preview width'),
+ '#default_value' => empty($widget['audio_preview_width']) ? $width : $widget['audio_preview_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the preview audio. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['audio_preview']['audio_preview_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Audio preview height'),
+ '#default_value' => empty($widget['audio_preview_height']) ? $height : $widget['audio_preview_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the preview audio. It defaults to @height.', array('@height' => $height)),
+ );
+ $form['audio_preview']['audio_preview_autoplay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Autoplay'),
+ '#default_value' => empty($widget['preview_autoplay']) ? '' : $widget['preview_autoplay'],
+ '#description' => t('If supported by the provider, checking this box will cause the audio player to automatically begin after it loads when in its preview size.'),
+ );
+
+ $width = variable_get('emaudio_default_thumbnail_width', EMAUDIO_DEFAULT_THUMBNAIL_WIDTH);
+ $height = variable_get('emaudio_default_thumbnail_height', EMAUDIO_DEFAULT_THUMBNAIL_HEIGHT);
+ $form['audio_tn'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Audio Thumbnail'),
+ '#description' => t('When displayed as a thumbnail, these settings control the image returned. Note that not all 3rd party audio content providers offer thumbnails, and others may require an API key or other requirements. More information from the settings page. The default size for thumbnails is @widthx@height.', array('@settings' => url('admin/content/emfield'), '@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['audio_tn']['audio_thumbnail_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Audio width'),
+ '#default_value' => empty($widget['audio_thumbnail_width']) ? $width : $widget['audio_thumbnail_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the thumbnail. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['audio_tn']['audio_thumbnail_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Thumbnail height'),
+ '#default_value' => empty($widget['audio_thumbnail_height']) ? $height : $widget['audio_thumbnail_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the thumbnail. It defaults to @height.', array('@height' => $height)),
+ );
+ if (!module_exists('emthumb')) {
+ $tn_desc = ' '. t('You may be interested in activating the Embedded Media Thumbnails module as well, which will allow you to specify custom thumbnails on a per-node basis.');
+ }
+ $default_path = variable_get('emaudio_default_thumbnail_path', EMAUDIO_DEFAULT_THUMBNAIL_PATH);
+ $form['audio_tn']['audio_thumbnail_default_path'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Default thumbnail path'),
+ '#default_value' => empty($widget['audio_thumbnail_default_path']) ? $default_path : $widget['audio_thumbnail_default_path'],
+ '#description' => t("Path to a local default thumbnail image for cases when a thumbnail can't be found. For example, you might have a default thumbnail at %files.", array('%files' => 'files/thumbnail.png')) . $tn_desc,
+ );
+
+ //Image Section
+ $form['provider_list']['providers_image'] = (array)_emfield_generic_widget_settings('form', $widget, 'emimage');
+ $link_options = array(
+ EMIMAGE_LINK_NONE => t('No link'),
+ EMIMAGE_LINK_CONTENT => t('Link to content'),
+ EMIMAGE_LINK_PROVIDER => t('Link to provider'),
+ );
+ $width = variable_get('emimage_default_full_width', EMIMAGE_DEFAULT_FULL_WIDTH);
+ $height = variable_get('emimage_default_full_height', EMIMAGE_DEFAULT_FULL_HEIGHT);
+ $form['image_full'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Image Full size display settings'),
+ '#description' => t('These settings control how this image is displayed in its full size, which defaults to @widthx@height. Note that if one of the dimensions is 0, then the image will be resized to be no larger than the other dimension.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['image_full']['full_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Full size display width'),
+ '#default_value' => empty($widget['full_width']) ? $width : $widget['full_width'],
+ '#required' => true,
+ '#description' => t('The width of the image. It defaults to @width. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@width' => $width)),
+ );
+ $form['image_full']['full_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Full size display height'),
+ '#default_value' => empty($widget['full_height']) ? $height : $widget['full_height'],
+ '#required' => true,
+ '#description' => t('The height of the image. It defaults to @height. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@height' => $height)),
+ );
+ $full_link = variable_get('emimage_default_full_link', EMIMAGE_DEFAULT_FULL_LINK);
+ $form['image_full']['full_link'] = array(
+ '#type' => 'select',
+ '#title' => t('Full size link'),
+ '#description' => t("Where the image will link when displayed in its full size. 'Content' links to the content page, 'provider' links to the provider's image page, and 'none' displays the image with no link."),
+ '#options' => $link_options,
+ '#default_value' => empty($widget['full_link']) ? $full_link : $widget['full_link'],
+ );
+
+ $width = variable_get('emimage_default_preview_width', EMIMAGE_DEFAULT_PREVIEW_WIDTH);
+ $height = variable_get('emimage_default_preview_height', EMIMAGE_DEFAULT_PREVIEW_HEIGHT);
+ $form['image_preview'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Image Preview Settings'),
+ '#description' => t('These settings control how this image is displayed in its preview size, which defaults to @widthx@height. Note that if one of the dimensions is 0, then the image will be resized to be no larger than the other dimension.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => true,
+ '#collapsed' => TRUE,
+ );
+ $form['image_preview']['image_preview_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Image preview width'),
+ '#default_value' => empty($widget['image_preview_width']) ? $width : $widget['image_preview_width'],
+ '#required' => true,
+ '#description' => t('The width of the image preview. It defaults to @width. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@width' => $width)),
+ );
+ $form['image_preview']['image_preview_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Image preview height'),
+ '#default_value' => empty($widget['image_preview_height']) ? $height : $widget['image_preview_height'],
+ '#required' => true,
+ '#description' => t('The height of the image preview. It defaults to @height. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@height' => $height)),
+ );
+ $full_link = variable_get('emimage_default_preview_link', EMIMAGE_DEFAULT_PREVIEW_LINK);
+ $form['image_preview']['preview_link'] = array(
+ '#type' => 'select',
+ '#title' => t('Preview size link'),
+ '#description' => t("Where the image will link when displayed in its preview size. 'Content' links to the content page, 'provider' links to the provider's image page, and 'none' displays the image with no link."),
+ '#options' => $link_options,
+ '#default_value' => empty($widget['full_link']) ? $full_link : $widget['full_link'],
+ );
+ $width = variable_get('emimage_default_thumbnail_width', EMIMAGE_DEFAULT_THUMBNAIL_WIDTH);
+ $height = variable_get('emimage_default_thumbnail_height', EMIMAGE_DEFAULT_THUMBNAIL_HEIGHT);
+ $form['image_tn'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Image Thumbnail'),
+ '#description' => t('When displayed as a thumbnail, these settings control the image returned. The default size for thumbnails is @widthx@height. Note that if one of the dimensions is 0, then the image will be resized to be no larger than the other dimension.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['image_tn']['image_thumbnail_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Image thumbnail width'),
+ '#default_value' => empty($widget['image_thumbnail_width']) ? $width : $widget['image_thumbnail_width'],
+ '#required' => true,
+ '#description' => t('The width of the image thumbnail. It defaults to @width. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@width' => $width)),
+ );
+ $form['image_tn']['image_thumbnail_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Image thumbnail height'),
+ '#default_value' => empty($widget['image_thumbnail_height']) ? $height : $widget['image_thumbnail_height'],
+ '#required' => true,
+ '#description' => t('The height of the image thumbnail. It defaults to @height. Set it to 0 if you want to leave the image at its original aspect ratio.', array('@height' => $height)),
+ );
+ $thumb_link = variable_get('emimage_default_thumbnail_link', EMIMAGE_DEFAULT_THUMBNAIL_LINK);
+ $form['image_tn']['image_thumbnail_link'] = array(
+ '#type' => 'select',
+ '#title' => t('Image thumbnail link'),
+ '#description' => t("Where the image will link when displayed as a thumbnail. 'Content' links to the content page, 'provider' links to the provider's image page, and 'none' displays the image with no link."),
+ '#options' => $link_options,
+ '#default_value' => empty($widget['image_thumbnail_link']) ? $thumb_link : $widget['image_thumbnail_link'],
+ );
+
+ //Video Section
+ $form['provider_list']['providers_video'] = (array)_emfield_generic_widget_settings('form', $widget, 'emvideo');
+
+ $width = variable_get('emvideo_default_video_width', EMVIDEO_DEFAULT_VIDEO_WIDTH);
+ $height = variable_get('emvideo_default_video_height', EMVIDEO_DEFAULT_VIDEO_HEIGHT);
+
+ $form['video'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Video Display Settings'),
+ '#description' => t('These settings control how this video is displayed in its full size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['video']['video_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Video display width'),
+ '#default_value' => empty($widget['video_width']) ? $width : $widget['video_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the video. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['video']['video_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Video display height'),
+ '#default_value' => empty($widget['video_height']) ? $height : $widget['video_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the video. It defaults to @height.', array('@height' => $height)),
+ );
+ $form['video']['video_autoplay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Autoplay'),
+ '#default_value' => empty($widget['video_autoplay']) ? '' : $widget['video_autoplay'],
+ '#description' => t('If supported by the provider, checking this box will cause the video to automatically begin after the video loads when in its full size.'),
+ );
+
+ $width = variable_get('emvideo_default_preview_width', EMVIDEO_DEFAULT_PREVIEW_WIDTH);
+ $height = variable_get('emvideo_default_preview_height', EMVIDEO_DEFAULT_PREVIEW_HEIGHT);
+ $form['video_preview'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Video Preview Settings'),
+ '#description' => t('These settings control how this video is displayed in its preview size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['video_preview']['video_preview_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Video preview width'),
+ '#default_value' => empty($widget['video_preview_width']) ? $width : $widget['video_preview_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the preview video. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['video_preview']['video_preview_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Video preview height'),
+ '#default_value' => empty($widget['video_preview_height']) ? $height : $widget['video_preview_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the preview video. It defaults to @height.', array('@height' => $height)),
+ );
+ $form['video_preview']['vieo_preview_autoplay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Autoplay'),
+ '#default_value' => empty($widget['video_preview_autoplay']) ? '' : $widget['video_preview_autoplay'],
+ '#description' => t('If supported by the provider, checking this box will cause the video to automatically begin after the video loads when in its preview size.'),
+ );
+
+ $width = variable_get('emvideo_default_thumbnail_width', EMVIDEO_DEFAULT_THUMBNAIL_WIDTH);
+ $height = variable_get('emvideo_default_thumbnail_height', EMVIDEO_DEFAULT_THUMBNAIL_HEIGHT);
+ $form['video_tn'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Video Thumbnail'),
+ '#description' => t('When displayed as a thumbnail, these settings control the image returned. Note that not all 3rd party files content providers offer thumbnails, and others may require an API key or other requirements. More information from the settings page. The default size for thumbnails is @widthx@height.', array('@settings' => url('admin/content/emfield'), '@width' => $width, '@height' => $height)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['video_tn']['video_thumbnail_width'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Thumbnail width'),
+ '#default_value' => empty($widget['video_thumbnail_width']) ? $width : $widget['video_thumbnail_width'],
+ '#required' => TRUE,
+ '#description' => t('The width of the thumbnail. It defaults to @width.', array('@width' => $width)),
+ );
+ $form['video_tn']['video_thumbnail_height'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Thumbnail height'),
+ '#default_value' => empty($widget['video_thumbnail_height']) ? $height : $widget['video_thumbnail_height'],
+ '#required' => TRUE,
+ '#description' => t('The height of the thumbnail. It defaults to @height.', array('@height' => $height)),
+ );
+ if (!module_exists('emthumb')) {
+ $tn_desc = ' '. t('You may be interested in activating the Embedded Media Thumbnails module as well, which will allow you to specify custom thumbnails on a per-node basis.');
+ }
+ $default_path = variable_get('emfield_generic_default_thumbnail_path', '');
+ $form['video_tn']['video_thumbnail_default_path'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Default thumbnail path'),
+ '#default_value' => empty($widget['video_thumbnail_default_path']) ? $default_path : $widget['video_thumbnail_default_path'],
+ '#description' => t("Path to a local default thumbnail image for cases when a thumbnail can't be found. For example, you might have a default thumbnail at %files.", array('%files' => 'files/thumbnail.png')) . $tn_desc,
+ );
+ }
+ return $form;
+
+ case 'validate':
+ if ($widget['type'] == 'emfield_generic') {
+
+ //Audio Section
+ if (!is_numeric($widget['audio_width']) || intval($widget['audio_width']) != $widget['audio_width'] || $widget['audio_width'] < 1) {
+ form_set_error('audio_width', t('"Audio width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['audio_height']) || intval($widget['audio_height']) != $widget['audio_height'] || $widget['audio_height'] < 1) {
+ form_set_error('audio_height', t('"Audio height" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['audio_preview_width']) || intval($widget['audio_preview_width']) != $widget['audio_preview_width'] || $widget['audio_preview_width'] < 1) {
+ form_set_error('audio_preview_width', t('"Audio Preview width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['audio_preview_height']) || intval($widget['audio_preview_height']) != $widget['audio_preview_height'] || $widget['audio_preview_height'] < 1) {
+ form_set_error('audio_preview_height', t('"Audio Preview height" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['audio_thumbnail_width']) || intval($widget['audio_thumbnail_width']) != $widget['audio_thumbnail_width'] || $widget['audio_thumbnail_width'] < 1) {
+ form_set_error('audio_thumbnail_width', t('"Audio Thumbnail width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['audio_thumbnail_height']) || intval($widget['audio_thumbnail_height']) != $widget['audio_thumbnail_height'] || $widget['audio_thumbnail_height'] < 1) {
+ form_set_error('audio_thumbnail_height', t('"Audio Thumbnail height" must be a positive integer.'));
+ }
+
+ //Image Section
+ if (!is_numeric($widget['full_width']) || intval($widget['full_width']) != $widget['full_width'] || $widget['full_width'] < 0) {
+ form_set_error('full_width', t('"Image Full size width" must be an integer.'));
+ }
+ if (!is_numeric($widget['full_height']) || intval($widget['full_height']) != $widget['full_height'] || $widget['full_height'] < 0) {
+ form_set_error('full_height', t('"Image Full size height" must be an integer.'));
+ }
+ if (!is_numeric($widget['image_preview_width']) || intval($widget['image_preview_width']) != $widget['image_preview_width'] || $widget['image_preview_width'] < 0) {
+ form_set_error('image_preview_width', t('"Image Preview width" must be an integer.'));
+ }
+ if (!is_numeric($widget['image_preview_height']) || intval($widget['image_preview_height']) != $widget['image_preview_height'] || $widget['image_preview_height'] < 0) {
+ form_set_error('image_preview_height', t('"Image Preview height" must be an integer.'));
+ }
+ if (!is_numeric($widget['image_thumbnail_width']) || intval($widget['image_thumbnail_width']) != $widget['image_thumbnail_width'] || $widget['image_thumbnail_width'] < 0) {
+ form_set_error('image_thumbnail_width', t('"Image Thumbnail width" must be an integer.'));
+ }
+ if (!is_numeric($widget['image_thumbnail_height']) || intval($widget['image_thumbnail_height']) != $widget['image_thumbnail_height'] || $widget['image_thumbnail_height'] < 0) {
+ form_set_error('image_thumbnail_height', t('"Image Thumbnail height" must be an integer.'));
+ }
+
+ //Video Section
+ if (!is_numeric($widget['video_width']) || intval($widget['video_width']) != $widget['video_width'] || $widget['video_width'] < 1) {
+ form_set_error('video_width', t('"Video width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['video_height']) || intval($widget['video_height']) != $widget['video_height'] || $widget['video_height'] < 1) {
+ form_set_error('video_height', t('"Video height" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['video_preview_width']) || intval($widget['video_preview_width']) != $widget['video_preview_width'] || $widget['video_preview_width'] < 1) {
+ form_set_error('video_preview_width', t('"Video Preview width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['video_preview_height']) || intval($widget['video_preview_height']) != $widget['video_preview_height'] || $widget['video_preview_height'] < 1) {
+ form_set_error('video_preview_height', t('"Video Preview height" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['video_thumbnail_width']) || intval($widget['video_thumbnail_width']) != $widget['video_thumbnail_width'] || $widget['video_thumbnail_width'] < 1) {
+ form_set_error('video_thumbnail_width', t('"Video Thumbnail width" must be a positive integer.'));
+ }
+ if (!is_numeric($widget['video_thumbnail_height']) || intval($widget['video_thumbnail_height']) != $widget['video_thumbnail_height'] || $widget['video_thumbnail_height'] < 1) {
+ form_set_error('video_thumbnail_height', t('"Video Thumbnail height" must be a positive integer.'));
+ }
+ }
+ break;
+
+ case 'save':
+ if ($widget['widget_type'] == 'emfield_generic_textfields') {
+ $columns_audio = array('audio_width', 'audio_height', 'audio_autoplay', 'audio_preview_width', 'audio_preview_height', 'audio_preview_autoplay', 'audio_thumbnail_width', 'audio_thumbnail_height', 'audio_thumbnail_default_path', );
+ $columns_image = array('full_width', 'full_height', 'full_link', 'image_preview_width', 'image_preview_height', 'image_preview_link', 'image_thumbnail_width', 'image_thumbnail_height', 'image_thumbnail_link', );
+ $columns_video = array('video_width', 'video_height', 'video_autoplay', 'video_preview_width', 'video_preview_height', 'video_preview_autoplay', 'videio_thumbnail_width', 'video_thumbnail_height', 'video_thumbnail_default_path', );
+ $providers = array('providers_audio','providers_image','providers_video');
+ $columns = array_merge($columns_audio,$columns_image,$columns_video,$providers);
+ //$columns = array_merge($columns_audio,$columns_image,$columns_video, module_invoke('emfield', 'emfield_widget_settings', 'save', $widget, 'emfield_generic'));
+ return $columns;
+ }
+ break;
+ }
+}
+
+/**
+ * Return a list of providers allowed for a specific field. honor general setting and cck field settings
+ */
+function _emfield_generic_allowed_providers($field, $module,$type) {
+ $allowed_providers = _emfield_generic_system_list($module,$type);
+ $providers = "providers_" . substr($type,2);
+
+ foreach ($allowed_providers as $provider) {
+ if (!variable_get('emfield_'. $module . '_allow_'. $provider->name, FALSE) || !$field['widget'][$providers][$provider->name]) {
+ unset($allowed_providers[$provider->name]);
+ }
+ }
+ return $allowed_providers;
+}
+
+/**
+ * Implementation of hook_widget()
+ */
+function emfield_generic_widget(&$form, &$form_state, $field, $items, $delta = 0) {
+ if (module_hook('emfield', 'emfield_widget')) {
+ return emfield_emfield_widget($form, $form_state, $field, $items, $delta, 'emfield_generic');
+ }
+}
+
+function emfield_generic_embed_form($field, $item, $formatter, $node, $options = array()) {
+ $embed = $item['value'];
+ $width = $options['width'] ? $options['width'] : $field['widget']['video_width'];
+ $height = $options['height'] ? $options['height'] : $field['widget']['video_height'];
+ $autoplay = $options['autoplay'] ? $options['autoplay'] : $field['widget']['video_autoplay'];
+ $title = $options['title'] ? $options['title'] : t('Embed Code');
+ $description = $options['description'] ? $options['description'] : t('To embed this video on your own site, simply copy and paste the html code from this text area.');
+ $text = module_invoke('emfield', 'include_invoke', 'emfield_generic', $item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay);
+ $form = array();
+ $form['emfield_generic_embed'] = array(
+ '#type' => 'textarea',
+ '#title' => $title,
+ '#description' => $description,
+ '#default_value' => $text,
+ );
+
+ return $form;
+}
+
+/**
+ * Providers may supply an enclosure for rss feeds. This expects something in a
+ * file format, so would be an object in the format of $file->filepath,
+ * $file->filesize, and $file->filemime.
+ * Calls the providers hook emfield_generic_PROVIDER_RSS($item, $teaser).
+ */
+function emfield_generic_emfield_rss($node, $items = array(), $teaser = NULL) {
+ $rss_data = array();
+ foreach ($items as $item) {
+ // note only the first $item will get an RSS enclosure, other items may have media: data in the feed however
+ if ($item['value'] && $item['provider']) {
+ $rss_data[] = module_invoke('emfield', 'include_invoke', 'emfield_generic', $item['provider'], 'rss', $item, $teaser);
+ }
+ }
+
+ return $rss_data;
+}
+
+function emfield_generic_handler_arg_provider($op, &$query, $argtype, $arg = '') {
+ return _emfield_handler_arg_provider($op, $query, $argtype, $arg, 'emfield_generic');
+}
+
+/**
+ * Page callback for video-cck/thickbox.
+ * This will display our video in a modal window defined by the thickbox module.
+ * As it's a direct callback, it displays no HTML other than the video.
+ */
+function emfield_generic_thickbox($nid, $width, $height, $field_name) {
+ $field = array();
+ $field['widget']['video_width'] = $width;
+ $field['widget']['video_height'] = $height;
+ $field['widget']['video_autoplay'] = 1;
+ $field['field_name'] = $field_name;
+ $node = node_load($nid);
+ $items = $node->$field_name;
+ $item = $items[0];
+ print theme('emfield_generic_video_video', $field, $item, 'video_video', $node);
+}
diff -urpN contrib/emfield_generic/emfield_generic.theme.inc contrib/emfield_generic/emfield_generic.theme.inc
--- contrib/emfield_generic/emfield_generic.theme.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emfield_generic.theme.inc 2008-11-23 16:32:20.000000000 -0600
@@ -0,0 +1,97 @@
+ true));
+ }
+ return $output;
+}
+
+function theme_emimage_image_thumbnail($field, $item, $formatter, $node) {
+ if ($item['value'] && $item['provider']) {
+ $code = $item['value'];
+ $width = $field['widget']['thumbnail_width'] === '' ? variable_get('emimage_default_full_width', EMIMAGE_DEFAULT_FULL_WIDTH) : $field['widget']['thumbnail_width'];
+ $height = $field['widget']['thumbnail_height'] === '' ? variable_get('emimage_default_full_height', EMIMAGE_DEFAULT_FULL_HEIGHT) : $field['widget']['thumbnail_height'];
+ $link = $field['widget']['thumbnail_link'] ? $field['widget']['thumbnail_link'] : variable_get('emimage_default_thumbnail_link', EMIMAGE_DEFAULT_THUMBNAIL_LINK);
+ if ($link == EMIMAGE_LINK_CONTENT) {
+ $link = 'node/'. $node->nid;
+ }
+ else if ($link == EMIMAGE_LINK_PROVIDER) {
+ $link = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'embedded_link', $code, $item['data']);
+ }
+ else {
+ $link = NULL;
+ }
+ $title = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'image_title', $code, $item['data']);
+ $output = theme('emimage_image', $field, $item, $formatter, $node, $code, $width, $height, $title, $link);
+ }
+ return $output;
+}
+
+function theme_emimage_image_full($field, $item, $formatter, $node) {
+ if ($item['value'] && $item['provider']) {
+ $code = $item['value'];
+ $width = $field['widget']['full_width'] === '' ? variable_get('emimage_default_full_width', EMIMAGE_DEFAULT_FULL_WIDTH) : $field['widget']['full_width'];
+ $height = $field['widget']['full_height'] === '' ? variable_get('emimage_default_full_height', EMIMAGE_DEFAULT_FULL_HEIGHT) : $field['widget']['full_height'];
+ $link = $field['widget']['full_link'] ? $field['widget']['full_link'] : variable_get('emimage_default_full_link', EMIMAGE_DEFAULT_FULL_LINK);
+ if ($link == EMIMAGE_LINK_CONTENT) {
+ $link = 'node/'. $node->nid;
+ }
+ else if ($link == EMIMAGE_LINK_PROVIDER) {
+ $link = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'embedded_link', $code, $item['data']);
+ }
+ else {
+ $link = NULL;
+ }
+ $title = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'image_title', $code, $item['data']);
+ $output = theme('emimage_image', $field, $item, $formatter, $node, $code, $width, $height, $title, $link);
+ }
+ return $output;
+}
+
+function theme_emimage_default($field, $item, $formatter, $node) {
+ return theme('emimage_image_full', $field, $item, $formatter, $node);
+}
+
+function theme_emimage_image_preview($field, $item, $formatter, $node) {
+ if ($item['value'] && $item['provider']) {
+ $code = $item['value'];
+ $width = $field['widget']['preview_width'] === '' ? variable_get('emimage_default_preview_width', EMIMAGE_DEFAULT_PREVIEW_WIDTH) : $field['widget']['preview_width'];
+ $height = $field['widget']['preview_height'] === '' ? variable_get('emimage_default_preview_height', EMIMAGE_DEFAULT_PREVIEW_HEIGHT) : $field['widget']['preview_height'];
+ $link = $field['widget']['preview_link'] ? $field['widget']['preview_link'] : variable_get('emimage_default_preview_link', EMIMAGE_DEFAULT_PREVIEW_LINK);
+ if ($link == EMIMAGE_LINK_CONTENT) {
+ $link = 'node/'. $node->nid;
+ }
+ else if ($link == EMIMAGE_LINK_PROVIDER) {
+ $link = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'embedded_link', $code, $item['data']);
+ }
+ else {
+ $link = NULL;
+ }
+ $title = _emfield_generic_include_invoke('emfield_generic', 'emimage', $item['provider'], 'image_title', $code, $item['data']);
+ $output = theme('emimage_image', $field, $item, $formatter, $node, $code, $width, $height, $title, $link);
+ }
+ return $output;
+}
\ No newline at end of file
diff -urpN contrib/emfield_generic/emvideo.theme.inc contrib/emfield_generic/emvideo.theme.inc
--- contrib/emfield_generic/emvideo.theme.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/emvideo.theme.inc 2008-11-23 16:03:18.000000000 -0600
@@ -0,0 +1,162 @@
+type]['fields'][$field_type]['widget'];
+ print theme('emvideo_video_embed', $field, $node->{$field_type}[0], 'emvideo_embed', $node);
+
+ or you can set $field to NULL and just use the options array
+ */
+ if ($item['value'] && $item['provider']) {
+ $output = drupal_get_form('emvideo_embed_form', $field, $item, $formatter, $node, $options);
+ }
+
+ return $output;
+}
+
+/**
+ * This will return a provided thumbnail image for a video.
+ *
+ * @param $field
+ * This is the field providing settings for the video thumbnail.
+ * @param $item
+ * This is the data returned by the field. It requires at the least to be an array with 'value' and 'provider'.
+ * $item['value'] will be the video code, and $item['provider'] will be the provider, such as youtube.
+ * @param $formatter
+ * This is the formatter for the view. This will nearly always be video_thumbnail.
+ * @param $node
+ * This is the node object containing the field.
+ * @param $no_link
+ * Optional. If FALSE, then we provide a link to the node.
+ * (In retrospect, this should have been $link, defaulting to TRUE.
+ * TODO: fix? problem though is that this goes deeper up the tree.)
+ * @param $options
+ * Optional array. This is to pass optional overrides. currently:
+ * $options['width'] and $options['height'], if provided, will override any field settings for the thumbnail w/h.
+ * $options['link_url'], if provided, will cause the thumbnail link to go to another URL other than node/nid. $no_link must be FALSE.
+ * $options['link_title'], if provided, will set the title of the link when no image is provided. otherwise, it defaults to 'See video'.
+ * $options['image_title'], if provided, will set the title attribute of the href link, defaulting to $options['link_title'].
+ * $options['image_alt'], if provided, will set the alt attribute of the href link, defaulting to $options['link_title'].
+ * $options['thumbnail_url'], if provided, will completely override the thumbnail image entirely.
+ */
+function theme_emvideo_video_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ // If we've set $options['thumbnail_url'], then we'll just use that.
+ // Otherwise, if we have emthumb installed, then give it a chance to override our thumbnail
+ $thumbnail_url = $options['thumbnail_url'] ? $options['thumbnail_url'] : module_invoke('emthumb', 'thumbnail_url', $item);
+
+ // if we don't have a custom thumbnail, then see if the provider gives us a thumbnail
+ $thumbnail_url = $thumbnail_url ? $thumbnail_url : _emfield_generic_include_invoke('emfield_generic', 'emvideo', $item['provider'], 'thumbnail', $field, $item, $formatter, $node, $width, $height, $options);
+
+ // If we still don't have a thumbnail, then apply a default thumbnail, if it exists.
+ if (!$thumbnail_url) {
+ $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emvideo_default_thumbnail_path', NULL);
+
+ if ($default_thumbnail_url) {
+ $thumbnail_url = base_path() . $default_thumbnail_url;
+ }
+ }
+ }
+ else {
+ // Seems to be an unknown video. Apply a default thumbnail, if it exists.
+ if (!$thumbnail_url) {
+ $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emvideo_default_thumbnail_path', NULL);
+ if ($default_thumbnail_url) {
+ $thumbnail_url = base_path() . $default_thumbnail_url;
+ }
+ }
+ }
+
+ $link_url = isset($options['link_url']) ? $options['link_url'] : 'node/'. $node->nid;
+ $link_title = isset($options['link_title']) ? $options['link_title'] : t('See video');
+ $image_title = isset($options['image_title']) ? $options['image_title'] : $link_title;
+ $image_alt = isset($options['image_alt']) ? $options['image_alt'] : $link_title;
+
+ if ($thumbnail_url) {
+ $width = isset($options['width']) ? $options['width'] : NULL;
+ $width = isset($width) ? $width : ($field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('emvideo_default_thumbnail_width', EMVIDEO_DEFAULT_THUMBNAIL_WIDTH));
+ $height = isset($options['height']) ? $options['height'] : NULL;
+ $height = isset($height) ? $height : ($field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('emvideo_default_thumbnail_height', EMVIDEO_DEFAULT_THUMBNAIL_HEIGHT));
+ if ($no_link) { //thickbox requires the thumbnail returned without the link
+ $output = '';
+ }
+ else {
+ $output = l('', $link_url, array('html'=> TRUE));
+ }
+ }
+ else {
+ // if all else fails, then just print a 'see video' link.
+ if ($no_link) {
+ $output = ''; //thickbox won't work without a thumbnail
+ }
+ else {
+ $output = l($link_title, $link_url);
+ }
+ }
+
+ return $output;
+}
+
+function theme_emvideo_video_video($field, $item, $formatter, $node, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ $embed = $item['value'];
+ $width = $options['width'] ? $options['width'] : ($field['widget']['video_width'] ? $field['widget']['video_width'] : variable_get('emvideo_default_video_width', EMVIDEO_DEFAULT_VIDEO_WIDTH));
+ $height = $options['height'] ? $options['height'] : ($field['widget']['video_height'] ? $field['widget']['video_height'] : variable_get('emvideo_default_video_height', EMVIDEO_DEFAULT_VIDEO_HEIGHT));
+ $autoplay = $options['autoplay'] ? $options['autoplay'] : $field['widget']['video_autoplay'];
+ $output = _emfield_generic_include_invoke('emfield_generic','emvideo',$item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay, $options);
+
+ }
+
+ return $output;
+}
+
+function theme_emvideo_default($field, $item, $formatter, $node, $options = array()) {
+ return theme('emvideo_video_video', $field, $item, $formatter, $node, $options);
+}
+
+function theme_emvideo_video_preview($field, $item, $formatter, $node, $options = array()) {
+ if ($item['value'] && $item['provider']) {
+ $embed = $item['value'];
+ $width = $options['width'] ? $options['width'] : ($field['widget']['preview_width'] ? $field['widget']['preview_width'] : variable_get('emvideo_default_preview_width', EMVIDEO_DEFAULT_PREVIEW_WIDTH));
+ $height = $options['height'] ? $options['height'] : ($field['widget']['preview_height'] ? $field['widget']['preview_height'] : variable_get('emvideo_default_preview_height', EMVIDEO_DEFAULT_PREVIEW_HEIGHT));
+ $autoplay = $options['autoplay'] ? $options['autoplay'] : $field['widget']['preview_autoplay'];
+ $output = _emfield_generic_include_invoke('emfield_generic','emvideo', $item['provider'], 'preview', $embed, $width, $height, $field, $item, $autoplay, $options);
+ }
+
+ return $output;
+}
+
+function theme_emvideo_thickbox($field, $item, $formatter, $node, $options = array()) {
+ $thumbnail = theme('emvideo_video_thumbnail', $field, $item, 'video_thumbnail', $node, TRUE, $options);
+
+ $destination = 'emvideo/thickbox/'. $node->nid .'/'. $field['widget']['video_width'] .'/'. $field['widget']['video_height'] .'/'. $field['field_name'];
+ $options = array(
+ 'attributes' => array(
+ 'title' => $title,
+ 'class' => 'thickbox',
+ 'rel' => $field['type_name'],
+ ),
+ 'query' => NULL,
+ 'fragment' => NULL,
+ 'absolute' => FALSE,
+ 'html' => TRUE,
+ );
+ $output = l($thumbnail, $destination, $options);
+
+ return $output;
+}
\ No newline at end of file
diff -urpN contrib/emfield_generic/providers/emaudio/odeo.inc contrib/emfield_generic/providers/emaudio/odeo.inc
--- contrib/emfield_generic/providers/emaudio/odeo.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emaudio/odeo.inc 2008-11-23 12:00:44.000000000 -0600
@@ -0,0 +1,168 @@
+ 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 emaudio_odeo_info() {
+ $features = array(
+ array(t('Autoplay'), t('No'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), t('')),
+ );
+ return array(
+ 'provider' => 'odeo',
+ 'name' => t('odeo'),
+ 'url' => EMAUDIO_ODEO_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect audio podcasts displayed from odeo.', array('@odeo' => EMAUDIO_ODEO_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+/**
+ * Implementation of hook emaudio_odeo_settings().
+ *
+ * This should return a subform to be added to the emaudio_settings() admin settings page.
+ * Note that a form field will already be provided, at $form['odeo'] (such as $form['podomatic']).
+ * So if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emaudio_odeo_settings() {
+ $form = array();
+
+ return $form;
+}
+
+/**
+ * Implementation of hook emaudio_odeo_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
+ * audio code to be used. If the hook tests the code itself, it should return
+ * either the string of the audio 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 emaudio_odeo_extract($embed = '') {
+ return array(
+ '@odeo\.com/audio/([0-9]+)/@i',
+ '@href="http://odeo.com/audio/([0-9]+)/@i',
+ );
+}
+
+/**
+ * The embedded flash displaying the odeo audio.
+ *
+ * Default width is 322, height is 54.
+ */
+function theme_emaudio_odeo_flash($embed, $width, $height, $autoplay) {
+ if ($embed) {
+ /*
+ if ($autoplay) {
+ $autoplay_value = '&autostart=1';
+ }
+ */
+
+ $output .= "
+
+
+
+
+
+
+
+
+
+ \n";
+ }
+
+ return $output;
+}
+
+/**
+ * Implementation of hook emaudio_odeo_thumbnail().
+ *
+ * Returns the external url for a thumbnail of a specific audio.
+ * 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 emaudio_odeo_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return $tn;
+}
+
+/**
+ * Implementation of hook emaudio_odeo_audio().
+ *
+ * This actually displays the full/normal-sized video we want, usually on the default page view.
+ *
+ * @param $embed
+ * The video code for the audio to embed.
+ * @param $width
+ * The width to display the audio.
+ * @param $height
+ * The height to display the audio.
+ * @param $field
+ * The field info from the requesting node.
+ * @param $item
+ * The actual content from the field.
+ * @return
+ * The html of the embedded audio.
+ */
+function emaudio_odeo_audio($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_odeo_flash', $embed, $width, $height, $autoplay);
+
+ return $output;
+}
+
+/**
+ * Implementation of hook emaudio_odeo_preview().
+ *
+ * This actually displays the preview-sized video we want, commonly for the teaser.
+ *
+ * @param $embed
+ * The video code for the audio to embed.
+ * @param $width
+ * The width to display the audio.
+ * @param $height
+ * The height to display the audio.
+ * @param $field
+ * The field info from the requesting node.
+ * @param $item
+ * The actual content from the field.
+ * @return
+ * The html of the embedded audio.
+ */
+function emaudio_odeo_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_odeo_flash', $embed, $width, $height, $autoplay);
+
+ return $output;
+}
diff -urpN contrib/emfield_generic/providers/emaudio/podcastalley.inc contrib/emfield_generic/providers/emaudio/podcastalley.inc
--- contrib/emfield_generic/providers/emaudio/podcastalley.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emaudio/podcastalley.inc 2008-11-23 12:00:44.000000000 -0600
@@ -0,0 +1,167 @@
+ 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 emaudio_podcastalley_info() {
+ $features = array(
+ array(t('Autoplay'), t('No'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), t('')),
+ );
+
+ return array(
+ 'provider' => 'Podcast Alley',
+ 'name' => t('Podcast Alley'),
+ 'url' => EMAUDIO_PODCASTALLEY_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect audio podcasts displayed from Podcast Alley.', array('@podcastalley' => EMAUDIO_PODCASTALLEY_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+/**
+ * Implementation of hook emaudio_podcastalley_settings().
+ *
+ * This should return a subform to be added to the emaudio_settings() admin settings page.
+ * Note that a form field will already be provided, at $form['podcastalley'].
+ * So if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emaudio_podcastalley_settings() {
+ $form = array();
+ return $form;
+}
+
+/**
+ * Implementation of hook emaudio_podcastalley_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
+ * audio code to be used. If the hook tests the code itself, it should return
+ * either the string of the audio 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 emaudio_podcastalley_extract($embed = '') {
+ // http://www.podcastalley.com/podcast_details.php?pod_id=929#
+ return array(
+ '@podcastalley\.com/podcast_details\.php\?pod_id=([0-9]+)@i'
+ );
+}
+
+/**
+ * The embedded flash displaying the podcastalley audio.
+ *
+ * Default width is 419, height is 202.
+ */
+function theme_emaudio_podcastalley_flash($embed, $width, $height, $autoplay) {
+ if ($embed) {
+ /*
+ if ($autoplay) {
+ $autoplay_value = '&autostart=1';
+ }
+ */
+ $output .= "
+
+
+
+
+
+
+
+
+
+
+
+
+ \n";
+ }
+
+ return $output;
+}
+
+/**
+ * Implementation of hook emaudio_podcastalley_thumbnail.
+ *
+ * Returns the external url for a thumbnail of a specific audio.
+ * 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 emaudio_podcastalley_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return $tn;
+}
+
+/**
+ * Implementation of hook emaudio_podcastalley_audio().
+ *
+ * This actually displays the full/normal-sized video we want,
+ * usually on the default page view.
+ *
+ * @param $embed
+ * The video code for the audio to embed.
+ * @param $width
+ * The width to display the audio.
+ * @param $height
+ * The height to display the audio.
+ * @param $field
+ * The field info from the requesting node.
+ * @param $item
+ * The actual content from the field.
+ * @return
+ * The html of the embedded audio.
+ */
+function emaudio_podcastalley_audio($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_podcastalley_flash', $embed, $width, $height, $autoplay);
+
+ return $output;
+}
+
+/**
+ * Implementation of hook emaudio_podcastalley_preview().
+ *
+ * This actually displays the preview-sized video we want, commonly for the teaser.
+ *
+ * @param $embed
+ * The video code for the audio to embed.
+ * @param $width
+ * The width to display the audio.
+ * @param $height
+ * The height to display the audio.
+ * @param $field
+ * The field info from the requesting node.
+ * @param $item
+ * The actual content from the field.
+ * @return
+ * The html of the embedded audio.
+ */
+function emaudio_podcastalley_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_podcastalley_flash', $embed, $width, $height, $autoplay);
+
+ return $output;
+}
diff -urpN contrib/emfield_generic/providers/emaudio/podomatic.inc contrib/emfield_generic/providers/emaudio/podomatic.inc
--- contrib/emfield_generic/providers/emaudio/podomatic.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emaudio/podomatic.inc 2008-11-23 12:00:44.000000000 -0600
@@ -0,0 +1,176 @@
+ 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 emaudio_podomatic_info() {
+ $features = array(
+ array(t('Autoplay'), t('No'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), t('')),
+ );
+ return array(
+ 'provider' => 'podomatic',
+ 'name' => t('podOmatic'),
+ 'url' => EMAUDIO_PODOMATIC_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect audio podcasts displayed from podOmatic.', array('@podomatic' => EMAUDIO_PODOMATIC_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+/**
+ * hook emaudio_PROVIDER_settings
+ * this should return a subform to be added to the emaudio_settings() admin settings page.
+ * note that a form field will already be provided, at $form['PROVIDER'] (such as $form['podomatic'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emaudio_podomatic_settings() {
+ $form = array();
+ return $form;
+}
+
+/**
+ * hook emaudio_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 audio code to be used
+ * if the hook tests the code itself, it should return either the string of the audio 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 emaudio_podomatic_extract($embed = '') {
+ // http://www.podomatic.com/podcast/embed/funkylondon
+ // Click here to get your own player.
+ // http://funkylondon.podomatic.com
+ return array(
+ '@podomatic\.com/podcast/embed/([^"\&]+)@i',
+ '@playlist_url\=http://([^\.]+)\.podOmatic\.com@i',
+ '@http://([^\.]+)\.podomatic\.com@i',
+ );
+}
+
+/**
+ * hook emaudio_PROVIDER_embedded_link($audio_code)
+ * returns a link to view the audio at the provider's site
+ * @param $audio_code
+ * the string containing the audio to watch
+ * @return
+ * a string containing the URL to view the audio at the original provider's site
+ */
+function emaudio_podomatic_embedded_link($audio_code) {
+ return 'http://www.podomatic.com/podcast/embed/'. $audio_code;
+}
+
+/**
+ * hook theme_emaudio_PROVIDER_flash
+ * the embedded flash displaying the podomatic audio
+ */
+
+function theme_emaudio_podomatic_flash($code, $width, $height, $field, $item, $autoplay, $flv, $thumbnail, $options = array()) {
+ // Click here to get your own player.
+
+ if ($code) {
+/* if ($autoplay) {
+ $autoplay_value = '&autostart=1';
+ }*/
+ $output .=
+ '
+
+
+
+
+
+
+
+
+ \n';
+ }
+ return $output;
+}
+
+/**
+ * hook emaudio_PROVIDER_thumbnail
+ * returns the external url for a thumbnail of a specific audio
+ * 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 emaudio_podomatic_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return $tn;
+}
+
+/**
+ * hook emaudio_PROVIDER_audio
+ * this actually displays the full/normal-sized video we want, usually on the default page view
+ * @param $embed
+ * the video code for the audio to embed
+ * @param $width
+ * the width to display the audio
+ * @param $height
+ * the height to display the audio
+ * @param $field
+ * the field info from the requesting node
+ * @param $item
+ * the actual content from the field
+ * @return
+ * the html of the embedded audio
+ */
+function emaudio_podomatic_audio($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_podomatic_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+/**
+ * hook emaudio_PROVIDER_preview
+ * this actually displays the preview-sized video we want, commonly for the teaser
+ * @param $embed
+ * the video code for the audio to embed
+ * @param $width
+ * the width to display the audio
+ * @param $height
+ * the height to display the audio
+ * @param $field
+ * the field info from the requesting node
+ * @param $item
+ * the actual content from the field
+ * @return
+ * the html of the embedded audio
+ */
+function emaudio_podomatic_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emaudio_podomatic_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emaudio_podomatic_subtheme() {
+ return array (
+ 'emaudio_podomatic_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/podomatic.inc'
+ )
+ );
+}
+
diff -urpN contrib/emfield_generic/providers/emimage/flickr.inc contrib/emfield_generic/providers/emimage/flickr.inc
--- contrib/emfield_generic/providers/emimage/flickr.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emimage/flickr.inc 2008-11-27 10:09:28.000000000 -0600
@@ -0,0 +1,240 @@
+ 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 emimage_flickr_info() {
+ $features = array(
+ array(t('Import photosets'), t('Yes'), t('If you have the Embedded Media Import module activated, you may allow @name photosets to be imported into content.', array('@name' => $name))),
+ );
+ return array(
+ 'provider' => 'flickr',
+ 'name' => t('Flickr'),
+ 'url' => EMIMAGE_FLICKR_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect images displayed from Flickr.', array('@flickr' => EMIMAGE_FLICKR_MAIN_URL)),
+ 'supported_features' => $features,
+ 'import_sets_word' => t('photosets'),
+ );
+}
+
+/**
+ * This allows flickr photosets to be imported into nodes
+ */
+function emimage_flickr_import($url, $limit = 0, $page = 0) {
+ $codes = array();
+
+ // http://www.flickr.com/photos/nikkiana/sets/72157601948647678/
+ if (preg_match('@flickr\.com/photos/([^/]*)/([^/]*)/([^/]*)/@i', $url, $matches)) {
+ $page++; // flickr starts current page at 1
+ $codes['#matches'] = $matches;
+ $args = array('photoset_id' => $matches[3]);
+ if ($limit) {
+ $args['per_page'] = $limit;
+ }
+ $args['page'] = $page;
+ $xml = emimage_flickr_request('flickr.photosets.getPhotos', $args);
+// print_r($xml);
+ $codes['#pages'] = $xml['photoset']['pages'];
+ $codes['#page'] = $xml['photoset']['page'] - 1;
+ $codes['#total'] = $xml['photoset']['total'];
+ $codes['#per_page'] = $xml['photoset']['per_page'];
+ $codes['#set'] = array();
+ foreach ($xml['photoset']['photo'] as $photo) {
+ $data = emimage_flickr_data(NULL, array('value' => $photo['id']));
+ $codes['#set'][] = array(
+ '#code' => $photo['id'],
+ '#title' => $photo['title'],
+ '#link' => emimage_flickr_embedded_link($photo['id'], $xml['photoset']['owner']),
+ '#thumb' => emimage_flickr_image_url($photo['id'], 100, 100, NULL, NULL, NULL),
+ '#body' => $data['description'],
+ '#tags' => $data['tags'],
+// '#body' => emimage_flickr_description($photo['id']),
+// '#tags' => emimage_flickr_tags($photo['id']),
+ );
+ }
+/*
+ $data['owner'] = $xml['photo']['owner']['nsid'];
+ $data['title'] = $xml['photo']['title']['_content'];*/
+ }
+// print_r($codes);
+ return $codes;
+}
+
+/**
+ * hook emimage_PROVIDER_settings
+ * this should return a subform to be added to the emimage_settings() admin settings page.
+ * note that a form field will already be provided, at $form['PROVIDER'] (such as $form['flickr'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emimage_flickr_settings() {
+ $form['flickr']['api'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Flickr API'),
+ '#description' => t('You will first need to apply for an API Developer Key from the Flickr Developer Profile page.', array('@flickr' => EMIMAGE_FLICKR_API_APPLICATION_URL)),
+ '#collapsible' => TRUE,
+ '#collapsed' => (variable_get('emimage_flickr_api_key', '') != ''),
+ );
+ $form['flickr']['api']['emimage_flickr_api_key'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Flickr API Key'),
+ '#default_value' => variable_get('emimage_flickr_api_key', ''),
+ '#description' => t('Please enter your Flickr Developer Key here.'),
+ );
+ $form['flickr']['api']['emimage_flickr_api_secret'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Flickr API Secret'),
+ '#default_value' => variable_get('emimage_flickr_api_secret', ''),
+ '#description' => t('If you have a secret for the Flickr API, enter it here.'),
+ );
+ return $form;
+}
+
+
+/**
+ * this is a wrapper for emimage_request_xml that includes flickr's api key
+ */
+function emimage_flickr_request($method, $args = array(), $cached = TRUE) {
+ // display an error if we don't have an api key yet
+ emimage_flickr_error_check();
+
+ $args['api_key'] = trim(variable_get('emimage_flickr_api_key', ''));
+ if ($secret = trim(variable_get('emimage_flickr_api_secret', ''))) {
+ $args['secret'] = md5($secret . $arghash);
+ }
+ $args['method'] = $method;
+ $args['format'] = 'php_serial';
+
+ $xml = module_invoke('emfield', 'request_xml', 'flickr', EMIMAGE_FLICKR_REST_ENDPOINT, $args, $cached, FALSE, FALSE, TRUE);
+ return $xml;
+}
+
+function emimage_flickr_data($field, $item) {
+ $data = array();
+
+ // use the page id, since we'll have that in most cases (except in embed pastes, which gets parsed during extraction)
+ // we use this to get an rss feed w/ all the info for the video. interesting reading ;)
+ $xml = emimage_flickr_request('flickr.photos.getInfo', array('photo_id' => $item['value']));
+
+ $data['owner'] = $xml['photo']['owner']['nsid'];
+ $data['title'] = $xml['photo']['title']['_content'];
+ $data['description'] = $xml['photo']['description']['_content'];
+ $data['tags'] = array();
+ if (is_array($xml['photo']['tags']['tag'])) {
+ foreach ($xml['photo']['tags']['tag'] as $tag) {
+ $data['tags'][] = $tag['raw'];
+ }
+ }
+ return $data;
+}
+
+/**
+ * This will log an error if we don't have a key yet. In addition, if the user is an admin, we'll display an error.
+ */
+function emimage_flickr_error_check() {
+ static $checked;
+ if (!$checked && (variable_get('emimage_flickr_api_key', '') == '')) {
+ global $user;
+ $error = t('You do not yet have a Flickr API key set. You will need to apply for a Flickr API key and enter your key at the settings administration page before Flickr images may be displayed.', array('@apply' => EMIMAGE_FLICKR_API_APPLICATION_URL, '@settings' => url('admin/content/emfield')));
+ if (user_access('administer site configuration')) {
+ drupal_set_message($error, 'error');
+ }
+ watchdog('Embedded Media Field', '!error', array('!error' => $error));
+ }
+ $checked = TRUE;
+}
+
+function emimage_flickr_extract($embed = '') {
+ // http://flickr.com/photos/96898796@N00/194727976/
+ return array('@flickr\.com/photos/[^/]*/(\d+)@i');
+}
+
+/**
+ * hook emimage_PROVIDER_embedded_link($code)
+ * returns a link to view the content at the provider's site
+ * @param $code
+ * the string containing the content to watch
+ * @return
+ * a string containing the URL to view the video at the original provider's site
+ */
+function emimage_flickr_embedded_link($code, $data = array()) {
+ if ($data['owner']) {
+ $owner = $data['owner'];
+ }
+ else {
+ $xml = emimage_flickr_request('flickr.photos.getInfo', array('photo_id' => $code));
+ $owner = $xml['photo']['owner']['nsid'];
+ }
+ return 'http://www.flickr.com/photos/'. $owner .'/'. $code;
+}
+
+/**
+ * Implements emimage_PROVIDER_image_url.
+ *
+ * @param $code
+ * The provider code of the image.
+ * @param $width
+ * @param $height
+ * The dimensions of the photo to display.
+ * @return
+ * The url directly to the image to display.
+ */
+function emimage_flickr_image_url($code, $width, $height, $formatter = NULL, $field = NULL, $item = NULL, $node = NULL) {
+ if ($code) {
+ $size = _emimage_flickr_guess_size($width, $height);
+ $getsize = emimage_flickr_request('flickr.photos.getSizes', array('photo_id' => $code));
+ $url = $getsize['sizes']['size'][$size]['source'];
+ }
+ return $url;
+}
+
+/**
+ * Implements emimage_PROVIDER_image_title.
+ *
+ * @param $code
+ * The provider code of the image.
+ * @param $data
+ * Any stored data for the image, which may already have the title.
+ * @return
+ * The title as the 3rd party provider knows it, if accessible to us. otherwise, ''.
+ */
+function emimage_flickr_image_title($code, $data) {
+ if ($data['title']) {
+ return $data['title'];
+ }
+ $photo = emimage_flickr_request('flickr.photos.getInfo', array('photo_id' => $code));
+ return $photo['photo']['title']['_content'] ? $photo['photo']['title']['_content'] : '';
+}
+
+/**
+ * Helper function for emimage_flickr_image_url.
+ * This will return the appropriate array key for the image size we wish.
+ */
+function _emimage_flickr_guess_size($width, $height) {
+ $max = max($width, $height);
+ foreach (array('0' => 75, '1' => 100, '2' => 240, '3' => 500, '4' => 1024) as $size => $value) {
+ if ($max <= $value) {
+ return $size;
+ }
+ }
+ return '5';
+}
diff -urpN contrib/emfield_generic/providers/emimage/imageshack.inc contrib/emfield_generic/providers/emimage/imageshack.inc
--- contrib/emfield_generic/providers/emimage/imageshack.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emimage/imageshack.inc 2008-11-23 12:00:46.000000000 -0600
@@ -0,0 +1,123 @@
+ 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 emimage_imageshack_info() {
+ $features = array();
+ return array(
+ 'provider' => 'imageshack',
+ 'name' => t('ImageShack'),
+ 'url' => EMIMAGE_IMAGESHACK_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect images displayed from ImageShack.', array('@imageshack' => EMIMAGE_IMAGESHACK_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+function emimage_imageshack_data($field, $item) {
+ $data = array();
+
+ $url = stristr($item['embed'], 'my.php?image=')? _emimage_imageshack_scrape_image_url($item['embed']) : $item['embed'];
+ if (preg_match('!([^/.:@]+)\.imageshack\.us/([^/]+)/([^/]+)/(.+)$!i', $url, $matches)) {
+ $data = array(
+ 'server' => $matches[1],
+ 'a1' => $matches[2],
+ 'a2' => $matches[3],
+ 'file' => $matches[4],
+ 'title' => '',
+ );
+ }
+ return $data;
+}
+
+function emimage_imageshack_extract($embed = '') {
+ // http://img255.imageshack.us/my.php?image=dscn0036ky1.jpg
+ // http://img255.imageshack.us/img255/7682/dscn0036ky1.jpg
+ if (preg_match('!([^/.:@]+)\.imageshack\.us/(([^/]+)/([^/]+)/|my.php\?image=)?(.+)$!i', $embed, $matches)) {
+ return $matches[5];
+ }
+
+ return array();
+}
+
+/**
+ * hook emimage_PROVIDER_embedded_link($code)
+ * returns a link to view the content at the provider's site
+ * @param $code
+ * the string containing the content to watch
+ * @return
+ * a string containing the URL to view the image at the original provider's site
+ */
+function emimage_imageshack_embedded_link($code, $data) {
+ return "http://{$data['server']}.imageshack.us/my.php?image={$code}";
+}
+
+/**
+ * implement emimage_PROVIDER_image_url
+ *
+ * @param $code
+ * the code of the image
+ * @param $data
+ * any stored data for the image, which may already have the title
+ * @return
+ * the url directly to the image to display
+ */
+function emimage_imageshack_image_url($code, $data) {
+ if (func_num_args() == 7) {
+ $arg = func_get_arg(5);
+ $code = &$arg['data']['file'];
+ $data = &$arg['data'];
+ }
+ return "http://{$data['server']}.imageshack.us/{$data['a1']}/{$data['a2']}/{$code}";
+}
+
+/**
+ * implement emimage_PROVIDER_image_title
+ *
+ * @param $code
+ * the code of the image
+ * @param $data
+ * any stored data for the image, which may already have the title
+ * @return
+ * the title as the 3rd party provider knows it, if accessible to us. otherwise, ''
+ */
+function emimage_imageshack_image_title($code, $data) {
+ return ''; // Not provided by on ImageShack.
+}
+
+/**
+ * Scrape the actual image URL from the ImageShack page.
+ *
+ * @param String $url
+ * ImageShack page.
+ * @return String
+ * ImageShack image URL.
+ */
+function _emimage_imageshack_scrape_image_url($url) {
+ static $urls;
+ if (isset($urls[$url])) {
+ return $urls[$url];
+ }
+
+ $html = file_get_contents($url);
+ if (preg_match('! 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 emimage_photobucket_info() {
+ $features = array();
+ return array(
+ 'provider' => 'photobucket',
+ 'name' => t('Photobucket'),
+ 'url' => EMIMAGE_PHOTOBUCKET_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect images displayed from Photobucket.', array('@photobucket' => EMIMAGE_PHOTOBUCKET_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+function emimage_photobucket_data($field, $item) {
+ $data = array();
+
+ if (preg_match('\.photobucket\.com/albums/([^/]+)/([^/]+)/(\?action=view¤t=)?(.+)$!i', $item['embed'], $matches)) {
+ $data = array(
+ 'server' => $matches[1],
+ 'album' => $matches[2],
+ 'owner' => $matches[3],
+ 'file' => $matches[5],
+ );
+ $data['title'] = emimage_photobucket_image_title($data['file'], $data);
+ }
+ return $data;
+}
+
+function emimage_photobucket_extract($embed = '') {
+ // http://s201.photobucket.com/albums/aa274/layoutqueenie/?action=view¤t=baileys_in_gardens.jpg
+ // http://i201.photobucket.com/albums/aa274/layoutqueenie/baileys_in_gardens.jpg
+ if (preg_match('\.photobucket\.com/albums/([^/]+)/([^/]+)/(\?action=view¤t=)?(.+)$!i', $embed, $matches)) {
+ return $matches[5];
+ }
+ return array();
+}
+
+/**
+ * hook emimage_PROVIDER_embedded_link($code)
+ * returns a link to view the content at the provider's site
+ * @param $code
+ * the string containing the content to watch
+ * @return
+ * a string containing the URL to view the image at the original provider's site
+ */
+function emimage_photobucket_embedded_link($code, $data) {
+ return "http://s{$data['server']}.photobucket.com/albums/{$data['album']}/{$data['owner']}/?action=view¤t={$code}";
+}
+
+/**
+ * implement emimage_PROVIDER_image_url
+ *
+ * @param $code
+ * the code of the image
+ * @param $data
+ * any stored data for the image, which may already have the title
+ * @return
+ * the url directly to the image to display
+ */
+function emimage_photobucket_image_url($code, $data) {
+ if (func_num_args() == 7) {
+ $arg = func_get_arg(5);
+ $code = &$arg['data']['file'];
+ $data = &$arg['data'];
+ }
+
+ return "http://i{$data['server']}.photobucket.com/albums/{$data['album']}/{$data['owner']}/{$code}";
+}
+
+/**
+ * implement emimage_PROVIDER_image_title
+ *
+ * @param $code
+ * the code of the image
+ * @param $data
+ * any stored data for the image, which may already have the title
+ * @return
+ * the title as the 3rd party provider knows it, if accessible to us. otherwise, ''
+ */
+function emimage_photobucket_image_title($code, $data) {
+ if ($data['title']) {
+ return $data['title'];
+ }
+ $url = emimage_photobucket_embedded_link($code, $data);
+ return _emimage_photobucket_scrape_image_title($url);
+}
+
+/**
+ * Visit the image URL and scrape the image title from HTML.
+ *
+ * @param String $url
+ * Image URL.
+ * @return String
+ * Image title.
+ */
+function _emimage_photobucket_scrape_image_title($url) {
+ static $title;
+ if (isset($title[$url])) {
+ return $title[$url];
+ }
+
+ $html = file_get_contents($url);
+ return $title[$url] = preg_match('@(.+?)@is', $html, $matches)? $matches[1] : '';
+}
diff -urpN contrib/emfield_generic/providers/emimage/picasa.inc contrib/emfield_generic/providers/emimage/picasa.inc
--- contrib/emfield_generic/providers/emimage/picasa.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emimage/picasa.inc 2008-11-23 12:00:46.000000000 -0600
@@ -0,0 +1,161 @@
+ 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 emimage_picasa_info() {
+ $features = array(
+ array(t('Import photosets'), t('No'), ''),
+ );
+ return array(
+ 'provider' => 'picasa',
+ 'name' => t('Picasa'),
+ 'url' => EMIMAGE_PICASA_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect images displayed from Picasa.', array('@picasa' => EMIMAGE_PICASA_MAIN_URL)),
+ 'supported_features' => $features,
+ 'import_sets_word' => t('photosets'),
+ );
+}
+
+/**
+ * This is a wrapper for image_cck_request_xml.
+ */
+function emimage_picasa_request($data = array(), $kind = '', $cached = TRUE) {
+ $args['kind'] = $kind;
+ $xml = module_invoke('emfield', 'request_xml', 'picasa', EMIMAGE_PICASA_REST_ENDPOINT ."{$data['userid']}/album/{$data['album']}/photoid/{$data['photoid']}", $args, $cached, FALSE, ":{$data['userid']}:{$data['album']}?{$data['photoid']}");
+
+ return $xml;
+}
+
+function emimage_picasa_data($field, $item) {
+ $data = array();
+ if (preg_match('!picasaweb\.google\.com/([^/]*)/([^/]*)/photo\#(.*)!i', $item['embed'], $matches)) {
+ $data = array(
+ 'userid' => $matches[1],
+ 'album' => $matches[2],
+ 'photoid' => $matches[3],
+ );
+ }
+ // use the page id, since we'll have that in most cases (except in embed pastes, which gets parsed during extraction)
+ // we use this to get an rss feed w/ all the info for the image. interesting reading ;)
+ $xml = emimage_picasa_request($data, 'tag');
+
+ $data['title'] = $xml['MEDIA:GROUP']['MEDIA:DESCRIPTION'][0];
+ $data['original'] = $xml['MEDIA:GROUP']['MEDIA:CONTENT'][1][URL];
+ $data['small'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][1][URL];
+ $data['medium'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][3][URL];
+ $data['large'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][URL];
+ $data['width'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][WIDTH];
+ $data['height'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][HEIGHT];
+
+ return $data;
+}
+
+function emimage_picasa_extract($embed = '') {
+ // http://picasaweb.google.com/kaos777/YearlyKos/photo#5119063656501095090
+ if (preg_match('!picasaweb\.google\.com/([^/]*)/([^/]*)/photo\#(.*)!i', $embed, $matches)) {
+ return $matches[3];
+ }
+
+ return array();
+}
+
+/**
+ * hook emimage_PROVIDER_embedded_link($code)
+ * returns a link to view the content at the provider's site
+ * @param $code
+ * the string containing the content to watch
+ * @return
+ * a string containing the URL to view the image at the original provider's site
+ */
+function emimage_picasa_embedded_link($code, $data) {
+ $userid = $data['userid'];
+ $album= $data['album'];
+ $photoid= $data['photoid'];
+
+ return "http://picasaweb.google.com/$userid/$album/photo#$photoid";
+}
+
+/**
+ * Implement emimage_PROVIDER_image_url.
+ *
+ * @param $code
+ * the code of the image
+ * @param $data
+ * any stored data for the image, which may already have the url of the image to display
+ * @return
+ * the url directly to emfield for the image to display
+ */
+function emimage_picasa_image_url($code, $width, $height, $formatter, $field, $item, $node) {
+ if (func_num_args() == 7) {
+ $arg = func_get_arg(5);
+ $code = &$arg['data']['original'];
+ $data = &$arg['data'];
+ $size = _emimage_picasa_guess_size($width, $height);
+ }
+ //http://lh5.google.com/kaos777/RwqRRgxcKrI/AAAAAAAAAB0/pl5FboT6x2M/IMG_0468.JPG
+ if (preg_match ('!([^/]*)\.ggpht\.com/([^/]*)/([^/]*)/([^/]*)/([^/]*)/(.*)!i', $code, $matches)) {
+ $info = array(
+ 'server' => $matches[1],
+ 'userid' => $matches[2],
+ 's1' => $matches[3],
+ 's2' => $matches[4],
+ 's3' => $matches[5],
+ 'image' => $matches[6],
+ );
+ }
+
+ return "http://{$info['server']}.google.com/{$info['userid']}/{$info['s1']}/{$info['s2']}/{$info['s3']}/s$size/{$info['image']}";
+}
+
+/**
+ * Implement emimage_PROVIDER_image_title.
+ *
+ * @param $code
+ * The code of the image.
+ * @param $data
+ * Any stored data for the image, which may already have the title.
+ * @return
+ * The title as the 3rd party provider knows it, if accessible to us. otherwise, ''.
+ */
+function emimage_picasa_image_title($code, $data) {
+ if (func_num_args() == 7) {
+ $arg = func_get_arg(5);
+ $code = &$arg['data']['title'];
+ $data = &$arg['data'];
+ $title = $code;
+ }
+
+ return "$title";
+}
+
+function _emimage_picasa_guess_size($width, $height) {
+ $max = max($width, $height);
+ foreach (array('144' => 144, '288' => 288, '400' => 400, '800' => 800) as $size => $value) {
+ if ($max <= $value) {
+ return $size;
+ }
+ }
+
+ // we would use the original size if we could, but we can't since google won't serve it
+ return '800';
+}
diff -urpN contrib/emfield_generic/providers/emvideo/bliptv.inc contrib/emfield_generic/providers/emvideo/bliptv.inc
--- contrib/emfield_generic/providers/emvideo/bliptv.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/bliptv.inc 2008-11-23 15:19:00.000000000 -0600
@@ -0,0 +1,316 @@
+ 'bliptv',
+ 'name' => t('Blip.tv'),
+ 'url' => EMVIDEO_BLIPTV_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Blip.tv.', array('@provider' => EMVIDEO_BLIPTV_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+function emvideo_bliptv_settings() {
+ $tags = array('none' => t('No video'), 'flv' => t('Flash Video'), 'override' => t('Override tag'), 'web' => t('Web'), 'Web High Resolution' => t('Web High Resolution'), 'Portable (iPod)' => t('Portable (iPod)'), 'Portable (other)' => t('Portable (other)'), 'Television' => t('Television'), 'HDTV' => t('HDTV'), 'Cell Phone' => t('Cell Phone'), 'Source' => t('Source'));
+ $formats = array('none' => t('No video'), 'flv' => t('Flash video (flv)'), 'mov' => t('Quicktime Movie (mov)'), 'mp3' => t('MP3'), 'm4a' => t('m4a'), 'mpg' => t('MPEG'), 'mp4' => t('mp4'), 'm4v' => t('m4v'), 'wmv' => t('Windows Media (wmv)'));
+
+ $form = array();
+ $form['video_formats'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Video formats'),
+ '#description' => t("Blip.TV allows users to upload videos of various formats, sizes, and qualities. These options will allow the administrator to choose the default video formats to display. Blip.TV uses 'tags' to determine this, such as 'Web' for a standard web resolution, and 'HDTV' for a high definition. If you select a tag, then the video format provided by Blip.TV for that tag will be displayed. If you select 'Override tag', then you may specify that the first available video of the given format will be displayed instead, which may or may not have your desired resolution. If a tag or format is not available for a specific video, the module will display the Flash video format instead, which is always present."),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ );
+ $form['video_formats']['rss'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('RSS'),
+ '#description' => t("This will determine the preferred video format for RSS feeds."),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+
+ $form['video_formats']['rss']['emvideo_bliptv_rss_tag'] = array(
+ '#type' => 'select',
+ '#title' => t('RSS full page tag'),
+ '#description' => t("When RSS feeds are displayed, and this tag is available for a video, then the clip for that tag will be displayed as an enclosure tag in the feed. Select 'Override tag' if you wish to control the format displayed. Select 'No video' if you do not wish a video to be displayed in RSS feeds."),
+ '#options' => $tags,
+ '#default_value' => variable_get('emvideo_bliptv_rss_tag', array(EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE => EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE)),
+ );
+ $form['video_formats']['rss']['emvideo_bliptv_rss_format'] = array(
+ '#type' => 'select',
+ '#title' => t('RSS full page format override'),
+ '#description' => t("When RSS feeds are displayed, and the 'Override tag' option is selected above, then this format will be displayed as an enclosure tag in the feed."),
+ '#options' => $formats,
+ '#default_value' => variable_get('emvideo_bliptv_rss_format', array(EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE => EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE)),
+ );
+ return $form;
+}
+
+function emvideo_bliptv_data($field, $item) {
+ $data = array();
+
+ // we added new data fields to keep from having to reload the api/rss
+ // because the data is only stored on update/insert, however, we have to know which data type we're using
+ // this will just be an integer, increased when we make a change to data
+ $data['emvideo_bliptv_data_version'] = 2;
+
+ // use the page id, since we'll have that in most cases (except in embed pastes, which gets parsed during extraction)
+ // we use this to get an rss feed w/ all the info for the video. interesting reading ;)
+ // some of our data we'll get from the api, like available files
+ $rss = emvideo_bliptv_request($item['value'], TRUE, 'rss');
+ $api = emvideo_bliptv_request($item['value'], TRUE, 'api');
+
+ // special handling for show/feature pages
+ // TODO: this is disabled for now.
+// if (empty($rss) && empty($api) && preg_match('@http\://([^\.]+)\.blip\.tv/@i', $item['embed'], $matches)) {
+// $show_rss = emvideo_bliptv_request($item['value'], TRUE, 'rss', TRUE);
+// $data['thumbnail']['url'] = $rss['IMAGE']['URL'][0];
+// $data['flv'] = array();
+// $data['showpage'] = "http://{$item['value']}.blip.tv/";
+// $data['is_show'] = TRUE;
+// return $data;
+// }
+
+ $data['is_show'] = FALSE;
+
+ // get our thumbnail url
+ $data['thumbnail']['url'] = $rss['ITEM']['MEDIA:THUMBNAIL'][1]['URL'];
+ // this gets sent to the player
+ foreach ((array)$api['MEDIA']['LINK'] as $x => $link) {
+ $x--;
+ $video_type = '';
+ switch ($link['TYPE']) {
+ case 'video/x-flv':
+ $video_type = 'flv';
+ break;
+ case 'video/x-m4v':
+ $video_type = 'm4v';
+ break;
+ case 'video/quicktime':
+ $video_type = 'mov';
+ break;
+ }
+ if ($video_type) {
+ $video_info = array();
+ $video_info['url'] = $link['HREF'];
+ $video_info['width'] = $api['MEDIA']['WIDTH'][$x];
+ $video_info['height'] = $api['MEDIA']['HEIGHT'][$x];
+ $video_info['duration'] = $api['MEDIA']['DURATION'][$x];
+ $video_info['size'] = $api['MEDIA']['SIZE'][$x];
+ $video_info['mime'] = $link['TYPE'];
+ $video_info['embed_code'] = $rss['ITEM']['BLIP:EMBEDLOOKUP'];
+
+ // we only store the last video of a particular type, for instance if two roles use .mov
+ $data[$video_type] = $video_info;
+
+ // however, we store the whole thing under role, so the information is still saved
+ // but our arrays may be out of synch...
+ $y = $x + 1;
+ if ($api['MEDIA']['ROLE'][$y]) {
+ $data[$video_type]['role'] = $api['MEDIA']['ROLE'][$y];
+ $data[$api['MEDIA']['ROLE'][$y]] = $video_info;
+ $data[$api['MEDIA']['ROLE'][$y]]['role'] = $api['MEDIA']['ROLE'][$y];
+ }
+ }
+ }
+ if (!$data['flv']) {
+ $data['flv'] = array();
+ }
+ if (!$data['flv']['url']) {
+ $data['flv']['url'] = $rss['ITEM']['ENCLOSURE'][1]['URL'];
+ }
+ $data['title'] = $api['en']['TITLE'][0] ? $api['en']['TITLE'][0] : $rss['2.0']['CHANNEL']['TITLE'][0];
+ $data['description'] = $api['en']['DESCRIPTION'][0] ? $api['en']['DESCRIPTION'][0] : $rss['ITEM']['BLIP:PUREDESCRIPTION'][0];
+ $data['blip_user']['uid'] = $api['CREATEDBY']['UID'][0] ? $api['CREATEDBY']['UID'][0] : $rss['ITEM']['BLIP:USERID'][0];
+ $data['blip_user']['username'] = $api['CREATEDBY']['LOGIN'][0] ? $api['CREATEDBY']['LOGIN'][0] : $rss['ITEM']['BLIP:USER'][0];
+ $data['blip_user']['url'] = $api['CREATEDBY']['LINKS']['LINK'][1] ? $api['CREATEDBY']['LINKS']['LINK'][1] : 'http://blip.tv/users/view/'. $data['blip_user']['username'];
+
+ $data['showpage'] = $rss['ITEM']['BLIP:SHOWPAGE'][0];
+ $data['embed_code'] = $rss['ITEM']['BLIP:EMBEDLOOKUP'];
+
+ // this is the code actually used by the player, even though it's different than for the page
+ if ($rss['ITEM']['BLIP:POSTS_ID'][0]) {
+ $data['post_id'] = $rss['ITEM']['BLIP:POSTS_ID'][0];
+ }
+ return $data;
+}
+
+function emvideo_bliptv_request($code, $cacheable = TRUE, $skin = 'rss', $show = FALSE) {
+ $args = array();
+ $file = $show ? "http://$code.blip.tv/file/?skin=" . $skin : "http://blip.tv/file/$code?skin=" . $skin;
+ return module_invoke('emfield', 'request_xml', 'bliptv', $file, $args, $cacheable, FALSE, $code .':'. $skin . ($show ? ':show' : ':post'));
+}
+
+function emvideo_bliptv_extract($embed) {
+ return array(
+ '@blip\.tv/rss/flash/([^"\&\?]+)@i',
+ '@blip\.tv/file/view/([^"\&\?]+)@i',
+ '@blip\.tv/file/([^"\&\?]+)@i',
+ '@blip\.tv/play/([^"\&\?]+)@i',
+
+ // test handling for featured shows. disabled for now.
+// '@http\://([^\.]+)\.blip\.tv/@i',
+ );
+}
+
+function emvideo_bliptv_video_link($video_code) {
+ return 'http://blip.tv/file/'. $video_code;
+}
+
+function _emvideo_bliptv_get_video_info_from_preferred_tag($data, $var) {
+ $preferred_tags = (array)variable_get($var, array(EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE => EMVIDEO_BLIPTV_DEFAULT_RSS_TYPE));
+
+ foreach ($preferred_tags as $test_tag) {
+ // if we override the tag with a type, then break so it can be handled
+ if ($test_tag == 'override') {
+ $video_info = 'override';
+ break;
+ }
+
+ // if we have a clip of that format type, then return it
+ if ($data[$test_tag]['url']) {
+ $video_info = $data[$test_tag];
+ break;
+ }
+ }
+
+ return $video_info;
+}
+
+/**
+ * Providers may supply an enclosure for rss feeds. This expects something in a file format, so would be an object
+ * in the format of $file->filepath, $file->filesize, and $file->filemime. calls the providers hook emvideo_PROVIDER_rss.
+ */
+function emvideo_bliptv_rss($item, $teaser = NULL) {
+ if ($item['value']) {
+ if ($item['data']['emvideo_bliptv_data_version'] >= 1) {
+ $data = $item['data'];
+ }
+ else {
+ $data = emvideo_bliptv_data(NULL, $item);
+ }
+
+ // get the preferred type for the rss feed
+ $var = 'emvideo_bliptv_rss_tag';
+ $video_info = _emvideo_bliptv_get_video_info_from_preferred_tag($data, $var);
+
+ // grab the preferred filetype rather than tag, so .mov rather than 'web'
+ if ($video_info == 'override') {
+ $var = 'emvideo_bliptv_rss_format';
+ $video_info = _emvideo_bliptv_get_video_info_from_preferred_tag($data, $var);
+ }
+
+ // default to flv if there's no available clip format
+ if (is_null($video_info) || ($video_info == 'override') && $video_info != 'none') {
+ $video_info = $data['flv'];
+ }
+
+ if (is_array($video_info)) {
+ // Begin building file object.
+
+ $file = array();
+ // Create temporary name/path for newly uploaded files.
+ $file['filepath'] = $video_info['url'];
+ $file['filesize'] = $video_info['size'];
+ $file['filemime'] = $video_info['mime'];
+
+ // additional data for Y! MRSS
+ $file['thumbnail']['filepath'] = $data['thumbnail']['url'];
+ $file['width'] = ($video_info['width']) ? $video_info['width'] : 0;
+ $file['height'] = ($video_info['height']) ? $video_info['height'] : 0;
+ $file['duration'] = ($video_info['duration']) ? $video_info['duration'] : FALSE;
+ // @todo media:credit role="author" ...
+
+
+
+ }
+ }
+}
+
+function theme_emvideo_bliptv_flash($code, $width, $height, $field, $item, $autoplay, $flv, $thumbnail, $options = array()) {
+ static $count;
+ if ($code) {
+ $count++;
+ $id = isset($options['id']) ? $options['id'] : "emfield_videocck_player_bliptv_$count";
+ $autoplay = $autoplay ? 'autoStart=true' : 'autoStart=false';
+
+ $rss = $item['data']['showpage'] ? "&feedurl={$item['data']['showpage']}/rss" : '';
+ $post_id = $item['data']['post_id'];
+ // if/when we allow featured shows to be embedded, this will handle that.
+// $file = $item['data']['is_show'] ? "http://$code.blip.tv/rss/flash/" : 'http://blip.tv/rss/flash/'. $item['data']['post_id'];
+ $embed_code = $item['data']['flv']['embed_code']['0'];
+ $file = 'http://blip.tv/rss/flash/'. $item['data']['post_id'];
+ $embed_file = 'http://blip.tv/scripts/flash/showplayer.swf?enablejs=true'. $rss .'&file='. $file .'&showplayerpath=http://blip.tv/scripts/flash/showplayer.swf';
+
+ // If you want strict html you may want to use the following code instead of the one blip provides
+ // $output .= '';
+
+ $output .= '';
+ }
+
+ return $output;
+}
+
+function emvideo_bliptv_thumbnail($field, $item, $formatter, $node, $width, $height, $options = array()) {
+ if ($item['data']['emvideo_bliptv_data_version'] >= 1) {
+ $tn = $item['data']['thumbnail']['url'];
+ }
+ else {
+ $tn = $item['data']['thumbnail'];
+ }
+ return $tn;
+}
+
+function emvideo_bliptv_video($code, $width, $height, $field, $item, $autoplay, $options = array()) {
+ if ($item['data']['emvideo_bliptv_data_version'] >= 1) {
+ $flv = $item['data']['flv']['url'];
+ $thumbnail = $item['data']['thumbnail']['url'];
+ }
+ else {
+ $flv = $item['data']['flv'];
+ $thumbnail = $item['data']['thumbnail'];
+ }
+
+ $output = theme('emvideo_bliptv_flash', $code, $width, $height, $field, $item, $autoplay, $flv, $thumbnail);
+ return $output;
+}
+
+function emvideo_bliptv_preview($code, $width, $height, $field, $item, $autoplay, $options = array()) {
+ if ($item['data']['emvideo_bliptv_data_version'] >= 1) {
+ $flv = $item['data']['flv']['url'];
+ $thumbnail = $item['data']['thumbnail']['url'];
+ }
+ else {
+ $flv = $item['data']['flv'];
+ $thumbnail = $item['data']['thumbnail'];
+ }
+ $output = theme('emvideo_bliptv_flash', $code, $width, $height, $field, $item, $autoplay, $flv, $thumbnail);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emvideo_bliptv_emfield_subtheme() {
+ return array(
+ 'emvideo_bliptv_flash' => array(
+ 'arguments' => array('code' => NULL, 'width' => NULL, 'height' => NULL, 'field' => NULL, 'item' => NULL, 'autoplay' => NULL, 'flv' => NULL, 'thumbnail' => NULL, 'options' => NULL),
+ 'file' => 'providers/emvideo/bliptv.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/brightcove.inc contrib/emfield_generic/providers/emvideo/brightcove.inc
--- contrib/emfield_generic/providers/emvideo/brightcove.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/brightcove.inc 2008-11-23 15:19:48.000000000 -0600
@@ -0,0 +1,161 @@
+ 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
+ */
+function emvideo_brightcove_info() {
+ $features = array(
+ array(t('Autoplay'), t('Yes'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), ''),
+ );
+ return array(
+ 'provider' => 'brightcove',
+ 'name' => t('Brightcove'),
+ 'url' => EMVIDEO_BRIGHTCOVE_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Brightcove.', array('@brightcove' => EMVIDEO_BRIGHTCOVE_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['brightcove'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emvideo_brightcove_settings() {
+ $form = array();
+ 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_brightcove_extract($embed = '') {
+ return array(
+ //
+
+ '@brightcove\.tv/playerswf\' bgcolor\=\'\#FFFFFF\' flashVars\=\'initVideoId\=([^\&]*)\&@i',
+
+ // was:
+ // &initVideoId=753308735&
+ // '@\&initVideoId=([^\&]*)\&@',
+
+ // http://www.brightcove.tv/title.jsp?title=753308735
+ '@brightcove\.tv/title\.jsp\?title=(.*)@i',
+ );
+}
+
+/**
+ * hook emvideo_PROVIDER_video_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_brightcove_video_link($video_code) {
+ return 'http://www.brightcove.tv/title.jsp?title='. $video_code;
+}
+
+/**
+ * the embedded flash displaying the brightcove video
+ */
+function theme_emvideo_brightcove_flash($embed, $width, $height, $autoplay) {
+ if ($embed) {
+ $autostart = $autoplay ? 'autoStart=true' : 'autoStart=false';
+ $output .= "";
+ }
+ 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_brightcove_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return '';
+}
+
+/**
+ * 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_brightcove_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_brightcove_flash', $embed, $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_brightcove_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_brightcove_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emvideo_brightcove_emfield_subtheme() {
+ return array(
+ 'emvideo_brightcove_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/brightcove.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/dailymotion.inc contrib/emfield_generic/providers/emvideo/dailymotion.inc
--- contrib/emfield_generic/providers/emvideo/dailymotion.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/dailymotion.inc 2008-11-23 15:19:58.000000000 -0600
@@ -0,0 +1,182 @@
+ 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_dailymotion_info() {
+ $features = array(
+ array(t('Autoplay'), t('Yes'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), t('')),
+ );
+ return array(
+ 'provider' => 'dailymotion',
+ 'name' => t('Dailymotion'),
+ 'url' => EMVIDEO_DAILYMOTION_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Dailymotion.', array('@dailymotion' => EMVIDEO_DAILYMOTION_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['dailymotion'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emvideo_dailymotion_settings() {
+ $form = array();
+ 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_dailymotion_extract($embed = '') {
+ // http://www.dailymotion.com/us/cluster/news/featured/video/x3xk8v_primary-smackdown-obama-girl-return_fun
+ // http://www.dailymotion.com/barelypolitical/video/x3xk8v_primary-smackdown-obama-girl-return_fun
+ // http://www.dailymotion.com/barelypolitical/video/x3xk8v
+ //
+// if (preg_match('@dailymotion\.com@i', $embed, $matches)) {
+// if (preg_match('@/([^/_]+)_@i', $embed, $matches)) {
+// return $matches[0];
+// }
+// }
+ if (preg_match('@dailymotion\.com/swf/([^"\&]+)@i', $embed, $matches)) {
+ return $matches[1];
+ }
+ if (preg_match('@dailymotion\.com@i', $embed, $matches)) {
+ if (preg_match('@/([^/_]+)_@i', $embed, $matches)) {
+ return $matches[1];
+ }
+ }
+ return array();
+}
+
+/**
+ * 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_dailymotion_embedded_link($video_code) {
+ return 'http://www.dailymotion.com/swf/'. $video_code;
+}
+
+/**
+ * the embedded flash displaying the dailymotion video
+ */
+function theme_emvideo_dailymotion_flash($embed, $width, $height, $autoplay) {
+ if ($embed) {
+ if ($autoplay) {
+ $autoplay_value = '&autoStart=1';
+ }
+ $output .= "
+
+
+
+
+
+
+
+
+
+ \n";
+ }
+ 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_dailymotion_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return 'http://www.dailymotion.com/thumbnail/160x120/video/'. $item['value'];
+}
+
+/**
+ * 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_dailymotion_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_dailymotion_flash', $embed, $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_dailymotion_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_dailymotion_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emvideo_dailymotion_emfield_subtheme() {
+ return array(
+ 'emvideo_dailymotion_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/dailymotion.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/google.inc contrib/emfield_generic/providers/emvideo/google.inc
--- contrib/emfield_generic/providers/emvideo/google.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/google.inc 2008-11-23 15:20:18.000000000 -0600
@@ -0,0 +1,198 @@
+ 'google',
+ 'name' => t('Google'),
+ 'url' => EMVIDEO_GOOGLE_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Google.', array('@google' => EMVIDEO_GOOGLE_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+function emvideo_google_settings() {
+ $form = array();
+ $form['emvideo_google_domain'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Google video domain'),
+ '#default_value' => variable_get('emvideo_google_domain', EMVIDEO_GOOGLE_DOMAIN_DEFAULT),
+ '#description' => t('Google hosts their videos on various servers throughout the world. By default, videos from Google will be displayed from the United States, at their google.com servers. If you wish to display the video from another Google server, please enter the domain here, without the initial dot. For instance, you might enter it for the Italian Google servers at google.it, or ca for their Canadian servers.'),
+ );
+ return $form;
+}
+
+function emvideo_google_extract($embed) {
+ return array(
+ '@http://video\.google(?:\.[a-z]{2,4})+/videoplay(?:\?|%3F)docid(?:=|%3D)([^\&]*)\&@i',
+ '@http://video\.google(?:\.[a-z]{2,4})+/videoplay(?:\?|%3F)docid(?:=|%3D)([^\&]*)\&@i',
+ '@http://video\.google(?:\.[a-z]{2,4})+/videoplay\?docid=(.*)@i',
+ '@http://video\.google(?:\.[a-z]{2,4})+/googleplayer\.swf\?docId=(-?\d*)@i',
+ '@http://video\.google(?:\.[a-z]{2,4})+/url\?docid=([^\&]*)\&@i',
+ );
+}
+
+function emvideo_google_request($embed, $cacheable = TRUE) {
+ $args = array('docid' => $embed);
+ return module_invoke('emfield', 'request_xml', 'google', EMVIDEO_GOOGLE_XML, $args, $cacheable);
+}
+
+function emvideo_google_video_link($video_code) {
+ return 'http://video.google.'. variable_get('emvideo_google_domain', EMVIDEO_GOOGLE_DOMAIN_DEFAULT) .'/videoplay?docid='. $video_code;
+}
+
+function theme_emvideo_google_flash($embed, $width, $height, $autoplay) {
+ if ($embed) {
+ $autoplay = $autoplay ? '&autoPlay=true' : '';
+ // 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 .= '
+
+
+
+
+
+
+
'. t('Your browser is not able to display this multimedia content.') .'
+ ';
+ }
+ return $output;
+}
+
+/**
+ * hook emfield_PROVIDER_data
+ *
+ * provides an array to be serialised and made available with $item elsewhere
+ */
+function emvideo_google_data($field, $item) {
+ $data = array();
+ // create some 'field' version control
+ //$data['emvideo_google_version'] = 1;
+
+ $rss = emvideo_google_request($item['value']);
+
+ if (
+ is_array($rss['ITEM']) &&
+ is_array($rss['ITEM']['MEDIA:GROUP']) &&
+ is_array($rss['ITEM']['MEDIA:GROUP']['MEDIA:CONTENT']) &&
+ is_array($rss['ITEM']['MEDIA:GROUP']['MEDIA:CONTENT'][1])
+ ) {
+ $video = $rss['ITEM']['MEDIA:GROUP']['MEDIA:CONTENT'][1];
+ $data['filepath'] = $video['URL'];
+ $data['filemime'] = $video['TYPE'];
+ $data['medium'] = $video['MEDIUM'];
+ $data['expression'] = $video['EXPRESSION'];
+ $data['duration'] = $video['DURATION'];
+ $data['width'] = $video['WIDTH'];
+ $data['height'] = $video['HEIGHT'];
+ }
+
+ if (is_array($rss['MEDIA:GROUP'])) {
+ if (is_array($rss['MEDIA:GROUP']['MEDIA:THUMBNAIL']) && is_array($rss['MEDIA:GROUP']['MEDIA:THUMBNAIL'][1])) {
+ $thumbnail = $rss['MEDIA:GROUP']['MEDIA:THUMBNAIL'][1];
+ $data['thumbnail']['filepath'] = $thumbnail['URL'];
+ $data['thumbnail']['width'] = $thumbnail['WIDTH'];
+ $data['thumbnail']['height'] = $thumbnail['HEIGHT'];
+ }
+ if (is_array($rss['MEDIA:GROUP']['MEDIA:PLAYER']) && is_array($rss['MEDIA:GROUP']['MEDIA:PLAYER'][1])) {
+ $data['player']['filepath'] = $rss['MEDIA:GROUP']['MEDIA:PLAYER'][1]['URL'];
+ }
+ }
+
+ if ($data['thumbnail']['filepath'] == '') {
+ // for whatever reason the thumbnail failed try the old method
+ // we'll parse it from the description, where it's repeated.
+ $desc = $rss['ITEM']['DESCRIPTION'][0];
+ $regex = '@ media, just MRSS, and no size
+ // so not actually really really necessary or really useful but for completeness
+ $play = 'http://video.google.'. variable_get('emvideo_google_domain', EMVIDEO_GOOGLE_DOMAIN_DEFAULT) .'/googleplayer.swf?docId='. check_plain($item['embed']);
+ $response = emfield_request_header('google', $play, FALSE, FALSE);
+
+ if ($response->code == 200) {
+ $data['filesize'] = $response->headers['Content-Length'];
+ }
+
+ return $data;
+}
+
+function emvideo_google_rss($item, $teaser) {
+ if ($item['value']) {
+ if ($item['data']['emvideo_google_data_version'] >= 1000000) {
+ $data = $item['data'];
+ }
+ else {
+ $data = emvideo_google_data(NULL, $item);
+ }
+
+ return $data;
+ }
+}
+
+function emvideo_google_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ if ($item['data']['emvideo_google_data_version'] >= 1) {
+ $data = $item['data'];
+ }
+ else {
+ $data = emvideo_google_data($field, $item);
+ }
+
+ return $data['thumbnail']['filepath'];
+
+ return NULL;
+}
+
+function emvideo_google_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_google_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_google_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_google_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emvideo_google_emfield_subtheme() {
+ return array(
+ 'emvideo_google_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/google.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/guba.inc contrib/emfield_generic/providers/emvideo/guba.inc
--- contrib/emfield_generic/providers/emvideo/guba.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/guba.inc 2008-11-23 15:20:26.000000000 -0600
@@ -0,0 +1,98 @@
+ 'guba',
+ 'name' => t('GUBA'),
+ 'url' => EMVIDEO_GUBA_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from GUBA. You can learn more about its API here.', array('@guba' => EMVIDEO_GUBA_MAIN_URL, '@api' => EMVIDEO_GUBA_API_INFO)),
+ 'supported_features' => $features,
+ );
+}
+
+function emvideo_guba_settings() {
+ $form['guba']['api'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('GUBA API'),
+ '#description' => t('If you wish to be able to display GUBA thumbnails automatically, you will first need to apply for an API Developer Key from the GUBA Developer Profile page. Note that you do not need this key to display GUBA videos themselves.', array('@guba' => EMVIDEO_GUBA_API_APPLICATION_URL)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['guba']['api']['emvideo_guba_api_key'] = array(
+ '#type' => 'textfield',
+ '#title' => t('GUBA API Key'),
+ '#default_value' => variable_get('emvideo_guba_api_key', ''),
+ '#description' => t('Please enter your GUBA Developer Key here.'),
+ );
+ $form['guba']['api']['emvideo_guba_api_secret'] = array(
+ '#type' => 'textfield',
+ '#title' => t('GUBA API Secret'),
+ '#default_value' => variable_get('emvideo_guba_api_secret', ''),
+ '#description' => t('If you have a secret for the GUBA API, enter it here.'),
+ );
+ return $form;
+}
+
+
+function emvideo_guba_request($method, $args = array(), $cached = TRUE) {
+ //$args = array('docid' => $embed);
+ return module_invoke('emfield', 'request_xml', 'guba', "http://www.guba.com/rest/video/". $method ."/details", $args, $cacheable);
+}
+
+function emvideo_guba_extract($embed = '') {
+ return array(
+ '@http://www\.guba\.com/watch/([^"\?]+)@i',
+ '@http://www\.guba\.com/f/root\.swf\?video_url=http://free\.guba\.com/uploaditem/([^"\?/]*)@i',
+ );
+}
+
+function emvideo_guba_embedded_link($video_code) {
+ return 'http://www.guba.com/watch/'. $video_code;
+}
+
+function theme_emvideo_guba_flash($embed, $width, $height, $autoplay) {
+ $autoplay = $autoplay ? '&autoPlay=TRUE' : '&autoPlay=FALSE';
+ $output .= '';
+ return $output;
+}
+
+function emvideo_guba_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ $thumbid = $item['value'];
+ $thm = 'http://img.guba.com/public/video/f/58/'. $thumbid .'-m.jpg';
+ return $thm;
+}
+
+function emvideo_guba_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_guba_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_guba_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_guba_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_guba_emfield_subtheme() {
+ return array(
+ 'emvideo_guba_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/guba.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/imeem.inc contrib/emfield_generic/providers/emvideo/imeem.inc
--- contrib/emfield_generic/providers/emvideo/imeem.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/imeem.inc 2008-11-23 15:20:34.000000000 -0600
@@ -0,0 +1,103 @@
+ 'imeem',
+ 'name' => t('IMEEM'),
+ 'url' => EMVIDEO_IMEEM_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from IMEEM. You can learn more about its API here.', array('@imeem' => EMVIDEO_IMEEM_MAIN_URL, '@api' => EMVIDEO_IMEEM_API_INFO)),
+ 'supported_features' => $features,
+ );
+}
+
+function emvideo_imeem_settings() {
+ $form['imeem']['api'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('IMEEM API'),
+ '#description' => t('If you wish to be able to display IMEEM thumbnails automatically, you will first need to apply for an API Developer Key from the IMEEM Developer Profile page. Note that you do not need this key to display IMEEM videos themselves.', array('@imeem' => EMVIDEO_IMEEM_API_APPLICATION_URL)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['imeem']['api']['emvideo_imeem_api_key'] = array(
+ '#type' => 'textfield',
+ '#title' => t('IMEEM API Key'),
+ '#default_value' => variable_get('emvideo_imeem_api_key', ''),
+ '#description' => t('Please enter your IMEEM Developer Key here.'),
+ );
+ $form['imeem']['api']['emvideo_imeem_api_secret'] = array(
+ '#type' => 'textfield',
+ '#title' => t('IMEEM API Secret'),
+ '#default_value' => variable_get('emvideo_imeem_api_secret', ''),
+ '#description' => t('If you have a secret for the IMEEM API, enter it here.'),
+ );
+ return $form;
+}
+
+function emvideo_imeem_request($embed, $cacheable = TRUE) {
+ $args = array('docid' => $embed);
+ return module_invoke('emfield', 'request_xml', 'imeem', EMVIDEO_IMEEM_XML . $embed .'&version=1.0', $args, $cacheable);
+}
+
+function emvideo_imeem_extract($embed = '') {
+ return array(
+ '@http://media\.imeem\.com/[a-z]{1,2}/([^"\?/]+)/@i',
+ );
+}
+
+function emvideo_imeem_embedded_link($video_code) {
+ return 'http://www.imeem.com/v/'. $video_code;
+}
+
+function theme_emvideo_imeem_flash($embed, $width, $height, $autoplay) {
+ $autoplay = $autoplay ? '/aus=true' : '/aus=false';
+ $colors = 'backColor=666666&primaryColor=cccccc&secondaryColor=333333&linkColor=cccccc';
+
+ $output .= '';
+ $output .= '';
+ $output .= '';
+ $output .= '';
+ $output .= '';
+ $output .= '';
+ $output .= '';
+ return $output;
+}
+
+function emvideo_imeem_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ $xml = emvideo_imeem_request($item['value']);
+ $tmpthm = $xml['ITEM']['ICONURL'][0];
+ $imgmax = $xml['ITEM']['DURATION'][0];
+ $formatnum = str_pad(rand(0, $imgmax) .'.jpg', 9, "0", STR_PAD_LEFT);;
+ $thm = str_replace('00010.jpg', $formatnum, $tmpthm);
+ return $thm;
+}
+
+function emvideo_imeem_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_imeem_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_imeem_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_imeem_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_imeem_emfield_subtheme() {
+ return array(
+ 'emvideo_imeem_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/imeem.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/jumpcut.inc contrib/emfield_generic/providers/emvideo/jumpcut.inc
--- contrib/emfield_generic/providers/emvideo/jumpcut.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/jumpcut.inc 2008-11-23 15:20:44.000000000 -0600
@@ -0,0 +1,73 @@
+ 'jumpcut',
+ 'name' => t('JumpCut'),
+ 'url' => EMVIDEO_JUMPCUT_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from JumpCut.', array('@provider' => EMVIDEO_JUMPCUT_MAIN_URL)),
+ 'supported_features' => $features,
+ );
+}
+
+function emvideo_jumpcut_settings() {
+ $form = array();
+ return $form;
+}
+
+function emvideo_jumpcut_extract($embed) {
+ return array(
+ '@jumpcut\.com/view\?id=(.*)@i',
+ '@jumpcut\.com/view\?id=([^\&]*)\&@i',
+ );
+}
+
+function emvideo_jumpcut_video_link($video_code) {
+ return 'http://jumpcut.com/view?id='. $video_code;
+}
+
+function theme_emvideo_jumpcut_flash($embed, $width, $height) {
+ if ($embed) {
+ $output .= '';
+ }
+ return $output;
+}
+
+function emvideo_jumpcut_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ return '';
+}
+
+function emvideo_jumpcut_video($embed, $width, $height, $field, $item) {
+ $output = theme('emvideo_jumpcut_flash', $embed, $width, $height);
+ return $output;
+}
+
+function emvideo_jumpcut_preview($embed, $width, $height, $field, $item) {
+ $output = theme('emvideo_jumpcut_flash', $embed, $width, $height);
+ return $output;
+}
+
+/**
+ * Implementation of hook_emfield_subtheme.
+ */
+function emvideo_jumpcut_emfield_subtheme() {
+ return array(
+ 'emvideo_jumpcut_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL),
+ 'file' => 'providers/emvideo/jumpcut.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/lastfm.inc contrib/emfield_generic/providers/emvideo/lastfm.inc
--- contrib/emfield_generic/providers/emvideo/lastfm.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/lastfm.inc 2008-11-23 15:21:04.000000000 -0600
@@ -0,0 +1,178 @@
+ 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_lastfm_info() {
+ $features = array(
+ array(t('Autoplay'), t('No'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('No'), t('')),
+ );
+ return array(
+ 'provider' => 'lastfm',
+ 'name' => t('Last.fm'),
+ 'url' => EMVIDEO_LASTFM_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Last.fm.', array('@lastfm' => EMVIDEO_LASTFM_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['lastfm'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emvideo_lastfm_settings() {
+}
+
+/**
+ * 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_lastfm_extract($embed = '') {
+ // http://www.last.fm/music/The+Shins/+videos/2794412
+ //
+
+ // thumb:
+ // http://userserve-ak.last.fm/serve/image:160/2794412.jpg
+
+ // src="http://www.lastfm.com/v/nvbQQnvxXDk"
+ // http://lastfm.com/watch?v=nvbQQnvxXDk
+ // http://www.lastfm.com/watch?v=YzFCA-xUc8w&feature=dir
+ if (preg_match('@cdn.last.fm@i', $embed, $matches)) {
+ if (preg_match('@uniqueName=([0-9]+)@i', $embed, $matches)) {
+ return $matches[1];
+ }
+ }
+ else if (preg_match('@last\.fm@i', $embed, $matches)) {
+ if (preg_match('@([0-9]+)@i', $embed, $matches)) {
+ return $matches[1];
+ }
+ }
+ return array(
+ );
+}
+
+/**
+ * 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_lastfm_embedded_link($video_code) {
+ return '';
+}
+
+/**
+ * the embedded flash displaying the lastfm video
+ */
+function theme_emvideo_lastfm_flash($embed, $width, $height, $autoplay) {
+ static $count;
+ if ($embed) {
+ // set css id count
+ $count++;
+ $output .= '';
+ }
+ 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_lastfm_thumbnail($field, $item, $formatter, $node, $width, $height) {
+ $lastfm_id = $item['value'];
+
+ // if we have a large thumbnail size, then get the larger version available.
+ if ($width >= 320) {
+ $tn = "http://userserve-ak.last.fm/serve/image:320/$lastfm_id.jpg";
+ }
+ else {
+ $tn = "http://userserve-ak.last.fm/serve/image:160/$lastfm_id.jpg";
+ }
+ 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_lastfm_video($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_lastfm_flash', $embed, $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_lastfm_preview($embed, $width, $height, $field, $item, $autoplay) {
+ $output = theme('emvideo_lastfm_flash', $embed, $width, $height, $autoplay);
+ return $output;
+}
+
+function emvideo_lastfm_emfield_subtheme() {
+ return array(
+ 'emvideo_lastfm_flash' => array(
+ 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL),
+ 'file' => 'providers/emvideo/lastfm.inc'
+ )
+ );
+}
diff -urpN contrib/emfield_generic/providers/emvideo/livevideo.inc contrib/emfield_generic/providers/emvideo/livevideo.inc
--- contrib/emfield_generic/providers/emvideo/livevideo.inc 1969-12-31 18:00:00.000000000 -0600
+++ contrib/emfield_generic/providers/emvideo/livevideo.inc 2008-11-23 15:21:14.000000000 -0600
@@ -0,0 +1,197 @@
+ 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_livevideo_info() {
+ $features = array(
+ array(t('Autoplay'), t('Yes'), ''),
+ array(t('RSS Attachment'), t('No'), ''),
+ array(t('Thumbnails'), t('Yes'), ''),
+ );
+
+ return array(
+ 'provider' => 'livevideo',
+ 'name' => t('Live Video'),
+ 'url' => EMVIDEO_LIVEVIDEO_MAIN_URL,
+ 'settings_description' => t('These settings specifically affect videos displayed from Live Video. You can learn more about its API here.', array('@livevideo' => EMVIDEO_LIVEVIDEO_MAIN_URL, '@api' => EMVIDEO_LIVEVIDEO_API_INFO)),
+ '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['livevideo'])
+ * so if you want specific provider settings within that field, you can add the elements to that form field.
+ */
+function emvideo_livevideo_settings() {
+ $form['livevideo']['api'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Live Video API'),
+ '#description' => t('If you wish to be able to display Live Video thumbnails automatically, you will first need to apply for an API Developer Key from the Live Video Developer Profile page. Note that you do not need this key to display Live Video videos themselves.', array('@livevideo' => EMVIDEO_LIVEVIDEO_API_APPLICATION_URL)),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['livevideo']['api']['emvideo_livevideo_api_key'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Live Video API Key'),
+ '#default_value' => variable_get('emvideo_livevideo_api_key', ''),
+ '#description' => t('Please enter your Live Video Developer Key here.'),
+ );
+
+ return $form;
+}
+
+/**
+ * this is a wrapper for emvideo_request_xml that includes livevideo's api key
+ */
+function emvideo_livevideo_request($method, $args = array(), $cached = TRUE) {
+ $args['developerId'] = trim(variable_get('emvideo_livevideo_api_key', ''));
+ $request = module_invoke('emfield', 'request_xml', 'livevideo', EMVIDEO_LIVEVIDEO_REST_ENDPOINT . $method, $args, $cached);
+
+ return $request;
+}
+
+/**
+ * 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_livevideo_extract($embed = '') {
+ //