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
This commit is contained in:
Scott Taylor 2014-12-20 22:19:24 +00:00
parent f19bec8754
commit 2dbd0d0a8f

View File

@ -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 = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
$html .= "<label for='{$css_id}'>$label</label>";
// Only show the dimensions if that choice is available.
if ( $enabled )
$html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
$html .= '</div>';
$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 = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
$html .= "<label for='{$css_id}'>$label</label>";
// Only show the dimensions if that choice is available.
if ( $enabled ) {
$html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
}
$html .= '</div>';
$out[] = $html;
}
return array(
'label' => __( 'Size' ),
'input' => 'html',
'html' => join( "\n", $out ),
);
}
/**