Changeset 30981
- Timestamp:
- 12/20/2014 10:18:12 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r30680 r30981 950 950 */ 951 951 function image_size_input_fields( $post, $check = '' ) { 952 953 952 /** 954 953 * Filter the names and labels of the default image sizes. … … 966 965 ) ); 967 966 968 if ( empty($check) ) 969 $check = get_user_setting('imgsize', 'medium'); 970 971 foreach ( $size_names as $size => $label ) { 972 $downsize = image_downsize($post->ID, $size); 973 $checked = ''; 974 975 // Is this size selectable? 976 $enabled = ( $downsize[3] || 'full' == $size ); 977 $css_id = "image-size-{$size}-{$post->ID}"; 978 979 // If this size is the default but that's not available, don't select it. 980 if ( $size == $check ) { 981 if ( $enabled ) 982 $checked = " checked='checked'"; 983 else 984 $check = ''; 985 } elseif ( !$check && $enabled && 'thumbnail' != $size ) { 986 /* 987 * If $check is not enabled, default to the first available size 988 * that's bigger than a thumbnail. 989 */ 990 $check = $size; 967 if ( empty( $check ) ) { 968 $check = get_user_setting('imgsize', 'medium'); 969 } 970 $out = array(); 971 972 foreach ( $size_names as $size => $label ) { 973 $downsize = image_downsize( $post->ID, $size ); 974 $checked = ''; 975 976 // Is this size selectable? 977 $enabled = ( $downsize[3] || 'full' == $size ); 978 $css_id = "image-size-{$size}-{$post->ID}"; 979 980 // If this size is the default but that's not available, don't select it. 981 if ( $size == $check ) { 982 if ( $enabled ) { 991 983 $checked = " checked='checked'"; 984 } else { 985 $check = ''; 992 986 } 993 994 $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />"; 995 996 $html .= "<label for='{$css_id}'>$label</label>"; 997 998 // Only show the dimensions if that choice is available. 999 if ( $enabled ) 1000 $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d × %d)", $downsize[1], $downsize[2] ). "</label>"; 1001 1002 $html .= '</div>'; 1003 1004 $out[] = $html; 1005 } 1006 1007 return array( 1008 'label' => __('Size'), 1009 'input' => 'html', 1010 'html' => join("\n", $out), 1011 ); 987 } elseif ( ! $check && $enabled && 'thumbnail' != $size ) { 988 /* 989 * If $check is not enabled, default to the first available size 990 * that's bigger than a thumbnail. 991 */ 992 $check = $size; 993 $checked = " checked='checked'"; 994 } 995 996 $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />"; 997 998 $html .= "<label for='{$css_id}'>$label</label>"; 999 1000 // Only show the dimensions if that choice is available. 1001 if ( $enabled ) { 1002 $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d × %d)", $downsize[1], $downsize[2] ). "</label>"; 1003 } 1004 $html .= '</div>'; 1005 1006 $out[] = $html; 1007 } 1008 1009 return array( 1010 'label' => __( 'Size' ), 1011 'input' => 'html', 1012 'html' => join( "\n", $out ), 1013 ); 1012 1014 } 1013 1015
Note: See TracChangeset
for help on using the changeset viewer.