Code Duplication    Length = 10-10 lines in 2 locations

src/wp-includes/class-wp-xmlrpc-server.php 2 locations

@@ 4966-4975 (lines=10) @@
4963
				$post_type = 'page';
4964
				if ( !empty( $content_struct['wp_page_template'] ) )
4965
					$page_template = $content_struct['wp_page_template'];
4966
			} elseif ( $content_struct['post_type'] == 'post' ) {
4967
				if ( $publish )
4968
					$cap  = 'publish_posts';
4969
				elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] )
4970
					$cap  = 'publish_posts';
4971
				else
4972
					$cap = 'edit_posts';
4973
				$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4974
				$post_type = 'post';
4975
			} else {
4976
				// No other post_type values are allowed here
4977
				return new IXR_Error( 401, __( 'Invalid post type.' ) );
4978
			}
@@ 4979-4988 (lines=10) @@
4976
				// No other post_type values are allowed here
4977
				return new IXR_Error( 401, __( 'Invalid post type.' ) );
4978
			}
4979
		} else {
4980
			if ( $publish )
4981
				$cap  = 'publish_posts';
4982
			elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'])
4983
				$cap  = 'publish_posts';
4984
			else
4985
				$cap = 'edit_posts';
4986
			$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4987
			$post_type = 'post';
4988
		}
4989
4990
		if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) )
4991
			return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );