diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 10023c1..db2bdc0 100644
a
|
b
|
function get_submit_button( $text = '', $type = 'primary large', $name = 'submit |
1900 | 1900 | |
1901 | 1901 | $attributes = ''; |
1902 | 1902 | if ( is_array( $other_attributes ) ) { |
1903 | | foreach ( $other_attributes as $attribute => $value ) { |
1904 | | $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important |
1905 | | } |
| 1903 | $attributes = get_html_attrs( $other_attributes ); |
1906 | 1904 | } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string |
1907 | | $attributes = $other_attributes; |
| 1905 | $attributes = ' ' . $other_attributes; |
1908 | 1906 | } |
1909 | 1907 | |
1910 | | // Don't output empty name and id attributes. |
1911 | | $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; |
1912 | | $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
| 1908 | $attrs = array( |
| 1909 | 'type' => 'submit', |
| 1910 | 'name' => $name, |
| 1911 | 'id' => $id, |
| 1912 | 'class' => $class, |
| 1913 | 'value' => $text, |
| 1914 | ); |
1913 | 1915 | |
1914 | | $button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class ); |
1915 | | $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />'; |
| 1916 | $button = '<input' . get_html_attrs( $attrs ) . $attributes . ' />'; |
1916 | 1917 | |
1917 | 1918 | if ( $wrap ) { |
1918 | 1919 | $button = '<p class="submit">' . $button . '</p>'; |
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 0e1e361..57d665b 100644
a
|
b
|
function comments_popup_link( $zero = false, $one = false, $more = false, $css_c |
1282 | 1282 | $id = get_the_ID(); |
1283 | 1283 | $title = get_the_title(); |
1284 | 1284 | $number = get_comments_number( $id ); |
| 1285 | |
| 1286 | $class_attr = get_html_attrs( array( 'class' => $css_class ) ); |
1285 | 1287 | |
1286 | 1288 | if ( false === $zero ) { |
1287 | 1289 | /* translators: %s: post title */ |
… |
… |
function comments_popup_link( $zero = false, $one = false, $more = false, $css_c |
1305 | 1307 | } |
1306 | 1308 | |
1307 | 1309 | if ( 0 == $number && !comments_open() && !pings_open() ) { |
1308 | | echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>'; |
| 1310 | echo '<span' . $class_attr . '>' . $none . '</span>'; |
1309 | 1311 | return; |
1310 | 1312 | } |
1311 | 1313 | |
… |
… |
function comments_popup_link( $zero = false, $one = false, $more = false, $css_c |
1330 | 1332 | echo '"'; |
1331 | 1333 | } |
1332 | 1334 | |
1333 | | if ( !empty( $css_class ) ) { |
1334 | | echo ' class="'.$css_class.'" '; |
| 1335 | if ( $class_attr ) { |
| 1336 | echo $class_attr . ' '; |
1335 | 1337 | } |
1336 | 1338 | |
1337 | 1339 | $attributes = ''; |
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 9a0ee88..47824d5 100644
a
|
b
|
function wp_delete_file( $file ) { |
4845 | 4845 | @unlink( $delete ); |
4846 | 4846 | } |
4847 | 4847 | } |
| 4848 | |
| 4849 | /** |
| 4850 | * Get HTML attributes. |
| 4851 | * |
| 4852 | * @since 4.3.0 |
| 4853 | * |
| 4854 | * @param array $attrs |
| 4855 | * @return string |
| 4856 | */ |
| 4857 | function html_attributes( $attrs ) { |
| 4858 | if ( ! is_array( $attrs ) ) { |
| 4859 | return false; |
| 4860 | } |
| 4861 | |
| 4862 | $html = array(); |
| 4863 | |
| 4864 | foreach ( (array) $attrs as $attr => $value ) { |
| 4865 | if ( is_numeric( $attr ) ) { |
| 4866 | $attr = $value; |
| 4867 | } |
| 4868 | |
| 4869 | if ( ! empty( $value ) ) { |
| 4870 | $value = 'href' == $attr ? esc_url( $value ) : esc_attr( $value ); |
| 4871 | |
| 4872 | $html[] = $attr . '="' . $value . '"'; |
| 4873 | } |
| 4874 | } |
| 4875 | |
| 4876 | return count( $html ) > 0 ? ' ' . implode( ' ', $html ) : ''; |
| 4877 | } |
diff --git a/wp-includes/media.php b/wp-includes/media.php
index b69b328..1b82861 100644
a
|
b
|
function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa |
758 | 758 | * @param string|array $size Requested size. |
759 | 759 | */ |
760 | 760 | $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); |
761 | | $attr = array_map( 'esc_attr', $attr ); |
762 | | $html = rtrim("<img $hwstring"); |
763 | | foreach ( $attr as $name => $value ) { |
764 | | $html .= " $name=" . '"' . $value . '"'; |
765 | | } |
766 | | $html .= ' />'; |
| 761 | |
| 762 | $html = '<img ' . rtrim( $hwstring ) . html_attributes( $attr ) . ' />'; |
767 | 763 | } |
768 | 764 | |
769 | 765 | return $html; |
… |
… |
function img_caption_shortcode( $attr, $content = null ) { |
879 | 875 | if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) |
880 | 876 | return $content; |
881 | 877 | |
882 | | if ( ! empty( $atts['id'] ) ) |
883 | | $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; |
884 | | |
885 | | $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); |
886 | | |
| 878 | $attrs = array( |
| 879 | 'id' => $atts['id'], |
| 880 | 'style' => 'width: ' . (int) $atts['width'] . 'px;', |
| 881 | 'class' => trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ) |
| 882 | ); |
| 883 | |
887 | 884 | if ( current_theme_supports( 'html5', 'caption' ) ) { |
888 | | return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">' |
| 885 | return '<figure' . get_html_attrs( $attrs ) . '>' |
889 | 886 | . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; |
890 | 887 | } |
891 | 888 | |
… |
… |
function img_caption_shortcode( $attr, $content = null ) { |
909 | 906 | $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content ); |
910 | 907 | |
911 | 908 | $style = ''; |
912 | | if ( $caption_width ) |
913 | | $style = 'style="width: ' . (int) $caption_width . 'px" '; |
914 | | |
915 | | return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' |
| 909 | |
| 910 | if ( $caption_width ) { |
| 911 | $attrs['style'] = 'width: ' . (int) $caption_width . 'px;'; |
| 912 | } |
| 913 | return '<div' . get_html_attrs( $attrs ) . '>' |
916 | 914 | . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; |
917 | 915 | } |
918 | 916 | |
… |
… |
function wp_audio_shortcode( $attr, $content = '' ) { |
1641 | 1639 | } |
1642 | 1640 | } |
1643 | 1641 | |
1644 | | $attr_strings = array(); |
1645 | | foreach ( $html_atts as $k => $v ) { |
1646 | | $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; |
1647 | | } |
1648 | | |
1649 | 1642 | $html = ''; |
1650 | 1643 | if ( 'mediaelement' === $library && 1 === $instance ) { |
1651 | 1644 | $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n"; |
1652 | 1645 | } |
1653 | | $html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) ); |
1654 | | |
| 1646 | $html .= '<audio %s controls="controls"' . html_attributes( $html_atts ) . '>'; |
| 1647 | |
1655 | 1648 | $fileurl = ''; |
1656 | 1649 | $source = '<source type="%s" src="%s" />'; |
1657 | 1650 | foreach ( $default_types as $fallback ) { |
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
index 5feac80..a13d325 100644
a
|
b
|
class Walker_Nav_Menu extends Walker { |
140 | 140 | */ |
141 | 141 | $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); |
142 | 142 | |
143 | | $attributes = ''; |
144 | | foreach ( $atts as $attr => $value ) { |
145 | | if ( ! empty( $value ) ) { |
146 | | $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
147 | | $attributes .= ' ' . $attr . '="' . $value . '"'; |
148 | | } |
149 | | } |
150 | | |
151 | 143 | $item_output = $args->before; |
152 | | $item_output .= '<a'. $attributes .'>'; |
| 144 | $item_output .= '<a' . html_attributes( $atts ) . '>'; |
153 | 145 | /** This filter is documented in wp-includes/post-template.php */ |
154 | 146 | $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
155 | 147 | $item_output .= '</a>'; |