summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes/class-custom-image-header.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
commitfa9a33d818470a5796f0ff8797f98b510ed8de18 (patch)
treebde6a1eede376f9b5df5898ce812330152984d8e /wp-admin/includes/class-custom-image-header.php
parentReleasing progress-linux version 6.4.3+dfsg1-1~progress7.99u1. (diff)
downloadwordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.tar.xz
wordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.zip
Merging upstream version 6.5+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--wp-admin/includes/class-custom-image-header.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php
index ee3bcb1..20f1959 100644
--- a/wp-admin/includes/class-custom-image-header.php
+++ b/wp-admin/includes/class-custom-image-header.php
@@ -47,11 +47,13 @@ class Custom_Image_Header {
private $updated;
/**
- * Constructor - Register administration header callback.
+ * Constructor - Registers administration header callback.
*
* @since 2.1.0
- * @param callable $admin_header_callback
- * @param callable $admin_image_div_callback Optional custom image div output callback.
+ *
+ * @param callable $admin_header_callback Administration header callback.
+ * @param callable $admin_image_div_callback Optional. Custom image div output callback.
+ * Default empty string.
*/
public function __construct( $admin_header_callback, $admin_image_div_callback = '' ) {
$this->admin_header_callback = $admin_header_callback;
@@ -932,7 +934,7 @@ endif;
<p class="hide-if-js"><strong><?php _e( 'You need JavaScript to choose a part of the image.' ); ?></strong></p>
<div id="crop_image" style="position: relative">
- <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" alt="" />
+ <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" alt="" />
</div>
<input type="hidden" name="x1" id="x1" value="0" />
@@ -1075,7 +1077,7 @@ endif;
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
- $attachment = $this->create_attachment_object( $cropped, $attachment_id );
+ $attachment = wp_copy_parent_attachment_properties( $cropped, $attachment_id, 'custom-header' );
if ( ! empty( $_POST['create-new-attachment'] ) ) {
unset( $attachment['ID'] );
@@ -1312,12 +1314,14 @@ endif;
* Creates an attachment 'object'.
*
* @since 3.9.0
+ * @deprecated 6.5.0
*
* @param string $cropped Cropped image URL.
* @param int $parent_attachment_id Attachment ID of parent image.
* @return array An array with attachment object data.
*/
final public function create_attachment_object( $cropped, $parent_attachment_id ) {
+ _deprecated_function( __METHOD__, '6.5.0', 'wp_copy_parent_attachment_properties()' );
$parent = get_post( $parent_attachment_id );
$parent_url = wp_get_attachment_url( $parent->ID );
$url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
@@ -1419,7 +1423,7 @@ endif;
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
- $attachment = $this->create_attachment_object( $cropped, $attachment_id );
+ $attachment = wp_copy_parent_attachment_properties( $cropped, $attachment_id, 'custom-header' );
$previous = $this->get_previous_crop( $attachment );