Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 881-891 (lines=11) @@
878
		if ( ! empty( $args['has_terms'] ) ) {
879
			foreach( (array)$args['has_terms'] as $term ) {
880
				if ( mb_strlen( $term->taxonomy ) ) {
881
					switch ( $term->taxonomy ) {
882
						case 'post_tag':
883
							$tax_fld = 'tag.slug';
884
							break;
885
						case 'category':
886
							$tax_fld = 'category.slug';
887
							break;
888
						default:
889
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
890
							break;
891
					}
892
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
893
				}
894
			}

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

@@ 1164-1179 (lines=16) @@
1161
				$terms = (array) $terms;
1162
1163
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1164
					switch ( $tax ) {
1165
						case 'post_tag':
1166
							$tax_fld = 'tag.slug';
1167
1168
							break;
1169
1170
						case 'category':
1171
							$tax_fld = 'category.slug';
1172
1173
							break;
1174
1175
						default:
1176
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1177
1178
							break;
1179
					}
1180
1181
					foreach ( $terms as $term ) {
1182
						$parser->add_filter(