WordPress.org

Make WordPress Core

Ticket #9424: media_buttons_filters.diff

File media_buttons_filters.diff, 3.4 KB (added by simonwheatley, 5 years ago)

Diff to add individual filters to the media buttons

  • Users/simon/Projects/WordPress/site/wordpress/wp-admin/includes/media.php

     
    330330} 
    331331 
    332332/** 
    333  * {@internal Missing Short Description}} 
     333 * Prints the HTML for the media buttons on the admin edit pages. 
     334 *  
     335 * This function utilises various filters to allow developers to alter 
     336 * or remove any of the media type buttons. 
    334337 * 
    335338 * @since unknown 
    336339 */ 
     
    338341        global $post_ID, $temp_ID; 
    339342        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 
    340343        $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); 
     344        $out = ''; 
    341345        $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID"; 
    342         $media_title = __('Add Media'); 
     346 
    343347        $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&type=image"); 
    344         $image_title = __('Add an Image'); 
     348        $image_title = __('Add an Image');       
     349        $image_button = "<a href='{$image_upload_iframe_src}&amp;TB_iframe=true' id='add_image' class='thickbox' title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>"; 
     350        $out .= apply_filters('image_upload_button', $image_button ); 
     351 
    345352        $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video"); 
    346353        $video_title = __('Add Video'); 
     354        $video_button = "<a href='{$video_upload_iframe_src}&amp;TB_iframe=true' id='add_video' class='thickbox' title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>"; 
     355        $out .= apply_filters('video_upload_button', $video_button ); 
     356 
    347357        $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio"); 
    348358        $audio_title = __('Add Audio'); 
    349         $out = <<<EOF 
     359        $audio_button = "<a href='{$audio_upload_iframe_src}&amp;TB_iframe=true' id='add_audio' class='thickbox' title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>"; 
     360        $out .= apply_filters('audio_upload_button', $audio_button ); 
    350361 
    351         <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a> 
    352         <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a> 
    353         <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a> 
    354         <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a> 
     362        $media_title = __('Add Media'); 
     363        $audio_button = "<a href='{$media_upload_iframe_src}&amp;TB_iframe=true' id='add_media' class='thickbox' title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>"; 
     364        $out .= apply_filters('media_upload_button', $media_button ); 
    355365 
    356 EOF; 
    357366        printf($context, $out); 
    358367} 
    359368add_action( 'media_buttons', 'media_buttons' ); 
    360 add_action('media_upload_media', 'media_upload_handler'); 
     369add_action( 'media_upload_media', 'media_upload_handler' ); 
    361370 
    362371/** 
    363372 * {@internal Missing Short Description}}