Index: wp-includes/feed-atom.php
===================================================================
--- wp-includes/feed-atom.php	(revision 4929)
+++ wp-includes/feed-atom.php	(working copy)
@@ -38,8 +38,8 @@
 <?php if ( !get_option('rss_use_excerpt') ) : ?>
 		<content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
 <?php endif; ?>
-<?php rss_enclosure(); ?>
+<?php atom_enclosure(); ?>
 <?php do_action('atom_entry'); ?>
 	</entry>
 	<?php endwhile ; ?>
-</feed>
+</feed>
\ No newline at end of file
Index: wp-includes/feed.php
===================================================================
--- wp-includes/feed.php	(revision 4929)
+++ wp-includes/feed.php	(working copy)
@@ -173,19 +173,29 @@
 	if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
 		return;
 
-	$custom_fields = get_post_custom();
-	if ( is_array($custom_fields) ) {
-		while ( list($key, $val) = each($custom_fields) ) { 
-			if ( $key == 'enclosure' ) {
-				if ( is_array($val) ) {
-					foreach ( (array) $val as $enc ) {
-						$enclosure = split( "\n", $enc );
-						print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
-					}
-				}
+	foreach (get_post_custom() as $k => $v) {
+		if ($key == 'enclosure') {
+			foreach ((array)$val as $enc) {
+				$enclosure = split("\n", $enc);
+				echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
 			}
 		}
 	}
 }
 
-?>
+function atom_enclosure() {
+	global $id, $post;
+	if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
+		return;
+
+	foreach (get_post_custom() as $k => $v) {
+		if ($key == 'enclosure') {
+			foreach ((array)$val as $enc) {
+				$enclosure = split("\n", $enc);
+				echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
+			}
+		}
+	}
+}
+
+?>
\ No newline at end of file

