Changeset 22778
- Timestamp:
- 11/21/2012 05:44:49 PM (12 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-background.php
r22521 r22778 73 73 add_action("load-$page", array(&$this, 'take_action'), 49); 74 74 add_action("load-$page", array(&$this, 'handle_upload'), 49); 75 76 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) {77 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );78 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) );79 add_filter( 'media_upload_mime_type_links', '__return_empty_array' );80 }81 75 82 76 if ( $this->admin_header_callback ) … … 106 100 ); 107 101 108 add_thickbox();109 102 wp_enqueue_media(); 110 103 wp_enqueue_script('custom-background'); … … 398 391 399 392 /** 400 * Replace default attachment actions with "Set as background" link.393 * Unused since 3.5.0. 401 394 * 402 395 * @since 3.4.0 403 396 */ 404 function attachment_fields_to_edit( $form_fields, $post ) { 405 $form_fields = array( 'image-size' => $form_fields['image-size'] ); 406 $form_fields['buttons'] = array( 'tr' => '<tr class="submit"><td></td><td><a data-attachment-id="' . $post->ID . '" class="wp-set-background">' . __( 'Set as background' ) . '</a></td></tr>' ); 407 $form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-background' ); 408 397 function attachment_fields_to_edit( $form_fields ) { 409 398 return $form_fields; 410 399 } 411 400 412 401 /** 413 * Leave only "Media Library" tab in the uploader window.402 * Unused since 3.5.0. 414 403 * 415 404 * @since 3.4.0 416 405 */ 417 function filter_upload_tabs( ) {418 return array( 'library' => __('Media Library') );406 function filter_upload_tabs( $tabs ) { 407 return $tabs; 419 408 } 420 409 -
trunk/wp-admin/custom-header.php
r22695 r22778 94 94 if ( $this->admin_header_callback ) 95 95 add_action("admin_head-$page", $this->admin_header_callback, 51); 96 97 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-header' ) {98 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );99 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) );100 add_filter( 'media_upload_mime_type_links', '__return_empty_array' );101 }102 96 } 103 97 … … 172 166 173 167 if ( ( 1 == $step || 3 == $step ) ) { 174 add_thickbox();175 168 wp_enqueue_media(); 176 169 wp_enqueue_script( 'custom-header' ); … … 911 904 912 905 /** 913 * Replace default attachment actions with "Set as header" link.906 * Unused since 3.5.0. 914 907 * 915 908 * @since 3.4.0 916 909 */ 917 function attachment_fields_to_edit( $form_fields, $post ) { 918 $form_fields = array(); 919 $href = esc_url(add_query_arg(array( 920 'page' => 'custom-header', 921 'step' => 2, 922 '_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'), 923 'file' => $post->ID 924 ), admin_url('themes.php'))); 925 926 $form_fields['buttons'] = array( 'tr' => '<tr class="submit"><td></td><td><a data-location="' . $href . '" class="wp-set-header">' . __( 'Set as header' ) . '</a></td></tr>' ); 927 $form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-header' ); 928 910 function attachment_fields_to_edit( $form_fields ) { 929 911 return $form_fields; 930 912 } 931 913 932 914 /** 933 * Leave only "Media Library" tab in the uploader window.915 * Unused since 3.5.0. 934 916 * 935 917 * @since 3.4.0 936 918 */ 937 function filter_upload_tabs( ) {938 return array( 'library' => __('Media Library') );919 function filter_upload_tabs( $tabs ) { 920 return $tabs; 939 921 } 940 922
Note: See TracChangeset
for help on using the changeset viewer.