After [31415], make sure `str_replace()` only occurs once for each matched tag to avoid overwriting until `<pre>`s.
See #31214. git-svn-id: https://develop.svn.wordpress.org/trunk@31416 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
18610ef0ad
commit
4fb31473e8
|
@ -568,6 +568,8 @@ class WP_oEmbed {
|
||||||
if ( class_exists( 'DOMDocument' ) ) {
|
if ( class_exists( 'DOMDocument' ) ) {
|
||||||
$token = '__PRE__';
|
$token = '__PRE__';
|
||||||
$replace = array();
|
$replace = array();
|
||||||
|
$count = 1;
|
||||||
|
|
||||||
$dom = new DOMDocument();
|
$dom = new DOMDocument();
|
||||||
$dom->loadHTML( $html );
|
$dom->loadHTML( $html );
|
||||||
$tags = $dom->getElementsByTagName( 'pre' );
|
$tags = $dom->getElementsByTagName( 'pre' );
|
||||||
|
@ -575,7 +577,8 @@ class WP_oEmbed {
|
||||||
$tag_html = $dom->saveHTML( $tag );
|
$tag_html = $dom->saveHTML( $tag );
|
||||||
$tag_token = $token . $i;
|
$tag_token = $token . $i;
|
||||||
$replace[ $tag_token ] = $tag_html;
|
$replace[ $tag_token ] = $tag_html;
|
||||||
$html = str_replace( $tag_html, $tag_token, $html );
|
|
||||||
|
$html = str_replace( $tag_html, $tag_token, $html, $count );
|
||||||
}
|
}
|
||||||
$pre = array_values( $replace );
|
$pre = array_values( $replace );
|
||||||
$tokens = array_keys( $replace );
|
$tokens = array_keys( $replace );
|
||||||
|
|
Loading…
Reference in New Issue