Changeset 42693
- Timestamp:
- 02/11/2018 03:19:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r42692 r42693 1544 1544 $atts = shortcode_atts( 1545 1545 array( 1546 'id' => '', 1547 'align' => 'alignnone', 1548 'width' => '', 1549 'caption' => '', 1550 'class' => '', 1546 'id' => '', 1547 'caption_id' => '', 1548 'align' => 'alignnone', 1549 'width' => '', 1550 'caption' => '', 1551 'class' => '', 1551 1552 ), $attr, 'caption' 1552 1553 ); … … 1557 1558 } 1558 1559 1559 $caption_id = ''; 1560 1561 if ( ! empty( $atts['id'] ) ) { 1560 if ( $atts['id'] ) { 1562 1561 $att_id = esc_attr( sanitize_html_class( $atts['id'] ) ); 1563 1562 $atts['id'] = 'id="' . $att_id . '" '; 1564 $caption_id = 'caption-' . str_replace( '_', '-', $att_id ); 1563 1564 if ( ! $atts['caption_id'] ) { 1565 $atts['caption_id'] = 'caption-' . str_replace( '_', '-', $att_id ); 1566 } 1567 } 1568 1569 $describedby = ''; 1570 1571 if ( $atts['caption_id'] ) { 1572 $describedby = 'aria-describedby="' . $atts['caption_id'] . '" '; 1573 $atts['caption_id'] = 'id="' . $atts['caption_id'] . '" '; 1565 1574 } 1566 1575 … … 1595 1604 if ( $html5 ) { 1596 1605 $html = sprintf( 1597 '<figure %s%s class="%s" aria-describedby="%s">%s%s</figure>',1606 '<figure %s%s%sclass="%s">%s%s</figure>', 1598 1607 $atts['id'], 1608 $describedby, 1599 1609 $style, 1600 1610 esc_attr( $class ), 1601 $caption_id,1602 1611 do_shortcode( $content ), 1603 1612 sprintf( 1604 '<figcaption id="%s"class="wp-caption-text">%s</figcaption>',1605 $ caption_id,1613 '<figcaption %sclass="wp-caption-text">%s</figcaption>', 1614 $atts['caption_id'], 1606 1615 $atts['caption'] 1607 1616 ) … … 1613 1622 $style, 1614 1623 esc_attr( $class ), 1615 str_replace( '<img ', '<img aria-describedby="' . $caption_id . '" ', do_shortcode( $content ) ),1624 str_replace( '<img ', '<img ' . $describedby, do_shortcode( $content ) ), 1616 1625 sprintf( 1617 1626 '<p id="%s" class="wp-caption-text">%s</p>', 1618 $ caption_id,1627 $atts['caption_id'], 1619 1628 $atts['caption'] 1620 1629 )
Note: See TracChangeset
for help on using the changeset viewer.