From 2dbd0d0a8fe9dde1b5313d56438fe487cabb6fd0 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 20 Dec 2014 22:19:24 +0000 Subject: [PATCH] In `image_size_input_fields()`: * Declare `$out` as an empty array - this is not a strict PHP requirement, but is a good practice before loops * Most of this function was tabbed twice, instead of once See #30799. Built from https://develop.svn.wordpress.org/trunk@30981 git-svn-id: http://core.svn.wordpress.org/trunk@30967 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 78 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 7fa4dd8f05..a3a9dd86f9 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -949,7 +949,6 @@ function image_align_input_fields( $post, $checked = '' ) { * @return array */ function image_size_input_fields( $post, $check = '' ) { - /** * Filter the names and labels of the default image sizes. * @@ -965,50 +964,53 @@ function image_size_input_fields( $post, $check = '' ) { 'full' => __( 'Full Size' ) ) ); - if ( empty($check) ) - $check = get_user_setting('imgsize', 'medium'); + if ( empty( $check ) ) { + $check = get_user_setting('imgsize', 'medium'); + } + $out = array(); - foreach ( $size_names as $size => $label ) { - $downsize = image_downsize($post->ID, $size); - $checked = ''; + foreach ( $size_names as $size => $label ) { + $downsize = image_downsize( $post->ID, $size ); + $checked = ''; - // Is this size selectable? - $enabled = ( $downsize[3] || 'full' == $size ); - $css_id = "image-size-{$size}-{$post->ID}"; + // Is this size selectable? + $enabled = ( $downsize[3] || 'full' == $size ); + $css_id = "image-size-{$size}-{$post->ID}"; - // If this size is the default but that's not available, don't select it. - if ( $size == $check ) { - if ( $enabled ) - $checked = " checked='checked'"; - else - $check = ''; - } elseif ( !$check && $enabled && 'thumbnail' != $size ) { - /* - * If $check is not enabled, default to the first available size - * that's bigger than a thumbnail. - */ - $check = $size; + // If this size is the default but that's not available, don't select it. + if ( $size == $check ) { + if ( $enabled ) { $checked = " checked='checked'"; + } else { + $check = ''; } - - $html = "
"; - - $html .= ""; - - // Only show the dimensions if that choice is available. - if ( $enabled ) - $html .= " "; - - $html .= '
'; - - $out[] = $html; + } elseif ( ! $check && $enabled && 'thumbnail' != $size ) { + /* + * If $check is not enabled, default to the first available size + * that's bigger than a thumbnail. + */ + $check = $size; + $checked = " checked='checked'"; } - return array( - 'label' => __('Size'), - 'input' => 'html', - 'html' => join("\n", $out), - ); + $html = "
"; + + $html .= ""; + + // Only show the dimensions if that choice is available. + if ( $enabled ) { + $html .= " "; + } + $html .= '
'; + + $out[] = $html; + } + + return array( + 'label' => __( 'Size' ), + 'input' => 'html', + 'html' => join( "\n", $out ), + ); } /**