Code Duplication    Length = 7-9 lines in 2 locations

geodirectory-functions/general_functions.php 2 locations

@@ 3907-3913 (lines=7) @@
3904
			$taxonomy   = $post_type . 'category';
3905
			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3906
3907
			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3908
				foreach ( $terms as $term_id ) {
3909
					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3910
					$children               = get_term_children( $term_id, $taxonomy );
3911
					$term_array[ $term_id ] = $count;
3912
				}
3913
			}
3914
3915
			$session_listing = $gd_session->get( 'listing' );
3916
@@ 3924-3932 (lines=9) @@
3921
				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3922
			}
3923
3924
			if ( ! empty( $terms ) ) {
3925
				foreach ( $terms as $term_id ) {
3926
					if ( $term_id > 0 ) {
3927
						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3928
						$children               = get_term_children( $term_id, $taxonomy );
3929
						$term_array[ $term_id ] = $count;
3930
					}
3931
				}
3932
			}
3933
		} else { // Update reviews count for all post categories.
3934
			$term_array = array();
3935
			$post_types = geodir_get_posttypes();