754
754
$html = $content[1] . $content[2];
756
preg_match( '/ src=([\'"])(.*?)\1/', $html, $results );
758
if ( ! empty( $results ) ) {
759
$secret = wp_generate_password( 10, false );
761
$url = esc_url( "{$results[2]}#?secret=$secret" );
764
$html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html );
765
$html = str_replace( '<blockquote', "<blockquote data-secret=\"$secret\"", $html );
768
$allowed_html['blockquote']['data-secret'] = true;
769
$allowed_html['iframe']['data-secret'] = true;
771
$html = wp_kses( $html, $allowed_html );
756
773
if ( ! empty( $content[1] ) ) {
757
774
// We have a blockquote to fall back on. Hide the iframe by default.
758
775
$html = str_replace( '<iframe', '<iframe style="position: absolute; clip: rect(1px, 1px, 1px, 1px);"', $html );
759
776
$html = str_replace( '<blockquote', '<blockquote class="wp-embedded-content"', $html );
762
$html = str_replace( '<iframe', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $html );
764
preg_match( '/ src=[\'"]([^\'"]*)[\'"]/', $html, $results );
766
if ( ! empty( $results ) ) {
767
$secret = wp_generate_password( 10, false );
769
$url = esc_url( "{$results[1]}#?secret=$secret" );
771
$html = str_replace( $results[0], " src=\"$url\" data-secret=\"$secret\"", $html );
772
$html = str_replace( '<blockquote', "<blockquote data-secret=\"$secret\"", $html );
779
$html = str_ireplace( '<iframe', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $html );