Make WordPress Core

Ticket #27402: 27402.3.patch

File 27402.3.patch, 2.8 KB (added by DrewAPicture, 11 years ago)

standards

  • src/wp-includes/media.php

     
    10471047
    10481048        $i = 0;
    10491049        foreach ( $attachments as $id => $attachment ) {
    1050                 if ( ! empty( $link ) && 'file' === $link )
    1051                         $image_output = wp_get_attachment_link( $id, $size, false, false );
    1052                 elseif ( ! empty( $link ) && 'none' === $link )
    1053                         $image_output = wp_get_attachment_image( $id, $size, false );
    1054                 else
    1055                         $image_output = wp_get_attachment_link( $id, $size, true, false );
     1050                $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
     1051               
     1052                if ( ! empty( $link ) && 'file' === $link ) {
     1053                        $image_output = wp_get_attachment_link( $id, $size, false, false, false, $attr );
     1054                } elseif ( ! empty( $link ) && 'none' === $link ) {
     1055                        $image_output = wp_get_attachment_image( $id, $size, false, $attr );
     1056                } else {
     1057                        $image_output = wp_get_attachment_link( $id, $size, true, false, false, $attr );
     1058                }
    10561059
    10571060                $image_meta  = wp_get_attachment_metadata( $id );
    10581061
     
    10671070                        </{$icontag}>";
    10681071                if ( $captiontag && trim($attachment->post_excerpt) ) {
    10691072                        $output .= "
    1070                                 <{$captiontag} class='wp-caption-text gallery-caption'>
     1073                                <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
    10711074                                " . wptexturize($attachment->post_excerpt) . "
    10721075                                </{$captiontag}>";
    10731076                }
  • src/wp-includes/post-template.php

     
    14001400 * @param bool $permalink Optional, default is false. Whether to add permalink to image.
    14011401 * @param bool $icon Optional, default is false. Whether to include icon.
    14021402 * @param string|bool $text Optional, default is false. If string, then will be link text.
     1403 * @param array|string $attr Optional. Array or string of attributes.
    14031404 * @return string HTML content.
    14041405 */
    1405 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
     1406function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
    14061407        $id = intval( $id );
    14071408        $_post = get_post( $id );
    14081409
     
    14141415
    14151416        $post_title = esc_attr( $_post->post_title );
    14161417
    1417         if ( $text )
     1418        if ( $text ) {
    14181419                $link_text = $text;
    1419         elseif ( $size && 'none' != $size )
    1420                 $link_text = wp_get_attachment_image( $id, $size, $icon );
    1421         else
     1420        } elseif ( $size && 'none' != $size ) {
     1421                $link_text = wp_get_attachment_image( $id, $size, $icon, $attr );
     1422        } else {
    14221423                $link_text = '';
     1424        }
    14231425
    14241426        if ( trim( $link_text ) == '' )
    14251427                $link_text = $_post->post_title;