Code Duplication    Length = 11-16 lines in 2 locations

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

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

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

@@ 1067-1082 (lines=16) @@
1064
				$terms = (array) $terms;
1065
1066
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1067
					switch ( $tax ) {
1068
						case 'post_tag':
1069
							$tax_fld = 'tag.slug';
1070
1071
							break;
1072
1073
						case 'category':
1074
							$tax_fld = 'category.slug';
1075
1076
							break;
1077
1078
						default:
1079
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1080
1081
							break;
1082
					}
1083
1084
					foreach ( $terms as $term ) {
1085
						$parser->add_filter( array(