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: http://core.svn.wordpress.org/trunk@22848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-26 22:32:35 +00:00
parent 7df6a903f5
commit 4e9e4bf2cf
1 changed files with 9 additions and 3 deletions

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' );