Index: contrib/emimage/providers/photobucket.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emimage/providers/Attic/photobucket.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 photobucket.inc --- contrib/emimage/providers/photobucket.inc 18 Jul 2008 20:32:59 -0000 1.1.2.2 +++ contrib/emimage/providers/photobucket.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ 'fieldset', '#title' => t('Flickr API'), '#description' => t('You will first need to apply for an API Developer Key from the !flickr.', array('!flickr' => l(t('Flickr Developer Profile page'), EMIMAGE_FLICKR_API_APPLICATION_URL, array('target' => '_blank')))), - '#collapsible' => true, + '#collapsible' => TRUE, '#collapsed' => (variable_get('emimage_flickr_api_key', '') != ''), ); $form['flickr']['api']['emimage_flickr_api_key'] = array( Index: contrib/emimage/providers/picasa.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emimage/providers/Attic/picasa.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 picasa.inc --- contrib/emimage/providers/picasa.inc 18 Jul 2008 20:32:59 -0000 1.1.2.2 +++ contrib/emimage/providers/picasa.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ $matches[1], + 'server' => $matches[1], 'userid' => $matches[2], - 's1' => $matches[3], - 's2' => $matches[4], - 's3' => $matches[5], - 'image' => $matches[6], + 's1' => $matches[3], + 's2' => $matches[4], + 's3' => $matches[5], + 'image' => $matches[6], ); } @@ -123,14 +129,14 @@ } /** - * implement emimage_PROVIDER_image_title + * 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, '' + * @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) { @@ -139,16 +145,18 @@ $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) { + 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'; } Index: contrib/emimage/emimage.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emimage/Attic/emimage.install,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 emimage.install --- contrib/emimage/emimage.install 18 Jul 2008 20:32:59 -0000 1.1.2.2 +++ contrib/emimage/emimage.install 25 Jul 2008 06:40:41 -0000 @@ -2,6 +2,11 @@ // $Id: emimage.install,v 1.1.2.2 2008/07/18 20:32:59 alexua Exp $ /** + * @file + * This is the emimage.module's install, configuration, and removal instructions. + */ + +/** * Implementation of hook_install(). */ function emimage_install() { @@ -16,29 +21,31 @@ } /** -* Implementation of hook_enable(). -*/ + * Implementation of hook_enable(). + */ function emimage_enable() { content_notify('enable', 'emimage'); } /** -* Implementation of hook_disable(). -*/ + * Implementation of hook_disable(). + */ function emimage_disable() { content_notify('disable', 'emimage'); } function emimage_update_1() { $ret = _emimage_update_reset_cache_views(); + return $ret; } -// I'd like this to be conditional, so it only runs if they don't have views installed. -// however, module_exists doesn't actually work in the update scripts. -// TODO: conditional on if table exists instead... +// I'd like this to be conditional, so it only runs if they don't have Views installed. +// However, module_exists doesn't actually work in the update scripts. +// TODO: Conditional on if table exists instead... function _emimage_update_reset_cache_views() { $ret = array(); $ret[] = update_sql("DELETE FROM {cache_views}"); + return $ret; } Index: contrib/emvideo/emvideo.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.info,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 emvideo.info --- contrib/emvideo/emvideo.info 18 Jul 2008 20:22:44 -0000 1.1.2.1 +++ contrib/emvideo/emvideo.info 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,8 @@ ; $Id: emvideo.info,v 1.1.2.1 2008/07/18 20:22:44 alexua Exp $ + name = Embedded Video Field description = Defines a field type for displaying third party videos, such as YouTube and Google Video. + +core = 6.x dependencies[] = emfield package = CCK -core = 6.x Index: contrib/emvideo/emvideo.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.install,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 emvideo.install --- contrib/emvideo/emvideo.install 18 Jul 2008 20:22:44 -0000 1.1.2.1 +++ contrib/emvideo/emvideo.install 25 Jul 2008 06:40:41 -0000 @@ -2,6 +2,11 @@ // $Id: emvideo.install,v 1.1.2.1 2008/07/18 20:22:44 alexua Exp $ /** + * @file + * Installation, configuration, and removal of the emvideo module. + */ + +/** * Implementation of hook_install(). */ function emvideo_install() { @@ -16,28 +21,28 @@ } /** -* Implementation of hook_enable(). -*/ + * Implementation of hook_enable(). + */ function emvideo_enable() { content_notify('enable', 'emvideo'); } /** -* Implementation of hook_disable(). -*/ + * Implementation of hook_disable(). + */ function emvideo_disable() { content_notify('disable', 'emvideo'); } /** - * we need to make sure to show our new 'embed code' filter on views + * We need to make sure to show our new 'embed code' filter on Views. */ function emvideo_update_1() { return _emvideo_update_reset_cache(); } /** - * we need a new data field for extra info stored by certain providers, such as blip.tv + * We need a new data field for extra info stored by certain providers, such as blip.tv. */ function emvideo_update_2() { $ret = array(); @@ -52,7 +57,7 @@ switch ($field['type']) { case 'emvideo': $columns = array( - 'data' => array('type' => 'longtext', 'not null' => TRUE, 'default' => "''", 'sortable' => false), + 'data' => array('type' => 'longtext', 'not null' => TRUE, 'default' => "''", 'sortable' => FALSE), ); // the following line will trigger (negligible) warnings if emvideo_update_2 was run before // (column already exists) @@ -62,25 +67,28 @@ } $ret = _emvideo_update_reset_cache(); $ret[] = update_sql("DELETE FROM {cache}"); + return $ret; } function _emvideo_update_reset_cache() { $ret = _emvideo_update_reset_cache_views(); $ret[] = update_sql("DELETE FROM {cache_content}"); + return $ret; } /** - * since we made our engine dependent on emfield, we need to change some variables accordingly + * Since we made our engine dependent on emfield, we need to change some variables accordingly. */ function emvideo_update_3() { $ret = array(); foreach (emfield_system_list('emvideo') as $provider) { // TODO: this will need some attention when we upgrade to d6 $test = variable_get('emvideo_allow_'. $provider->name, NULL); + if (isset($test)) { - variable_set('emfield_'. $module .'_allow_'. $provider->name, variable_get('emvideo_allow_'. $provider->name, true)); + variable_set('emfield_'. $module .'_allow_'. $provider->name, variable_get('emvideo_allow_'. $provider->name, TRUE)); } } $ret[] = array( @@ -91,12 +99,13 @@ // now we need to depend on emfield's menu. remove our old admin menu path menu_rebuild(); + return $ret; } /** - * oops. cleanup from update 3 -- we don't want to accidentally reset our variables - * if we have to run update 3 again... + * Oops. Cleanup from update 3 -- we don't want to accidentally reset our + * variables if we have to run update 3 again. */ function emvideo_update_4() { $ret = array(); @@ -111,28 +120,35 @@ 'query' => t('The old Embedded Video Field allowed provider variables have been cleaned up.'), 'success' => TRUE ); + return $ret; } /** - * changed the data structure for blip.tv - * TODO: this doesn't work. thought data was cached? ... + * Changed the data structure for blip.tv + * + * TODO: This doesn't work. Thought data was cached? */ function emvideo_update_5() { $ret = _emvideo_update_reset_cache(); $ret[] = update_sql("DELETE FROM {cache}"); + return $ret; } function emvideo_update_6() { $ret = _emvideo_update_reset_cache_views(); + return $ret; } -// I'd like this to be conditional, so it only runs if they don't have views installed. -// however, module_exists doesn't actually work in the update scripts. +/** + * I'd like this to be conditional, so it only runs if they don't have Views + * installed. However, module_exists doesn't actually work in the update scripts. + */ function _emvideo_update_reset_cache_views() { $ret = array(); $ret[] = update_sql("DELETE FROM {cache_views}"); + return $ret; } 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.2 diff -u -r1.1.2.2 emvideo.theme.inc --- contrib/emvideo/emvideo.theme.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/emvideo.theme.inc 25 Jul 2008 06:40:41 -0000 @@ -7,9 +7,9 @@ */ /** - * formatter for emvideo_video_embed - * - * this will return the 'embed code', typically used to embed media in an external site or blog. + * Formatter for emvideo_video_embed. + * This will return the 'embed code', typically used to embed media in an + * external site or blog. */ function theme_emvideo_video_embed($field, $item, $formatter, $node, $options = array()) { /* @@ -25,52 +25,55 @@ 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. + * 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. + * @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 + // 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 : module_invoke('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 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 + // 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) { @@ -93,7 +96,7 @@ $output = ''. $image_alt .''; } else { - $output = l(''. $image_alt .'', $link_url, array(), NULL, NULL, false, true); + $output = l(''. $image_alt .'', $link_url, array(), NULL, NULL, FALSE, TRUE); } } else { @@ -118,6 +121,7 @@ $output = module_invoke('emfield', 'include_invoke', 'emvideo', $item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay, $options); } $output .= 'test2'; + return $output; } @@ -133,23 +137,26 @@ $autoplay = $options['autoplay'] ? $options['autoplay'] : $field['widget']['preview_autoplay']; $output = module_invoke('emfield', 'include_invoke', '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); + $thumbnail = theme('emvideo_video_thumbnail', $field, $item, 'video_thumbnail', $node, TRUE, $options); $destination = 'video-cck/thickbox/'. $node->nid .'/'. $field['widget']['video_width'] .'/'. $field['widget']['video_height'] .'/'. $field['field_name']; $options = array( - 'attributes'=> array( + 'attributes' => array( 'title' => $title, 'class' => 'thickbox', - 'rel' => $field['type_name']), + 'rel' => $field['type_name'], + ), 'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE, - ); - $output = l($thumbnail, $destination, $options); - return $output; + ); + $output = l($thumbnail, $destination, $options); + + return $output; } Index: contrib/emvideo/emvideo.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.module,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 emvideo.module --- contrib/emvideo/emvideo.module 23 Jul 2008 01:12:06 -0000 1.1.2.2 +++ contrib/emvideo/emvideo.module 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ MENU_CALLBACK, ); } + return $items; } /** - * Implement hook_emfield_info + * Implementation of hook_emfield_info(). */ function emvideo_emfield_info() { $name = t('Embedded Video Field'); @@ -67,18 +73,19 @@ } /** - * Implement hook_emfield_settings + * 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. + * 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 emvideo_emfield_settings() { $form = array(); + return $form; } /** - * Implementation of hook_field_info + * Implementation of hook_field_info(). */ function emvideo_field_info() { $fields = array( @@ -91,6 +98,7 @@ ), ), ); + return $fields; } @@ -99,9 +107,9 @@ */ function emvideo_field_settings($op, $field) { switch ($op) { - case 'database columns': return module_invoke('emfield', 'field_columns', $field); + case 'filters': return array( 'not null' => array( @@ -123,6 +131,7 @@ ), ); break; + case 'arguments': return array( 'content: '. $field['field_name'] => array( @@ -141,20 +150,24 @@ } /** - * implement hook_content_is_empty + * Implementation of hook_content_is_empty(). */ function emvideo_content_is_empty($item, $field) { return module_invoke('emfield', 'emfield_content_is_empty', $item, $field); } -//** Implementation of hook_field **/ +/** + * Implementation of hook_field(). + */ function emvideo_field($op, &$node, $field, &$items, $teaser, $page) { if (module_hook('emfield', 'emfield_field')) { return emfield_emfield_field($op, $node, $field, $items, $teaser, $page, 'emvideo'); } } -/** Implementation of hook_field_formatter_info **/ +/** + * Implementation of hook_field_formatter_info() + */ function emvideo_field_formatter_info() { $types = array('emvideo', ); $formats = array( @@ -179,24 +192,30 @@ 'field types' => $types, ), ); - // add thickbox formatter if thickbox module exists + + // 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 **/ +/** + * Implementation of hook_field_formatter(). + */ function emvideo_field_formatter($field, $item, $formatter, $node) { return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'emvideo'); } /** Widgets **/ -/** Implementation of hook_widget_info **/ +/** + * Implementation of hook_widget_info + */ function emvideo_widget_info() { return array( 'emvideo_textfields' => array( @@ -344,8 +363,9 @@ } } -/** Implementation of hook_widget **/ - +/** + * Implementation of hook_widget() + */ function emvideo_widget(&$form, &$form_state, $field, $items, $delta = 0) { if (module_hook('emfield', 'emfield_widget')) { return emfield_emfield_widget($form, $form_state, $field, $items, $delta, 'emvideo'); @@ -367,13 +387,15 @@ '#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 EMVIDEO_PROVIDER_RSS($item, $teaser) + * 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($item, $teaser). */ function emvideo_emfield_rss($node, $items = array(), $teaser = NULL) { $rss_data = array(); @@ -383,6 +405,7 @@ $rss_data[] = module_invoke('emfield', 'include_invoke', 'emvideo', $item['provider'], 'rss', $item, $teaser); } } + return $rss_data; } @@ -391,18 +414,18 @@ } /** - * 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. + * 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 emvideo_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('emvideo_video_video', $field, $item, 'video_video', $node); + $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('emvideo_video_video', $field, $item, 'video_video', $node); } Index: contrib/emvideo/providers/myspace.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/myspace.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 myspace.inc --- contrib/emvideo/providers/myspace.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/myspace.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ data; } + return $thumbnail; } 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.2 diff -u -r1.1.2.2 youtube.inc --- contrib/emvideo/providers/youtube.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/youtube.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ 'fieldset', '#title' => t('YouTube API'), '#description' => t('The API is no longer required. However, there may be future features requiring it (such as the ability to display otherwise private videos). You will first need to apply for an API Developer Key from the !youtube. Note that you do not need this key to display YouTube videos or their thumbnails.', array('!youtube' => l('YouTube Developer Profile page', EMVIDEO_YOUTUBE_API_APPLICATION_URL, array('target' => '_blank')))), - '#collapsible' => true, - '#collapsed' => true, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); $form['youtube']['api']['emvideo_youtube_api_key'] = array( '#type' => 'textfield', @@ -73,8 +78,8 @@ '#type' => 'fieldset', '#title' => t('Embedded Video Player Colors'), '#description' => t('If allowed, these two colors, in hexidecimal form (#RRGGBB), will be used to skin the YouTube player.'), - '#collapsible' => true, - '#collapsed' => true, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); $form['youtube']['colors']['emvideo_youtube_show_colors'] = array( '#type' => 'checkbox', @@ -111,7 +116,7 @@ '#title' => t('Color 2 picker'), '#description' => t('Click in this textfield to start picking your color'), ); - } + } else { $form['youtube']['colors']['#description'] .= t(' The !colorpicker, if active, gives an easy way to select these colors.', array('!colorpicker' => l(t('Colorpicker module'), 'http://drupal.org/project/colorpicker'))); } @@ -158,7 +163,7 @@ else { $data = emvideo_youtube_data(NULL, $item); } - + $file = array(); if (is_array($data['flash'])) { $file['filepath'] = $data['flash']['url']; @@ -223,8 +228,9 @@ function emvideo_youtube_convert_color($color = NULL) { if ($color{0} == '#') { - return substr($color, 1); + return drupal_substr($color, 1); } + return $color; } @@ -240,7 +246,7 @@ if (variable_get('emvideo_youtube_show_colors', FALSE)) { $color1 = emvideo_youtube_convert_color(variable_get('emvideo_youtube_colors_color1', EMVIDEO_YOUTUBE_COLOR1_DEFAULT)); $color2 = emvideo_youtube_convert_color(variable_get('emvideo_youtube_colors_color2', EMVIDEO_YOUTUBE_COLOR2_DEFAULT)); - $colors='&color1=0x'.$color1.'&color2=0x'.$color2; + $colors='&color1=0x'. $color1 .'&color2=0x'. $color2; } $border = (variable_get('emvideo_youtube_show_border', FALSE) == FALSE ? '' : '&border=1'); $output .= " @@ -270,19 +276,20 @@ */ function emvideo_youtube_thumbnail($field, $item, $formatter, $node, $width, $height) { $youtube_id = $item['value']; - // old code to grab thumbnail via api -// $request = emvideo_youtube_request('youtube.videos.get_details', array('video_id' => $youtube_id)); -// $tn = $request['THUMBNAIL_URL'][0]; + // Old code to grab thumbnail via API. +//$request = emvideo_youtube_request('youtube.videos.get_details', array('video_id' => $youtube_id)); +//$tn = $request['THUMBNAIL_URL'][0]; // if we have a large thumbnail size, then get the larger version available. if ($width > 130 || $height > 97) { $tn = "http://img.youtube.com/vi/$youtube_id/0.jpg"; - } + } else { // youtube offers 3 thumbnails. select one randomly. $rand = rand(0, 2) + 1; $tn = "http://img.youtube.com/vi/$youtube_id/$rand.jpg"; } + return $tn; } Index: contrib/emvideo/providers/spike.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/spike.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 spike.inc --- contrib/emvideo/providers/spike.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/spike.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ - if ($embed) { + if ($embed) { $autoplay = $autoplay ? ' autoplay="true"' : ''; $output = ' '; } + return $output; } @@ -54,7 +60,8 @@ * TODO: Is this correct? Using ifilmpro for thumbnails. */ function emvideo_spike_thumbnail($field, $item, $formatter, $node, $width, $height) { - $picturelink = substr($item['value'], 0, 7); + $picturelink = drupal_substr($item['value'], 0, 7); + return 'http://img1.ifilmpro.com/resize/image/stills/films/resize/istd/'. $picturelink .'.jpg?width='. $width; } Index: contrib/emvideo/providers/sevenload.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/sevenload.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 sevenload.inc --- contrib/emvideo/providers/sevenload.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/sevenload.inc 25 Jul 2008 06:40:41 -0000 @@ -1,9 +1,14 @@ 'livevideo', 'name' => $name, @@ -44,8 +50,8 @@ '#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 !livevideo. Note that you do not need this key to display Live Video videos themselves.', array('!livevideo' => l('Live Video Developer Profile page', EMVIDEO_LIVEVIDEO_API_APPLICATION_URL, array('target' => '_blank')))), - '#collapsible' => true, - '#collapsed' => true, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); $form['livevideo']['api']['emvideo_livevideo_api_key'] = array( '#type' => 'textfield', @@ -53,16 +59,17 @@ '#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) { +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; } @@ -110,6 +117,7 @@ $autostart = $autoplay ? '&autoStart=1' : ''; $output .= ''; } + return $output; } @@ -129,6 +137,7 @@ $args = array('videoId' => $item['value']); $request = emvideo_livevideo_request($method, $args); $tn = $request['VIDEODETAILS']['DEFAULTTHUMBNAIL'][0]; + return $tn; } @@ -150,6 +159,7 @@ */ function emvideo_livevideo_video($embed, $width, $height, $field, $item, $autoplay) { $output = theme('emvideo_livevideo_flash', $embed, $width, $height, $autoplay); + return $output; } @@ -171,5 +181,6 @@ */ function emvideo_livevideo_preview($embed, $width, $height, $field, $item, $autoplay) { $output = theme('emvideo_livevideo_flash', $embed, $width, $height, $autoplay); + return $output; } Index: contrib/emvideo/providers/zzz_custom_url.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/zzz_custom_url.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 zzz_custom_url.inc --- contrib/emvideo/providers/zzz_custom_url.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/zzz_custom_url.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ '; case 'rm': $autostart = $autoplay ? 'true' : 'false'; - return '
'; + return '
'; case 'swf': return ''; case 'flv': Index: contrib/emvideo/providers/bliptv.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/bliptv.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 bliptv.inc --- contrib/emvideo/providers/bliptv.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/bliptv.inc 25 Jul 2008 06:40:41 -0000 @@ -1,5 +1,11 @@ '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, + '#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, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); $form['video_formats']['rss']['emvideo_bliptv_rss_tag'] = array( @@ -148,7 +154,8 @@ 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')); + + return module_invoke('emfield', 'request_xml', 'bliptv', $file, $args, $cacheable, FALSE, $code .':'. $skin . ($show ? ':show' : ':post')); } function emvideo_bliptv_extract($embed) { @@ -187,8 +194,8 @@ } /** - * 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 + * 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']) { @@ -205,7 +212,7 @@ // grab the preferred filetype rather than tag, so .mov rather than 'web' if ($video_info == 'override') { - $var = 'emvideo_bliptv_rss_format'; + $var = 'emvideo_bliptv_rss_format'; $video_info = _emvideo_bliptv_get_video_info_from_preferred_tag($data, $var); } Index: contrib/emvideo/providers/revver.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/revver.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 revver.inc --- contrib/emvideo/providers/revver.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/revver.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ 'fieldset', '#title' => t('Revver affiliate program'), '#description' => t('You may share ad revenue if you publish Revver videos through their !program.', array('!program' => l('Affiliate Program', EMVIDEO_REVVER_AFFILIATE_PROGRAM_URL, array('target' => '_blank')))), - '#collapsible' => true, - '#collapsed' => true, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); $form['revver']['api']['emvideo_revver_affiliate_id'] = array( '#type' => 'textfield', Index: contrib/emvideo/providers/metacafe.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/providers/Attic/metacafe.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 metacafe.inc --- contrib/emvideo/providers/metacafe.inc 18 Jul 2008 20:29:04 -0000 1.1.2.2 +++ contrib/emvideo/providers/metacafe.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ 'emfield.admin.inc', 'title' => 'Embedded Media Field configuration', - 'description' => t('Configure Embedded Media Field: Allow content types to use various 3rd party providers, enter API keys, etc.'), + 'description' => 'Configure Embedded Media Field: Allow content types to use various 3rd party providers, enter API keys, etc.', 'page callback' => 'drupal_get_form', 'page arguments' => array('emfield_settings'), 'access arguments' => array('administer site configuration'), @@ -28,11 +33,12 @@ function emfield_field_columns($field) { module_load_include('inc', 'emfield', 'emfield.cck'); + return _emfield_field_columns($field); } /** - * This is a function to help implement hook_field, called by the various Embedded Media Field modules. + * A helper function for hook_field(), called by the various sub-modules. */ function emfield_emfield_field($op, &$node, $field, &$items, $teaser, $page, $module) { module_load_include('inc', 'emfield', 'emfield.cck'); @@ -54,7 +60,7 @@ $providers = array(); $allow_all = TRUE; foreach ($allowed_providers as $test) { - if (!variable_get('emfield_' . $module . '_allow_' . $test->name, TRUE)) { + if (!variable_get('emfield_'. $module .'_allow_'. $test->name, TRUE)) { unset($allowed_providers[$test->name]); } else { @@ -68,6 +74,7 @@ } } } + return $allowed_providers; } @@ -111,19 +118,22 @@ } cache_set('emfield_implement_types', serialize($types), 'cache', CACHE_PERMANENT); + return $types; } /** - * This will parse the url or embedded code pasted by the node submitter. - * @return - * Either an empty array (if no match), or an array of 'provider' and 'value'. + * This will parse the url or embedded code pasted by the node submitter. + * + * @return + * Either an empty array (if no match), or an array of 'provider' and 'value'. */ function emfield_parse_embed($field, $embed = '', $module) { $providers = emfield_allowed_providers($field, $module); foreach ($providers as $provider) { $success = emfield_include_invoke($module, $provider->name, 'extract', $embed, $field); - // we've been given an array of regex strings, so let's see if we can find a match + + // We've been given an array of regex strings, so try to find a match. if (is_array($success)) { foreach ($success as $regex) { $matches = NULL; @@ -137,6 +147,7 @@ return array('provider' => $provider->name, 'value' => $success); } } + // We found no match. return array(); } @@ -151,6 +162,7 @@ if ($item['embed'] && !$item['value']) { form_set_error($error_field, t('You have specified an invalid media URL or embed code.')); } + return $item; } @@ -161,6 +173,7 @@ function _emfield_field_submit_id($field, $item, $module) { $item = array_merge($item, emfield_parse_embed($field, $item['embed'], $module)); $item['data'] = (array)emfield_include_invoke($module, $item['provider'], 'data', $field, $item); + return $item; } @@ -192,6 +205,7 @@ // The individual modules actually define the theme for the formatter. $output .= theme($module .'_'. $formatter, $field, $item, $formatter, $node); + return $output; } @@ -203,6 +217,7 @@ function emfield_emfield_widget(&$form, &$form_state, $field, $items, $delta = 0, $module) { module_load_include('inc', 'emfield', 'emfield.cck'); + return _emfield_emfield_widget($form, $form_state, $field, $items, $delta, $module); } @@ -216,6 +231,7 @@ 'callback' => 'emfield_operations_reload', ), ); + return $operations; } @@ -269,13 +285,13 @@ function emfield_request_xml($provider, $url, $args = array(), $cached = TRUE, $return_errors = FALSE, $hash_extra = FALSE, $serialized = FALSE) { ksort($args); - // build an argument hash that we'll use for the cache id and api signing + // Build an argument hash that we'll use for the cache id and api signing. $arghash = $provider .':'; foreach ($args as $k => $v) { $arghash .= $k . $v; } - // build the url + // Build the url. foreach ( $args as $k => $v) { $encoded_params[] = urlencode($k) .'='. urlencode($v); } @@ -306,6 +322,7 @@ ); } emfield_set_error(t("Could not connect to @provider, HTTP error @error", array('@error' => $result->code, '@provider' => $provider))); + return array(); } @@ -320,7 +337,9 @@ 'message' => 'The response was corrupted, it could not be unserialized.', ); } + emfield_set_error(t("The response from @provider was corrupted and could not be unserialized.", array('@provider' => $provider))); + return array(); } } @@ -358,21 +377,22 @@ } cache_set($arghash, serialize($response), 'cache', time() + variable_get('emfield_cache_duration', 3600)); + return $response; } /** - * Get the HTTP Header of media, for mime-type and length + * Get the HTTP Header of media, for mime-type and length. * - * @param $provider - * the string of the third party provider, such as 'youtube', 'flikr', or 'google' - * @param $url - * the url for the media - * @param $cached - * optional; if TRUE, the result of this xml request will be cached. good to play nice w/ - * the third party folks so they don't stop providing service to your site... - * @return - * the header results returned as an array + * @param $provider + * The string of the third party provider, such as 'youtube', 'flikr', or 'google'. + * @param $url + * The url for the media. + * @param $cached + * Optional; if TRUE, the result of this xml request will be cached. good to play nice w/ + * the third party folks so they don't stop providing service to your site... + * @return + * The header results, returned as an array. */ function emfield_request_header($provider, $url, $cached = TRUE, $return_errors = TRUE) { // if it's cacheable, try to load a cached value @@ -388,11 +408,13 @@ } emfield_set_error(t("Could not connect to @provider, HTTP error @error", array('@error' => $result->code, '@provider' => $provider))); + return array(); } // @todo does this not want to be changing 'cache' to 'cache_emfield' or similar cache_set($url, serialize($result), 'cache', time() + variable_get('emfield_cache_duration', 3600)); + return $result; } @@ -518,7 +540,7 @@ } /** - * Custom filter for provider NOT NULL + * Custom filter for provider NOT NULL. */ function emfield_views_handler_filter_is_not_null($op, $filter, $filterinfo, &$query) { if ($op == 'handler') { @@ -545,7 +567,7 @@ } /** - * Views handler for the provider list filter. + * Views handler for the provider list filter. */ function emfield_views_handler_filter_provider($op, $filter, $filterinfo, &$query) { if ($op == 'handler') { @@ -575,14 +597,14 @@ */ function _emfield_handler_arg_provider($op, &$query, $argtype, $arg = '', $module = '') { if ($op == 'filter') { - $field_name = substr($argtype['type'], 10); + $field_name = drupal_substr($argtype['type'], 10); } else { - $field_name = substr($argtype, 10); + $field_name = drupal_substr($argtype, 10); } $field = content_fields($field_name); - $db_info = content_database_info($field); + $db_info = content_database_info($field); // TODO: This hook no longer exists in D6. $main_column = $db_info['columns']['provider']; // The table name used here is the Views alias for the table, not the actual @@ -616,4 +638,3 @@ return $title ? $title : check_plain($query); } } - Index: emfield.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/Attic/emfield.admin.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 emfield.admin.inc --- emfield.admin.inc 20 Jul 2008 15:24:22 -0000 1.1.2.2 +++ emfield.admin.inc 25 Jul 2008 06:40:41 -0000 @@ -2,12 +2,12 @@ // $Id: emfield.admin.inc,v 1.1.2.2 2008/07/20 15:24:22 alexua Exp $ /** - * @file - * Our administrative settings pages. + * @file + * The administrative settings page. */ /** - * Callback for admin/content/emfield + * Callback for admin/content/emfield. */ function emfield_settings() { if (!module_exists('emvideo') && !module_exists('emimage') && !module_exists('emaudio')) { @@ -21,6 +21,7 @@ '#collapsible' => TRUE, '#collapsed' => TRUE, ); + if (module_exists('swfobject_api')) { $swfobject_desc = t('As you have the !swfobject_api module installed, Embedded Media Field will use those settings, assuming you\'ve configured them properly. Visit its !settings for more information.', array('!swfobject_api' => l(t('SWFObject API'), 'http://drupal.org/project/swfobject_api', array('target' => '_blank')), l(t('settings page'), 'admin/settings/swfobject_api'))); } @@ -39,6 +40,7 @@ '#default_value' => variable_get('emfield_swfobject', FALSE), '#description' => t('When checked, then Embedded Media Field will use the SWFObject javascript library when it is able.'), ); + if (!module_exists('swfobject_api')) { $form['general']['swfobject']['emfield_swfobject_location'] = array( '#type' => 'textfield', @@ -48,6 +50,7 @@ ); } $header = array(t('Feature'), t('Supported'), t('Notes')); + foreach (module_implements('emfield_info', TRUE) as $module) { $emfield_info = module_invoke($module, 'emfield_info'); $providers = emfield_system_list($module); @@ -101,4 +104,3 @@ return system_settings_form($form); } - Index: emfield.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/emfield.info,v retrieving revision 1.1.6.4 diff -u -r1.1.6.4 emfield.info --- emfield.info 27 May 2008 02:37:00 -0000 1.1.6.4 +++ emfield.info 25 Jul 2008 06:40:41 -0000 @@ -1,8 +1,7 @@ ; $Id: emfield.info,v 1.1.6.4 2008/05/27 02:37:00 alexua Exp $ + name = Embedded Media Field -core = 6.x description = Provides an engine for modules to integrate various 3rd party content providers, such as Video Neighborhood, Image Neighborhood, and Audio Neighborhood. +core = 6.x dependencies[] = content package = CCK - - Index: emfield.rss.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/Attic/emfield.rss.inc,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 emfield.rss.inc --- emfield.rss.inc 23 Jun 2008 15:09:15 -0000 1.1.2.1 +++ emfield.rss.inc 25 Jul 2008 06:40:41 -0000 @@ -1,9 +1,15 @@ type); + foreach ($type['fields'] as $field) { if (module_hook($field['type'], 'emfield_info')) { $items = (array)$node->{$field['field_name']}; @@ -21,6 +27,7 @@ } } } + if (is_array($rss_encl)) { // by now the delta doesn't matter we have enough data in the individual arrays $files = array_merge($files, $rss_encl); @@ -30,6 +37,7 @@ $enclosure = array(); $rss = array(); + foreach ($files as $file) { // RRS2 enclosure http://cyber.law.harvard.edu/rss/rss.html#ltenclosuregtSubelementOfLtitemgt if ( @@ -109,7 +117,7 @@ } } - // work around for http://drupal.org/node/157709 + // Workaround for http://drupal.org/node/157709. static $been_here = FALSE; if (! $been_here) { $rss[] = array('namespace' => array('xmlns:media="http://search.yahoo.com/mrss/"')); Index: emfield.cck.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/Attic/emfield.cck.inc,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 emfield.cck.inc --- emfield.cck.inc 24 Jul 2008 23:37:04 -0000 1.1.2.4 +++ emfield.cck.inc 25 Jul 2008 06:40:41 -0000 @@ -29,13 +29,16 @@ $columns = array_merge($columns, $extra); } } + return $columns; } -/** Implementation of hook_emfield_field **/ +/** + * Implementation of hook_emfield_field(). + */ function _emfield_emfield_field($op, &$node, $field, &$items, $teaser, $page, $module) { switch ($op) { - // TODO: nothing to validate at the moment. we need to have different provider api's have a chance to validate + // TODO: Nothing to validate at the moment. We need to have different provider api's have a chance to validate. case 'validate': foreach ($items as $delta => $item) { $error_field = $field['multiple'] ? $field['field_name'] .']['. $delta .'][embed' : $field['field_name']; @@ -53,24 +56,25 @@ break; case 'load': - // We need to unserialize the 'data' column manually + // We need to unserialize the 'data' column manually. $field_name = $field['field_name']; foreach ($items as $delta => $item) { $data = (array)unserialize($items[$delta]['data']); $items[$delta]['data'] = $data; $node->{$field_name}[$delta]['data'] = $data; } + $return = array(); $return[$field_name] = $items; break; - - case 'sanitize': - foreach ($items as $delta => $item) { + + case 'sanitize': + foreach ($items as $delta => $item) { $content = module_invoke($module, 'field_formatter', $field, $item, 'video_video', $node); $items[$delta]['value'] = $content; - } + } break; - + case 'delete': break; } @@ -88,13 +92,14 @@ $items[$delta]['data'] = serialize($items[$delta]['data']); } } + return $return; } function _emfield_emfield_widget_settings($op, $widget, $module) { switch ($op) { case 'form': - // make sure to register the new type as supported by this module + // Make sure to register the new type as supported by this module. emfield_implement_types(FALSE); $form = array(); @@ -131,19 +136,16 @@ foreach (module_implements('emfield_widget_settings_extra') as $module) { $columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget)); } + return $columns; } } -/** - * @file - * This defines our various field and widget settings. - */ /** - * This creates default widget handling for all the Embedded Media Fields. - * Helper modules are expected to call this function to create the widget, which will include a list of all providers, - * as well as handle the parsing of the data. + * This creates default widget handling for all the Embedded Media Fields. + * Helper modules are expected to call this function to create the widget, + * which will include a list of all providers as well as handle data parsing. */ function _emfield_emfield_widget(&$form, &$form_state, $field, $items, $delta = 0, $module) { //($op, &$node, $field, &$node_field, $module) { // Our form element will need to be processed as a tree, collapsing any children elements. @@ -152,6 +154,7 @@ $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)) { @@ -166,6 +169,7 @@ } } } + // Set the widget description, but allow the field to override this. if (!(empty($field['widget']['description']))) { $textfield_description = $field['widget']['description']; @@ -173,6 +177,7 @@ else { $textfield_description = t('Enter the URL or Embed Code here. The embedded third party content will be parsed and displayed appropriately from this.'); } + // Add a list of all supported third party providers. $textfield_description .= '
'. t('The following services are provided: !urls', array('!urls' => implode(', ', $urls))); // Get the value of our data, if it's been set for this node. @@ -190,11 +195,13 @@ '#type' => 'value', '#value' => $value, ); + if (!empty($additional_form_elements)) { foreach ($additional_form_elements as $key => $element) { $tree[$key] = $element; } } + if ($value) { $info = emfield_include_invoke($module, $items[$delta]['provider'], 'info'); $tree['value_markup'] = array( @@ -202,9 +209,11 @@ '#value' => t('(@provider ID: !value)', array('@provider' => $info['provider'], '!value' => l($value, emfield_include_invoke($module, $info['provider'], 'embedded_link', $value, $items[$delta]['data']), array('target' => '_blank')))), ); } + // Allow other modules, such as Embedded Media Thumbnail, to add additional elements to the widget. foreach (module_implements('emfield_widget_extra') as $module_extra) { $tree[$module_extra] = module_invoke($module_extra, 'emfield_widget_extra', 'form', $form, $field, $items[$delta]); } + return $tree; } Index: contrib/emaudio/providers/podcastalley.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emaudio/providers/podcastalley.inc,v retrieving revision 1.1.4.3 diff -u -r1.1.4.3 podcastalley.inc --- contrib/emaudio/providers/podcastalley.inc 27 May 2008 02:37:00 -0000 1.1.4.3 +++ contrib/emaudio/providers/podcastalley.inc 25 Jul 2008 06:40:41 -0000 @@ -1,10 +1,19 @@ 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. @@ -18,6 +27,7 @@ array(t('RSS Attachment'), t('No'), ''), array(t('Thumbnails'), t('No'), t('')), ); + return array( 'provider' => 'Podcast Alley', 'name' => $name, @@ -29,6 +39,7 @@ /** * 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. @@ -40,11 +51,17 @@ /** * 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. + * + * @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# @@ -55,13 +72,16 @@ /** * 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) { + /* + if ($autoplay) { $autoplay_value = '&autostart=1'; - }*/ + } + */ $output .= " @@ -77,16 +97,22 @@ \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. + * + * @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; @@ -94,31 +120,49 @@ /** * 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. + * + * 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. + * + * 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; } - Index: contrib/emaudio/providers/podomatic.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emaudio/providers/podomatic.inc,v retrieving revision 1.1.4.4 diff -u -r1.1.4.4 podomatic.inc --- contrib/emaudio/providers/podomatic.inc 27 May 2008 02:37:00 -0000 1.1.4.4 +++ contrib/emaudio/providers/podomatic.inc 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ The translated name of the provider. @@ -30,22 +38,30 @@ /** * 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. + * + * @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( @@ -56,13 +72,17 @@ /** * 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) { + /* + if ($autoplay) { $autoplay_value = '&autostart=1'; - }*/ + } + */ + $output .= " @@ -71,24 +91,30 @@ - \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. + * + * @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; @@ -96,31 +122,48 @@ /** * 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. + * + * @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. + * + * @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; } - Index: contrib/emaudio/emaudio.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emaudio/emaudio.install,v retrieving revision 1.1.4.5 diff -u -r1.1.4.5 emaudio.install --- contrib/emaudio/emaudio.install 30 May 2008 13:29:04 -0000 1.1.4.5 +++ contrib/emaudio/emaudio.install 25 Jul 2008 06:40:41 -0000 @@ -2,6 +2,11 @@ // $Id: emaudio.install,v 1.1.4.5 2008/05/30 13:29:04 aaron Exp $ /** + * @file + * This is the emaudio.module's install, configuration, and removal file. + */ + +/** * Implementation of hook_install(). */ function emaudio_install() { @@ -16,21 +21,22 @@ } /** -* Implementation of hook_enable(). -*/ + * Implementation of hook_enable(). + */ function emaudio_enable() { content_notify('enable', 'emaudio'); } /** -* Implementation of hook_disable(). -*/ + * Implementation of hook_disable(). + */ function emaudio_disable() { content_notify('disable', 'emaudio'); } function emaudio_update_1() { $ret = _emaudio_update_reset_cache_views(); + return $ret; } Index: contrib/emaudio/emaudio.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emaudio/emaudio.module,v retrieving revision 1.1.4.12 diff -u -r1.1.4.12 emaudio.module --- contrib/emaudio/emaudio.module 5 Jul 2008 20:55:40 -0000 1.1.4.12 +++ contrib/emaudio/emaudio.module 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,11 @@ array( @@ -40,16 +46,18 @@ ), ), ); + return $fields; } -/** Implementation of hook_field_settings **/ - +/** + * Implementation of hook_field_settings(). + */ function emaudio_field_settings($op, $field) { switch ($op) { - case 'database columns': return module_invoke('emfield', 'field_columns', $field); + case 'filters': return array( 'not null' => array( @@ -71,6 +79,7 @@ ), ); break; + case 'arguments': return array( 'content: '. $field['field_name'] => array( @@ -92,7 +101,9 @@ return _emfield_handler_arg_provider($op, $query, $argtype, $arg, 'emaudio'); } -/** Implementation of hook_field **/ +/** + * Implementation of hook_field(). + */ function emaudio_field($op, &$node, $field, &$items, $teaser, $page) { if (module_hook('emfield', 'emfield_field')) { return emfield_emfield_field($op, $node, $field, $items, $teaser, $page, 'emaudio'); @@ -100,13 +111,15 @@ } /** - * implement hook_content_is_empty + * Implementation of hook_content_is_empty(). */ function emaudio_content_is_empty($item, $field) { return module_invoke('emfield', 'emfield_content_is_empty', $item, $field); } -/** Implementation of hook_field_formatter_info **/ +/** + * Implementation of hook_field_formatter_info(). + */ function emaudio_field_formatter_info() { $types = array('emaudio', ); $formats = array( @@ -131,18 +144,22 @@ 'field types' => $types, ), ); + return $formats; } -/** Implementation of hook_field_formatter **/ - +/** + * Implementation of hook_field_formatter(). + */ function emaudio_field_formatter($field, $item, $formatter, $node) { return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'emaudio'); } /** Widgets **/ -/** Implementation of hook_widget_info **/ +/** + * Implementation of hook_widget_info(). + */ function emaudio_widget_info() { return array( 'emaudio_textfields' => array( @@ -255,6 +272,7 @@ '#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': @@ -284,14 +302,16 @@ if ($widget['widget_type'] == 'emaudio_textfields') { $columns = array('audio_width', 'audio_height', 'audio_autoplay', 'preview_width', 'preview_height', 'preview_autoplay', 'thumbnail_width', 'thumbnail_height', 'thumbnail_default_path', ); $columns = array_merge($columns, module_invoke('emfield', 'emfield_widget_settings', 'save', $widget, 'emaudio')); + return $columns; } break; } } -/** Implementation of hook_widget **/ - +/** + * Implementation of hook_widget(). + */ function emaudio_widget(&$form, &$form_state, $field, $items, $delta = 0) { if (module_hook('emfield', 'emfield_widget')) { return emfield_emfield_widget($form, $form_state, $field, $items, $delta, 'emaudio'); @@ -311,13 +331,15 @@ '#description' => t('To embed this audio on your own site, simply copy and paste the html code from this text area.'), '#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 emaudio_PROVIDER_rss($item, $teaser) + * 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 emaudio_PROVIDER_rss($item, $teaser). */ function emaudio_emfield_rss($node, $items = array(), $teaser = NULL) { $rss_data = array(); @@ -327,6 +349,7 @@ $rss_data[] = module_invoke('emfield', 'include_invoke', 'emaudio', $item['provider'], 'rss', $item, $teaser); } } + return $rss_data; } @@ -363,24 +386,26 @@ if ($item['value'] && $item['provider']) { $output = drupal_get_form('emaudio_embed_form', $field, $item, $formatter, $node); } + return $output; } function theme_emaudio_emaudio_thumbnail($field, $item, $formatter, $node) { if ($item['value'] && $item['provider']) { - // if we have emthumb installed, then give it a chance to override our thumbnail + // If we have emthumb installed, then give it a chance to override our thumbnail. $thumbnail_url = module_invoke('emthumb', 'thumbnail_url', $item); - // if we don't have a custom thumbnail, then see if the provider gives us one + // If we don't have a custom thumbnail, then see if the provider gives us one. $thumbnail_url = $thumbnail_url ? $thumbnail_url : module_invoke('emfield', 'include_invoke', 'emaudio', $item['provider'], 'thumbnail', $field, $item, $formatter, $node, $width, $height); - // if we still don't have a thumbnail, then apply a default thumbnail, if it exists + // If we still don't have a thumbnail, then apply a default thumbnail. 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; } } + if ($thumbnail_url) { $width = $field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('emaudio_default_thumbnail_width', EMAUDIO_DEFAULT_THUMBNAIL_WIDTH); $height = $field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('emaudio_default_thumbnail_height', EMAUDIO_DEFAULT_THUMBNAIL_HEIGHT); @@ -391,6 +416,7 @@ $output = l(t('Hear Audio'), 'node/'. $node->nid); } } + return $output; } @@ -402,6 +428,7 @@ $autoplay = $field['widget']['audio_autoplay']; $output = module_invoke('emfield', 'include_invoke', 'emaudio', $item['provider'], 'audio', $embed, $width, $height, $field, $item, $autoplay); } + return $output; } @@ -417,5 +444,6 @@ $autoplay = $field['widget']['preview_autoplay']; $output = module_invoke('emfield', 'include_invoke', 'emaudio', $item['provider'], 'preview', $embed, $width, $height, $field, $item, $autoplay); } + return $output; } Index: contrib/emaudio/emaudio.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emaudio/emaudio.info,v retrieving revision 1.1.4.4 diff -u -r1.1.4.4 emaudio.info --- contrib/emaudio/emaudio.info 27 May 2008 02:37:00 -0000 1.1.4.4 +++ contrib/emaudio/emaudio.info 25 Jul 2008 06:40:41 -0000 @@ -1,6 +1,7 @@ ; $Id: emaudio.info,v 1.1.4.4 2008/05/27 02:37:00 alexua Exp $ + name = Embedded Audio Field -core = 6.x description = Defines a field type for displaying third party music, podcasts, and other audio, such as podOmatic and Odeo. +core = 6.x dependencies[] = emfield package = CCK