diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php old mode 100644 new mode 100755 index 03ff4e7..72b3c2e --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1900,19 +1900,20 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit $attributes = ''; if ( is_array( $other_attributes ) ) { - foreach ( $other_attributes as $attribute => $value ) { - $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important - } + $attributes = html_attributes( $other_attributes ); } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string - $attributes = $other_attributes; + $attributes = ' ' . $other_attributes; } - // Don't output empty name and id attributes. - $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; - $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; + $atts = array( + 'type' => 'submit', + 'name' => $name, + 'id' => $id, + 'class' => $class, + 'value' => $text, + ); - $button = ''; + $button = ''; if ( $wrap ) { $button = '
' . $button . '
'; diff --git a/wp-includes/functions.php b/wp-includes/functions.php old mode 100644 new mode 100755 index 1f6e3b1..b997b11 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4845,3 +4845,33 @@ function wp_delete_file( $file ) { @unlink( $delete ); } } + +/** + * Get HTML attributes. + * + * @since 4.3.0 + * + * @param array $attrs + * @return string + */ +function html_attributes( $attrs ) { + if ( ! is_array( $attrs ) ) { + return false; + } + + $html = array(); + + foreach ( (array) $attrs as $attr => $value ) { + if ( is_numeric( $attr ) ) { + $attr = $value; + } + + if ( ! empty( $value ) ) { + $value = 'href' == $attr ? esc_url( $value ) : esc_attr( $value ); + + $html[] = $attr . '="' . $value . '"'; + } + } + + return count( $html ) > 0 ? ' ' . implode( ' ', $html ) : ''; +} diff --git a/wp-includes/media.php b/wp-includes/media.php old mode 100644 new mode 100755 index b69b328..7520128 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -758,12 +758,8 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa * @param string|array $size Requested size. */ $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); - $attr = array_map( 'esc_attr', $attr ); - $html = rtrim(" $value ) { - $html .= " $name=" . '"' . $value . '"'; - } - $html .= ' />'; + + $html = ''; } return $html; @@ -879,13 +875,14 @@ function img_caption_shortcode( $attr, $content = null ) { if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) return $content; - if ( ! empty( $atts['id'] ) ) - $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; - - $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); - + $html_atts = array( + 'id' => $atts['id'], + 'style' => 'width: ' . (int) $atts['width'] . 'px;', + 'class' => trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ) + ); + if ( current_theme_supports( 'html5', 'caption' ) ) { - return '