WordPress.org

Make WordPress Core

Changeset 24623


Ignore:
Timestamp:
07/10/13 03:34:35 (10 months ago)
Author:
nacin
Message:

XML-RPC: Save enclosures with a trailing new line. fixes #23219.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r24597 r24623  
    43154315    } 
    43164316 
    4317     function add_enclosure_if_new($post_ID, $enclosure) { 
     4317    function add_enclosure_if_new( $post_ID, $enclosure ) { 
    43184318        if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 
    4319  
    4320             $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; 
     4319            $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; 
    43214320            $found = false; 
    4322             foreach ( (array) get_post_custom($post_ID) as $key => $val) { 
    4323                 if ($key == 'enclosure') { 
    4324                     foreach ( (array) $val as $enc ) { 
    4325                         if ($enc == $encstring) { 
    4326                             $found = true; 
    4327                             break 2; 
    4328                         } 
     4321            if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) { 
     4322                foreach ( $enclosures as $enc ) { 
     4323                    // This method used to omit the trailing new line. #23219 
     4324                    if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) { 
     4325                        $found = true; 
     4326                        break; 
    43294327                    } 
    43304328                } 
    43314329            } 
    4332             if (!$found) 
     4330            if ( ! $found ) 
    43334331                add_post_meta( $post_ID, 'enclosure', $encstring ); 
    43344332        } 
Note: See TracChangeset for help on using the changeset viewer.