Changeset 35437 for trunk/src/wp-includes/embed-functions.php
- Timestamp:
- 10/29/2015 11:10:46 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/embed-functions.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/embed-functions.php
r35436 r35437 462 462 $embed_url = get_post_embed_url( $post ); 463 463 464 $output = "<script type='text/javascript'>\n"; 464 $output = '<blockquote><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . "</a></blockquote>\n"; 465 466 $output .= "<script type='text/javascript'>\n"; 465 467 $output .= "<!--//--><![CDATA[//><!--\n"; 466 468 if ( SCRIPT_DEBUG ) { … … 753 755 754 756 $allowed_html = array( 755 'iframe' => array( 757 'a' => array( 758 'href' => true, 759 ), 760 'blockquote' => array(), 761 'iframe' => array( 756 762 'src' => true, 757 763 'width' => true, … … 767 773 768 774 $html = wp_kses( $result, $allowed_html ); 769 preg_match( '|^.*(<iframe.*?></iframe>).*$|m', $html, $iframes ); 770 771 if ( empty( $iframes ) ) { 775 776 preg_match( '|(<blockquote>.*?</blockquote>)?.*(<iframe.*?></iframe>)|ms', $html, $content ); 777 // We require at least the iframe to exist. 778 if ( empty( $content[2] ) ) { 772 779 return false; 773 780 } 774 775 $html = str_replace( '<iframe', '<iframe sandbox="allow-scripts" security="restricted"', $iframes[1] ); 781 $html = $content[1] . $content[2]; 782 783 if ( ! empty( $content[1] ) ) { 784 // We have a blockquote to fall back on. Hide the iframe by default. 785 $html = str_replace( '<iframe', '<iframe style="display:none;"', $html ); 786 } 787 788 $html = str_replace( '<iframe', '<iframe sandbox="allow-scripts" security="restricted"', $html ); 776 789 777 790 preg_match( '/ src=[\'"]([^\'"]*)[\'"]/', $html, $results ); … … 783 796 784 797 $html = str_replace( $results[0], " src=\"$url\" data-secret=\"$secret\"", $html ); 798 $html = str_replace( '<blockquote', "<blockquote data-secret=\"$secret\"", $html ); 785 799 } 786 800 … … 911 925 <?php 912 926 } 927 928 /** 929 * Prepare the oembed HTML to be displayed in an RSS feed. 930 * 931 * @since 4.4.0 932 * @access private 933 * 934 * @param string $content The content to filter. 935 * @return string The filtered content. 936 */ 937 function _oembed_filter_feed_content( $content ) { 938 return str_replace( '<iframe sandbox="allow-scripts" security="restricted" style="display:none;"', '<iframe sandbox="allow-scripts" security="restricted"', $content ); 939 }
Note: See TracChangeset
for help on using the changeset viewer.