<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12543] trunk/wp-admin: More cleanup of the edit media screen:</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12543">12543</a></dd>
<dt>Author</dt> <dd>matt</dd>
<dt>Date</dt> <dd>2009-12-25 23:04:48 +0000 (Fri, 25 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>More cleanup of the edit media screen:

* Simplified table to not need rowspan, and other markup where possible.
* Put more elements in a paragraph tag for better spacing.
* Brought edit image buton under the image.
* Everything is now in line with WordPress Coding Standards, particularly with regards to spacing and attribute quotes.
* Minor styling for better alignment.

TODO: We show the file URL here, but for images we should show the URL to each size, with its dimensions.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminmediaphp">trunk/wp-admin/media.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (12542 => 12543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2009-12-25 22:22:21 UTC (rev 12542)
+++ trunk/wp-admin/includes/media.php        2009-12-25 23:04:48 UTC (rev 12543)
</span><span class="lines">@@ -1019,6 +1019,8 @@
</span><span class="cx"> 
</span><span class="cx">         $edit_post = sanitize_post($post, 'edit');
</span><span class="cx"> 
</span><ins>+        
+
</ins><span class="cx">         $form_fields = array(
</span><span class="cx">                 'post_title'   =&gt; array(
</span><span class="cx">                         'label'      =&gt; __('Title'),
</span><span class="lines">@@ -1131,7 +1133,7 @@
</span><span class="cx"> function get_media_item( $attachment_id, $args = null ) {
</span><span class="cx">         global $redir_tab;
</span><span class="cx"> 
</span><del>-        if ( ( $attachment_id = intval($attachment_id) ) &amp;&amp; $thumb_url = get_attachment_icon_src( $attachment_id ) )
</del><ins>+        if ( ( $attachment_id = intval( $attachment_id ) ) &amp;&amp; $thumb_url = get_attachment_icon_src( $attachment_id ) )
</ins><span class="cx">                 $thumb_url = $thumb_url[0];
</span><span class="cx">         else
</span><span class="cx">                 return false;
</span><span class="lines">@@ -1140,29 +1142,29 @@
</span><span class="cx">         $args = wp_parse_args( $args, $default_args );
</span><span class="cx">         extract( $args, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-        $toggle_on = __('Show');
-        $toggle_off = __('Hide');
</del><ins>+        $toggle_on  = __( 'Show' );
+        $toggle_off = __( 'Hide' );
</ins><span class="cx"> 
</span><del>-        $post = get_post($attachment_id);
</del><ins>+        $post = get_post( $attachment_id );
</ins><span class="cx"> 
</span><del>-        $filename = basename($post-&gt;guid);
-        $title = esc_attr($post-&gt;post_title);
</del><ins>+        $filename = basename( $post-&gt;guid );
+        $title = esc_attr( $post-&gt;post_title );
</ins><span class="cx"> 
</span><del>-        if ( $_tags = get_the_tags($attachment_id) ) {
</del><ins>+        if ( $_tags = get_the_tags( $attachment_id ) ) {
</ins><span class="cx">                 foreach ( $_tags as $tag )
</span><span class="cx">                         $tags[] = $tag-&gt;name;
</span><del>-                $tags = esc_attr(join(', ', $tags));
</del><ins>+                $tags = esc_attr( join( ', ', $tags ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $post_mime_types = get_post_mime_types();
</span><del>-        $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post-&gt;post_mime_type));
-        $type = array_shift($keys);
</del><ins>+        $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post-&gt;post_mime_type ) );
+        $type = array_shift( $keys );
</ins><span class="cx">         $type_html = &quot;&lt;input type='hidden' id='type-of-$attachment_id' value='&quot; . esc_attr( $type ) . &quot;' /&gt;&quot;;
</span><span class="cx"> 
</span><del>-        $form_fields = get_attachment_fields_to_edit($post, $errors);
</del><ins>+        $form_fields = get_attachment_fields_to_edit( $post, $errors );
</ins><span class="cx"> 
</span><span class="cx">         if ( $toggle ) {
</span><del>-                $class = empty($errors) ? 'startclosed' : 'startopen';
</del><ins>+                $class = empty( $errors ) ? 'startclosed' : 'startopen';
</ins><span class="cx">                 $toggle_links = &quot;
</span><span class="cx">         &lt;a class='toggle describe-toggle-on' href='#'&gt;$toggle_on&lt;/a&gt;
</span><span class="cx">         &lt;a class='toggle describe-toggle-off' href='#'&gt;$toggle_off&lt;/a&gt;&quot;;
</span><span class="lines">@@ -1172,33 +1174,33 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
</span><del>-        $display_title = $show_title ? &quot;&lt;div class='filename new'&gt;&lt;span class='title'&gt;&quot; . wp_html_excerpt($display_title, 60) . &quot;&lt;/span&gt;&lt;/div&gt;&quot; : '';
</del><ins>+        $display_title = $show_title ? &quot;&lt;div class='filename new'&gt;&lt;span class='title'&gt;&quot; . wp_html_excerpt( $display_title, 60 ) . &quot;&lt;/span&gt;&lt;/div&gt;&quot; : '';
</ins><span class="cx"> 
</span><del>-        $gallery = ( (isset($_REQUEST['tab']) &amp;&amp; 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) &amp;&amp; 'gallery' == $redir_tab) ) ? true : false;
</del><ins>+        $gallery = ( ( isset( $_REQUEST['tab'] ) &amp;&amp; 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) &amp;&amp; 'gallery' == $redir_tab ) ) ? true : false;
</ins><span class="cx">         $order = '';
</span><span class="cx"> 
</span><span class="cx">         foreach ( $form_fields as $key =&gt; $val ) {
</span><span class="cx">                 if ( 'menu_order' == $key ) {
</span><span class="cx">                         if ( $gallery )
</span><del>-                                $order = '&lt;div class=&quot;menu_order&quot;&gt; &lt;input class=&quot;menu_order_input&quot; type=&quot;text&quot; id=&quot;attachments['.$attachment_id.'][menu_order]&quot; name=&quot;attachments['.$attachment_id.'][menu_order]&quot; value=&quot;'.$val['value'].'&quot; /&gt;&lt;/div&gt;';
</del><ins>+                                $order = &quot;&lt;div class='menu_order'&gt; &lt;input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='&quot; . esc_attr( $val['value'] ). &quot;' /&gt;&lt;/div&gt;&quot;;
</ins><span class="cx">                         else
</span><del>-                                $order = '&lt;input type=&quot;hidden&quot; name=&quot;attachments['.$attachment_id.'][menu_order]&quot; value=&quot;'.$val['value'].'&quot; /&gt;';
</del><ins>+                                $order = &quot;&lt;input type='hidden' name='attachments[$attachment_id][menu_order]' value='&quot; . esc_attr( $val['value'] ) . &quot;' /&gt;&quot;;
</ins><span class="cx"> 
</span><del>-                        unset($form_fields['menu_order']);
</del><ins>+                        unset( $form_fields['menu_order'] );
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $media_dims = '';
</span><del>-        $meta = wp_get_attachment_metadata($post-&gt;ID);
-        if ( is_array($meta) &amp;&amp; array_key_exists('width', $meta) &amp;&amp; array_key_exists('height', $meta) )
-                $media_dims .= &quot;&lt;span id='media-dims-{$post-&gt;ID}'&gt;{$meta['width']}&amp;nbsp;&amp;times;&amp;nbsp;{$meta['height']}&lt;/span&gt; &quot;;
-        $media_dims = apply_filters('media_meta', $media_dims, $post);
</del><ins>+        $meta = wp_get_attachment_metadata( $post-&gt;ID );
+        if ( is_array( $meta ) &amp;&amp; array_key_exists( 'width', $meta ) &amp;&amp; array_key_exists( 'height', $meta ) )
+                $media_dims .= &quot;&lt;span id='media-dims-$post-&gt;ID'&gt;{$meta['width']}&amp;nbsp;&amp;times;&amp;nbsp;{$meta['height']}&lt;/span&gt; &quot;;
+        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
</ins><span class="cx"> 
</span><span class="cx">         $image_edit_button = '';
</span><del>-        if ( gd_edit_image_support($post-&gt;post_mime_type) ) {
-                $nonce = wp_create_nonce(&quot;image_editor-$post-&gt;ID&quot;);
-                $image_edit_button = &quot;&lt;input type='button' id='imgedit-open-btn-{$post-&gt;ID}' onclick='imageEdit.open($post-&gt;ID, \&quot;$nonce\&quot;)' class='button' value='&quot; . esc_attr__( 'Edit image' ) . &quot;' /&gt; &lt;img src='images/wpspin_light.gif' class='imgedit-wait-spin' alt='' /&gt;&quot;;
</del><ins>+        if ( gd_edit_image_support( $post-&gt;post_mime_type ) ) {
+                $nonce = wp_create_nonce( &quot;image_editor-$post-&gt;ID&quot; );
+                $image_edit_button = &quot;&lt;input type='button' id='imgedit-open-btn-$post-&gt;ID' onclick='imageEdit.open( $post-&gt;ID, \&quot;$nonce\&quot; )' class='button' value='&quot; . esc_attr__( 'Edit image' ) . &quot;' /&gt; &lt;img src='images/wpspin_light.gif' class='imgedit-wait-spin' alt='' /&gt;&quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $attachment_url = get_permalink( $attachment_id );
</span><span class="lines">@@ -1210,20 +1212,23 @@
</span><span class="cx">         $display_title
</span><span class="cx">         &lt;table class='slidetoggle describe $class'&gt;
</span><span class="cx">                 &lt;thead class='media-item-info' id='media-head-$post-&gt;ID'&gt;
</span><del>-                &lt;tr&gt;
-                        &lt;td class='A1B1' id='thumbnail-head-$post-&gt;ID' rowspan='5'&gt;
-                        &lt;a href='$attachment_url' target='_blank'&gt;&lt;img class='thumbnail' src='$thumb_url' alt='' /&gt;&lt;/a&gt;
</del><ins>+                &lt;tr valign='top'&gt;
+                        &lt;td class='A1B1' id='thumbnail-head-$post-&gt;ID'&gt;
+                        &lt;p&gt;&lt;a href='$attachment_url' target='_blank'&gt;&lt;img class='thumbnail' src='$thumb_url' alt='' style='margin-top: 3px' /&gt;&lt;/a&gt;&lt;/p&gt;
+                        &lt;p&gt;$image_edit_button&lt;/p&gt;
</ins><span class="cx">                         &lt;/td&gt;
</span><del>-                        &lt;td&gt;&lt;strong&gt;&quot; . __('File name:') . &quot;&lt;/strong&gt; $filename&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;&lt;td&gt;&lt;strong&gt;&quot; . __('File type:') . &quot;&lt;/strong&gt; $post-&gt;post_mime_type&lt;/td&gt;&lt;/tr&gt;
-                &lt;tr&gt;&lt;td&gt;&lt;strong&gt;&quot; . __('Upload date:') . &quot;&lt;/strong&gt; &quot; . mysql2date( get_option('date_format'), $post-&gt;post_date ) . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
</del><ins>+                        &lt;td&gt;
+                        &lt;p&gt;&lt;strong&gt;&quot; . __('File name:') . &quot;&lt;/strong&gt; $filename&lt;/p&gt;
+                        &lt;p&gt;&lt;strong&gt;&quot; . __('File type:') . &quot;&lt;/strong&gt; $post-&gt;post_mime_type&lt;/p&gt;
+                        &lt;p&gt;&lt;strong&gt;&quot; . __('Upload date:') . &quot;&lt;/strong&gt; &quot; . mysql2date( get_option('date_format'), $post-&gt;post_date ). '&lt;/p&gt;';
+                        if ( !empty( $media_dims ) )
+                                $item .= &quot;&lt;p&gt;&lt;strong&gt;&quot; . __('Dimensions:') . &quot;&lt;/strong&gt; $media_dims&lt;/p&gt;\n&quot;;
+                        
+                        echo &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;;
</ins><span class="cx"> 
</span><del>-        if ( !empty($media_dims) )
-                $item .= &quot;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&quot; . __('Dimensions:') . &quot;&lt;/strong&gt; $media_dims&lt;/td&gt;&lt;/tr&gt;\n&quot;;
</del><ins>+        
</ins><span class="cx"> 
</span><span class="cx">         $item .= &quot;
</span><del>-                &lt;tr&gt;&lt;td class='A1B1'&gt;$image_edit_button&lt;/td&gt;&lt;/tr&gt;
</del><span class="cx">                 &lt;/thead&gt;
</span><span class="cx">                 &lt;tbody&gt;
</span><span class="cx">                 &lt;tr&gt;&lt;td colspan='2' class='imgedit-response' id='imgedit-response-$post-&gt;ID'&gt;&lt;/td&gt;&lt;/tr&gt;
</span><span class="lines">@@ -1238,13 +1243,18 @@
</span><span class="cx"> 
</span><span class="cx">         if ( $send )
</span><span class="cx">                 $send = &quot;&lt;input type='submit' class='button' name='send[$attachment_id]' value='&quot; . esc_attr__( 'Insert into Post' ) . &quot;' /&gt;&quot;;
</span><del>-        if ( $delete &amp;&amp; current_user_can('delete_post', $attachment_id) ) {
</del><ins>+        if ( $delete &amp;&amp; current_user_can( 'delete_post', $attachment_id ) ) {
</ins><span class="cx">                 if ( !EMPTY_TRASH_DAYS ) {
</span><del>-                        $delete = &quot;&lt;a href=\&quot;&quot; . wp_nonce_url(&quot;post.php?action=delete&amp;amp;post=$attachment_id&quot;, 'delete-post_' . $attachment_id) . &quot;\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;delete\&quot;&gt;&quot; . __('Delete Permanently') . &quot;&lt;/a&gt;&quot;;
</del><ins>+                        $delete = &quot;&lt;a href='&quot; . wp_nonce_url( &quot;post.php?action=delete&amp;amp;post=$attachment_id&quot;, 'delete-post_' . $attachment_id ) . &quot;' id='del[$attachment_id]' class='delete'&gt;&quot; . __( 'Delete Permanently' ) . '&lt;/a&gt;';
</ins><span class="cx">                 } elseif ( !MEDIA_TRASH ) {
</span><del>-                        $delete = &quot;&lt;a href=\&quot;#\&quot; class=\&quot;del-link\&quot; onclick=\&quot;document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\&quot;&gt;&quot; . __('Delete') . &quot;&lt;/a&gt; &lt;div id=\&quot;del_attachment_$attachment_id\&quot; class=\&quot;del-attachment\&quot; style=\&quot;display:none;\&quot;&gt;&quot; . sprintf(__(&quot;You are about to delete &lt;strong&gt;%s&lt;/strong&gt;.&quot;), $filename) . &quot; &lt;a href=\&quot;&quot; . wp_nonce_url(&quot;post.php?action=delete&amp;amp;post=$attachment_id&quot;, 'delete-post_' . $attachment_id) . &quot;\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;button\&quot;&gt;&quot; . __('Continue') . &quot;&lt;/a&gt; &lt;a href=\&quot;#\&quot; class=\&quot;button\&quot; onclick=\&quot;this.parentNode.style.display='none';return false;\&quot;&gt;&quot; . __('Cancel') . &quot;&lt;/a&gt;&lt;/div&gt;&quot;;
</del><ins>+                        $delete = &quot;&lt;a href='#' class='del-link' onclick=\&quot;document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\&quot;&gt;&quot; . __( 'Delete' ) . &quot;&lt;/a&gt;
+                         &lt;div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'&gt;&quot; . sprintf( __( 'You are about to delete &lt;strong&gt;%s&lt;/strong&gt;.' ), $filename ) . &quot; 
+                         &lt;a href='&quot; . wp_nonce_url( &quot;post.php?action=delete&amp;amp;post=$attachment_id&quot;, 'delete-post_' . $attachment_id ) . &quot;' id='del[$attachment_id]' class='button'&gt;&quot; . __( 'Continue' ) . &quot;&lt;/a&gt; 
+                         &lt;a href='#' class='button' onclick=\&quot;this.parentNode.style.display='none';return false;\&quot;&gt;&quot; . __( 'Cancel' ) . &quot;&lt;/a&gt;
+                         &lt;/div&gt;&quot;;
</ins><span class="cx">                 } else {
</span><del>-                        $delete = &quot;&lt;a href=\&quot;&quot; . wp_nonce_url(&quot;post.php?action=trash&amp;amp;post=$attachment_id&quot;, 'trash-post_' . $attachment_id) . &quot;\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;delete\&quot;&gt;&quot; . __('Move to Trash') . &quot;&lt;/a&gt; &lt;a href=\&quot;&quot; . wp_nonce_url(&quot;post.php?action=untrash&amp;amp;post=$attachment_id&quot;, 'untrash-post_' . $attachment_id) . &quot;\&quot; id=\&quot;undo[$attachment_id]\&quot; class=\&quot;undo hidden\&quot;&gt;&quot; . __('Undo') . &quot;&lt;/a&gt;&quot;;
</del><ins>+                        $delete = &quot;&lt;a href='&quot; . wp_nonce_url( &quot;post.php?action=trash&amp;amp;post=$attachment_id&quot;, 'trash-post_' . $attachment_id ) . &quot;' id='del[$attachment_id]' class='delete'&gt;&quot; . __( 'Move to Trash' ) . &quot;&lt;/a&gt; 
+                        &lt;a href='&quot; . wp_nonce_url( &quot;post.php?action=untrash&amp;amp;post=$attachment_id&quot;, 'untrash-post_' . $attachment_id ) . &quot;' id='undo[$attachment_id]' class='undo hidden'&gt;&quot; . __( 'Undo' ) . &quot;&lt;/a&gt;&quot;;
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 $delete = '';
</span><span class="lines">@@ -1259,8 +1269,8 @@
</span><span class="cx">         if ( 'image' == $type &amp;&amp; $calling_post_id &amp;&amp; current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) &amp;&amp; get_post_thumbnail_id( $calling_post_id ) != $attachment_id )
</span><span class="cx">                 $thumbnail = &quot;&lt;a class='wp-post-thumbnail' id='wp-post-thumbnail-&quot; . $attachment_id . &quot;' href='#' onclick='WPSetAsThumbnail(\&quot;$attachment_id\&quot;);return false;'&gt;&quot; . esc_html__( &quot;Use as thumbnail&quot; ) . &quot;&lt;/a&gt;&quot;;
</span><span class="cx"> 
</span><del>-        if ( ( $send || $thumbnail || $delete ) &amp;&amp; !isset($form_fields['buttons']) )
-                $form_fields['buttons'] = array('tr' =&gt; &quot;\t\t&lt;tr class='submit'&gt;&lt;td&gt;&lt;/td&gt;&lt;td class='savesend'&gt;$send $thumbnail $delete&lt;/td&gt;&lt;/tr&gt;\n&quot;);
</del><ins>+        if ( ( $send || $thumbnail || $delete ) &amp;&amp; !isset( $form_fields['buttons'] ) )
+                $form_fields['buttons'] = array( 'tr' =&gt; &quot;\t\t&lt;tr class='submit'&gt;&lt;td&gt;&lt;/td&gt;&lt;td class='savesend'&gt;$send $thumbnail $delete&lt;/td&gt;&lt;/tr&gt;\n&quot; );
</ins><span class="cx"> 
</span><span class="cx">         $hidden_fields = array();
</span><span class="cx"> 
</span><span class="lines">@@ -1268,12 +1278,12 @@
</span><span class="cx">                 if ( $id{0} == '_' )
</span><span class="cx">                         continue;
</span><span class="cx"> 
</span><del>-                if ( !empty($field['tr']) ) {
</del><ins>+                if ( !empty( $field['tr'] ) ) {
</ins><span class="cx">                         $item .= $field['tr'];
</span><span class="cx">                         continue;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $field = array_merge($defaults, $field);
</del><ins>+                $field = array_merge( $defaults, $field );
</ins><span class="cx">                 $name = &quot;attachments[$attachment_id][$id]&quot;;
</span><span class="cx"> 
</span><span class="cx">                 if ( $field['input'] == 'hidden' ) {
</span><span class="lines">@@ -1281,30 +1291,30 @@
</span><span class="cx">                         continue;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $required = $field['required'] ? '&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;' : '';
</del><ins>+                $required      = $field['required'] ? '&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;' : '';
</ins><span class="cx">                 $aria_required = $field['required'] ? &quot; aria-required='true' &quot; : '';
</span><span class="cx">                 $class  = $id;
</span><span class="cx">                 $class .= $field['required'] ? ' form-required' : '';
</span><span class="cx"> 
</span><span class="cx">                 $item .= &quot;\t\t&lt;tr class='$class'&gt;\n\t\t\t&lt;th valign='top' scope='row' class='label'&gt;&lt;label for='$name'&gt;&lt;span class='alignleft'&gt;{$field['label']}&lt;/span&gt;&lt;span class='alignright'&gt;$required&lt;/span&gt;&lt;br class='clear' /&gt;&lt;/label&gt;&lt;/th&gt;\n\t\t\t&lt;td class='field'&gt;&quot;;
</span><del>-                if ( !empty($field[$field['input']]) )
-                        $item .= $field[$field['input']];
</del><ins>+                if ( !empty( $field[ $field['input'] ] ) )
+                        $item .= $field[ $field['input'] ];
</ins><span class="cx">                 elseif ( $field['input'] == 'textarea' ) {
</span><del>-                        $item .= &quot;&lt;textarea type='text' id='$name' name='$name'&quot; . $aria_required . &quot;&gt;&quot; . esc_html( $field['value'] ) . &quot;&lt;/textarea&gt;&quot;;
</del><ins>+                        $item .= &quot;&lt;textarea type='text' id='$name' name='$name' $aria_required&gt;&quot; . esc_html( $field['value'] ) . '&lt;/textarea&gt;';
</ins><span class="cx">                 } else {
</span><del>-                        $item .= &quot;&lt;input type='text' class='text' id='$name' name='$name' value='&quot; . esc_attr( $field['value'] ) . &quot;'&quot; . $aria_required . &quot;/&gt;&quot;;
</del><ins>+                        $item .= &quot;&lt;input type='text' class='text' id='$name' name='$name' value='&quot; . esc_attr( $field['value'] ) . &quot;' $aria_required /&gt;&quot;;
</ins><span class="cx">                 }
</span><del>-                if ( !empty($field['helps']) )
-                        $item .= &quot;&lt;p class='help'&gt;&quot; . join( &quot;&lt;/p&gt;\n&lt;p class='help'&gt;&quot;, array_unique((array) $field['helps']) ) . '&lt;/p&gt;';
</del><ins>+                if ( !empty( $field['helps'] ) )
+                        $item .= &quot;&lt;p class='help'&gt;&quot; . join( &quot;&lt;/p&gt;\n&lt;p class='help'&gt;&quot;, array_unique( (array) $field['helps'] ) ) . '&lt;/p&gt;';
</ins><span class="cx">                 $item .= &quot;&lt;/td&gt;\n\t\t&lt;/tr&gt;\n&quot;;
</span><span class="cx"> 
</span><span class="cx">                 $extra_rows = array();
</span><span class="cx"> 
</span><del>-                if ( !empty($field['errors']) )
-                        foreach ( array_unique((array) $field['errors']) as $error )
</del><ins>+                if ( !empty( $field['errors'] ) )
+                        foreach ( array_unique( (array) $field['errors'] ) as $error )
</ins><span class="cx">                                 $extra_rows['error'][] = $error;
</span><span class="cx"> 
</span><del>-                if ( !empty($field['extra_rows']) )
</del><ins>+                if ( !empty( $field['extra_rows'] ) )
</ins><span class="cx">                         foreach ( $field['extra_rows'] as $class =&gt; $rows )
</span><span class="cx">                                 foreach ( (array) $rows as $html )
</span><span class="cx">                                         $extra_rows[$class][] = $html;
</span><span class="lines">@@ -1314,7 +1324,7 @@
</span><span class="cx">                                 $item .= &quot;\t\t&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class='$class'&gt;$html&lt;/td&gt;&lt;/tr&gt;\n&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( !empty($form_fields['_final']) )
</del><ins>+        if ( !empty( $form_fields['_final'] ) )
</ins><span class="cx">                 $item .= &quot;\t\t&lt;tr class='final'&gt;&lt;td colspan='2'&gt;{$form_fields['_final']}&lt;/td&gt;&lt;/tr&gt;\n&quot;;
</span><span class="cx">         $item .= &quot;\t&lt;/tbody&gt;\n&quot;;
</span><span class="cx">         $item .= &quot;\t&lt;/table&gt;\n&quot;;
</span><span class="lines">@@ -1322,11 +1332,10 @@
</span><span class="cx">         foreach ( $hidden_fields as $name =&gt; $value )
</span><span class="cx">                 $item .= &quot;\t&lt;input type='hidden' name='$name' id='$name' value='&quot; . esc_attr( $value ) . &quot;' /&gt;\n&quot;;
</span><span class="cx"> 
</span><del>-        if ( $post-&gt;post_parent &lt; 1 &amp;&amp; isset($_REQUEST['post_id']) ) {
</del><ins>+        if ( $post-&gt;post_parent &lt; 1 &amp;&amp; isset( $_REQUEST['post_id'] ) ) {
</ins><span class="cx">                 $parent = (int) $_REQUEST['post_id'];
</span><span class="cx">                 $parent_name = &quot;attachments[$attachment_id][post_parent]&quot;;
</span><del>-
-                $item .= &quot;\t&lt;input type='hidden' name='$parent_name' id='$parent_name' value='&quot; . $parent . &quot;' /&gt;\n&quot;;
</del><ins>+                $item .= &quot;\t&lt;input type='hidden' name='$parent_name' id='$parent_name' value='$parent' /&gt;\n&quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $item;
</span></span></pre></div>
<a id="trunkwpadminmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/media.php (12542 => 12543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media.php        2009-12-25 22:22:21 UTC (rev 12542)
+++ trunk/wp-admin/media.php        2009-12-25 23:04:48 UTC (rev 12543)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> &lt;h2&gt;&lt;?php _e( 'Edit Media' ); ?&gt;&lt;/h2&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo esc_url( remove_query_arg( 'message' ) ); ?&gt;&quot; class=&quot;media-upload-form&quot; id=&quot;media-single-form&quot;&gt;
</span><del>-&lt;p class=&quot;submit&quot;&gt;
</del><ins>+&lt;p class=&quot;submit&quot; style=&quot;padding-bottom: 0;&quot;&gt;
</ins><span class="cx"> &lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; name=&quot;save&quot; value=&quot;&lt;?php esc_attr_e('Update Media'); ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;/p&gt;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>