Code Duplication    Length = 7-9 lines in 3 locations

wp-admin/includes/ajax-actions.php 1 location

@@ 2475-2481 (lines=7) @@
2472
	if ( MEDIA_TRASH && isset( $changes['status'] ) )
2473
		$post['post_status'] = $changes['status'];
2474
2475
	if ( isset( $changes['alt'] ) ) {
2476
		$alt = wp_unslash( $changes['alt'] );
2477
		if ( $alt != get_post_meta( $id, '_wp_attachment_image_alt', true ) ) {
2478
			$alt = wp_strip_all_tags( $alt, true );
2479
			update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) );
2480
		}
2481
	}
2482
2483
	if ( wp_attachment_is( 'audio', $post['ID'] ) ) {
2484
		$changed = false;

wp-admin/includes/post.php 1 location

@@ 311-318 (lines=8) @@
308
309
	// Attachment stuff
310
	if ( 'attachment' == $post_data['post_type'] ) {
311
		if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) {
312
			$image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
313
			if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) {
314
				$image_alt = wp_strip_all_tags( $image_alt, true );
315
				// update_meta expects slashed.
316
				update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
317
			}
318
		}
319
320
		$attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
321

wp-admin/includes/media.php 1 location

@@ 675-683 (lines=9) @@
672
		 */
673
		$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
674
675
		if ( isset($attachment['image_alt']) ) {
676
			$image_alt = wp_unslash( $attachment['image_alt'] );
677
			if ( $image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ) {
678
				$image_alt = wp_strip_all_tags( $image_alt, true );
679
680
				// Update_meta expects slashed.
681
				update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
682
			}
683
		}
684
685
		if ( isset($post['errors']) ) {
686
			$errors[$attachment_id] = $post['errors'];