Ticket #22759: 22759.4.diff
File 22759.4.diff, 9.1 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-editor.js
554 554 props = wp.media.string.props( props, attachment ); 555 555 556 556 options = { 557 id: attachment.id 557 id: attachment.id, 558 post_content: attachment.description 558 559 }; 559 560 560 561 if ( props.linkUrl ) -
wp-includes/js/media-views.js
2829 2829 width: '', 2830 2830 height: '', 2831 2831 compat: false, 2832 alt: '' 2832 alt: '', 2833 description: '', 2833 2834 }); 2834 2835 2835 2836 options.buttons = this.buttons; -
wp-includes/media.php
1395 1395 } 1396 1396 1397 1397 if ( function_exists('get_compat_media_markup') ) 1398 $response['compat'] = get_compat_media_markup( $attachment->ID, array( ' taxonomies' => true, 'description' => true ) );1398 $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); 1399 1399 1400 1400 return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta ); 1401 1401 } … … 1740 1740 <label class="setting" data-setting="title"> 1741 1741 <span><?php _e('Title'); ?></span> 1742 1742 <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} 1743 <# if ( 'video' === data.type ) { #> 1744 placeholder="<?php esc_attr_e('Describe this video…'); ?>" 1745 <# } else if ( 'audio' === data.type ) { #> 1746 placeholder="<?php esc_attr_e('Describe this audio file…'); ?>" 1747 <# } else { #> 1748 placeholder="<?php esc_attr_e('Describe this media file…'); ?>" 1749 <# } #>/> 1743 <# if ( ! maybeReadOnly ) { #> 1744 <# if ( 'video' === data.type ) { #> 1745 placeholder="<?php esc_attr_e('Describe this video…'); ?>" 1746 <# } else if ( 'audio' === data.type ) { #> 1747 placeholder="<?php esc_attr_e('Describe this audio file…'); ?>" 1748 <# } else { #> 1749 placeholder="<?php esc_attr_e('Describe this media file…'); ?>" 1750 <# } #> 1751 <# } #> 1752 /> 1750 1753 </label> 1751 1754 <# } #> 1755 <label class="setting" data-setting="description"> 1756 <span><?php _e('Description'); ?></span> 1757 <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> 1758 </label> 1752 1759 </script> 1753 1760 1754 1761 <script type="text/html" id="tmpl-media-selection"> -
wp-admin/includes/ajax-actions.php
1884 1884 if ( isset( $changes['caption'] ) ) 1885 1885 $post['post_excerpt'] = $changes['caption']; 1886 1886 1887 if ( isset( $changes['description'] ) ) 1888 $post['post_content'] = $changes['description']; 1889 1887 1890 if ( isset( $changes['alt'] ) ) { 1888 1891 $alt = get_post_meta( $id, '_wp_attachment_image_alt', true ); 1889 1892 $new_alt = stripslashes( $changes['alt'] ); … … 1923 1926 if ( 'attachment' != $post['post_type'] ) 1924 1927 wp_send_json_error(); 1925 1928 1926 // Handle the description field automatically, if a plugin adds it back.1927 if ( isset( $attachment_data['post_content'] ) )1928 $post['post_content'] = $attachment_data['post_content'];1929 1930 1929 $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data ); 1931 1930 1932 1931 if ( isset( $post['errors'] ) ) { -
wp-admin/includes/meta-boxes.php
296 296 } 297 297 298 298 /** 299 * Display attachment/media-specific information300 *301 * @since 3.5.0302 *303 * @param object $post304 */305 function attachment_content_meta_box( $post ) {306 $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );307 $editor_args = array(308 'textarea_name' => 'content',309 'textarea_rows' => 5,310 'media_buttons' => false,311 'tinymce' => false,312 'quicktags' => $quicktags_settings,313 );314 ?>315 <p>316 <label class="screen-reader-text" for="content"><strong><?php _e( 'Attachment Page Content' ); ?></strong></label>317 <?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?>318 </p>319 <?php320 }321 322 /**323 299 * Display post format form elements. 324 300 * 325 301 * @since 3.1.0 -
wp-admin/includes/media.php
1286 1286 1287 1287 $default_args = array( 1288 1288 'errors' => null, 1289 'taxonomies' => false, 1290 'description' => false, 1289 'in_modal' => false, 1291 1290 ); 1292 1291 1293 1292 $user_can_edit = current_user_can( 'edit_post', $attachment_id ); … … 1297 1296 1298 1297 $form_fields = array(); 1299 1298 1300 if ( $args[' taxonomies'] ) {1299 if ( $args['in_modal'] ) { 1301 1300 foreach ( get_attachment_taxonomies($post) as $taxonomy ) { 1302 1301 $t = (array) get_taxonomy($taxonomy); 1303 1302 if ( ! $t['public'] || ! $t['show_ui'] ) … … 1329 1328 $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); 1330 1329 1331 1330 unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], 1332 $form_fields['post_title'], $form_fields['post_excerpt'], 1331 $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], 1333 1332 $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); 1334 1333 1335 if ( ! $args['description'] )1336 unset( $form_fields['post_content'] );1337 1338 1334 $media_meta = apply_filters( 'media_meta', '', $post ); 1339 1335 1340 1336 $defaults = array( … … 1361 1357 1362 1358 $field = array_merge( $defaults, $field ); 1363 1359 1360 if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) 1361 continue; 1362 1364 1363 if ( $field['input'] == 'hidden' ) { 1365 1364 $hidden_fields[$name] = $field['value']; 1366 1365 continue; … … 2282 2281 2283 2282 $att_url = wp_get_attachment_url( $post->ID ); 2284 2283 2285 $image_edit_button = '';2286 if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {2287 $nonce = wp_create_nonce( "image_editor-$post->ID" );2288 $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";2289 }2290 2284 if ( wp_attachment_is_image( $post->ID ) ) : 2285 $image_edit_button = ''; 2286 if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { 2287 $nonce = wp_create_nonce( "image_editor-$post->ID" ); 2288 $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>"; 2289 } 2291 2290 ?> 2292 2291 <div class="wp_attachment_holder"> 2293 2292 <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div> … … 2298 2297 </div> 2299 2298 <div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div> 2300 2299 </div> 2300 <?php endif; ?> 2301 2301 2302 2302 <div class="wp_attachment_details"> 2303 2303 <p> … … 2312 2312 </p> 2313 2313 <?php endif; ?> 2314 2314 2315 <?php 2316 $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ); 2317 $editor_args = array( 2318 'textarea_name' => 'content', 2319 'textarea_rows' => 5, 2320 'media_buttons' => false, 2321 'tinymce' => false, 2322 'quicktags' => $quicktags_settings, 2323 ); 2324 ?> 2325 <p> 2326 <label for="content"><strong><?php _e( 'Description' ); ?></strong></label> 2327 <?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?> 2328 </p> 2329 2315 2330 </div> 2316 2331 <?php 2317 2332 $extras = get_compat_media_markup( $post->ID ); … … 2348 2363 <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> 2349 2364 </div> 2350 2365 <div class="misc-pub-section"> 2351 <?php _e( 'File type:' ); ?> <strong><?php echo $post->post_mime_type; ?></strong> 2366 <?php _e( 'File type:' ); ?> <strong><?php 2367 if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) 2368 echo esc_html( strtoupper( $matches[1] ) ); 2369 else 2370 echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) ); 2371 ?> 2352 2372 </div> 2353 2373 2354 2374 <?php if ( $media_dims ) : ?> -
wp-admin/edit-form-advanced.php
107 107 wp_enqueue_script( 'image-edit' ); 108 108 wp_enqueue_style( 'imgareaselect' ); 109 109 add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); 110 add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_content_meta_box', null, 'normal', 'core' );111 110 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); 112 111 } else { 113 112 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );