Code Duplication    Length = 32-32 lines in 2 locations

modules/masterbar/masterbar.php 2 locations

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