WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/31/2015 01:45:34 AM (5 years ago)
Author:
azaozz
Message:

Backport r33469 and r33470 to 3.7.
See #33106.

File:
1 edited

Legend:

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

    r33389 r33525  
    281281     */
    282282    function autoembed( $content ) {
    283         // Strip newlines from all elements.
    284         $content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
     283        // Replace line breaks from all HTML elements with placeholders.
     284        $content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
    285285
    286286        // Find URLs that are on their own line.
    287         return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     287        $content = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
     288
     289        // Put the line breaks back.
     290        return str_replace( '<!-- wp-line-break -->', "\n", $content );
    288291    }
    289292
Note: See TracChangeset for help on using the changeset viewer.