X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..refs/tags/wordpress-3.8.1:/wp-admin/custom-header.php
diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php
index 14f01dfb..7f222f7c 100644
--- a/wp-admin/custom-header.php
+++ b/wp-admin/custom-header.php
@@ -84,13 +84,13 @@ class Custom_Image_Header {
if ( ! current_user_can('edit_theme_options') )
return;
- $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array(&$this, 'admin_page'));
+ $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array($this, 'admin_page'));
- add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
- add_action("admin_print_styles-$page", array(&$this, 'css_includes'));
- add_action("admin_head-$page", array(&$this, 'help') );
- add_action("admin_head-$page", array(&$this, 'take_action'), 50);
- add_action("admin_head-$page", array(&$this, 'js'), 50);
+ add_action("admin_print_scripts-$page", array($this, 'js_includes'));
+ add_action("admin_print_styles-$page", array($this, 'css_includes'));
+ add_action("admin_head-$page", array($this, 'help') );
+ add_action("admin_head-$page", array($this, 'take_action'), 50);
+ add_action("admin_head-$page", array($this, 'js'), 50);
if ( $this->admin_header_callback )
add_action("admin_head-$page", $this->admin_header_callback, 51);
}
@@ -450,7 +450,6 @@ class Custom_Image_Header {
?>
-
updated ) ) { ?>
@@ -464,6 +463,7 @@ class Custom_Image_Header {
@@ -663,8 +670,8 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
list( $width, $height, $type, $attr ) = getimagesize( $file );
} else {
$data = wp_get_attachment_metadata( $attachment_id );
- $height = $data[ 'height' ];
- $width = $data[ 'width' ];
+ $height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0;
+ $width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0;
unset( $data );
}
@@ -687,7 +694,16 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
- do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication
+ /**
+ * Fires after the header image is set or an error is returned.
+ *
+ * @since 2.1.0
+ *
+ * @param string $file Path to the file.
+ * @param int $attachment_id Attachment ID.
+ */
+ do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication
+
return $this->finished();
} elseif ( $width > $max_width ) {
$oitar = $width / $max_width;
@@ -695,7 +711,8 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
if ( ! $image || is_wp_error( $image ) )
wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
- $image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication
+ /** This filter is documented in wp-admin/custom-header.php */
+ $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
$url = str_replace(basename($url), basename($image), $url);
$width = $width / $oitar;
@@ -706,7 +723,6 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
?>
-