X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/61343b82c4f0da4c68e4c6373daafff4a81efdd1..a349837896628462bf8c9bdc27d1477a10fe03eb:/wp-admin/includes/media.php diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index b8cc0981..e2f78d63 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -914,18 +914,19 @@ function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { * @param array $attachment {@internal $attachment not used}} * @return array */ -function image_attachment_fields_to_save($post, $attachment) { - if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { - if ( strlen(trim($post['post_title'])) == 0 ) { - $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid'])); - $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.'); +function image_attachment_fields_to_save( $post, $attachment ) { + if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) { + if ( strlen( trim( $post['post_title'] ) ) == 0 ) { + $attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid']; + $post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) ); + $post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' ); } } return $post; } -add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2); +add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 ); /** * {@internal Missing Short Description}} @@ -1499,7 +1500,7 @@ function media_upload_header() { * @param unknown_type $errors */ function media_upload_form( $errors = null ) { - global $type, $tab, $pagenow, $is_IE, $is_opera; + global $type, $tab, $is_IE, $is_opera; if ( ! _device_can_upload() ) { echo '

' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.'), 'http://wordpress.org/mobile/' ) . '

'; @@ -2077,17 +2078,18 @@ $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmon $arc_result = $wpdb->get_results( $arc_query ); $month_count = count($arc_result); +$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> -
+
-
+
ID ), $matches ) ) echo esc_html( strtoupper( $matches[1] ) ); @@ -2448,19 +2450,51 @@ function attachment_submitbox_metadata() { ?>
-post_mime_type ) ): + ID ); + $file_size = false; + + if ( isset( $meta['filesize'] ) ) + $file_size = $meta['filesize']; + elseif ( file_exists( $file ) ) + $file_size = filesize( $file ); + + if ( ! empty( $file_size ) ) : ?> +
+ +
+ __( 'Mime-type:' ), - 'year' => __( 'Year:' ), - 'genre' => __( 'Genre:' ), + if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ): + + /** + * Audio and video metadata fields to be shown in the publish meta box. + * + * The key for each item in the array should correspond to an attachment + * metadata key, and the value should be the desired label. + * + * @since 3.7.0 + * + * @param array $fields { + * An array of the attachment metadata keys and labels. + * + * @type string 'mime_type' Label to be shown before the field mime_type. + * @type string 'year' Label to be shown before the field year. + * @type string 'genre' Label to be shown before the field genre. + * @type string 'length_formatted' Label to be shown before the field length_formatted. + * } + */ + $fields = apply_filters( 'media_submitbox_misc_sections', array( + 'mime_type' => __( 'Mime-type:' ), + 'year' => __( 'Year:' ), + 'genre' => __( 'Genre:' ), 'length_formatted' => __( 'Length:' ), - ); + ) ); foreach ( $fields as $key => $label ): if ( ! empty( $meta[$key] ) ) : ?> -
+
-
+
__( 'Audio Format:' ), - 'codec' => __( 'Audio Codec:' ) - ); + 'codec' => __( 'Audio Codec:' ) + ) ); foreach ( $audio_fields as $key => $label ): if ( ! empty( $meta['audio'][$key] ) ) : ?> -
+
-
+