Code Duplication    Length = 34-34 lines in 2 locations

modules/masterbar/masterbar/masterbar.php 2 locations

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