Ticket #26825: 26825.diff
File 26825.diff, 1.7 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/media.php
2747 2747 2748 2748 if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ): 2749 2749 2750 if ( empty( $meta ) && file_exists( $file ) ): ?> 2751 <div class="misc-pub-section"> 2752 <a class="button" id="media-read-metadata" href="<?php echo admin_url( 'post.php?action=generate-metadata&post=' . $post->ID ) ?>"><?php _e( 'Read Metadata From File' ) ?></a> 2753 </div> 2754 <?php else: 2750 2755 /** 2751 2756 * Filter the audio and video metadata fields to be shown in the publish meta box. 2752 2757 * … … 2822 2827 endif; 2823 2828 endforeach; 2824 2829 2830 endif; 2825 2831 endif; 2826 2832 2827 2833 if ( $media_dims ) : ?> -
src/wp-admin/post.php
311 311 exit(); 312 312 break; 313 313 314 case 'generate-metadata': 315 if ( ! current_user_can( 'edit_post', $post_id ) ) { 316 wp_die( __( 'You are not allowed to edit this item.' ) ); 317 } 318 319 $post = get_post( $post_id ); 320 if ( 'attachment' !== $post->post_type ) { 321 wp_die( __( 'You can only generate metadata for an attachment.' ) ); 322 } 323 324 $file = get_attached_file( $post_id ); 325 if ( empty( $file ) ) { 326 wp_die( __( 'This file does not exist.' ) ); 327 } 328 329 wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $file ) ); 330 331 wp_redirect( add_query_arg( 'action', 'edit', remove_query_arg( 'action' ) ) ); 332 exit(); 333 break; 334 314 335 default: 315 336 wp_redirect( admin_url('edit.php') ); 316 337 exit();