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

@@ 3574-3580 (lines=7) @@
3571
	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3572
3573
	// set post type to current viewing post type
3574
	if ( $use_viewing_post_type ) {
3575
		$current_post_type = geodir_get_current_posttype();
3576
		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3577
			$post_type = $current_post_type;
3578
			$category  = array(); // old post type category will not work for current changed post type
3579
		}
3580
	}
3581
	// replace widget title dynamically
3582
	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3583
	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );