Make WordPress Core

Ticket #15155: 15155.3.diff

File 15155.3.diff, 1.4 KB (added by DrewAPicture, 12 years ago)

shortcode_atts_{$shortcode}

  • wp-includes/media.php

     
    644644                'align' => 'alignnone',
    645645                'width' => '',
    646646                'caption' => ''
    647         ), $attr));
     647        ), $attr, 'caption'));
    648648
    649649        if ( 1 > (int) $width || empty($caption) )
    650650                return $content;
     
    704704                'size'       => 'thumbnail',
    705705                'include'    => '',
    706706                'exclude'    => ''
    707         ), $attr));
     707        ), $attr, 'gallery'));
    708708
    709709        $id = intval($id);
    710710        if ( 'RAND' == $order )
  • wp-includes/shortcodes.php

     
    289289 *
    290290 * @param array $pairs Entire list of supported attributes and their defaults.
    291291 * @param array $atts User defined attributes in shortcode tag.
     292 * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering
    292293 * @return array Combined and filtered attribute list.
    293294 */
    294 function shortcode_atts($pairs, $atts) {
     295function shortcode_atts( $pairs, $atts, $shortcode = '' ) {
    295296        $atts = (array)$atts;
    296297        $out = array();
    297298        foreach($pairs as $name => $default) {
     
    300301                else
    301302                        $out[$name] = $default;
    302303        }
     304
     305        if ( ! empty( $shortcode ) )
     306                $out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
     307
    303308        return $out;
    304309}
    305310