mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-31 13:37:51 +01:00
XML-RPC: Save enclosures with a trailing new line. fixes #23219.
git-svn-id: http://core.svn.wordpress.org/trunk@24623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b6c1023caa
commit
49bb647dda
@ -4314,22 +4314,20 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return strval($post_ID);
|
||||
}
|
||||
|
||||
function add_enclosure_if_new($post_ID, $enclosure) {
|
||||
function add_enclosure_if_new( $post_ID, $enclosure ) {
|
||||
if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
|
||||
|
||||
$encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
|
||||
$encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n";
|
||||
$found = false;
|
||||
foreach ( (array) get_post_custom($post_ID) as $key => $val) {
|
||||
if ($key == 'enclosure') {
|
||||
foreach ( (array) $val as $enc ) {
|
||||
if ($enc == $encstring) {
|
||||
$found = true;
|
||||
break 2;
|
||||
}
|
||||
if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) {
|
||||
foreach ( $enclosures as $enc ) {
|
||||
// This method used to omit the trailing new line. #23219
|
||||
if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$found)
|
||||
if ( ! $found )
|
||||
add_post_meta( $post_ID, 'enclosure', $encstring );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user