- Timestamp:
- 01/29/2020 12:43:23 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-custom-image-header.php
r45932 r47122 801 801 802 802 $max_width = 0; 803 // For flex, limit size of image displayed to 1500px unless theme says otherwise 803 // For flex, limit size of image displayed to 1500px unless theme says otherwise. 804 804 if ( current_theme_supports( 'custom-header', 'flex-width' ) ) { 805 805 $max_width = 1500; … … 811 811 $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); 812 812 813 // If flexible height isn't supported and the image is the exact right size 813 // If flexible height isn't supported and the image is the exact right size. 814 814 if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) 815 815 && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) { 816 // Add the meta -data816 // Add the metadata. 817 817 if ( file_exists( $file ) ) { 818 818 wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); … … 829 829 * @param int $attachment_id Attachment ID. 830 830 */ 831 do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication 831 do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication. 832 832 833 833 return $this->finished(); … … 840 840 841 841 /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ 842 $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication 842 $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication. 843 843 844 844 $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); … … 911 911 $filename = wp_basename( $file ); 912 912 913 // Construct the object array 913 // Construct the object array. 914 914 $object = array( 915 915 'post_title' => $filename, … … 920 920 ); 921 921 922 // Save the data 922 // Save the data. 923 923 $attachment_id = wp_insert_attachment( $object, $file ); 924 924 return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); … … 983 983 984 984 /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ 985 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication 985 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 986 986 987 987 $object = $this->create_attachment_object( $cropped, $attachment_id ); … … 991 991 } 992 992 993 // Update the attachment 993 // Update the attachment. 994 994 $attachment_id = $this->insert_attachment( $object, $cropped ); 995 995 … … 1181 1181 ); 1182 1182 1183 // For flex, limit size of image displayed to 1500px unless theme says otherwise 1183 // For flex, limit size of image displayed to 1500px unless theme says otherwise. 1184 1184 if ( $has_flex_width ) { 1185 1185 $max_width = 1500; … … 1319 1319 1320 1320 /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ 1321 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication 1321 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 1322 1322 1323 1323 $object = $this->create_attachment_object( $cropped, $attachment_id ); … … 1435 1435 $default = get_theme_support( 'custom-header', 'default-image' ); 1436 1436 1437 if ( ! $default ) { // If not, 1438 return $this->default_headers; // easy peasy.1437 if ( ! $default ) { // If not, easy peasy. 1438 return $this->default_headers; 1439 1439 } 1440 1440
Note: See TracChangeset
for help on using the changeset viewer.