Make WordPress Core

Changeset 14109


Ignore:
Timestamp:
04/16/2010 02:15:16 PM (16 years ago)
Author:
nacin
Message:

Strip new lines from Viddler embeds, as we do for Scribd embeds. Avoids conflicts with wpautop. props Viper007Bond. see #12115.

File:
1 edited

Legend:

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

    r13996 r14109  
    5757                ) );
    5858
    59                 // Fix Scribd embeds. They contain new lines in the middle of the HTML which breaks wpautop().
    60                 add_filter( 'oembed_dataparse', array(&$this, 'strip_scribd_newlines'), 10, 3 );
     59                // Fix Scribd and Viddler embeds. They contain new lines in the middle of the HTML which breaks wpautop().
     60                add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 );
    6161        }
    6262
     
    264264
    265265        /**
    266          * Strip new lines from the HTML if it's a Scribd embed.
    267          *
     266         * Strip new lines from the HTML if it's a Scribd or Viddler embed.
     267         *
     268         * @access private
    268269         * @param string $html Existing HTML.
    269270         * @param object $data Data object from WP_oEmbed::data2html()
     
    271272         * @return string Possibly modified $html
    272273         */
    273         function strip_scribd_newlines( $html, $data, $url ) {
    274                 if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) )
     274        function _strip_newlines( $html, $data, $url ) {
     275                if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) || preg_match( '#http://(www\.)?viddler\.com/.*#i', $url ) )
    275276                        $html = str_replace( array( "\r\n", "\n" ), '', $html );
    276277
Note: See TracChangeset for help on using the changeset viewer.