Ticket #23219: 23219.diff
File 23219.diff, 1.3 KB (added by , 11 years ago) |
---|
-
wp-includes/class-wp-xmlrpc-server.php
4303 4303 return strval($post_ID); 4304 4304 } 4305 4305 4306 function add_enclosure_if_new( $post_ID, $enclosure) {4306 function add_enclosure_if_new( $post_ID, $enclosure ) { 4307 4307 if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 4308 4309 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; 4308 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; 4310 4309 $found = false; 4311 foreach ( (array) get_post_custom($post_ID) as $key => $val) { 4312 if ($key == 'enclosure') { 4313 foreach ( (array) $val as $enc ) { 4314 if ($enc == $encstring) { 4315 $found = true; 4316 break 2; 4317 } 4310 if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) { 4311 foreach ( $enclosures as $enc ) { 4312 // This method used to omit the trailing new line. #23219 4313 if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) { 4314 $found = true; 4315 break; 4318 4316 } 4319 4317 } 4320 4318 } 4321 if ( !$found)4319 if ( ! $found ) 4322 4320 add_post_meta( $post_ID, 'enclosure', $encstring ); 4323 4321 } 4324 4322 }