Changeset 47959 for branches/5.3/src/wp-includes/embed.php
- Timestamp:
- 06/10/2020 05:58:07 PM (6 years ago)
- Location:
- branches/5.3
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/embed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/5.3
- Property svn:mergeinfo changed
/trunk merged: 47947-47951
- Property svn:mergeinfo changed
-
branches/5.3/src/wp-includes/embed.php
r46164 r47959 798 798 $title = ! empty( $data->title ) ? $data->title : ''; 799 799 800 $pattern = '`<iframe[^>]*?title=(\\\\\'|\\\\"|[\'"])([^>]*?)\1`i'; 801 $has_title_attr = preg_match( $pattern, $result, $matches ); 802 803 if ( $has_title_attr && ! empty( $matches[2] ) ) { 804 $title = $matches[2]; 800 $pattern = '`<iframe([^>]*)>`i'; 801 if ( preg_match( $pattern, $result, $matches ) ) { 802 $attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() ); 803 804 foreach ( $attrs as $attr => $item ) { 805 $lower_attr = strtolower( $attr ); 806 if ( $lower_attr === $attr ) { 807 continue; 808 } 809 if ( ! isset( $attrs[ $lower_attr ] ) ) { 810 $attrs[ $lower_attr ] = $item; 811 unset( $attrs[ $attr ] ); 812 } 813 } 814 } 815 816 if ( ! empty( $attrs['title']['value'] ) ) { 817 $title = $attrs['title']['value']; 805 818 } 806 819 … … 821 834 } 822 835 823 if ( $has_title_attr) {824 // Remove the old title, $matches[1]: quote, $matches[2]: title attribute value.825 $ result = str_replace( ' title=' . $matches[1] . $matches[2] . $matches[1], '', $result);826 }827 836 if ( isset( $attrs['title'] ) ) { 837 unset( $attrs['title'] ); 838 $attr_string = join( ' ', wp_list_pluck( $attrs, 'whole' ) ); 839 $result = str_replace( $matches[0], '<iframe ' . trim( $attr_string ) . '>', $result ); 840 } 828 841 return str_ireplace( '<iframe ', sprintf( '<iframe title="%s" ', esc_attr( $title ) ), $result ); 829 842 }
Note: See TracChangeset
for help on using the changeset viewer.