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.

git-svn-id: https://develop.svn.wordpress.org/trunk@22848 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-26 22:32:35 +00:00
parent e12621eccb
commit 340a772e73

View File

@ -391,13 +391,19 @@ function media_buttons($editor_id = 'content') {
'post' => $post 'post' => $post
) ); ) );
// $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
$img = '<span class="wp-media-buttons-icon"></span> '; $img = '<span class="wp-media-buttons-icon"></span> ';
echo '<a href="#" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>'; echo '<a href="#" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>';
// 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>'; // Don't use this filter. Want to add a button? Use the media_buttons action.
$legacy_filter = apply_filters('media_buttons_context', ''); // deprecated
if ( $legacy_filter ) {
// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) )
$legacy_filter .= '</a>';
echo $legacy_filter;
}
} }
add_action( 'media_buttons', 'media_buttons' ); add_action( 'media_buttons', 'media_buttons' );