Don't enclose different things multiple times - http://mosquito.wordpress.org/view.php?id=1197

git-svn-id: http://svn.automattic.com/wordpress/trunk@2560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-04-20 21:07:19 +00:00
parent 584fb345bd
commit baffa2ef15
1 changed files with 5 additions and 5 deletions

View File

@ -810,15 +810,15 @@ function do_enclose( $content, $post_ID ) {
endforeach; endforeach;
foreach ($post_links as $url) : foreach ($post_links as $url) :
if ( $url != '' && in_array($url, $pung) == false ) { if ( $url != '' && !$wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE post_id = '$post_ID' AND meta_key = 'enclosure' AND meta_value LIKE ('$url%')") ) {
if ( $headers = wp_get_http_headers( $url) ) { if ( $headers = wp_get_http_headers( $url) ) {
$len = $headers['content-length']; $len = (int) $headers['content-length'];
$type = $headers['content-type']; $type = addslashes( $headers['content-type'] );
$allowed_types = array( 'video', 'audio' ); $allowed_types = array( 'video', 'audio' );
if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
$meta_value = "$url\n$len\n$type\n"; $meta_value = "$url\n$len\n$type\n";
$wpdb->query( "INSERT INTO `".$wpdb->postmeta."` ( `post_id` , `meta_key` , `meta_value` ) $wpdb->query( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` )
VALUES ( '$post_ID', 'enclosure' , '".$meta_value."')" ); VALUES ( '$post_ID', 'enclosure' , '$meta_value')" );
} }
} }
} }