WordPress.org

Make WordPress Core

Ticket #5911: 5911-6.diff

File 5911-6.diff, 22.9 KB (added by andy, 8 years ago)

incremental changes to bring behavior up to latest wireframes

  • wp-includes/js/swfupload/handlers.js

     
    77        jQuery("#media-upload-error").empty(); 
    88} 
    99 
    10 // progress and success handlers for multimedia multi uploads 
     10// progress and success handlers for media multi uploads 
    1111function fileQueued(fileObj) { 
    1212        // Create a progress bar containing the filename 
    13         jQuery('#multimedia-items').append('<div id="multimedia-item-' + fileObj.id + '" class="multimedia-item"><span class="filename original">' + fileObj.name + '</span><div class="progress"><div class="bar"></div></div></div>'); 
     13        jQuery('#media-items').prepend('<div id="media-item-' + fileObj.id + '" class="media-item"><span class="filename original">' + fileObj.name + '</span><div class="progress"><div class="bar"></div></div></div>'); 
    1414 
    1515        // Disable the submit button 
    16         jQuery('#insert-multimedia').attr('disabled', 'disabled'); 
     16        jQuery('#insert-media').attr('disabled', 'disabled'); 
    1717} 
    1818 
    1919function uploadStart(fileObj) { return true; } 
    2020 
    2121function uploadProgress(fileObj, bytesDone, bytesTotal) { 
    2222        // Lengthen the progress bar 
    23         jQuery('#multimedia-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); 
     23        jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); 
    2424} 
    2525 
    26 function uploadSuccess(fileObj, serverData) { 
    27         // if async-upload returned an error message, place it in the multimedia item div and return 
    28         if ( serverData.match('media-upload-error') ) { 
    29                 jQuery('#multimedia-item-' + fileObj.id).html(serverData); 
    30                 return; 
    31         } 
    32  
     26function prepareMediaItem(fileObj, serverData) { 
    3327        // Move the progress bar to 100% 
    34         jQuery('#multimedia-item-' + fileObj.id + ' .bar').remove(); 
     28        jQuery('#media-item-' + fileObj.id + ' .bar').remove(); 
    3529 
    3630        // Append the HTML returned by the server -- thumbnail and form inputs 
    37         jQuery('#multimedia-item-' + fileObj.id).append(serverData); 
     31        jQuery('#media-item-' + fileObj.id).append(serverData); 
    3832 
    3933        // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename 
    40         jQuery('#multimedia-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#multimedia-item-' + fileObj.id); 
     34        jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id); 
    4135 
    4236        // Replace the original filename with the new (unique) one assigned during upload 
    43         jQuery('#multimedia-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#multimedia-item-' + fileObj.id + ' .filename.new')); 
     37        jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new')); 
    4438 
    4539        // Bind toggle function to a new mask over the progress bar area 
    46         jQuery('#multimedia-item-' + fileObj.id + ' .progress').clone().empty().addClass('clickmask').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).siblings('.toggle').toggle();}).appendTo('#multimedia-item-' + fileObj.id); 
     40        jQuery('#media-item-' + fileObj.id + ' .progress').clone().empty().addClass('clickmask').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).siblings('.toggle').toggle();}).appendTo('#media-item-' + fileObj.id); 
    4741 
    4842        // Also bind toggle to the links 
    49         jQuery('#multimedia-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); 
     43        jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); 
    5044 
    5145        // Bind AJAX to the new Delete button 
    52         jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();if(jQuery('.multimedia-item').length==0)jQuery('.insert-gallery').hide();});return false;}); 
     46        jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){ 
     47                // Tell the server to delete it. TODO: handle exceptions 
     48                jQuery.ajax({url:'admin-ajax.php',type:'post',data:{ 
     49                        id : this.id.replace(/[^0-9]/g,''), 
     50                        action : 'delete-post', 
     51                        _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')} 
     52                        }); 
     53                // Decrement the counter. 
     54                jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1); 
     55                // Vanish it. 
     56                jQuery(this).parents(".media-item").eq(0).slideToggle(300,function(){jQuery(this).remove();if(jQuery('.media-item').length==0)jQuery('.insert-gallery').hide();updateMediaForm();}); 
     57                return false; 
     58        }); 
    5359 
    54         // Open this item if it says to start open 
    55         jQuery('#multimedia-item-' + fileObj.id + ' .startopen') 
     60        // Open this item if it says to start open (e.g. to display an error) 
     61        jQuery('#media-item-' + fileObj.id + '.startopen') 
    5662                .removeClass('startopen') 
    5763                .slideToggle(500) 
    5864                .parent().eq(0).children('.toggle').toggle(); 
     65} 
    5966 
    60         jQuery('.insert-gallery').show(); 
     67function updateMediaForm() { 
     68        // Just one file, no need for collapsible part 
     69        if ( jQuery('#computer-form #media-items>*').length == 1 ) { 
     70                jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle(); 
     71                jQuery('#computer-form .slidetoggle').siblings().addClass('hidden'); 
     72        } else { 
     73                jQuery('#computer-form .slidetoggle').siblings().removeClass('hidden'); 
     74        } 
     75 
     76        // Only show Gallery button when there are at least two files. 
     77        if ( jQuery('#media-items>*').length > 1 ) 
     78                jQuery('.insert-gallery').show(); 
     79        else 
     80                jQuery('.insert-gallery').hide(); 
    6181} 
    6282 
     83function uploadSuccess(fileObj, serverData) { 
     84        // if async-upload returned an error message, place it in the media item div and return 
     85        if ( serverData.match('media-upload-error') ) { 
     86                jQuery('#media-item-' + fileObj.id).html(serverData); 
     87                return; 
     88        } 
     89        prepareMediaItem(fileObj, serverData); 
     90        updateMediaForm(); 
     91        jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1); 
     92} 
     93 
    6394function uploadComplete(fileObj) { 
    6495        // If no more uploads queued, enable the submit button 
    6596        if ( swfu.getStats().files_queued == 0 ) 
    66                 jQuery('#insert-multimedia').attr('disabled', ''); 
     97                jQuery('#insert-media').attr('disabled', ''); 
    6798} 
    6899 
    69100 
  • wp-includes/media.php

     
    8585        list( $img_src, $width, $height ) = image_downsize($id, $size); 
    8686        $hwstring = image_hwstring($width, $height); 
    8787 
    88         $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align-'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />'; 
     88        $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />'; 
    8989 
    9090        $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); 
    9191 
  • wp-includes/script-loader.php

     
    9494                $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2'); 
    9595                $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2'); 
    9696                $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2'); 
    97                 $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080220'); 
     97                $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080225'); 
    9898                // these error messages came from the sample swfupload js, they might need changing. 
    9999                $this->localize( 'swfupload-handlers', 'swfuploadL10n', array( 
    100100                                'queue_limit_exceeded' => 'You have attempted to queue too many files.', 
  • wp-admin/includes/media.php

     
    11<?php 
    22 
    3 function image_upload_tabs() { 
     3function media_upload_tabs() { 
    44        $_default_tabs = array( 
    5                 'image_upload_handler' => __('From Computer'), // handler function name => tab text 
     5                'computer' => __('From Computer'), // handler action suffix => tab text 
     6                'attachments' => __('Attachments'), 
     7                'library' => __('Media Library'), 
    68        ); 
    79 
    8         return apply_filters('image_upload_tabs', $_default_tabs); 
     10        return apply_filters('media_upload_tabs', $_default_tabs); 
    911} 
    1012 
    11 function the_image_upload_tabs() { 
    12         $tabs = image_upload_tabs(); 
     13function update_attachments_tab($tabs) { 
     14        global $wpdb; 
     15        if ( !isset($_REQUEST['post_id']) ) { 
     16                unset($tabs['attachments']); 
     17                return $tabs; 
     18        } 
     19        if ( intval($_REQUEST['post_id']) ) 
     20                $attachments = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])); 
    1321 
     22        $tabs['attachments'] = sprintf(__('Attachments (%s)'), "<span id='attachments-count'>$attachments</span>"); 
     23 
     24        return $tabs; 
     25} 
     26add_filter('media_upload_tabs', 'update_attachments_tab'); 
     27 
     28function the_media_upload_tabs() { 
     29        $tabs = media_upload_tabs(); 
     30 
    1431        if ( !empty($tabs) ) { 
    1532                echo "<ul id='media-upload-tabs'>\n"; 
    1633                if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) 
     
    2037                foreach ( $tabs as $callback => $text ) { 
    2138                        if ( ++$i == count($tabs) ) 
    2239                                $class = ' class="last"'; 
    23                         if ( $callback == $current ) 
    24                                 $disabled = ' disabled="disabled"'; 
    25                         else 
    26                                 $disabled = ''; 
    2740                        $href = add_query_arg('tab', $callback); 
    2841                        if ( $callback == $current ) 
    2942                                $link = $text; 
    3043                        else 
    3144                                $link = "<a href='$href'>$text</a>"; 
    32                         echo "\t<li$class>$link</li>\n"; 
     45                        echo "\t<li id='tab-$callback'$class>$link</li>\n"; 
    3346                } 
    3447                echo "</ul>\n"; 
    3548        } 
     
    143156function media_buttons() { 
    144157        global $post_ID, $temp_ID; 
    145158        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 
    146         $multimedia_upload_iframe_src = "media-upload.php?type=multimedia&amp;post_id=$uploading_iframe_ID"; 
    147         $multimedia_upload_iframe_src = apply_filters('multimedia_upload_iframe_src', $multimedia_upload_iframe_src); 
    148         echo "<a href='$multimedia_upload_iframe_src&amp;TB_iframe=true&amp;height=500&amp;width=640' class='button-secondary thickbox'>" . __('Add media'). '</a>'; 
     159        $media_upload_iframe_src = "media-upload.php?type=media&amp;post_id=$uploading_iframe_ID"; 
     160        $media_upload_iframe_src = apply_filters('media_upload_iframe_src', $media_upload_iframe_src); 
     161        echo "<a href='$media_upload_iframe_src&amp;TB_iframe=true&amp;height=500&amp;width=640' class='button-secondary thickbox'>" . __('Add media'). '</a>'; 
    149162} 
    150163add_action( 'media_buttons', 'media_buttons' ); 
    151164 
     
    169182        wp_admin_css('css/media'); 
    170183} 
    171184 
    172 add_action('media_upload_multimedia', 'multimedia_upload_handler'); 
    173 add_action('admin_head_image_upload_form', 'media_admin_css'); 
     185add_action('media_upload_media', 'media_upload_handler'); 
    174186 
    175 function multimedia_upload_handler() { 
    176         if ( !current_user_can('upload_files') ) { 
    177                 return new wp_error( 'upload_not_allowed', __('You are not allowed to upload files.') ); 
    178         } 
     187function media_upload_form_handler() { 
     188        check_admin_referer('media-form'); 
    179189 
    180         // no button click, we're just displaying the form 
    181         if ( empty($_POST) ) 
    182                 return wp_iframe( 'multimedia_upload_form' ); 
    183  
    184         check_admin_referer('multimedia-form'); 
    185  
    186         // Insert multimedia button was clicked 
     190        // Insert media button was clicked 
    187191        if ( !empty($_FILES) ) { 
    188192                // Upload File button was clicked 
    189193 
     
    217221                                wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 
    218222        } 
    219223 
    220         if ( isset($_POST['insert-multimedia']) ) 
     224        if ( isset($_POST['insert-media']) ) 
    221225                return media_send_to_editor('[gallery]'); 
    222226 
    223227        if ( isset($_POST['send']) ) { 
     
    227231                return media_send_to_editor($html); 
    228232        } 
    229233 
    230         wp_iframe( 'multimedia_upload_form', $errors ); 
     234        return $errors; 
    231235} 
    232236 
    233 function get_multimedia_items( $post_id, $errors ) { 
    234         $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=\"menu_order ASC, ID ASC\""); 
     237function media_upload_computer() { 
     238        if ( !empty($_POST) ) { 
     239                $return = media_upload_form_handler(); 
     240         
     241                if ( is_string($return) ) 
     242                        return $return; 
     243                if ( is_array($return) ) 
     244                        $errors = $return; 
     245        } 
    235246 
     247        return wp_iframe( 'media_upload_computer_form', $errors ); 
     248} 
     249 
     250function media_upload_attachments() { 
     251        if ( !empty($_POST) ) { 
     252                $return = media_upload_form_handler(); 
     253         
     254                if ( is_string($return) ) 
     255                        return $return; 
     256                if ( is_array($return) ) 
     257                        $errors = $return; 
     258        } 
     259 
     260        return wp_iframe( 'media_upload_attachments_form', $errors ); 
     261} 
     262 
     263function media_upload_library() { 
     264        if ( empty($_POST) ) 
     265                wp_iframe( 'media_upload_library_form', $errors ); 
     266} 
     267 
     268function get_media_items( $post_id, $errors ) { 
     269        if ( $post_id ) 
     270                $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC"); 
     271        else 
     272                $attachments = get_paged_attachments(); 
     273 
    236274        if ( empty($attachments) ) 
    237275                return ''; 
    238276 
    239277        foreach ( $attachments as $id => $attachment ) 
    240                 if ( $item = get_multimedia_item($id, isset($errors[$id]) ? $errors[$id] : null) ) 
    241                         $output .= "\n<div id='multimedia-item-$id' class='multimedia-item preloaded'><div id='media-upload-error-$id'></div><span class='filename'></span><div class='progress'><div class='bar'></div></div>$item<div class='progress clickmask'></div>\n</div>"; 
     278                if ( $item = get_media_item($id, isset($errors[$id]) ? $errors[$id] : null) ) 
     279                        $output .= "\n<div id='media-item-$id' class='media-item preloaded'><div id='media-upload-error-$id'></div><span class='filename'></span><div class='progress'><div class='bar'></div></div>$item<div class='progress clickmask'></div>\n</div>"; 
    242280 
    243281        return $output; 
    244282} 
     
    415453        return $form_fields; 
    416454} 
    417455 
    418 function get_multimedia_item( $attachment_id, $errors = null, $send = true ) { 
     456function get_media_item( $attachment_id, $errors = null, $send = true ) { 
    419457        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 
    420                 $thumb_url = $thumb_url[1]; 
     458                $thumb_url = $thumb_url[0]; 
    421459        else 
    422460                return false; 
    423461 
     
    453491                </tr> 
    454492                <tr><td>$post->post_mime_type</td></tr> 
    455493                <tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr> 
    456                 <tr><td>" . apply_filters('multimedia_meta', '', $post) . "</tr></td>\n"; 
     494                <tr><td>" . apply_filters('media_meta', '', $post) . "</tr></td>\n"; 
    457495 
    458496        $defaults = array( 
    459497                'input'      => 'text', 
     
    536574        return $item; 
    537575} 
    538576 
    539 function multimedia_upload_form( $errors = null ) { 
    540         $flash_action_url = get_option('siteurl') . '/wp-admin/async-upload.php?type=multimedia'; 
    541         $form_action_url = get_option('siteurl') . '/wp-admin/media-upload.php?type=multimedia'; 
     577function media_upload_header() { 
     578        ?> 
     579        <div id="media-upload-header"> 
     580        <h3><?php _e('Add Media'); ?></h3> 
     581        <?php the_media_upload_tabs(); ?> 
     582        </div> 
     583        <?php 
     584} 
    542585 
     586function media_upload_form( $errors = null ) { 
     587        $flash_action_url = get_option('siteurl') . '/wp-admin/async-upload.php?type=media'; 
     588 
    543589        $post_id = intval($_REQUEST['post_id']); 
    544590 
    545591?> 
    546 <div id="media-upload-header"> 
    547 <h3><?php _e('Add Media'); ?></h3> 
    548 <?php the_image_upload_tabs(); ?> 
    549 </div> 
    550  
    551592<div id="media-upload-error"> 
    552593<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?> 
    553594        <?php echo $errors['upload_error']->get_error_message(); ?> 
     
    564605                        post_params : { 
    565606                                "post_id" : "<?php echo $post_id; ?>", 
    566607                                "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>", 
    567                                 "type" : "multimedia" 
     608                                "type" : "media" 
    568609                        }, 
    569610                        swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available 
    570611                        degraded_element_id : "html-upload-ui",   // when swfupload is unavailable 
     
    582623                        debug: false, 
    583624                }); 
    584625        $("#flash-browse-button").bind( "click", function(){swfu.selectFiles();}); 
    585         var preloaded = $(".multimedia-item.preloaded"); 
    586         if ( preloaded.length > 0 ) { 
    587                 jQuery('#insert-multimedia').attr('disabled', ''); 
    588                 preloaded.each(function(){uploadSuccess({id:this.id.replace(/[^0-9]/g, '')},'');}); 
    589         } 
    590626}); 
    591627//--> 
    592628</script> 
    593629 
    594 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form"> 
    595630 
    596631<div id="flash-upload-ui"> 
    597632        <p><input id="flash-browse-button" type="button" value="<?php _e('Choose files to upload'); ?>" class="button" /></p> 
    598         <p><?php _e('As each upload completes, you can add titles and descriptions below.'); ?></p> 
     633        <p><?php _e('After a file has been uploaded, you can add titles and descriptions below.'); ?></p> 
    599634</div> 
    600635 
    601636<div id="html-upload-ui"> 
     
    610645        <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
    611646        <br style="clear:both" /> 
    612647</div> 
     648<?php 
     649} 
    613650 
    614 <div id="multimedia-items"> 
     651function media_upload_computer_form( $errors = null ) { 
     652        media_upload_header(); 
    615653 
    616 <?php echo get_multimedia_items($post_id, $errors); ?> 
     654        $post_id = intval($_REQUEST['post_id']); 
    617655 
    618 </div> 
     656        $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=media&tab=computer&post_id=$post_id"; 
    619657 
     658?> 
     659 
     660<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form" id="computer-form"> 
     661<?php wp_nonce_field('media-form'); ?> 
     662<?php media_upload_form( $errors ); ?> 
     663 
     664<div id="media-items"></div> 
    620665<p class="submit"> 
    621         <input type="submit" class="submit insert-gallery" name="insert-multimedia" value="<?php _e('Insert gallery into post'); ?>" /> 
     666        <input type="submit" class="submit insert-gallery" name="insert-media" value="<?php _e('Insert gallery into post'); ?>" /> 
    622667</p> 
     668</form> 
    623669 
    624 <?php wp_nonce_field('multimedia-form'); ?> 
     670<?php 
     671} 
    625672 
     673function media_upload_attachments_form($errors) { 
     674        media_upload_header(); 
     675 
     676        $post_id = intval($_REQUEST['post_id']); 
     677 
     678        $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=media&tab=attachments&post_id=$post_id"; 
     679 
     680?> 
     681 
     682<script type="text/javascript"> 
     683<!-- 
     684jQuery(function($){ 
     685        var preloaded = $(".media-item.preloaded"); 
     686        if ( preloaded.length > 0 ) { 
     687                preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); 
     688                updateMediaForm(); 
     689        } 
     690}); 
     691--> 
     692</script> 
     693 
     694<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form" id="attachments-form"> 
     695<?php wp_nonce_field('media-form'); ?> 
     696<?php //media_upload_form( $errors ); ?> 
     697 
     698<div id="media-items"> 
     699<?php echo get_media_items($post_id, $errors); ?> 
     700</div> 
     701<p class="submit"> 
     702        <input type="submit" class="submit insert-gallery" name="insert-media" value="<?php _e('Insert gallery into post'); ?>" /> 
     703</p> 
     704<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
    626705</form> 
    627  
    628706<?php 
    629707} 
    630708 
    631 add_action('admin_head_multimedia_upload_form', 'media_admin_css'); 
    632 add_filter('async_upload_multimedia', 'get_multimedia_item', 10, 2); 
    633 add_filter('media_upload_multimedia', 'multimedia_upload_handler'); 
     709function media_upload_library_form($errors) { 
     710        media_upload_header(); 
     711} 
    634712 
     713add_filter('async_upload_media', 'get_media_item', 10, 2); 
    635714 
     715add_filter('media_upload_computer', 'media_upload_computer'); 
     716add_action('admin_head_media_upload_computer_form', 'media_admin_css'); 
     717 
     718add_filter('media_upload_attachments', 'media_upload_attachments'); 
     719add_action('admin_head_media_upload_attachments_form', 'media_admin_css'); 
     720 
     721add_filter('media_upload_library', 'media_upload_library'); 
     722add_action('admin_head_media_upload_library_form', 'media_admin_css'); 
     723 
     724 
    636725// Any 'attachment' taxonomy will be included in the description input form for the multi uploader 
    637726// Example: 
    638727/* 
  • wp-admin/media-upload.php

     
    1919        wp_die(__("You are not allowed to be here")); 
    2020 
    2121// upload type: image, video, file, ..? 
    22 $type = @strval($_GET['type']); 
     22if ( isset($_GET['tab']) ) 
     23        $tab = strval($_GET['tab']); 
     24else 
     25        $tab = apply_filters('media_upload_default_tab', 'computer'); 
    2326 
    2427// let the action code decide how to handle the request 
    25 do_action("media_upload_{$type}"); 
     28do_action("media_upload_$tab"); 
    2629 
    2730?> 
  • wp-admin/css/media.css

     
    8484} 
    8585 
    8686/* specific to the image upload form */ 
    87 .media-upload-form fieldset#image-align label, .align .field label { 
     87.align .field label { 
    8888        display: inline; 
    8989        padding: 0 0 0 28px; 
    9090        margin: 0 0; 
    9191} 
    92 .media-upload-form fieldset#image-align input, .align .field input { 
     92.align .field input { 
    9393        margin-left: 15px; 
    9494} 
    9595 
    96 #image-align-none-label, .image-align-none-label { 
     96.image-align-none-label { 
    9797        background: url(../images/align-none.png) no-repeat center left; 
    9898} 
    9999 
    100 #image-align-left-label, .image-align-left-label { 
     100.image-align-left-label { 
    101101        background: url(../images/align-left.png) no-repeat center left; 
    102102} 
    103103 
    104 #image-align-center-label, .image-align-center-label { 
     104.image-align-center-label { 
    105105        background: url(../images/align-center.png) no-repeat center left; 
    106106} 
    107107 
    108 #image-align-right-label, .image-align-right-label { 
     108.image-align-right-label { 
    109109        background: url(../images/align-right.png) no-repeat center left; 
    110110} 
    111111 
     
    125125        max-height: 40px; 
    126126} 
    127127 
    128 #multimedia-items { 
     128#media-items { 
    129129        border: 1px solid #c0c0c0; 
    130130        border-bottom: none; 
    131131        width: 623px; 
    132132} 
    133 .multimedia-item { 
     133.media-item { 
    134134        border-bottom: 1px solid #d0d0d0; 
    135135        width: 623px; 
    136136        position: relative; 
     
    152152        background-color: #e8e8e8; 
    153153        border-right: 3px solid #99d; 
    154154} 
    155 .multimedia-item .thumbnail { 
     155.media-item .thumbnail { 
    156156        max-width: 128px; 
    157157        max-height: 128px; 
    158158} 
    159 .multimedia-item .pinkynail { 
     159.media-item .pinkynail { 
    160160        position: absolute; 
    161161        top: 2px; 
    162162        left: 2px; 
     
    200200        color: #246; 
    201201} 
    202202.describe-toggle-on, .describe-toggle-off { 
     203        display: block; 
    203204        line-height: 36px; 
    204205        z-index: 2; 
    205206        position: absolute; 
     
    224225tr.align td.field { 
    225226        text-align: center; 
    226227} 
     228 
     229.hidden { 
     230        height: 0px; 
     231        width: 0px; 
     232        overflow: hidden; 
     233        border: none; 
     234} 
     235 No newline at end of file