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

git-svn-id: https://develop.svn.wordpress.org/trunk@2560 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2005-04-20 21:07:19 +00:00
parent ce64ce057d
commit 1589419508
1 changed files with 5 additions and 5 deletions

View File

@ -810,15 +810,15 @@ function do_enclose( $content, $post_ID ) {
endforeach;
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) ) {
$len = $headers['content-length'];
$type = $headers['content-type'];
$len = (int) $headers['content-length'];
$type = addslashes( $headers['content-type'] );
$allowed_types = array( 'video', 'audio' );
if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
$meta_value = "$url\n$len\n$type\n";
$wpdb->query( "INSERT INTO `".$wpdb->postmeta."` ( `post_id` , `meta_key` , `meta_value` )
VALUES ( '$post_ID', 'enclosure' , '".$meta_value."')" );
$wpdb->query( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` )
VALUES ( '$post_ID', 'enclosure' , '$meta_value')" );
}
}
}