Don't force newlines around URLs in WP_Embed::autoembed().

props chipx86, sgrant.
fixes #23776.

git-svn-id: https://develop.svn.wordpress.org/trunk@31066 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2015-01-07 07:50:58 +00:00
parent 2fcd588983
commit 4fdc7c7a0b
2 changed files with 37 additions and 3 deletions
+3 -3
View File
@@ -311,7 +311,7 @@ class WP_Embed {
* @return string Potentially modified $content.
*/
public function autoembed( $content ) {
return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
}
/**
@@ -323,10 +323,10 @@ class WP_Embed {
public function autoembed_callback( $match ) {
$oldval = $this->linkifunknown;
$this->linkifunknown = false;
$return = $this->shortcode( array(), $match[1] );
$return = $this->shortcode( array(), $match[2] );
$this->linkifunknown = $oldval;
return "\n$return\n";
return $match[1] . $return . $match[3];
}
/**