Code Duplication    Length = 11-16 lines in 2 locations

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

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