Make WordPress Core

Changeset 42690


Ignore:
Timestamp:
02/11/2018 02:16:43 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Media: Convert concatenation in img_caption_shortcode() to sprintf() for clarity.

See #34595.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r42639 r42690  
    15901590
    15911591        if ( $html5 ) {
    1592                 $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    1593                 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
     1592                $html = sprintf(
     1593                        '<figure %s%sclass="%s">%s%s</figure>',
     1594                        $atts['id'],
     1595                        $style,
     1596                        esc_attr( $class ),
     1597                        do_shortcode( $content ),
     1598                        sprintf(
     1599                                '<figcaption class="wp-caption-text">%s</figcaption>',
     1600                                $atts['caption']
     1601                        )
     1602                );
    15941603        } else {
    1595                 $html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    1596                 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
     1604                $html = sprintf(
     1605                        '<div %s%sclass="%s">%s%s</div>',
     1606                        $atts['id'],
     1607                        $style,
     1608                        esc_attr( $class ),
     1609                        do_shortcode( $content ),
     1610                        sprintf(
     1611                                '<p class="wp-caption-text">%s</p>',
     1612                                $atts['caption']
     1613                        )
     1614                );
    15971615        }
    15981616
Note: See TracChangeset for help on using the changeset viewer.