Make WordPress Core


Ignore:
Timestamp:
07/31/2015 01:44:04 AM (10 years ago)
Author:
azaozz
Message:

Backport r33469 and r33470 to 3.9.
See #33106.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9/src/wp-includes/class-wp-embed.php

    r33386 r33523  
    292292     */
    293293    function autoembed( $content ) {
    294         // Strip newlines from all elements.
    295         $content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
     294        // Replace line breaks from all HTML elements with placeholders.
     295        $content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
    296296
    297297        // Find URLs that are on their own line.
    298         return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     298        $content = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     299
     300        // Put the line breaks back.
     301        return str_replace( '<!-- wp-line-break -->', "\n", $content );
    299302    }
    300303
Note: See TracChangeset for help on using the changeset viewer.