Code Duplication    Length = 7-9 lines in 2 locations

geodirectory-functions/general_functions.php 2 locations

@@ 3486-3492 (lines=7) @@
3483
            $taxonomy = $post_type . 'category';
3484
            $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3485
3486
            if (!empty($terms) && !is_wp_error($terms)) {
3487
                foreach ($terms as $term_id) {
3488
                    $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3489
                    $children = get_term_children($term_id, $taxonomy);
3490
                    $term_array[$term_id] = $count;
3491
                }
3492
            }
3493
            
3494
            $session_listing = $gd_session->get('listing');
3495
            
@@ 3503-3511 (lines=9) @@
3500
                $terms = (array)$session_listing['post_category'][$taxonomy];
3501
            }
3502
            
3503
            if (!empty($terms)) {
3504
                foreach ($terms as $term_id) {
3505
                    if ($term_id > 0) {
3506
                        $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3507
                        $children = get_term_children($term_id, $taxonomy);
3508
                        $term_array[$term_id] = $count;
3509
                    }
3510
                }
3511
            }
3512
        } else { // Update reviews count for all post categories.
3513
            $term_array = array();
3514
            $post_types = geodir_get_posttypes();