Code Duplication    Length = 34-34 lines in 2 locations

modules/masterbar/masterbar/masterbar.php 2 locations

@@ 1054-1087 (lines=34) @@
1051
		}
1052
1053
		// Testimonials.
1054
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) {
1055
			$testimonials_title = $this->create_menu_item_pair(
1056
				array(
1057
					'url'   => Redirect::get_url( 'calypso-list-jetpack-testimonial' ),
1058
					'id'    => 'wp-admin-bar-edit-testimonial',
1059
					'label' => esc_html__( 'Testimonials', 'jetpack' ),
1060
				),
1061
				array(
1062
					'url'   => Redirect::get_url( 'calypso-edit-jetpack-testimonial' ),
1063
					'id'    => 'wp-admin-bar-new-testimonial',
1064
					'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
1065
				)
1066
			);
1067
1068
			if ( ! current_user_can( 'edit_pages' ) ) {
1069
				$testimonials_title = $this->create_menu_item_anchor(
1070
					'ab-item ab-primary mb-icon',
1071
					Redirect::get_url( 'calypso-list-jetpack-testimonial' ),
1072
					esc_html__( 'Testimonials', 'jetpack' ),
1073
					'wp-admin-bar-edit-testimonial'
1074
				);
1075
			}
1076
1077
			$wp_admin_bar->add_menu(
1078
				array(
1079
					'parent' => 'publish',
1080
					'id'     => 'new-jetpack-testimonial',
1081
					'title'  => $testimonials_title,
1082
					'meta'   => array(
1083
						'class' => 'inline-action',
1084
					),
1085
				)
1086
			);
1087
		}
1088
1089
		// Portfolio.
1090
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) {
@@ 1090-1123 (lines=34) @@
1087
		}
1088
1089
		// Portfolio.
1090
		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) {
1091
			$portfolios_title = $this->create_menu_item_pair(
1092
				array(
1093
					'url'   => Redirect::get_url( 'calypso-list-jetpack-portfolio' ),
1094
					'id'    => 'wp-admin-bar-edit-portfolio',
1095
					'label' => esc_html__( 'Portfolio', 'jetpack' ),
1096
				),
1097
				array(
1098
					'url'   => Redirect::get_url( 'calypso-edit-jetpack-portfolio' ),
1099
					'id'    => 'wp-admin-bar-new-portfolio',
1100
					'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
1101
				)
1102
			);
1103
1104
			if ( ! current_user_can( 'edit_pages' ) ) {
1105
				$portfolios_title = $this->create_menu_item_anchor(
1106
					'ab-item ab-primary mb-icon',
1107
					Redirect::get_url( 'calypso-list-jetpack-portfolio' ),
1108
					esc_html__( 'Portfolio', 'jetpack' ),
1109
					'wp-admin-bar-edit-portfolio'
1110
				);
1111
			}
1112
1113
			$wp_admin_bar->add_menu(
1114
				array(
1115
					'parent' => 'publish',
1116
					'id'     => 'new-jetpack-portfolio',
1117
					'title'  => $portfolios_title,
1118
					'meta'   => array(
1119
						'class' => 'inline-action',
1120
					),
1121
				)
1122
			);
1123
		}
1124
1125
		if ( current_user_can( 'edit_theme_options' ) ) {
1126
			// Look and Feel group.