WordPress.org

Make WordPress Core

Changeset 12955


Ignore:
Timestamp:
02/04/2010 08:28:52 PM (10 years ago)
Author:
ryan
Message:

Merge mu_media_buttons() into media_buttons(). see #11644

Location:
trunk/wp-admin/includes
Files:
2 edited

Legend:

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

    r12824 r12955  
    362362    $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio");
    363363    $audio_title = __('Add Audio');
    364     $out = <<<EOF
    365 
    366     <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title' onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a>
    367     <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title' onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a>
    368     <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title' onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a>
    369     <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title' onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a>
    370 
    371 EOF;
     364
     365    $do_image = $do_audio = $do_video = true;
     366    if ( is_multisite() ) {
     367        $media_buttons = get_site_option( 'mu_media_buttons' );
     368        if ( empty($media_buttons['image']) )
     369            $do_image = false;
     370        if ( empty($media_buttons['audio']) )
     371            $do_audio = false;
     372        if ( empty($media_buttons['video']) )
     373            $do_video = false;
     374    }
     375    $out = '';
     376
     377    if ( $do_image )
     378        $out .= '<a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title="$image_title" onclick="return false;"><img src="images/media-button-image.gif" alt="$image_title" /></a>';
     379    if ( $do_video )
     380        $out .= '<a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title="$video_title" onclick="return false;"><img src="images/media-button-video.gif" alt="$video_title" /></a>';
     381    if ( $do_audio )
     382        $out .= '<a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title="$audio_title" onclick="return false;"><img src="images/media-button-music.gif" alt="$audio_title" /></a>';
     383    $out .= '<a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title="$media_title" onclick="return false;"><img src="images/media-button-other.gif" alt="$media_title" /></a>';
     384
    372385    printf($context, $out);
    373386}
  • trunk/wp-admin/includes/ms.php

    r12940 r12955  
    595595}
    596596
    597 // Only show "Media" upload icon
    598 function mu_media_buttons() {
    599     global $post_ID, $temp_ID;
    600     $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
    601     $context = apply_filters('media_buttons_context', __('Add media: %s'));
    602     $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
    603     $media_title = __('Add Media');
    604     $mu_media_buttons = get_site_option( 'mu_media_buttons' );
    605     $out = '';
    606     if ( $mu_media_buttons[ 'image' ] ) {
    607         $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
    608         $image_title = __('Add an Image');
    609         $out .= "<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>";
    610     }
    611     if ( $mu_media_buttons[ 'video' ] ) {
    612         $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
    613         $video_title = __('Add Video');
    614         $out .= "<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>";
    615     }
    616     if ( $mu_media_buttons[ 'audio' ] ) {
    617         $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
    618         $audio_title = __('Add Audio');
    619         $out .= "<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>";
    620     }
    621     $out .= "<a href='{$media_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640' class='thickbox' title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>";
    622     printf($context, $out);
    623 }
    624 add_action( 'media_buttons', 'mu_media_buttons' );
    625 remove_action( 'media_buttons', 'media_buttons' );
    626 
    627597/* Warn the admin if SECRET SALT information is missing from wp-config.php */
    628598function secret_salt_warning() {
Note: See TracChangeset for help on using the changeset viewer.