Ticket #23776: autoembed-preserve-whitespace.diff
File autoembed-preserve-whitespace.diff, 951 bytes (added by , 10 years ago) |
---|
-
src/wp-includes/class-wp-embed.php
326 326 * @return string Potentially modified $content. 327 327 */ 328 328 public function autoembed( $content ) { 329 return preg_replace_callback( '|^ \s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );329 return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); 330 330 } 331 331 332 332 /** … … 340 340 public function autoembed_callback( $match ) { 341 341 $oldval = $this->linkifunknown; 342 342 $this->linkifunknown = false; 343 $return = $this->shortcode( array(), $match[ 1] );343 $return = $this->shortcode( array(), $match[2] ); 344 344 $this->linkifunknown = $oldval; 345 345 346 return "\n$return\n";346 return $match[1] . $return . $match[3]; 347 347 } 348 348 349 349 /**