X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/61343b82c4f0da4c68e4c6373daafff4a81efdd1..85ad385665744d9cc3bcd939906309be7268edb3:/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 ) ) { ?>