WordPress.org

Make WordPress Core

Ticket #21391: 21391.6.diff

File 21391.6.diff, 5.9 KB (added by helenyhou, 8 years ago)
  • wp-admin/includes/meta-boxes.php

     
    302302 *
    303303 * @param object $post
    304304 */
    305 function attachment_data_meta_box( $post ) {
    306         $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
     305function attachment_content_meta_box( $post ) {
    307306        $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
    308307        $editor_args = array(
    309308                'textarea_name' => 'content',
     
    317316        <label class="screen-reader-text" for="content"><strong><?php _e( 'Attachment Page Content' ); ?></strong></label>
    318317        <?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?>
    319318</p>
    320 
    321 <p>
    322         <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
    323         <textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
    324 </p>
    325 <p>
    326         <label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
    327         <input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
    328 </p>
    329319<?php
    330320}
    331321
  • wp-admin/includes/media.php

     
    21222122
    21232123        $filename = esc_html( basename( $post->guid ) );
    21242124        $title = esc_attr( $post->post_title );
     2125        $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
    21252126
    21262127        $post_mime_types = get_post_mime_types();
    21272128        $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
     
    21512152                        <p><?php echo $image_edit_button; ?></p>
    21522153                </div>
    21532154                <div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div>
     2155        </div>
    21542156
    2155                 <div class="wp_attachment_details">
    2156                         <p>
    2157                                 <label for="attachment_url"><strong><?php _e( 'File URL' ); ?></strong></label><br />
    2158                                 <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" /><br />
    2159                         </p>
    2160                         <p><strong><?php _e( 'File name:' ); ?></strong> <?php echo $filename; ?><br />
    2161                         <strong><?php _e( 'File type:' ); ?></strong> <?php echo $post->post_mime_type; ?>
    2162                         <?php
    2163                                 if ( $media_dims )
    2164                                         echo '<br /><strong>' . __( 'Dimensions:' ) . '</strong> ' . $media_dims;
    2165                         ?>
    2166                         </p>
    2167                 </div>
     2157        <div class="wp_attachment_details">
     2158                <p>
     2159                        <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
     2160                        <textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
     2161                </p>
     2162                <p>
     2163                        <label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
     2164                        <input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
     2165                </p>
    21682166        </div>
    21692167        <?php
     2168        // need a filter on this content
    21702169}
    21712170
     2171/**
     2172 * Displays non-editable attachment metadata in the publish metabox
     2173 *
     2174 * @since 3.5.0
     2175 */
     2176function attachment_submitbox_metadata() {
     2177        $post = get_post();
     2178
     2179        $filename = esc_html( basename( $post->guid ) );
     2180
     2181        $media_dims = '';
     2182        $meta = wp_get_attachment_metadata( $post->ID );
     2183        if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
     2184                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     2185        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
     2186
     2187        $att_url = wp_get_attachment_url( $post->ID );
     2188?>
     2189        <div class="misc-pub-section">
     2190                        <label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
     2191                        <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" />
     2192        </div>
     2193        <div class="misc-pub-section">
     2194                <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
     2195        </div>
     2196        <div class="misc-pub-section">
     2197                <?php _e( 'File type:' ); ?> <strong><?php echo $post->post_mime_type; ?></strong>
     2198        </div>
     2199
     2200<?php if ( $media_dims ) : ?>
     2201        <div class="misc-pub-section">
     2202                <?php _e( 'Dimensions:' ); ?> <strong><?php echo $media_dims; ?></strong>
     2203        </div>
     2204<?php
     2205        endif;
     2206}
     2207
    21722208add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
    21732209add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
    21742210add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
     
    21812217
    21822218add_filter( 'media_upload_gallery', 'media_upload_gallery' );
    21832219add_filter( 'media_upload_library', 'media_upload_library' );
     2220
     2221add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
  • wp-admin/edit-form-advanced.php

     
    111111        wp_enqueue_script( 'image-edit' );
    112112        wp_enqueue_style( 'imgareaselect' );
    113113        add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
    114         add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_data_meta_box', null, 'normal', 'core' );
     114        add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_content_meta_box', null, 'normal', 'core' );
    115115        add_action( 'edit_form_after_title', 'edit_form_image_editor' );
    116116} else {
    117117        add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
  • wp-admin/css/wp-admin.css

     
    58265826        padding: 0;
    58275827}
    58285828
    5829 #poststuff .postarea {
     5829#post-body-content {
    58305830        margin-bottom: 20px;
    58315831}
    58325832