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

@@ 3601-3607 (lines=7) @@
3598
	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3599
3600
	// set post type to current viewing post type
3601
	if ( $use_viewing_post_type ) {
3602
		$current_post_type = geodir_get_current_posttype();
3603
		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3604
			$post_type = $current_post_type;
3605
			$category  = array(); // old post type category will not work for current changed post type
3606
		}
3607
	}
3608
	// replace widget title dynamically
3609
	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3610
	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );