Code Duplication    Length = 6-6 lines in 5 locations

projects/plugins/jetpack/modules/carousel/jetpack-carousel.php 5 locations

@@ 762-767 (lines=6) @@
759
		/** This action is documented in modules/carousel/jetpack-carousel.php */
760
		do_action( 'jp_carousel_check_blog_user_privileges' );
761
762
		if ( ! comments_open( $_post_id ) ) {
763
			if ( $switched ) {
764
				restore_current_blog();
765
			}
766
			die( wp_json_encode( array( 'error' => __( 'Comments on this post are closed.', 'jetpack' ) ) ) );
767
		}
768
769
		if ( is_user_logged_in() ) {
770
			$user         = wp_get_current_user();
@@ 776-781 (lines=6) @@
773
			$email        = $user->user_email;
774
			$url          = $user->user_url;
775
776
			if ( empty( $user_id ) ) {
777
				if ( $switched ) {
778
					restore_current_blog();
779
				}
780
				die( wp_json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', 'jetpack' ) ) ) );
781
			}
782
		} else {
783
			$user_id      = 0;
784
			$display_name = $_POST['author'];
@@ 789-794 (lines=6) @@
786
			$url          = $_POST['url'];
787
788
			if ( get_option( 'require_name_email' ) ) {
789
				if ( empty( $display_name ) ) {
790
					if ( $switched ) {
791
						restore_current_blog();
792
					}
793
					die( wp_json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
794
				}
795
796
				if ( empty( $email ) ) {
797
					if ( $switched ) {
@@ 796-801 (lines=6) @@
793
					die( wp_json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
794
				}
795
796
				if ( empty( $email ) ) {
797
					if ( $switched ) {
798
						restore_current_blog();
799
					}
800
					die( wp_json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
801
				}
802
803
				if ( ! is_email( $email ) ) {
804
					if ( $switched ) {
@@ 803-808 (lines=6) @@
800
					die( wp_json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
801
				}
802
803
				if ( ! is_email( $email ) ) {
804
					if ( $switched ) {
805
						restore_current_blog();
806
					}
807
					die( wp_json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) );
808
				}
809
			}
810
		}
811