Make WordPress Core


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

Backport r33469 and r33470 to 4.0.
See #33106.

File:
1 edited

Legend:

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

    r33381 r33522  
    327327     */
    328328    public function autoembed( $content ) {
    329         // Strip newlines from all elements.
    330         $content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
     329        // Replace line breaks from all HTML elements with placeholders.
     330        $content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
    331331
    332332        // Find URLs that are on their own line.
    333         return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     333        $content = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     334
     335        // Put the line breaks back.
     336        return str_replace( '<!-- wp-line-break -->', "\n", $content );
    334337    }
    335338
Note: See TracChangeset for help on using the changeset viewer.