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

git-svn-id: http://svn.automattic.com/wordpress/trunk@14109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-16 14:15:16 +00:00
parent 14916e2449
commit 5deebd667f
1 changed files with 6 additions and 5 deletions

View File

@ -56,8 +56,8 @@ class WP_oEmbed {
'#http://(www\.)?funnyordie\.com/videos/.*#i' => array( 'http://www.funnyordie.com/oembed', true ),
) );
// Fix Scribd embeds. They contain new lines in the middle of the HTML which breaks wpautop().
add_filter( 'oembed_dataparse', array(&$this, 'strip_scribd_newlines'), 10, 3 );
// Fix Scribd and Viddler embeds. They contain new lines in the middle of the HTML which breaks wpautop().
add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 );
}
/**
@ -263,15 +263,16 @@ class WP_oEmbed {
}
/**
* Strip new lines from the HTML if it's a Scribd embed.
* Strip new lines from the HTML if it's a Scribd or Viddler embed.
*
* @access private
* @param string $html Existing HTML.
* @param object $data Data object from WP_oEmbed::data2html()
* @param string $url The original URL passed to oEmbed.
* @return string Possibly modified $html
*/
function strip_scribd_newlines( $html, $data, $url ) {
if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) )
function _strip_newlines( $html, $data, $url ) {
if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) || preg_match( '#http://(www\.)?viddler\.com/.*#i', $url ) )
$html = str_replace( array( "\r\n", "\n" ), '', $html );
return $html;