Code Duplication    Length = 11-16 lines in 2 locations

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

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

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

@@ 1059-1074 (lines=16) @@
1056
				$terms = (array) $terms;
1057
1058
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1059
					switch ( $tax ) {
1060
						case 'post_tag':
1061
							$tax_fld = 'tag.slug';
1062
1063
							break;
1064
1065
						case 'category':
1066
							$tax_fld = 'category.slug';
1067
1068
							break;
1069
1070
						default:
1071
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1072
1073
							break;
1074
					}
1075
1076
					foreach ( $terms as $term ) {
1077
						$parser->add_filter( array(