Code Duplication    Length = 6-7 lines in 2 locations

geodirectory-widgets/geodirectory_bestof_widget.php 1 location

@@ 129-134 (lines=6) @@
126
        $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
128
        // set post type to current viewing post type
129
        if ($use_viewing_post_type) {
130
            $current_post_type = geodir_get_current_posttype();
131
            if ($current_post_type != '' && $current_post_type != $post_type) {
132
                $post_type = $current_post_type;
133
            }
134
        }
135
136
        if (isset($instance['character_count'])) {
137
            /**

geodirectory-functions/general_functions.php 1 location

@@ 3189-3195 (lines=7) @@
3186
    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3187
3188
    // set post type to current viewing post type
3189
    if ($use_viewing_post_type) {
3190
        $current_post_type = geodir_get_current_posttype();
3191
        if ($current_post_type != '' && $current_post_type != $post_type) {
3192
            $post_type = $current_post_type;
3193
            $category = array(); // old post type category will not work for current changed post type
3194
        }
3195
    }
3196
    // replace widget title dynamically
3197
    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3198
    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');