Ticket #20819: 20819.4.patch
| File 20819.4.patch, 2.8 KB (added by SergeyBiryukov, 12 months ago) |
|---|
-
wp-admin/custom-background.php
74 74 add_action("load-$page", array(&$this, 'handle_upload'), 49); 75 75 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); 76 76 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); 77 add_filter( 'media_upload_mime_type_links', array( $this, 'filter_upload_mime_type_links' ) ); 77 78 78 79 if ( $this->admin_header_callback ) 79 80 add_action("admin_head-$page", $this->admin_header_callback, 51); … … 388 389 $this->updated = true; 389 390 } 390 391 392 /** 393 * Replace default attachment actions with "Set as background" link. 394 * 395 * @since 3.4.0 396 */ 391 397 function attachment_fields_to_edit( $form_fields, $post ) { 392 398 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) { 393 399 $form_fields = array( 'image-size' => $form_fields['image-size'] ); … … 398 404 return $form_fields; 399 405 } 400 406 407 /** 408 * Leave only "Media Library" tab in the uploader window. 409 * 410 * @since 3.4.0 411 */ 401 412 function filter_upload_tabs ( $tabs ){ 402 413 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) 403 414 return array( 'library' => __('Media Library') ); … … 405 416 return $tabs; 406 417 } 407 418 419 /** 420 * Hide MIME type links. Only image files can be set as background. 421 * 422 * @since 3.4.0 423 */ 424 function filter_upload_mime_type_links( $type_links ) { 425 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) 426 return array(); 427 428 return $type_links; 429 } 430 408 431 public function wp_set_background_image() { 409 432 if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; 410 433 $attachment_id = absint($_POST['attachment_id']); -
wp-admin/custom-header.php
96 96 97 97 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); 98 98 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); 99 add_filter( 'media_upload_mime_type_links', '__return_empty_array');99 add_filter( 'media_upload_mime_type_links', array( $this, 'filter_upload_mime_type_links' ) ); 100 100 } 101 101 102 102 /** … … 1000 1000 return $tabs; 1001 1001 } 1002 1002 1003 /** 1004 * Hide MIME type links. Only image files can be set as header. 1005 * 1006 * @since 3.4.0 1007 */ 1008 function filter_upload_mime_type_links( $type_links ) { 1009 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-header' ) 1010 return array(); 1011 1012 return $type_links; 1013 } 1014 1003 1015 }
