Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 1030-1045 (lines=16) @@
1027
				$terms = (array) $terms;
1028
1029
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1030
					switch ( $tax ) {
1031
						case 'post_tag':
1032
							$tax_fld = 'tag.slug';
1033
1034
							break;
1035
1036
						case 'category':
1037
							$tax_fld = 'category.slug';
1038
1039
							break;
1040
1041
						default:
1042
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1043
1044
							break;
1045
					}
1046
1047
					foreach ( $terms as $term ) {
1048
						$parser->add_filter( array(

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

@@ 871-881 (lines=11) @@
868
		if ( ! empty( $args['has_terms'] ) ) {
869
			foreach( (array)$args['has_terms'] as $term ) {
870
				if ( mb_strlen( $term->taxonomy ) ) {
871
					switch ( $term->taxonomy ) {
872
						case 'post_tag':
873
							$tax_fld = 'tag.slug';
874
							break;
875
						case 'category':
876
							$tax_fld = 'category.slug';
877
							break;
878
						default:
879
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
880
							break;
881
					}
882
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
883
				}
884
			}