diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 5c54b21402..61c8b95760 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -3057,7 +3057,7 @@ function edit_form_image_editor( $post ) { } ?> - post_content, 'attachment_content', $editor_args ); ?> + post_content ), 'attachment_content', $editor_args ); ?> - get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?> + get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?> errors()->get_error_message(); ?> {$list_items}"; + $list_items_markup = sprintf( "", esc_attr( $class ), $list_items ); // PHP 5.2 compatibility. See: http://simplepie.org/wiki/faq/i_m_getting_memory_leaks. $rss->__destruct(); diff --git a/wp-includes/blocks/search.php b/wp-includes/blocks/search.php index ac7da463e9..f9bbe3eba5 100644 --- a/wp-includes/blocks/search.php +++ b/wp-includes/blocks/search.php @@ -46,7 +46,7 @@ function render_block_core_search( $attributes ) { return sprintf( '', - $class, + esc_attr( $class ), esc_url( home_url( '/' ) ), $label_markup . $input_markup . $button_markup ); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 9e8c6bb708..fb75b3a475 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -573,8 +573,8 @@ add_filter( 'the_excerpt_embed', 'wpautop' ); add_filter( 'the_excerpt_embed', 'shortcode_unautop' ); add_filter( 'the_excerpt_embed', 'wp_embed_excerpt_attachment' ); +add_filter( 'oembed_dataparse', 'wp_filter_oembed_iframe_title_attribute', 5, 3 ); add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 ); -add_filter( 'oembed_dataparse', 'wp_filter_oembed_iframe_title_attribute', 20, 3 ); add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 ); add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 ); diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 48c2212783..5fae5e7a41 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -797,11 +797,24 @@ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) { $title = ! empty( $data->title ) ? $data->title : ''; - $pattern = '`]*?title=(\\\\\'|\\\\"|[\'"])([^>]*?)\1`i'; - $has_title_attr = preg_match( $pattern, $result, $matches ); + $pattern = '`]*)>`i'; + if ( preg_match( $pattern, $result, $matches ) ) { + $attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() ); - if ( $has_title_attr && ! empty( $matches[2] ) ) { - $title = $matches[2]; + foreach ( $attrs as $attr => $item ) { + $lower_attr = strtolower( $attr ); + if ( $lower_attr === $attr ) { + continue; + } + if ( ! isset( $attrs[ $lower_attr ] ) ) { + $attrs[ $lower_attr ] = $item; + unset( $attrs[ $attr ] ); + } + } + } + + if ( ! empty( $attrs['title']['value'] ) ) { + $title = $attrs['title']['value']; } /** @@ -820,11 +833,11 @@ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) { return $result; } - if ( $has_title_attr ) { - // Remove the old title, $matches[1]: quote, $matches[2]: title attribute value. - $result = str_replace( ' title=' . $matches[1] . $matches[2] . $matches[1], '', $result ); + if ( isset( $attrs['title'] ) ) { + unset( $attrs['title'] ); + $attr_string = join( ' ', wp_list_pluck( $attrs, 'whole' ) ); + $result = str_replace( $matches[0], '