Changeset 53161
- Timestamp:
- 04/12/2022 04:14:01 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image-edit.php
r51303 r53161 44 44 } 45 45 } 46 46 $edit_custom_sizes = false; 47 /** 48 * Filters whether custom sizes are available options for image editing. 49 * 50 * @since 6.0.0 51 * 52 * @param bool|array $edit_custom_sizes True if custom sizes can be edited or array of custom sizes. 53 */ 54 $edit_custom_sizes = apply_filters( 'edit_custom_thumbnail_sizes', $edit_custom_sizes ); 47 55 ?> 48 56 <div class="imgedit-wrap wp-clearfix"> … … 240 248 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> 241 249 </span> 250 <?php 251 if ( $edit_custom_sizes ) { 252 if ( ! is_array( $edit_custom_sizes ) ) { 253 $edit_custom_sizes = get_intermediate_image_sizes(); 254 } 255 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { 256 if ( array_key_exists( $size, $meta['sizes'] ) ) { 257 if ( 'thumbnail' === $size ) { 258 continue; 259 } 260 ?> 261 <span class="imgedit-label"> 262 <input type="radio" id="imgedit-target-custom<?php echo esc_attr( $key ); ?>" name="imgedit-target-<?php echo $post_id; ?>" value="<?php echo esc_attr( $size ); ?>" /> 263 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> 264 </span> 265 <?php 266 } 267 } 268 } 269 ?> 242 270 </fieldset> 243 271 </div> … … 906 934 $meta['height'] = $size['height']; 907 935 908 if ( $success && ( 'nothumb' === $target || 'all' === $target )) {936 if ( $success ) { 909 937 $sizes = get_intermediate_image_sizes(); 910 if ( 'nothumb' === $target ) { 911 $sizes = array_diff( $sizes, array( 'thumbnail' ) ); 938 if ( 'nothumb' === $target || 'all' === $target ) { 939 if ( 'nothumb' === $target ) { 940 $sizes = array_diff( $sizes, array( 'thumbnail' ) ); 941 } 942 } elseif ( 'thumbnail' !== $target ) { 943 $sizes = array_diff( $sizes, array( $target ) ); 912 944 } 913 945 } … … 920 952 $delete = true; 921 953 $nocrop = true; 954 } else { 955 $sizes = array( $target ); 956 $success = true; 957 $delete = true; 958 $nocrop = $_wp_additional_image_sizes[ $size ]['crop']; 922 959 } 923 960
Note: See TracChangeset
for help on using the changeset viewer.