Code Duplication    Length = 11-16 lines in 2 locations

modules/search/class.jetpack-search.php 1 location

@@ 1198-1213 (lines=16) @@
1195
				$terms = (array) $terms;
1196
1197
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1198
					switch ( $tax ) {
1199
						case 'post_tag':
1200
							$tax_fld = 'tag.slug';
1201
1202
							break;
1203
1204
						case 'category':
1205
							$tax_fld = 'category.slug';
1206
1207
							break;
1208
1209
						default:
1210
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1211
1212
							break;
1213
					}
1214
1215
					foreach ( $terms as $term ) {
1216
						$parser->add_filter(

modules/related-posts/jetpack-related-posts.php 1 location

@@ 897-907 (lines=11) @@
894
		if ( ! empty( $args['has_terms'] ) ) {
895
			foreach( (array)$args['has_terms'] as $term ) {
896
				if ( mb_strlen( $term->taxonomy ) ) {
897
					switch ( $term->taxonomy ) {
898
						case 'post_tag':
899
							$tax_fld = 'tag.slug';
900
							break;
901
						case 'category':
902
							$tax_fld = 'category.slug';
903
							break;
904
						default:
905
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
906
							break;
907
					}
908
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
909
				}
910
			}