Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 681-691 (lines=11) @@
678
		if ( ! empty( $args['has_terms'] ) ) {
679
			foreach( (array)$args['has_terms'] as $term ) {
680
				if ( mb_strlen( $term->taxonomy ) ) {
681
					switch ( $term->taxonomy ) {
682
						case 'post_tag':
683
							$tax_fld = 'tag.slug';
684
							break;
685
						case 'category':
686
							$tax_fld = 'category.slug';
687
							break;
688
						default:
689
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
690
							break;
691
					}
692
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
693
				}
694
			}

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

@@ 1042-1057 (lines=16) @@
1039
				$terms = (array) $terms;
1040
1041
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1042
					switch ( $tax ) {
1043
						case 'post_tag':
1044
							$tax_fld = 'tag.slug';
1045
1046
							break;
1047
1048
						case 'category':
1049
							$tax_fld = 'category.slug';
1050
1051
							break;
1052
1053
						default:
1054
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1055
1056
							break;
1057
					}
1058
1059
					foreach ( $terms as $term ) {
1060
						$parser->add_filter( array(