Remove legacy media uploader bits from custom-header.php and custom-background.php. see #22186, #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-21 17:44:49 +00:00
parent f26102a248
commit dfb844b64b
2 changed files with 10 additions and 39 deletions

View File

@ -73,12 +73,6 @@ class Custom_Background {
add_action("load-$page", array(&$this, 'take_action'), 49);
add_action("load-$page", array(&$this, 'handle_upload'), 49);
if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) {
add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );
add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) );
add_filter( 'media_upload_mime_type_links', '__return_empty_array' );
}
if ( $this->admin_header_callback )
add_action("admin_head-$page", $this->admin_header_callback, 51);
}
@ -105,7 +99,6 @@ class Custom_Background {
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
);
add_thickbox();
wp_enqueue_media();
wp_enqueue_script('custom-background');
wp_enqueue_style('wp-color-picker');
@ -397,25 +390,21 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) )
}
/**
* Replace default attachment actions with "Set as background" link.
* Unused since 3.5.0.
*
* @since 3.4.0
*/
function attachment_fields_to_edit( $form_fields, $post ) {
$form_fields = array( 'image-size' => $form_fields['image-size'] );
$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>' );
$form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-background' );
function attachment_fields_to_edit( $form_fields ) {
return $form_fields;
}
/**
* Leave only "Media Library" tab in the uploader window.
* Unused since 3.5.0.
*
* @since 3.4.0
*/
function filter_upload_tabs() {
return array( 'library' => __('Media Library') );
function filter_upload_tabs( $tabs ) {
return $tabs;
}
public function wp_set_background_image() {

View File

@ -93,12 +93,6 @@ class Custom_Image_Header {
add_action("admin_head-$page", array(&$this, 'js'), 50);
if ( $this->admin_header_callback )
add_action("admin_head-$page", $this->admin_header_callback, 51);
if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-header' ) {
add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );
add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) );
add_filter( 'media_upload_mime_type_links', '__return_empty_array' );
}
}
/**
@ -171,7 +165,6 @@ class Custom_Image_Header {
$step = $this->step();
if ( ( 1 == $step || 3 == $step ) ) {
add_thickbox();
wp_enqueue_media();
wp_enqueue_script( 'custom-header' );
if ( current_theme_supports( 'custom-header', 'header-text' ) )
@ -910,32 +903,21 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
}
/**
* Replace default attachment actions with "Set as header" link.
* Unused since 3.5.0.
*
* @since 3.4.0
*/
function attachment_fields_to_edit( $form_fields, $post ) {
$form_fields = array();
$href = esc_url(add_query_arg(array(
'page' => 'custom-header',
'step' => 2,
'_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
'file' => $post->ID
), admin_url('themes.php')));
$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>' );
$form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-header' );
function attachment_fields_to_edit( $form_fields ) {
return $form_fields;
}
/**
* Leave only "Media Library" tab in the uploader window.
* Unused since 3.5.0.
*
* @since 3.4.0
*/
function filter_upload_tabs() {
return array( 'library' => __('Media Library') );
function filter_upload_tabs( $tabs ) {
return $tabs;
}
/**