Index: contrib/emimage/providers/flickr.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emimage/providers/Attic/flickr.inc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 flickr.inc
--- contrib/emimage/providers/flickr.inc	12 Nov 2008 18:46:18 -0000	1.1.2.5
+++ contrib/emimage/providers/flickr.inc	3 Jan 2009 13:57:39 -0000
@@ -24,6 +24,7 @@
  */
 
 function emimage_flickr_info() {
+  $name = t('Flickr');
   $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))),
   );
Index: contrib/emvideo/emvideo.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.module,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 emvideo.module
--- contrib/emvideo/emvideo.module	16 Dec 2008 21:12:42 -0000	1.1.2.12
+++ contrib/emvideo/emvideo.module	3 Jan 2009 20:14:22 -0000
@@ -378,14 +378,14 @@
   }
 }
 
-function emvideo_embed_form($field, $item, $formatter, $node, $options = array()) {
+function emvideo_embed_form($form_state = NULL, $field, $item, $formatter, $node, $options = array(), $other = 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', 'emvideo', $item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay);
+  $width = !empty($options['width']) ? $options['width'] : $field['widget']['video_width'];
+  $height = !empty($options['height']) ? $options['height'] : $field['widget']['video_height'];
+  $autoplay = !empty($options['autoplay']) ? $options['autoplay'] : $field['widget']['video_autoplay'];
+  $title = !empty($options['title']) ? $options['title'] : t('Embed Code');
+  $description = !empty($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', 'emvideo', $item['provider'], 'video', $embed, $width, $height, $field, $item, $node, $autoplay);
   $form = array();
   $form['emvideo_embed'] = array(
     '#type' => 'textarea',
Index: contrib/emvideo/emvideo.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.theme.inc,v
retrieving revision 1.1.2.13
diff -u -r1.1.2.13 emvideo.theme.inc
--- contrib/emvideo/emvideo.theme.inc	18 Dec 2008 16:33:34 -0000	1.1.2.13
+++ contrib/emvideo/emvideo.theme.inc	3 Jan 2009 20:17:31 -0000
@@ -59,26 +59,28 @@
 function theme_emvideo_video_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array()) {
   // Thickbox requires some output, so make sure we have at least a blank string.
   $output = '';
-
+  $width = isset($options['width']) ? $options['width'] : ($field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('emvideo_default_video_width', EMVIDEO_DEFAULT_THUMBNAIL_WIDTH));
+  $height = isset($options['height']) ? $options['height'] : ($field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('emvideo_default_video_height', EMVIDEO_DEFAULT_THUMBNAIL_HEIGHT));
+  
   // Get a thumbnail URL. This can be an override through $options['thumbnail_url'],
   // defined by the provider (the usual case), or a default image.
-  if ($options['thumbnail_url'] || ($item['value'] && $item['provider'])) {
+  if (isset($options['thumbnail_url']) || ($item['value'] && $item['provider'])) {
     // If we've set $options['thumbnail_url'], then we'll just use that.
-    $thumbnail_url = $options['thumbnail_url'];
+    $thumbnail_url = isset($options['thumbnail_url']) ? $options['thumbnail_url'] : '';
 
     // Otherwise, if we have emthumb installed, then give it a chance to override our thumbnail.
-    if (!$thumbnail_url && function_exists('emthumb_thumbnail_url')) {
+    if (empty($thumbnail_url) && function_exists('emthumb_thumbnail_url')) {
       $thumbnail_url = emthumb_thumbnail_url($item);
     }
 
     // If we don't have a custom thumbnail, then see if the provider gives us a thumbnail.
-    if (!$thumbnail_url) {
+    if (empty($thumbnail_url)) {
       $thumbnail_url = emfield_include_invoke('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) {
+  if (empty($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;
@@ -123,9 +125,9 @@
 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'];
+    $width = isset($options['width']) ? $options['width'] : ($field['widget']['video_width'] ? $field['widget']['video_width'] : variable_get('emvideo_default_video_width', EMVIDEO_DEFAULT_VIDEO_WIDTH));
+    $height = isset($options['height']) ? $options['height'] : ($field['widget']['video_height'] ? $field['widget']['video_height'] : variable_get('emvideo_default_video_height', EMVIDEO_DEFAULT_VIDEO_HEIGHT));
+    $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $field['widget']['video_autoplay'];
     $output = module_invoke('emfield', 'include_invoke', 'emvideo', $item['provider'], 'video', $embed, $width, $height, $field, $item, $node, $autoplay, $options);
   }
 
@@ -149,6 +151,7 @@
 }
 
 function theme_emvideo_thickbox($field, $item, $formatter, $node, $options = array()) {
+  $title = t('Thickbox'); // Is this right? Nothing is declared.
   $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'] .'/'. $item['provider'] .'/'. $item['value'];
   $options = array(
Index: contrib/emvideo/providers/youtube.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/youtube.inc,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 youtube.inc
--- contrib/emvideo/providers/youtube.inc	16 Dec 2008 14:49:30 -0000	1.1.2.14
+++ contrib/emvideo/providers/youtube.inc	3 Jan 2009 20:14:51 -0000
@@ -170,7 +170,7 @@
  */
 function emvideo_youtube_rss($item, $teaser = NULL) {
   if ($item['value']) {
-    if ($item['data']['emvideo_youtube_data_version'] >= 1) {
+    if (!empty($item['data']['emvideo_youtube_data_version']) && $item['data']['emvideo_youtube_data_version'] >= 1) {
       $data = $item['data'];
     }
     else {
@@ -252,6 +252,7 @@
  */
 function theme_emvideo_youtube_flash($embed, $width, $height, $autoplay, $options = array()) {
   static $count;
+  $output = '';
   if ($embed) {
     $fullscreen = variable_get('emvideo_youtube_full_screen', 1);
     $fullscreen_value = $fullscreen ? "true" : "false";
@@ -261,6 +262,7 @@
     $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $autoplay;
     $autoplay_value = $autoplay ? '&autoplay=1' : '';
     $show_colors = isset($options['show_colors']) ? $options['show_colors'] : variable_get('emvideo_youtube_show_colors', FALSE);
+    $colors = '';
     if ($show_colors) {
       $color1 = isset($options['color1']) ? $options['color1'] : variable_get('emvideo_youtube_colors_color1', emvideo_YOUTUBE_COLOR1_DEFAULT);
       $color2 = isset($options['color2']) ? $options['color2'] : variable_get('emvideo_youtube_colors_color2', emvideo_YOUTUBE_COLOR2_DEFAULT);
@@ -272,14 +274,14 @@
     $enablejsapi = $enablejsapi ? '&enablejsapi=1&playerapiid=ytplayer' : '';
     $id = isset($options['id']) ? $options['id'] : 'video-cck-youtube-flash-'. (++$count);
     $div_id = isset($options['div_id']) ? $options['div_id'] : 'video-cck-youtube-flash-wrapper-'. $count;
-    $url = "http://www.youtube.com/v/$embed&amp;$related$autoplay_value$colors$border$enablejsap$fs";
+    $url = "http://www.youtube.com/v/$embed&amp;$related$autoplay_value$colors$border$enablejsapi$fs";
     if (variable_get('emfield_swfobject', FALSE) && (module_exists('swfobject_api') || variable_get('emfield_swfobject_location', ''))) {
       if (module_exists('swfobject_api')) {
         $params['width'] = $width;
         $params['height'] = $height;
         $params['div_id'] = $id;
         $params['allowFullScreen'] = $fullscreen_value;
-        $output .= theme('swfobject_api', $url, $params, $vars, $id);
+        $output .= theme('swfobject_api', $url, $params, $options, $id);
       }
       else {
         drupal_add_js(variable_get('emfield_swfobject_location', ''));
Index: emfield.cck.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/Attic/emfield.cck.inc,v
retrieving revision 1.1.2.11
diff -u -r1.1.2.11 emfield.cck.inc
--- emfield.cck.inc	18 Dec 2008 16:47:41 -0000	1.1.2.11
+++ emfield.cck.inc	3 Jan 2009 15:13:34 -0000
@@ -103,7 +103,7 @@
       $options = array();
       $providers = emfield_system_list($module);
       foreach ($providers as $provider) {
-        if (variable_get('emfield_allow_'. $module .'_'. $provider->name, TRUE)) {
+        if (variable_get('emfield_'. $module .'_allow_'. $provider->name, TRUE)) {
           $info = emfield_include_invoke($module, $provider->name, 'info');
           $options[$provider->name] = $info['name'];
         }
@@ -153,10 +153,9 @@
   $providers = emfield_allowed_providers($field, $module);
   $urls = array();
   $additional_form_elements = array();
-
   foreach ($providers as $provider) {
     // Only list providers allowed for this field. Honor global settings first.
-    if (variable_get('emfield_allow_'. $module .'_'. $provider->name, TRUE)) {
+    if (variable_get('emfield_'. $module .'_allow_'. $provider->name, TRUE)) {
       // Get the provider info.
       $info = emfield_include_invoke($module, $provider->name, 'info');
       // Grab the provider's URL.
@@ -213,6 +212,5 @@
   foreach (module_implements('emfield_widget_extra') as $module_extra) {
     $tree[$module_extra] = module_invoke($module_extra, 'emfield_widget_extra', $form, $form_state, $field, $items, $delta, $module);
   }
-
   return $tree;
 }
Index: emfield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/emfield.module,v
retrieving revision 1.12.4.23
diff -u -r1.12.4.23 emfield.module
--- emfield.module	16 Dec 2008 16:27:58 -0000	1.12.4.23
+++ emfield.module	3 Jan 2009 20:29:14 -0000
@@ -69,24 +69,26 @@
  */
 function emfield_allowed_providers($field, $module) {
   $allowed_providers = emfield_system_list($module);
-  $providers = array();
+  
+  // $field sometimes is the whole $field and sometimes just the $widget, 
+  // depending on where it is called from, so check which one we have.
+  $providers = isset($field['widget']['providers']) ? $field['widget']['providers'] : (isset($field['providers']) ? $field['providers'] : array());
   $allow_all = TRUE;
   foreach ($allowed_providers as $test) {
     if (!variable_get('emfield_'. $module .'_allow_'. $test->name, TRUE)) {
       unset($allowed_providers[$test->name]);
     }
     else {
-      $allow_all &= !$field['widget']['providers'][$test->name];
+      $allow_all &= empty($providers[$test->name]);
     }
   }
   if (!$allow_all) {
     foreach ($allowed_providers as $test) {
-      if (!$field['widget']['providers'][$test->name]) {
+      if (empty($providers[$test->name])) {
         unset($allowed_providers[$test->name]);
       }
     }
   }
-
   return $allowed_providers;
 }
 
@@ -183,6 +185,18 @@
  *  This also allows you to grab directly from the URL to display the content from field 'provider'.
  */
 function _emfield_field_submit_id($field, $item, $module) {
+  
+  // TODO Find the right fix for this.
+  // When the embedded media field is used in the default value widget
+  // when editing field settings, the $item has no value for 'provider', 
+  // causing an error message.
+  // This is not the right way to fix this, but I don't know why that
+  // value has been left out of the form element returned by hook_widget_settings
+  // and this will at least keep the error message from being displayed.
+  
+  if (!isset($item['provider'])) {
+    $item['provider'] = '';
+  }
   $item = array_merge($item, emfield_parse_embed($field, $item['embed'], $module));
   $item['data'] = (array)emfield_include_invoke($module, $item['provider'], 'data', $field, $item);
 

