Code Duplication    Length = 4-6 lines in 4 locations

wp-admin/includes/post.php 4 locations

@@ 32-35 (lines=4) @@
29
	$ptype = get_post_type_object( $post_data['post_type'] );
30
31
	if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
32
		if ( 'page' == $post_data['post_type'] )
33
			return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
34
		else
35
			return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
36
	} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
37
		if ( 'page' == $post_data['post_type'] )
38
			return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
@@ 37-40 (lines=4) @@
34
		else
35
			return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
36
	} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
37
		if ( 'page' == $post_data['post_type'] )
38
			return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
39
		else
40
			return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
41
	}
42
43
	if ( isset( $post_data['content'] ) )
@@ 70-73 (lines=4) @@
67
	if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
68
		 && ! current_user_can( $ptype->cap->edit_others_posts ) ) {
69
		if ( $update ) {
70
			if ( 'page' == $post_data['post_type'] )
71
				return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
72
			else
73
				return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
74
		} else {
75
			if ( 'page' == $post_data['post_type'] )
76
				return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
@@ 74-79 (lines=6) @@
71
				return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
72
			else
73
				return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
74
		} else {
75
			if ( 'page' == $post_data['post_type'] )
76
				return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
77
			else
78
				return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
79
		}
80
	}
81
82
	if ( ! empty( $post_data['post_status'] ) ) {