Changeset 41454 for branches/4.5/src/wp-includes/embed.php
- Timestamp:
- 09/19/2017 01:49:05 PM (8 years ago)
- Location:
- branches/4.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-includes/embed.php
r40163 r41454 783 783 $html = $content[1] . $content[2]; 784 784 785 preg_match( '/ src=([\'"])(.*?)\1/', $html, $results ); 786 787 if ( ! empty( $results ) ) { 788 $secret = wp_generate_password( 10, false ); 789 790 $url = esc_url( "{$results[2]}#?secret=$secret" ); 791 $q = $results[1]; 792 793 $html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html ); 794 $html = str_replace( '<blockquote', "<blockquote data-secret=\"$secret\"", $html ); 795 } 796 797 $allowed_html['blockquote']['data-secret'] = true; 798 $allowed_html['iframe']['data-secret'] = true; 799 800 $html = wp_kses( $html, $allowed_html ); 801 785 802 if ( ! empty( $content[1] ) ) { 786 803 // We have a blockquote to fall back on. Hide the iframe by default. … … 789 806 } 790 807 791 $html = str_replace( '<iframe', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $html ); 792 793 preg_match( '/ src=[\'"]([^\'"]*)[\'"]/', $html, $results ); 794 795 if ( ! empty( $results ) ) { 796 $secret = wp_generate_password( 10, false ); 797 798 $url = esc_url( "{$results[1]}#?secret=$secret" ); 799 800 $html = str_replace( $results[0], " src=\"$url\" data-secret=\"$secret\"", $html ); 801 $html = str_replace( '<blockquote', "<blockquote data-secret=\"$secret\"", $html ); 802 } 808 $html = str_ireplace( '<iframe', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $html ); 803 809 804 810 return $html;
Note: See TracChangeset
for help on using the changeset viewer.