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

@@ 908-918 (lines=11) @@
905
		if ( ! empty( $args['has_terms'] ) ) {
906
			foreach( (array)$args['has_terms'] as $term ) {
907
				if ( mb_strlen( $term->taxonomy ) ) {
908
					switch ( $term->taxonomy ) {
909
						case 'post_tag':
910
							$tax_fld = 'tag.slug';
911
							break;
912
						case 'category':
913
							$tax_fld = 'category.slug';
914
							break;
915
						default:
916
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
917
							break;
918
					}
919
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
920
				}
921
			}