Code Duplication    Length = 6-7 lines in 2 locations

geodirectory-widgets/geodirectory_bestof_widget.php 1 location

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

geodirectory-functions/general_functions.php 1 location

@@ 3009-3015 (lines=7) @@
3006
    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3007
3008
    // set post type to current viewing post type
3009
    if ($use_viewing_post_type) {
3010
        $current_post_type = geodir_get_current_posttype();
3011
        if ($current_post_type != '' && $current_post_type != $post_type) {
3012
            $post_type = $current_post_type;
3013
            $category = array(); // old post type category will not work for current changed post type
3014
        }
3015
    }
3016
    // replace widget title dynamically
3017
    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3018
    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');