Changeset 8677

Show
Ignore:
Timestamp:
08/19/08 23:01:36 (3 months ago)
Author:
ryan
Message:

Merge cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/crazyhorse/wp-admin/css/colors-classic.css

    r8620 r8677  
    341341} 
    342342 
    343 <<<<<<< .working 
    344 div#media-upload-header { 
    345 ======= 
    346 #adminmenu, div#media-upload-header, div#plugin-information-header { 
    347 >>>>>>> .merge-right.r8619 
     343div#media-upload-header, div#plugin-information-header { 
    348344    background-color: #14568a; 
    349345    border-bottom-color: #07273e; 
  • branches/crazyhorse/wp-admin/css/colors-fresh.css

    r8620 r8677  
    321321} 
    322322 
    323 <<<<<<< .working 
    324 div#media-upload-header { 
    325 ======= 
    326 #adminmenu, div#media-upload-header, div#plugin-information-header { 
    327 >>>>>>> .merge-right.r8619 
     323div#media-upload-header, div#plugin-information-header { 
    328324    background-color: #e4f2fd; 
    329325    border-bottom-color: #c6d9e9; 
  • branches/crazyhorse/wp-admin/edit-attachment-rows.php

    r8620 r8677  
    128128            } 
    129129            ?> 
    130 <<<<<<< .working 
    131             <td><strong><a href="post.php?action=edit&amp;post=<?php echo $post->post_parent; ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td> 
    132 ======= 
    133             <td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong></td> 
    134 >>>>>>> .merge-right.r8619 
     130            <td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td> 
    135131            <?php 
    136132        } else { 
  • branches/crazyhorse/wp-admin/edit-form-advanced.php

    r8620 r8677  
    5151<?php 
    5252 
    53 <<<<<<< .working 
    5453// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 
    55 ======= 
    56 if ( 0 == $post_ID) 
    57     wp_nonce_field('add-post'); 
    58 else 
    59     wp_nonce_field('update-post_' .  $post_ID); 
    60 >>>>>>> .merge-right.r8619 
    6154 
    6255function post_tags_meta_box($post) { 
     
    6962add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core'); 
    7063 
    71 <<<<<<< .working 
    7264//crazyhorse 
    7365function post_media_meta_box($post) { 
    7466    echo "<p><small><em>This feature isn't fully functional in this prototype.</em></small></p>"; 
    75 ======= 
    76 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 
    77 <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" /> 
    78 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> 
    79 <input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> 
    80 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> 
    81 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" /> 
    82 <input name="referredby" type="hidden" id="referredby" value="<?php 
    83 if ( !empty($_REQUEST['popupurl']) ) 
    84     echo clean_url(stripslashes($_REQUEST['popupurl'])); 
    85 else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) == $post_ID  ) 
    86     echo 'redo'; 
    87 else 
    88     echo clean_url(stripslashes(wp_get_referer())); 
    89 ?>" /> 
    90 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?> 
    91 >>>>>>> .merge-right.r8619 
    9267 
    9368    if ( empty( $post->ID ) ) 
     
    11590        echo "<h4>$att->post_title</h4>"; 
    11691 
    117 <<<<<<< .working 
    11892        echo "<a href='#' class='no-crazy'>Remove</a> | "; 
    11993        echo "<a href='media.php?action=edit&amp;attachment_id=$att->ID'>Edit</a>"; 
    120 ======= 
    121 <p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p> 
    122 <p> 
    123 <select name='post_status' id='post_status' tabindex='4'> 
    124 <?php 
    125 // only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability) 
    126 if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : 
    127 ?> 
    128 <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> 
    129 <?php if ( 'future' == $post->post_status ) : ?> 
    130 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> 
    131 <?php endif; ?> 
    132 <?php endif; ?> 
    133 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 
    134 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> 
    135 </select> 
    136 </p> 
    137 >>>>>>> .merge-right.r8619 
    138  
    139 <<<<<<< .working 
     94 
    14095        echo "<br class='clear' />"; 
    141 ======= 
    142 <?php if ( current_user_can( 'publish_posts' ) ) : ?> 
    143 <p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p> 
    144     <?php if ( current_user_can( 'edit_others_posts' ) ) : ?> 
    145         <p id="sticky-checkbox"><label for="sticky" class="selectit"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <?php _e('Stick this post to the front page') ?></label></p> 
    146     <?php endif; ?> 
    147 <?php endif; ?> 
    148 <?php 
    149 if ( 0 != $post_ID ) { 
    150     if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 
    151         $stamp = __('Scheduled for:<br />%1$s at %2$s'); 
    152     } else if ( 'publish' == $post->post_status ) { // already published 
    153         $stamp = __('Published on:<br />%1$s at %2$s'); 
    154     } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified 
    155         $stamp = __('Publish immediately'); 
    156     } else { // draft, 1 or more saves, date specified 
    157         $stamp = __('Publish on:<br />%1$s at %2$s'); 
    158 >>>>>>> .merge-right.r8619 
    15996    } 
    16097 
     
    163100} 
    164101add_meta_box( 'mediadiv', __('Media added to this Post' ), 'post_media_meta_box', 'post', 'side', 'core' ); 
    165  
    166 <<<<<<< .working 
    167 ======= 
    168 if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) ) 
    169     echo "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post_ID", 'delete-post_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;post') . "</a>"; 
    170 ?> 
    171 <br class="clear" /> 
    172 <?php if ( 0 != $post_ID ): ?> 
    173 <?php if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) { 
    174     $last_user = get_userdata($last_id); 
    175     printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); 
    176 } else { 
    177     printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); 
    178 } 
    179 ?> 
    180 <br class="clear" /> 
    181 <?php endif; ?> 
    182 <span id="autosave"></span> 
    183 <span id="wp-word-count"></span> 
    184 </p> 
    185 >>>>>>> .merge-right.r8619 
    186  
    187  
    188 <<<<<<< .working 
    189 ======= 
    190 <ul> 
    191 <?php if ( 0 != $post_ID ): ?> 
    192 <li><a href="edit.php?p=<?php echo $post_ID ?>"><?php _e('See Comments on this Post') ?></a></li> 
    193 <?php endif; ?> 
    194 <li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li> 
    195 <li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li> 
    196 <li><a href="categories.php"><?php _e('Manage All Categories') ?></a></li> 
    197 <li><a href="edit-tags.php"><?php _e('Manage All Tags') ?></a></li> 
    198 <li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li> 
    199 <?php do_action('post_relatedlinks_list'); ?> 
    200 </ul> 
    201 >>>>>>> .merge-right.r8619 
    202102 
    203103function post_categories_meta_box($post) { 
     
    333233function post_password_meta_box($post) { 
    334234?> 
    335 <<<<<<< .working 
    336235<p> 
    337236    <input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label> 
     
    339238<h4><?php _e( 'Post Password' ); ?></h4> 
    340239<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p> 
    341 ======= 
    342 <p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php if ( isset( $post->post_password ) ) : echo attribute_escape( $post->post_password ); endif; ?>" /></p> 
    343 >>>>>>> .merge-right.r8619 
    344240<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p> 
    345241<?php 
     
    410306<?php 
    411307 
    412 if ( !isset($post_ID) || 0 == $post_ID) 
     308if ( 0 == $post_ID) 
    413309    wp_nonce_field('add-post'); 
    414310else 
     
    429325<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> 
    430326<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" /> 
    431 <input name="referredby" type="hidden" id="referredby" value="<?php 
    432 if ( !empty($_REQUEST['popupurl']) ) 
    433     echo clean_url(stripslashes($_REQUEST['popupurl'])); 
    434 else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID  ) 
    435     echo 'redo'; 
    436 else 
    437     echo clean_url(stripslashes(wp_get_referer())); 
    438 ?>" /> 
     327<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" /> 
    439328<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?> 
    440329 
  • branches/crazyhorse/wp-admin/edit-post-rows.php

    r8620 r8677  
    8585    case 'title': 
    8686        ?> 
    87 <<<<<<< .working 
    88         <td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> 
    89 ======= 
    90         <td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> 
    91         <?php if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } ?></td> 
    92 >>>>>>> .merge-right.r8619 
     87        <td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> 
    9388        <?php 
    9489        if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } 
  • branches/crazyhorse/wp-admin/includes/media.php

    r8620 r8677  
    6868function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 
    6969 
    70 <<<<<<< .working 
    71     if ( empty($alt) ) return $html; 
    72 ======= 
    7370    if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html; 
    74 >>>>>>> .merge-right.r8619 
    7571    $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 
    7672 
     
    182178    return $id; 
    183179} 
     180 
    184181 
    185182// wrap iframe content (produced by $content_func) in a doctype, html head/body etc 
     
    246243    printf($context, $out); 
    247244} 
    248 //add_action( 'media_buttons', 'media_buttons' ); // crazyhorse 
     245add_action( 'media_buttons', 'media_buttons' ); 
    249246add_action('media_upload_media', 'media_upload_handler'); 
    250247 
     
    252249    check_admin_referer('media-form'); 
    253250 
    254     if ( !empty($_POST['attachments']) ) 
    255         foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 
    256             $post = $_post = get_post($attachment_id, ARRAY_A); 
    257             if ( isset($attachment['post_content']) ) 
    258                 $post['post_content'] = $attachment['post_content']; 
    259             if ( isset($attachment['post_title']) ) 
    260                 $post['post_title'] = $attachment['post_title']; 
    261             if ( isset($attachment['post_excerpt']) ) 
    262                 $post['post_excerpt'] = $attachment['post_excerpt']; 
    263             if ( isset($attachment['menu_order']) ) 
    264                 $post['menu_order'] = $attachment['menu_order']; 
    265  
    266             $post = apply_filters('attachment_fields_to_save', $post, $attachment); 
    267  
    268             if ( isset($post['errors']) ) { 
    269                 $errors[$attachment_id] = $post['errors']; 
    270                 unset($post['errors']); 
    271             } 
    272  
    273             if ( $post != $_post ) 
    274                 wp_update_post($post); 
    275  
    276             foreach ( get_attachment_taxonomies($post) as $t ) 
    277                 if ( isset($attachment[$t]) ) 
    278                     wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 
    279         } 
     251    if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 
     252        $post = $_post = get_post($attachment_id, ARRAY_A); 
     253        if ( isset($attachment['post_content']) ) 
     254            $post['post_content'] = $attachment['post_content']; 
     255        if ( isset($attachment['post_title']) ) 
     256            $post['post_title'] = $attachment['post_title']; 
     257        if ( isset($attachment['post_excerpt']) ) 
     258            $post['post_excerpt'] = $attachment['post_excerpt']; 
     259        if ( isset($attachment['menu_order']) ) 
     260            $post['menu_order'] = $attachment['menu_order']; 
     261 
     262        $post = apply_filters('attachment_fields_to_save', $post, $attachment); 
     263 
     264        if ( isset($post['errors']) ) { 
     265            $errors[$attachment_id] = $post['errors']; 
     266            unset($post['errors']); 
     267        } 
     268 
     269        if ( $post != $_post ) 
     270            wp_update_post($post); 
     271 
     272        foreach ( get_attachment_taxonomies($post) as $t ) 
     273            if ( isset($attachment[$t]) ) 
     274                wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 
     275    } 
    280276 
    281277    if ( isset($_POST['insert-gallery']) ) 
     
    299295} 
    300296 
    301 // crazyhorse 
    302297function media_upload_image() { 
    303 <<<<<<< .working 
    304  
    305 ======= 
    306298    $errors = array(); 
    307299    $id = 0; 
    308300 
    309 >>>>>>> .merge-right.r8619 
    310301    if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 
    311302        // Upload File button was clicked 
    312         if ( $_FILES['async-upload']['name'] == '' ) 
    313             return wp_iframe( 'media_error_nofile' ); 
    314  
    315303        $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 
    316304        unset($_FILES); 
     
    349337    } 
    350338 
    351     return wp_iframe( 'media_edit_single_form', $id, $errors ); 
     339    return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); 
    352340} 
    353341 
     
    533521} 
    534522 
    535 <<<<<<< .working 
    536 // crazyhorse 
    537 ======= 
     523// produce HTML for the image alignment radio buttons with the specified one checked 
     524function image_align_input_fields($post, $checked='') { 
     525     
     526    $alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right'); 
     527    if ( !array_key_exists($checked, $alignments) ) 
     528        $checked = 'none'; 
     529     
     530    $out = array(); 
     531    foreach ($alignments as $name => $label) { 
     532     
     533        $out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='none'". 
     534            ( $checked == $name ? " checked='checked'" : "" ) .  
     535            " /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>" . __($label) . "</label>"; 
     536    } 
     537    return join("\n", $out); 
     538
     539 
     540// produce HTML for the size radio buttons with the specified one checked 
    538541function image_size_input_fields($post, $checked='') { 
    539542         
    540543        // get a list of the actual pixel dimensions of each possible intermediate version of this image 
    541         $sizes = array(); 
    542544        $size_names = array('thumbnail' => 'Thumbnail', 'medium' => 'Medium', 'large' => 'Large', 'full' => 'Full size'); 
    543545         
     
    548550            $enabled = ( $downsize[3] || 'full' == $size ); 
    549551            $css_id = "image-size-{$size}-{$post->ID}"; 
     552            // if this size is the default but that's not available, don't select it 
     553            if ( $checked && !$enabled ) 
     554                $checked = ''; 
    550555            // if $checked was not specified, default to the first available size that's bigger than a thumbnail 
    551556            if ( !$checked && $enabled && 'thumbnail' != $size ) 
     
    571576} 
    572577 
    573 >>>>>>> .merge-right.r8619 
     578// produce HTML for the Link URL buttons with the default link type as specified 
     579function image_link_input_fields($post, $url_type='') { 
     580 
     581    $file = wp_get_attachment_url($post->ID); 
     582    $link = get_attachment_link($post->ID); 
     583 
     584    $url = ''; 
     585    if ( $url_type == 'file' ) 
     586        $url = $file; 
     587    elseif ( $url_type == 'post' ) 
     588        $url = $link; 
     589     
     590    return "<input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br /> 
     591                <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button> 
     592                <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button> 
     593                <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button> 
     594                <script type='text/javascript'> 
     595                jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);}); 
     596                </script>\n"; 
     597
     598 
    574599function image_attachment_fields_to_edit($form_fields, $post) { 
    575600    if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 
    576601        $form_fields['post_title']['required'] = true; 
    577602 
    578 <<<<<<< .working 
    579         $form_fields['post_excerpt']['label'] = __('Caption'); 
    580         $form_fields['post_excerpt']['helps'][] = __('Alternate text (e.g. Blue skies)'); 
    581 ======= 
    582603        $form_fields['post_excerpt']['label'] = __('Caption'); 
    583604        $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); 
    584 >>>>>>> .merge-right.r8619 
    585  
    586 //      $form_fields['post_content']['label'] = __('Description'); 
    587  
    588 <<<<<<< .working 
    589 //      $thumb = wp_get_attachment_thumb_url($post->ID); 
    590  
    591 ======= 
    592 >>>>>>> .merge-right.r8619 
     605 
     606        $form_fields['post_content']['label'] = __('Description'); 
     607 
    593608        $form_fields['align'] = array( 
    594609            'label' => __('Alignment'), 
    595610            'input' => 'html', 
    596             'html'  => " 
    597                 <input type='radio' name='attachments[$post->ID][align]' id='image-align-none-$post->ID' value='none' checked='checked' /> 
    598                 <label for='image-align-none-$post->ID' class='align image-align-none-label'>" . __('None') . "</label> 
    599                 <input type='radio' name='attachments[$post->ID][align]' id='image-align-left-$post->ID' value='left' /> 
    600                 <label for='image-align-left-$post->ID' class='align image-align-left-label'>" . __('Left') . "</label> 
    601                 <input type='radio' name='attachments[$post->ID][align]' id='image-align-center-$post->ID' value='center' /> 
    602                 <label for='image-align-center-$post->ID' class='align image-align-center-label'>" . __('Center') . "</label> 
    603                 <input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' /> 
    604                 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 
     611            'html'  => image_align_input_fields($post, get_option('image_default_align')), 
    605612        ); 
    606 <<<<<<< .working 
    607 /* 
    608         $form_fields['image-size'] = array( 
    609             'label' => __('Size'), 
    610             'input' => 'html', 
    611             'html'  => " 
    612                 " . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' /> 
    613                 <label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label> 
    614                 " : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' /> 
    615                 <label for='image-size-medium-$post->ID'>" . __('Medium') . "</label> 
    616                 <input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' /> 
    617                 <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 
    618         ); 
    619 ======= 
    620         $form_fields['image-size'] = image_size_input_fields($post); 
    621 >>>>>>> .merge-right.r8619 
    622 */ 
     613         
     614        $form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size')); 
    623615    } 
    624616    return $form_fields; 
     
    670662add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); 
    671663 
    672 // crazyhorse 
    673664function get_attachment_fields_to_edit($post, $errors = null) { 
    674665    if ( is_int($post) ) 
     
    679670    $edit_post = sanitize_post($post, 'edit'); 
    680671    $file = wp_get_attachment_url($post->ID); 
    681 //    $link = get_attachment_link($post->ID); 
     672  $link = get_attachment_link($post->ID); 
    682673 
    683674    $form_fields = array( 
    684675        'post_title'   => array( 
    685676            'label'      => __('Title'), 
    686             'value'      => $edit_post->post_title 
     677            'value'      => $edit_post->post_title, 
    687678        ), 
    688679        'post_excerpt' => array( 
    689 <<<<<<< .working 
    690             'label'      => __('Caption'), 
    691             'value'      => $edit_post->post_excerpt 
    692 ======= 
    693680            'label'      => __('Caption'), 
    694681            'value'      => $edit_post->post_excerpt, 
    695 >>>>>>> .merge-right.r8619 
    696682        ), 
    697 /* 
    698683        'post_content' => array( 
    699684            'label'      => __('Description'), 
     
    701686            'input'      => 'textarea', 
    702687        ), 
    703 */ 
    704688        'url'          => array( 
    705             'label'      => __('Path'), 
    706             'value'      => attribute_escape($file) 
    707         ) 
    708 /* 
     689            'label'      => __('Link URL'), 
     690            'input'      => 'html', 
     691            'html'       => image_link_input_fields($post, get_option('image_default_link_type')), 
     692            'helps'      => __('Enter a link URL or click above for presets.'), 
     693        ), 
    709694        'menu_order'   => array( 
    710695            'label'      => __('Order'), 
    711696            'value'      => $edit_post->menu_order 
    712         ),*/ 
     697        ), 
    713698    ); 
    714 /* 
     699 
    715700    foreach ( get_attachment_taxonomies($post) as $taxonomy ) { 
    716701        $t = (array) get_taxonomy($taxonomy); 
     
    732717        $form_fields[$taxonomy] = $t; 
    733718    } 
    734 */ 
     719 
    735720    // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default 
    736721    // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) 
     
    742727} 
    743728 
    744 // crazyhorse 
    745 function get_media_items( $post_id ) { 
     729function get_media_items( $post_id, $errors ) { 
    746730    if ( $post_id ) { 
    747731        $post = get_post($post_id); 
     
    759743        return ''; 
    760744 
    761     $ins = isset($_REQUEST['ins']) ? 1 : 0; 
    762  
    763745    foreach ( $attachments as $id => $attachment ) 
    764         if ( $item = get_media_item_link( $id, $ins ) ) 
    765             $output .= $item; 
    766  
    767         //  $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div>$item\n</div>"; 
     746        if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) 
     747            $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>"; 
    768748 
    769749    return $output; 
    770 } 
    771  
    772 // crazyhorse 
    773 function get_media_item_link( $attachment_id, $ins ) { 
    774  
    775     if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 
    776         $thumb_url = $thumb_url[0]; 
    777     else 
    778         return false; 
    779  
    780     $post = get_post($attachment_id); 
    781     $mime = $post->post_mime_type; 
    782  
    783     if ( false !== strpos($mime, 'image') ) $type = 'image'; 
    784     elseif ( false !== strpos($mime, 'audio') ) $type = 'audio'; 
    785     elseif ( false !== strpos($mime, 'video') ) $type = 'video'; 
    786     else $type = 'file'; 
    787  
    788     $ins = $ins ? '&amp;ins=1' : ''; 
    789     $filename = basename($post->guid); 
    790     $title = attribute_escape($post->post_title); 
    791     $link = 'media-upload.php?att_id='.$attachment_id.'&amp;tab=single&amp;type='.$type.$ins; 
    792  
    793     $item = '<div class="filelink"> 
    794         <a href="'.$link.'"> 
    795         <img class="thumbnail" src="'.$thumb_url.'" alt="'.$title.'" title="'.$title.'" /></a> 
    796         <p class="filelink-caption">'.$filename.'</p></div>'."\n"; 
    797  
    798  
    799     return $item; 
    800 } 
    801  
    802 // crazyhorse 
    803 function media_edit_single_form($attachment_id = 0, $errors = null) { 
    804     global $redir_tab; 
    805  
    806     $redir_tab = 'gallery'; 
    807     $ins = isset($_REQUEST['ins']) ? true : false; 
    808  
    809     if ( ! $attachment_id ) 
    810        $attachment_id = (int) $_REQUEST['att_id']; 
    811  
    812     $class = ''; 
    813     if ( isset($_REQUEST['type']) ) 
    814         $class = ' class="type-'.$_REQUEST['type'].'"'; 
    815  
    816     $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 
    817     $form_action_url = admin_url("media-upload.php?type=single&tab=gallery&post_id=$post_id"); 
    818  
    819     $post = get_post($attachment_id); 
    820     $filename = basename($post->guid); 
    821  
    822     media_upload_header(); 
    823  
    824     if ( $errors ) : 
    825 ?> 
    826  
    827 <div id="media-upload-notice"> 
    828 <?php if (isset($errors['upload_notice']) ) { ?> 
    829     <?php echo $errors['upload_notice']; ?> 
    830 <?php } ?> 
    831 </div> 
    832 <div id="media-upload-error"> 
    833 <?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?> 
    834     <?php echo $errors['upload_error']->get_error_message(); ?> 
    835 <?php } ?> 
    836 </div> 
    837  
    838 <?php 
    839     return; 
    840     endif; // errors 
    841 ?> 
    842  
    843 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> 
    844 <?php wp_nonce_field('media-form'); ?> 
    845  
    846 <div id="att-info"><p<?php echo $class; ?>> 
    847 <?php echo $filename; ?> &nbsp; 
    848 (<a href="<?php echo wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id); ?>" class="del-link" onclick="return confirm('<?php echo js_escape( __("You are about to delete this file\n  'Cancel' to stop, 'OK' to delete.")); ?>');"><?php _e('Remove'); ?></a> | <a href="media-upload.php?tab=gallery<?php if ( $ins ) echo '&amp;ins=1'; ?>"><?php _e('Change'); ?></a>) 
    849 </p></div> 
    850  
    851 <?php echo media_edit_single($attachment_id); ?> 
    852  
    853 <p class="ml-submit"> 
    854 <?php if ( $ins ) { ?> 
    855    <input type="submit" class="button" name="send[<?php echo $attachment_id; ?>]" value="<?php echo attribute_escape( __( 'Insert into Post' ) ) ?>" /> 
    856    <input type="hidden" name="ins" value="1" /> 
    857 <?php } ?> 
    858  
    859 <input type="submit" class="button-link button" name="save" value="<?php echo attribute_escape( __( 'Save and Add Another' ) ); ?>" /> 
    860  
    861 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
    862 <input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" /> 
    863 <input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" /> 
    864 </p> 
    865 </form> 
    866 <?php 
    867 } 
    868  
    869 // crazyhorse 
    870 function media_edit_single($attachment_id = null) { 
    871     global $post_mime_types; 
    872  
    873     $post = get_post($attachment_id); 
    874  
    875     $filename = basename($post->guid); 
    876     $title_label = __('Title'); 
    877     $title = attribute_escape($post->post_title); 
    878  
    879     if ( isset($post_mime_types) ) { 
    880         $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 
    881         $type = array_shift($keys); 
    882         $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />"; 
    883     } 
    884  
    885     $form_fields = get_attachment_fields_to_edit($post); 
    886  
    887     $defaults = array( 
    888         'input'      => 'text', 
    889         'required'   => false, 
    890         'value'      => '', 
    891         'extra_rows' => array(), 
    892     ); 
    893  
    894     $hidden_fields = array(); 
    895  
    896     $item = "<table class='slidetoggle describe $class'> 
    897         <thead class='media-item-info'>"; 
    898  
    899     foreach ( $form_fields as $id => $field ) { 
    900         if ( $id{0} == '_' ) 
    901             continue; 
    902  
    903         if ( !empty($field['tr']) ) { 
    904             $item .= $field['tr']; 
    905             continue; 
    906         } 
    907  
    908         $field = array_merge($defaults, $field); 
    909         $name = "attachments[$attachment_id][$id]"; 
    910  
    911         if ( $field['input'] == 'hidden' ) { 
    912             $hidden_fields[$name] = $field['value']; 
    913             continue; 
    914         } 
    915  
    916         $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : ''; 
    917         $aria_required = $field['required'] ? " aria-required='true' " : ''; 
    918         $class  = $id; 
    919         $class .= $field['required'] ? ' form-required' : ''; 
    920  
    921         $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>"; 
    922         if ( !empty($field[$field['input']]) ) 
    923             $item .= $field[$field['input']]; 
    924         elseif ( $field['input'] == 'textarea' ) { 
    925             $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>"; 
    926         } else { 
    927             $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>"; 
    928         } 
    929         if ( !empty($field['helps']) ) 
    930             $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>'; 
    931         $item .= "</td>\n\t\t</tr>\n"; 
    932  
    933         $extra_rows = array(); 
    934  
    935         if ( !empty($field['errors']) ) 
    936             foreach ( array_unique((array) $field['errors']) as $error ) 
    937                 $extra_rows['error'][] = $error; 
    938  
    939         if ( !empty($field['extra_rows']) ) 
    940             foreach ( $field['extra_rows'] as $class => $rows ) 
    941                 foreach ( (array) $rows as $html ) 
    942                     $extra_rows[$class][] = $html; 
    943  
    944         foreach ( $extra_rows as $class => $rows ) 
    945             foreach ( $rows as $html ) 
    946                 $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n"; 
    947     } 
    948  
    949     if ( !empty($form_fields['_final']) ) 
    950         $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n"; 
    951     $item .= "\t</tbody>\n"; 
    952     $item .= "\t</table>\n"; 
    953  
    954     foreach ( $hidden_fields as $name => $value ) 
    955         $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 
    956  
    957     return $item; 
    958  
    959750} 
    960751 
     
    1126917    ?> 
    1127918    <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script> 
     919    <div id="media-upload-header"> 
     920    <?php the_media_upload_tabs(); ?> 
     921    </div> 
    1128922    <?php 
    1129923} 
     
    12791073        if ( f.alt.value ) { 
    12801074            alt = f.alt.value.replace(/['"<>]+/g, ''); 
    1281 <<<<<<< .working 
    1282 ======= 
    12831075<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 
    1284 >>>>>>> .merge-right.r8619 
    12851076            caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); 
     1077<?php } ?> 
    12861078        } 
    12871079 
     
    13921184} 
    13931185 
    1394 // crazyhorse 
    13951186function media_upload_library_form($errors) { 
    13961187    global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; 
     
    13981189    media_upload_header(); 
    13991190 
    1400     $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0
    1401  
    1402     $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id"); 
     1191    $post_id = intval($_REQUEST['post_id'])
     1192 
     1193    $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id"); 
    14031194 
    14041195    $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; 
     
    14081199    if ( $start < 1 ) 
    14091200        $start = 0; 
    1410     add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 8';" ) ); 
     1201    add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) ); 
    14111202 
    14121203    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 
    1413     $ins = isset($_REQUEST['ins']) ? '<input type="hidden" name="ins" value="1" />' : ''; 
     1204 
    14141205?> 
    14151206 
    1416 <div id="html-upload-ui"> 
    1417     <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate"> 
    1418     <input type="file" name="async-upload" id="async-upload" /> 
    1419     <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> 
    1420  
    1421     <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
    1422     <?php echo $ins; ?> 
    1423     <?php wp_nonce_field('media-form'); ?> 
    1424     </form> 
     1207<form id="filter" action="" method="get"> 
     1208<input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" /> 
     1209<input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" /> 
     1210<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> 
     1211<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" /> 
     1212 
     1213<div id="search-filter"> 
     1214    <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label> 
     1215    <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" /> 
     1216    <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" /> 
    14251217</div> 
    14261218 
    1427 <?php if ( 'false' !== $_GET['library'] ) : ?> 
    1428  
    1429 <div id="html-upload-help"><?php _e('Or select from your Media Library'); ?></div> 
     1219<ul class="subsubsub"> 
     1220<?php 
     1221$type_links = array(); 
     1222$_num_posts = (array) wp_count_attachments(); 
     1223$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); 
     1224foreach ( $matches as $_type => $reals ) 
     1225    foreach ( $reals as $real ) 
     1226        $num_posts[$_type] += $_num_posts[$real]; 
     1227// If available type specified by media button clicked, filter by that type 
     1228if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { 
     1229    $_GET['post_mime_type'] = $type; 
     1230    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 
     1231
     1232if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) 
     1233    $class = ' class="current"'; 
     1234$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>"; 
     1235foreach ( $post_mime_types as $mime_type => $label ) { 
     1236    $class = ''; 
     1237 
     1238    if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) 
     1239        continue; 
     1240 
     1241    if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 
     1242        $class = ' class="current"'; 
     1243 
     1244    $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>'; 
     1245
     1246echo implode(' | </li>', $type_links) . '</li>'; 
     1247unset($type_links); 
     1248?> 
     1249</ul> 
    14301250 
    14311251<div class="tablenav"> 
     1252 
    14321253<?php 
    14331254$page_links = paginate_links( array( 
     
    14411262    echo "<div class='tablenav-pages'>$page_links</div>"; 
    14421263?> 
     1264 
     1265<div class="alignleft"> 
     1266<?php 
     1267 
     1268$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; 
     1269 
     1270$arc_result = $wpdb->get_results( $arc_query ); 
     1271 
     1272$month_count = count($arc_result); 
     1273 
     1274if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> 
     1275<select name='m'> 
     1276<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option> 
     1277<?php 
     1278foreach ($arc_result as $arc_row) { 
     1279    if ( $arc_row->yyear == 0 ) 
     1280        continue; 
     1281    $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 ); 
     1282 
     1283    if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) 
     1284        $default = ' selected="selected"'; 
     1285    else 
     1286        $default = ''; 
     1287 
     1288    echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>"; 
     1289    echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" ); 
     1290    echo "</option>\n"; 
     1291} 
     1292?> 
     1293</select> 
     1294<?php } ?> 
     1295 
     1296<input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter &#187;' ) ); ?>" class="button-secondary" /> 
     1297 
    14431298</div> 
    14441299 
    1445 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form"> 
    1446  
    1447 <?php wp_nonce_field('media-form'); ?> 
    1448  
    1449 <div id="media-items"> 
    1450 <?php echo get_media_items(null, $errors); ?> 
    14511300<br class="clear" /> 
    14521301</div> 
    14531302</form> 
     1303 
     1304<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form"> 
     1305 
     1306<?php wp_nonce_field('media-form'); ?> 
     1307<?php //media_upload_form( $errors ); ?> 
     1308 
     1309<script type="text/javascript"> 
     1310<!-- 
     1311jQuery(function($){ 
     1312    var preloaded = $(".media-item.preloaded"); 
     1313    if ( preloaded.length > 0 ) { 
     1314        preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); 
     1315        updateMediaForm(); 
     1316    } 
     1317}); 
     1318--> 
     1319</script> 
     1320 
     1321<div id="media-items"> 
     1322<?php echo get_media_items(null, $errors); ?> 
     1323</div> 
     1324<p class="ml-submit"> 
     1325<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 
     1326<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
     1327</p> 
     1328</form> 
    14541329<?php 
    1455  
    1456 endif; // library 
    1457 
    1458  
    1459 function media_error_nofile() { ?> 
    1460     <div style="text-align:center;"><h3>Please choose a file to upload</h3> 
    1461     <p><button onclick="history.back();" class="button">Go Back</button></p></div> 
    1462 <?php } 
     1330
    14631331 
    14641332function type_form_image() { 
     
    14721340    } 
    14731341 
     1342    $default_align = get_option('image_default_align'); 
     1343    if ( empty($default_align) ) 
     1344        $default_align = 'none'; 
     1345         
    14741346    return ' 
    14751347    <table class="describe"><tbody> 
     
    14891361            <td clas