Make WordPress Core

Ticket #15155: 15155.diff

File 15155.diff, 1.7 KB (added by coffee2code, 14 years ago)

Patch mentioned in ticket.

  • wp-includes/shortcodes.php

     
    259259 *
    260260 * @param array $pairs Entire list of supported attributes and their defaults.
    261261 * @param array $atts User defined attributes in shortcode tag.
     262 * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering
    262263 * @return array Combined and filtered attribute list.
    263264 */
    264 function shortcode_atts($pairs, $atts) {
     265function shortcode_atts($pairs, $atts, $shortcode = '') {
     266        // Shortcode handlers should provide the name of the shortcode.
     267        if ( empty( $shortcode ) )
     268                _deprecated_argument( __FUNCTION__, '3.1', __( 'The "$shortcode" argument should be supplied.' ) );
     269
    265270        $atts = (array)$atts;
    266271        $out = array();
    267272        foreach($pairs as $name => $default) {
     
    270275                else
    271276                        $out[$name] = $default;
    272277        }
     278
     279        if ( ! empty( $shortcode ) ) {
     280                $out = apply_filters( 'shortcode_atts-' . $shortcode, $out, $pairs, $atts );
     281                $out = apply_filters( 'shortcode_atts', $out, $pairs, $atts, $shortcode );
     282        }
     283
    273284        return $out;
    274285}
    275286
  • wp-includes/media.php

     
    729729                'align' => 'alignnone',
    730730                'width' => '',
    731731                'caption' => ''
    732         ), $attr));
     732        ), $attr, 'caption'));
    733733
    734734        if ( 1 > (int) $width || empty($caption) )
    735735                return $content;
     
    782782                'size'       => 'thumbnail',
    783783                'include'    => '',
    784784                'exclude'    => ''
    785         ), $attr));
     785        ), $attr, 'gallery'));
    786786
    787787        $id = intval($id);
    788788        if ( 'RAND' == $order )