Wordpress enclosure workflow:
POSTING
==========
1) wp_insert_post (post.php)
Sets the '_encloseme' meta_key if $post_status==publish and $post_type=post
2) do_all_pings action (comment.php)
for each _encloseme flag
a) Delete flag
b) call do_enclose
3) do_enclose (functions.php)
does some confusing parsing and testing (which looks like it looks at all http:// urls
in the content whether they are enclosures or not)
calls wp_get_http_headers on filtered $url values
uses the results to set 'enclosure' meta_value with url, length, and content-type
4) wp_get_http_headers (functions.php)
Reads headers from passed in URL using fsockopen() and fgets()
returns an array of headers
5)
READING
=========
1) wp-rss2.php and wp-atom.php
call rss_enclosure()
2) rss_enclosure()
call get_post_custom() to read $custom_fields
uses $custom_fields to build and display the enclosure tag