Code Duplication    Length = 7-9 lines in 2 locations

geodirectory-functions/general_functions.php 2 locations

@@ 3880-3886 (lines=7) @@
3877
			$taxonomy   = $post_type . 'category';
3878
			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3879
3880
			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3881
				foreach ( $terms as $term_id ) {
3882
					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3883
					$children               = get_term_children( $term_id, $taxonomy );
3884
					$term_array[ $term_id ] = $count;
3885
				}
3886
			}
3887
3888
			$session_listing = $gd_session->get( 'listing' );
3889
@@ 3897-3905 (lines=9) @@
3894
				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3895
			}
3896
3897
			if ( ! empty( $terms ) ) {
3898
				foreach ( $terms as $term_id ) {
3899
					if ( $term_id > 0 ) {
3900
						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3901
						$children               = get_term_children( $term_id, $taxonomy );
3902
						$term_array[ $term_id ] = $count;
3903
					}
3904
				}
3905
			}
3906
		} else { // Update reviews count for all post categories.
3907
			$term_array = array();
3908
			$post_types = geodir_get_posttypes();