Code Duplication    Length = 32-32 lines in 2 locations

modules/masterbar/masterbar.php 2 locations

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