From 7df3885d2eec20dfaf38fa06421ef651523c0c11 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 7 Jan 2015 07:51:22 +0000 Subject: [PATCH] Don't force newlines around URLs in WP_Embed::autoembed(). props chipx86, sgrant. fixes #23776. Built from https://develop.svn.wordpress.org/trunk@31066 git-svn-id: http://core.svn.wordpress.org/trunk@31047 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-embed.php | 6 +++--- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-wp-embed.php b/wp-includes/class-wp-embed.php index f536f71a04..1cd4d6252c 100644 --- a/wp-includes/class-wp-embed.php +++ b/wp-includes/class-wp-embed.php @@ -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]; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 5ddb6e9384..2d30ec6c14 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31065'; +$wp_version = '4.2-alpha-31066'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.