Code Duplication    Length = 32-32 lines in 2 locations

modules/masterbar/masterbar.php 2 locations

@@ 774-805 (lines=32) @@
771
		}
772
773
		// Testimonials
774
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) {
775
			$testimonials_title = $this->create_menu_item_pair(
776
				array(
777
					'url'   => 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
778
					'id'    => 'wp-admin-bar-edit-testimonial',
779
					'label' => esc_html__( 'Testimonials', 'jetpack' ),
780
				),
781
				array(
782
					'url'   => 'https://wordpress.com/edit/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
783
					'id'    => 'wp-admin-bar-new-testimonial',
784
					'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
785
				)
786
			);
787
788
			if ( ! current_user_can( 'edit_pages' ) ) {
789
				$testimonials_title = $this->create_menu_item_anchor(
790
					'ab-item ab-primary mb-icon',
791
					'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
792
					esc_html__( 'Testimonials', 'jetpack' ),
793
					'wp-admin-bar-edit-testimonial'
794
				);
795
			}
796
797
			$wp_admin_bar->add_menu( array(
798
				'parent' => 'publish',
799
				'id'     => 'new-jetpack-testimonial',
800
				'title'  => $testimonials_title,
801
				'meta'   => array(
802
					'class' => 'inline-action',
803
				),
804
			) );
805
		}
806
807
		// Portfolio
808
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) {
@@ 808-839 (lines=32) @@
805
		}
806
807
		// Portfolio
808
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) {
809
			$portfolios_title = $this->create_menu_item_pair(
810
				array(
811
					'url'   => 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
812
					'id'    => 'wp-admin-bar-edit-portfolio',
813
					'label' => esc_html__( 'Portfolio', 'jetpack' ),
814
				),
815
				array(
816
					'url'   => 'https://wordpress.com/edit/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
817
					'id'    => 'wp-admin-bar-new-portfolio',
818
					'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
819
				)
820
			);
821
822
			if ( ! current_user_can( 'edit_pages' ) ) {
823
				$portfolios_title = $this->create_menu_item_anchor(
824
					'ab-item ab-primary mb-icon',
825
					'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
826
					esc_html__( 'Portfolio', 'jetpack' ),
827
					'wp-admin-bar-edit-portfolio'
828
				);
829
			}
830
831
			$wp_admin_bar->add_menu( array(
832
				'parent' => 'publish',
833
				'id'     => 'new-jetpack-portfolio',
834
				'title'  => $portfolios_title,
835
				'meta'   => array(
836
					'class' => 'inline-action',
837
				),
838
			) );
839
		}
840
841
		if ( current_user_can( 'edit_theme_options' ) ) {
842
			// Look and Feel group