Ticket #21329: 21329-2.diff
| File 21329-2.diff, 2.7 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/media.php
629 629 } 630 630 631 631 /** 632 * {@internal Missing Short Description}} 632 * Returns wp_iframe with the proper upload form for media uploads 633 * added to the media_upload filter in media-upload.php 633 634 * 634 * @since 2.5.0635 * @since 3.5.0 635 636 * 636 * @return unknown637 * @return HTML from the wp_iframe function 637 638 */ 638 function media_upload _gallery() {639 function media_upload() { 639 640 $errors = array(); 640 641 if ( !empty($_POST) ) { 641 $current_filter = current_filter(); 642 $type = str_replace( 'media_upload_' , '' , $current_filter ); 643 644 if ( !empty($_POST) || empty($type) ) { 642 645 $return = media_upload_form_handler(); 643 644 646 if ( is_string($return) ) 645 647 return $return; 646 648 if ( is_array($return) ) … … 648 650 } 649 651 650 652 wp_enqueue_script('admin-gallery'); 651 return wp_iframe( 'media_upload_gallery_form', $errors ); 653 654 switch($type) { 655 case 'library' : 656 $return = 'media_upload_library_form'; 657 break; 658 case 'gallery' : 659 $return = 'media_upload_gallery_form'; 660 break; 661 default : 662 $return = 'wp_media_upload_handler'; 663 break; 664 } 665 return wp_iframe( $return , $errors ); 652 666 } 653 667 654 668 /** … … 658 672 * 659 673 * @return unknown 660 674 */ 675 function media_upload_gallery() { 676 media_upload( 'gallery' ); 677 } 678 679 /** 680 * {@internal Missing Short Description}} 681 * 682 * @since 2.5.0 683 * 684 * @return unknown 685 */ 661 686 function media_upload_library() { 662 $errors = array(); 663 if ( !empty($_POST) ) { 664 $return = media_upload_form_handler(); 665 666 if ( is_string($return) ) 667 return $return; 668 if ( is_array($return) ) 669 $errors = $return; 670 } 671 672 return wp_iframe( 'media_upload_library_form', $errors ); 687 media_upload( 'library' ); 673 688 } 674 689 675 690 /** … … 2128 2143 add_filter( 'async_upload_video', 'get_media_item', 10, 2 ); 2129 2144 add_filter( 'async_upload_file', 'get_media_item', 10, 2 ); 2130 2145 2131 add_action( 'media_upload_image', ' wp_media_upload_handler' );2132 add_action( 'media_upload_audio', ' wp_media_upload_handler' );2133 add_action( 'media_upload_video', ' wp_media_upload_handler' );2134 add_action( 'media_upload_file', ' wp_media_upload_handler' );2146 add_action( 'media_upload_image', 'media_upload' ); 2147 add_action( 'media_upload_audio', 'media_upload' ); 2148 add_action( 'media_upload_video', 'media_upload' ); 2149 add_action( 'media_upload_file', 'media_upload' ); 2135 2150 2136 add_filter( 'media_upload_gallery', 'media_upload _gallery' );2137 add_filter( 'media_upload_library', 'media_upload _library' );2151 add_filter( 'media_upload_gallery', 'media_upload' ); 2152 add_filter( 'media_upload_library', 'media_upload' );