WordPress.org

Make WordPress Core

Changeset 22848


Ignore:
Timestamp:
11/26/12 22:32:35 (3 years ago)
Author:
nacin
Message:

Back compat for media_buttons_context, which is not the correct filter for adding new media buttons. If you want to add additional media buttons, use the media_buttons action instead. fixes #22559.

File:
1 edited

Legend:

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

    r22846 r22848  
    392392    ) ); 
    393393 
    394     // $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); 
    395  
    396394    $img = '<span class="wp-media-buttons-icon"></span> '; 
    397395 
    398396    echo '<a href="#" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>'; 
    399397 
    400     // echo '<a href="' . esc_url( get_upload_iframe_src() ) . '" class="thickbox add_media" id="' . esc_attr( $editor_id ) . '-add_media" title="' . esc_attr__( 'Add Media' ) . '" onclick="return false;">' . sprintf( $context, $img ) . '</a>'; 
     398    // Don't use this filter. Want to add a button? Use the media_buttons action. 
     399    $legacy_filter = apply_filters('media_buttons_context', ''); // deprecated 
     400 
     401    if ( $legacy_filter ) { 
     402        // #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag. 
     403        if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) ) 
     404            $legacy_filter .= '</a>'; 
     405        echo $legacy_filter; 
     406    } 
    401407} 
    402408add_action( 'media_buttons', 'media_buttons' ); 
Note: See TracChangeset for help on using the changeset viewer.