Changeset 49108 for trunk/src/wp-includes/media.php
- Timestamp:
- 10/08/2020 09:13:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r49021 r49108 71 71 $max_height = $size[1]; 72 72 } elseif ( 'thumb' === $size || 'thumbnail' === $size ) { 73 $max_width = intval( get_option( 'thumbnail_size_w' ));74 $max_height = intval( get_option( 'thumbnail_size_h' ));73 $max_width = (int) get_option( 'thumbnail_size_w' ); 74 $max_height = (int) get_option( 'thumbnail_size_h' ); 75 75 // Last chance thumbnail size defaults. 76 76 if ( ! $max_width && ! $max_height ) { … … 79 79 } 80 80 } elseif ( 'medium' === $size ) { 81 $max_width = intval( get_option( 'medium_size_w' ));82 $max_height = intval( get_option( 'medium_size_h' ));81 $max_width = (int) get_option( 'medium_size_w' ); 82 $max_height = (int) get_option( 'medium_size_h' ); 83 83 84 84 } elseif ( 'medium_large' === $size ) { 85 $max_width = intval( get_option( 'medium_large_size_w' ));86 $max_height = intval( get_option( 'medium_large_size_h' ));87 88 if ( intval( $content_width )> 0 ) {89 $max_width = min( intval( $content_width ), $max_width );85 $max_width = (int) get_option( 'medium_large_size_w' ); 86 $max_height = (int) get_option( 'medium_large_size_h' ); 87 88 if ( (int) $content_width > 0 ) { 89 $max_width = min( (int) $content_width, $max_width ); 90 90 } 91 91 } elseif ( 'large' === $size ) { … … 96 96 * can resize it in the editor if they wish. 97 97 */ 98 $max_width = intval( get_option( 'large_size_w' ));99 $max_height = intval( get_option( 'large_size_h' ));100 101 if ( intval( $content_width )> 0 ) {102 $max_width = min( intval( $content_width ), $max_width );98 $max_width = (int) get_option( 'large_size_w' ); 99 $max_height = (int) get_option( 'large_size_h' ); 100 101 if ( (int) $content_width > 0 ) { 102 $max_width = min( (int) $content_width, $max_width ); 103 103 } 104 104 } elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) { 105 $max_width = intval( $_wp_additional_image_sizes[ $size ]['width'] );106 $max_height = intval( $_wp_additional_image_sizes[ $size ]['height'] );105 $max_width = (int) $_wp_additional_image_sizes[ $size ]['width']; 106 $max_height = (int) $_wp_additional_image_sizes[ $size ]['height']; 107 107 // Only in admin. Assume that theme authors know what they're doing. 108 if ( intval( $content_width )> 0 && 'edit' === $context ) {109 $max_width = min( intval( $content_width ), $max_width );108 if ( (int) $content_width > 0 && 'edit' === $context ) { 109 $max_width = min( (int) $content_width, $max_width ); 110 110 } 111 111 } else { // $size === 'full' has no constraint. … … 156 156 $out = ''; 157 157 if ( $width ) { 158 $out .= 'width="' . intval( $width ). '" ';158 $out .= 'width="' . (int) $width . '" '; 159 159 } 160 160 if ( $height ) { 161 $out .= 'height="' . intval( $height ). '" ';161 $out .= 'height="' . (int) $height . '" '; 162 162 } 163 163 return $out; … … 776 776 foreach ( $imagedata['sizes'] as $_size => $data ) { 777 777 // If there's an exact match to an existing image size, short circuit. 778 if ( intval( $data['width'] ) === intval( $size[0] ) && intval( $data['height'] ) === intval( $size[1] )) {778 if ( (int) $data['width'] === (int) $size[0] && (int) $data['height'] === (int) $size[1] ) { 779 779 $candidates[ $data['width'] * $data['height'] ] = $data; 780 780 break; … … 897 897 if ( isset( $additional_sizes[ $size_name ]['width'] ) ) { 898 898 // For sizes added by plugins and themes. 899 $size_data['width'] = intval( $additional_sizes[ $size_name ]['width'] );899 $size_data['width'] = (int) $additional_sizes[ $size_name ]['width']; 900 900 } else { 901 901 // For default sizes set in options. 902 $size_data['width'] = intval( get_option( "{$size_name}_size_w" ));902 $size_data['width'] = (int) get_option( "{$size_name}_size_w" ); 903 903 } 904 904 905 905 if ( isset( $additional_sizes[ $size_name ]['height'] ) ) { 906 $size_data['height'] = intval( $additional_sizes[ $size_name ]['height'] );906 $size_data['height'] = (int) $additional_sizes[ $size_name ]['height']; 907 907 } else { 908 $size_data['height'] = intval( get_option( "{$size_name}_size_h" ));908 $size_data['height'] = (int) get_option( "{$size_name}_size_h" ); 909 909 } 910 910 … … 2216 2216 ); 2217 2217 2218 $id = intval( $atts['id'] );2218 $id = (int) $atts['id']; 2219 2219 2220 2220 if ( ! empty( $atts['include'] ) ) { … … 2294 2294 } 2295 2295 2296 $columns = intval( $atts['columns'] );2296 $columns = (int) $atts['columns']; 2297 2297 $itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100; 2298 2298 $float = is_rtl() ? 'right' : 'left'; … … 2554 2554 ); 2555 2555 2556 $id = intval( $atts['id'] );2556 $id = (int) $atts['id']; 2557 2557 2558 2558 if ( 'audio' !== $atts['type'] ) { … … 3331 3331 3332 3332 foreach ( $attachments as $k => $attachment ) { 3333 if ( intval( $attachment->ID ) === intval( $post->ID )) {3333 if ( (int) $attachment->ID === (int) $post->ID ) { 3334 3334 break; 3335 3335 } … … 4517 4517 // Specify the post ID of the gallery we're viewing if the shortcode doesn't reference another post already. 4518 4518 if ( ! isset( $shortcode_attrs['id'] ) ) { 4519 $shortcode[3] .= ' id="' . intval( $post->ID ). '"';4519 $shortcode[3] .= ' id="' . (int) $post->ID . '"'; 4520 4520 } 4521 4521
Note: See TracChangeset
for help on using the changeset viewer.