Changeset 12580
- Timestamp:
- 12/30/2009 07:36:17 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r12537 r12580 1161 1161 foreach ( (array) $post_links as $url ) { 1162 1162 if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) { 1163 1163 1164 if ( $headers = wp_get_http_headers( $url) ) { 1164 1165 $len = (int) $headers['content-length']; 1165 1166 $type = $headers['content-type']; 1166 1167 $allowed_types = array( 'video', 'audio' ); 1168 1169 // Check to see if we can figure out the mime type from 1170 // the extension 1171 $url_parts = parse_url( $url ); 1172 $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION ); 1173 if ( !empty( $extension ) ) { 1174 foreach ( get_allowed_mime_types( ) as $exts => $mime ) { 1175 if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { 1176 $type = $mime; 1177 break; 1178 } 1179 } 1180 } 1181 1167 1182 if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { 1168 1183 $meta_value = "$url\n$len\n$type\n";
Note: See TracChangeset
for help on using the changeset viewer.