WordPress.org

Make WordPress Core

Ticket #12115: 12115.patch

File 12115.patch, 1.2 KB (added by Viper007Bond, 4 years ago)
  • wp-includes/class-oembed.php

     
    5252                        'http://wordpress.tv/*'                 => array( 'http://wordpress.tv/oembed/',              false ), 
    5353                ) ); 
    5454 
    55                 // Fix Scribd embeds. They contain new lines in the middle of the HTML which breaks wpautop(). 
    56                 add_filter( 'oembed_dataparse', array(&$this, 'strip_scribd_newlines'), 10, 3 ); 
     55                // Fix Scribd and Viddler embeds. They contain new lines in the middle of the HTML which breaks wpautop(). 
     56                add_filter( 'oembed_dataparse', array(&$this, 'strip_newlines'), 10, 3 ); 
    5757        } 
    5858 
    5959        /** 
     
    239239         * @param string $url The original URL passed to oEmbed. 
    240240         * @return string Possibly modified $html 
    241241         */ 
    242         function strip_scribd_newlines( $html, $data, $url ) { 
    243                 if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) ) 
     242        function strip_newlines( $html, $data, $url ) { 
     243                if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) || preg_match( '#http://(www\.)?viddler\.com/.*#i', $url ) ) 
    244244                        $html = str_replace( array( "\r\n", "\n" ), '', $html ); 
    245245 
    246246                return $html;