Make WordPress Core

Ticket #21569: 21569.diff

File 21569.diff, 1.8 KB (added by markoheijnen, 12 years ago)
  • wp-includes/media.php

     
    693693                        unset( $attr['orderby'] );
    694694        }
    695695
     696        if ( ! isset( $attr['link'] ) )
     697                $attr['link'] = 'post';
     698
    696699        extract(shortcode_atts(array(
    697700                'order'      => 'ASC',
    698701                'orderby'    => 'menu_order ID',
     
    703706                'columns'    => 3,
    704707                'size'       => 'thumbnail',
    705708                'include'    => '',
    706                 'exclude'    => ''
     709                'exclude'    => '',
     710                'splitter'   => '<br style="clear: both;" />'
    707711        ), $attr));
    708712
    709713        $id = intval($id);
     
    772776                </style>
    773777                <!-- see gallery_shortcode() in wp-includes/media.php -->";
    774778        $size_class = sanitize_html_class( $size );
    775         $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
     779        $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class} gallery-link-{$attr['link']}'>";
    776780        $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
    777781
    778782        $i = 0;
    779783        foreach ( $attachments as $id => $attachment ) {
    780                 $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
     784                $link = 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
    781785
    782786                $output .= "<{$itemtag} class='gallery-item'>";
    783787                $output .= "
     
    792796                }
    793797                $output .= "</{$itemtag}>";
    794798                if ( $columns > 0 && ++$i % $columns == 0 )
    795                         $output .= '<br style="clear: both" />';
     799                        $output .= $splitter;
    796800        }
    797801
    798802        $output .= "
    799                         <br style='clear: both;' />
     803                        " . $splitter . "
    800804                </div>\n";
    801805
    802806        return $output;