function wpv_filter_shortcode_start($atts){
	
	global $WP_Views;
	$view_id = $WP_Views->get_current_view();
	$view_settings = $WP_Views->get_view_settings();
	$view_layout_settings = $WP_Views->get_view_layout_settings();
	$view_attrs = $WP_Views->get_view_shortcodes_attributes();
	$is_required = false;
	$dps_enabled = false;
	$counters_enabled = false;
	$out = '';
    if ( _wpv_filter_is_form_required() ) {
		
		$is_required = true;
		
        extract(
            shortcode_atts( array(), $atts )
        );
        
        $hide = '';
        if (
			( isset( $atts['hide'] ) && $atts['hide'] == 'true' )
			|| ( isset( $view_attrs['view_display'] ) && $view_attrs['view_display'] == 'layout' )
		) {
            $hide = ' style="display:none;"';
        }
        
        $form_class = array( 'js-wpv-form-full' );
        // Dependant stuf
        if ( !isset( $view_settings['dps'] ) || !is_array( $view_settings['dps'] ) ) {
			$view_settings['dps'] = array();
		}
		if ( isset( $view_settings['dps']['enable_dependency'] ) && $view_settings['dps']['enable_dependency'] == 'enable' ) {
			$dps_enabled = true;
			$controls_per_kind = wpv_count_filter_controls( $view_settings );
			$controls_count = 0;
			$no_intersection = array();
			if ( !isset( $controls_per_kind['error'] ) ) {
				$controls_count = $controls_per_kind['cf'] + $controls_per_kind['tax'] + $controls_per_kind['pr'] + $controls_per_kind['search'];
				if ( $controls_per_kind['cf'] > 1 && ( !isset( $view_settings['custom_fields_relationship'] ) || $view_settings['custom_fields_relationship'] != 'AND' ) ) {
					$no_intersection[] = __( 'custom field', 'wpv-views' );
				}
				if ( $controls_per_kind['tax'] > 1 && ( !isset( $view_settings['taxonomy_relationship'] ) || $view_settings['taxonomy_relationship'] != 'AND' ) ) {
					$no_intersection[] = __( 'taxonomy', 'wpv-views' );
				}
			} else {
				$dps_enabled = false;
			}
			if ( $controls_count > 0 ) {
				if ( count( $no_intersection ) > 0 ) {
					$dps_enabled = false;
				}
			} else {
				$dps_enabled = false;
			}
		}
		if ( !isset( $view_settings['filter_meta_html'] ) ) {
			$view_settings['filter_meta_html'] = '';
		}
		if ( strpos( $view_settings['filter_meta_html'], '%%COUNT%%' ) !== false ) {
			$counters_enabled = true;
		}
		if ( $dps_enabled || $counters_enabled ) {
			// TODO review this, makes little sense
			if ( $dps_enabled ) {
				$form_class[] = 'js-wpv-dps-enabled';
			}
		} else {
			// Set the force value
			$WP_Views->set_force_disable_dependant_parametric_search( true );
		}
        if ( !isset( $view_settings['dps']['ajax_results'] ) ) {
			$view_settings['dps']['ajax_results'] = 'disable';
		}
		if ( !isset( $view_settings['dps']['ajax_results_submit'] ) ) {
			$view_settings['dps']['ajax_results_submit'] = 'reload';
		}
		$ajax = $view_settings['dps']['ajax_results'];
		$ajax_submit = $view_settings['dps']['ajax_results_submit'];
		if ( $ajax == 'enable' ) {
			$form_class[] = 'js-wpv-ajax-results-enabled';
		} else if ( $ajax == 'disable' && $ajax_submit == 'ajaxed' ) {
			$form_class[] = 'js-wpv-ajax-results-submit-enabled';
		}
		

        $page = 1;
		
        $effect = 'fade';
		$ajax_pre_before = '';
		if ( isset( $view_settings['dps']['ajax_results_pre_before'] ) ) {
			$ajax_pre_before = esc_attr( $view_settings['dps']['ajax_results_pre_before'] );
		}
        $ajax_before = '';
        if ( isset( $view_settings['dps']['ajax_results_before'] ) ) {
			$ajax_before = esc_attr( $view_settings['dps']['ajax_results_before'] );
        }
        $ajax_after = '';
        if ( isset( $view_settings['dps']['ajax_results_after'] ) ) {
			$ajax_after = esc_attr( $view_settings['dps']['ajax_results_after'] );
        }
        
        $url = get_permalink();
        $out = '<form' . $hide . ' autocomplete="off" name="wpv-filter-' . $WP_Views->get_view_count() . '" action="' . $url . '" method="get" class="wpv-filter-form js-wpv-filter-form js-wpv-filter-form-' . $WP_Views->get_view_count() . ' ' . implode( ' ', $form_class ) . '" data-viewnumber="' . $WP_Views->get_view_count() . '" data-viewid="' . $view_id . '">';
        
        $out .= '<input type="hidden" class="js-wpv-dps-filter-data js-wpv-filter-data-for-this-form" data-action="' . $url . '" data-page="' . $page . '" data-ajax="' . $ajax . '" data-effect="' . $effect . '" data-maxpages="' . $WP_Views->get_max_pages() . '" data-ajaxprebefore="' . $ajax_pre_before . '" data-ajaxbefore="' . $ajax_before . '" data-ajaxafter="' . $ajax_after . '" />';
        
		// Set a hidden input for the View attributes, so we can pass them if needed
		if ( isset( $view_attrs['name'] ) ) {
			unset( $view_attrs['name'] );
		}
		if ( !empty( $view_attrs ) ) {
			$att_data = '';
			foreach ( $view_attrs as $att_key => $att_val ) {
				$att_data .= ' data-' . $att_key . '="' . esc_attr( $att_val ) . '"';
			}
			$out .= '<input type="hidden" class="js-wpv-view-attributes"' . $att_data . ' />';
		}
		
        // add hidden inputs for any url parameters.
        // We need these for when the form is submitted.
        $url_query = parse_url($url, PHP_URL_QUERY);
        if ($url_query != '') {
            $query_parts = explode('&', $url_query);
            foreach($query_parts as $param) {
                $item = explode('=', $param);
                if (strpos($item[0], 'wpv_') !== 0) {
                    $out .= '<input id="wpv_param_' . $item[0] . '" type="hidden" name="' . $item[0] . '" value="' . $item[1] . '" />';
                }
            }
        }
        
        // Add hidden inputs for column sorting id and direction:
        // these start populated with the View settings values and will be changed when a column title is clicked.
        if (isset($view_layout_settings['style']) && ($view_layout_settings['style'] == 'table_of_fields' or $view_layout_settings['style'] == 'table')) {
            if ($view_settings['query_type'][0] == 'posts') {
                $sort_id = $view_settings['orderby'];
                $sort_dir = strtolower($view_settings['order']);
            }
            if ($view_settings['query_type'][0] == 'taxonomy') {
                $sort_id = $view_settings['taxonomy_orderby'];
                $sort_dir = strtolower($view_settings['taxonomy_order']);
            }
            if ($view_settings['query_type'][0] == 'users') {
                $sort_id = $view_settings['users_orderby'];
                $sort_dir = strtolower($view_settings['users_order']);
            }

            if (
				isset( $_GET['wpv_column_sort_id'] ) 
				&& esc_attr( $_GET['wpv_column_sort_id'] ) != '' 
				&& isset( $_GET['wpv_view_count'] ) 
				&& esc_attr( $_GET['wpv_view_count'] ) == $WP_Views->get_view_count() 
			) {
                $sort_id = esc_attr( $_GET['wpv_column_sort_id'] );
            }
            if (
				isset( $_GET['wpv_column_sort_dir'] ) 
				&& esc_attr( $_GET['wpv_column_sort_dir'] ) != '' 
				&& isset( $_GET['wpv_view_count'] ) 
				&& esc_attr( $_GET['wpv_view_count'] ) == $WP_Views->get_view_count()
			) {
                $sort_dir = esc_attr( $_GET['wpv_column_sort_dir'] );
            }
            
            $out .= '<input id="wpv_column_sort_id" type="hidden" name="wpv_column_sort_id" value="' . $sort_id . '" />';
            $out .= '<input id="wpv_column_sort_dir" type="hidden" name="wpv_column_sort_dir" value="' . $sort_dir . '" />';
        }
        
        /**
        * Add other hidden fields for:
        *
        * max number of pages for this View
        * preload reach
        * widget ID when aplicable
        * View count for multiple Views per pages
        * View hash
        * current post ID when needed
        */
        
		/**
		* @todo this might not need a name at all...
		*/
        $out .= '<input id="wpv_paged_max-' . $WP_Views->get_view_count() . '" type="hidden" name="wpv_paged_max" value="' . intval($WP_Views->get_max_pages()) . '" />';
        
        if ( isset( $view_settings['pagination']['pre_reach'] ) ) { $pre_reach = intval($view_settings['pagination']['pre_reach']); } else { $pre_reach = 1; }
		/**
		* @todo this might not need a name at all...
		*/
        $out .= '<input id="wpv_paged_preload_reach-' . $WP_Views->get_view_count() . '" type="hidden" name="wpv_paged_preload_reach" value="' . $pre_reach . '" />';
        
        $out .= '<input id="wpv_widget_view-' . $WP_Views->get_view_count() . '" type="hidden" name="wpv_widget_view_id" value="' . intval($WP_Views->get_widget_view_id()) . '" />';
        $out .= '<input id="wpv_view_count-' . $WP_Views->get_view_count() . '" type="hidden" name="wpv_view_count" value="' . $WP_Views->get_view_count() . '" />';

        $view_data = $WP_Views->get_view_shortcodes_attributes();
        //$view_data['view_id'] = $WP_Views->get_current_view();
        $out .= '<input id="wpv_view_hash-' . $WP_Views->get_view_count() . '" type="hidden" name="wpv_view_hash" value="' . base64_encode(json_encode($view_data)) . '" />';
    
        $requires_current_page = false;
		/**
		* wpv_filter_requires_current_page
		*
		* Whether the current View requires the current page for any filter
		*
		* @param $requires_current_page boolean
		* @param $view_settings
		*
		* @since unknown
		*/
        $requires_current_page = apply_filters('wpv_filter_requires_current_page', $requires_current_page, $view_settings);
        if ( $requires_current_page ) {
            $current_post = $WP_Views->get_top_current_page();
            if (
				$current_post 
				&& isset( $current_post->ID ) 
			) {
                $out .= '<input id="wpv_post_id-' . esc_attr( $WP_Views->get_view_count() ) . '" type="hidden" name="wpv_post_id" value="' . esc_attr( $current_post->ID ) . '" class="js-wpv-keep-on-clear" />';
            }
        }
		
		$requires_parent_term = false;
		/**
		* wpv_filter_requires_parent_term
		*
		* Whether the current View is nested and requires the parent term for any filter
		*
		* @param $requires_parent_term boolean
		* @param $view_settings
		*
		* @since unknown
		*/
		$requires_parent_term = apply_filters( 'wpv_filter_requires_parent_term', $requires_parent_term, $view_settings );
		if ( $requires_parent_term ) {
            $parent_term_id = $WP_Views->get_parent_view_taxonomy();
            if ( $parent_term_id ) {
                $out .= '<input id="wpv_aux_parent_term_id-' . esc_attr( $WP_Views->get_view_count() ) . '" type="hidden" name="wpv_aux_parent_term_id" value="' . esc_attr( $parent_term_id ) . '" class="js-wpv-keep-on-clear" />';
            }
        }
		
		$requires_parent_user = false;
		/**
		* wpv_filter_requires_parent_user
		*
		* Whether the current View is nested and requires the parent user for any filter
		*
		* @param $requires_parent_user boolean
		* @param $view_settings
		*
		* @since unknown
		*/
		$requires_parent_user = apply_filters( 'wpv_filter_requires_parent_user', $requires_parent_user, $view_settings );
		if ( $requires_parent_user ) {
            $parent_user_id = $WP_Views->get_parent_view_user();
            if ( $parent_user_id ) {
                $out .= '<input id="wpv_aux_parent_user_id-' . esc_attr( $WP_Views->get_view_count() ) . '" type="hidden" name="wpv_aux_parent_user_id" value="' . esc_attr( $parent_user_id ) . '" class="js-wpv-keep-on-clear" />';
            }
        }
		
        add_action('wp_footer', 'wpv_pagination_js');
        
        // Rollover
        if (isset($view_settings['pagination']['mode']) && $view_settings['pagination']['mode'] == 'rollover') {
            wpv_pagination_rollover_shortcode();
        }
        
    }
    
	/**
	* Filter wpv_filter_start_filter_form
	*
	* @param $out the default form opening tag followed by the required hidden input tags needed for pagination and table sorting
	* @param $view_settings the current View settings
	* @param $view_id the ID of the View being displayed
	* @param $is_required [true|false] whether this View requires a form to be displayed (has a parametric search OR uses table sorting OR uses pagination)
	*
	* This can be useful to create additional inputs for the current form without needing to add them to the Filter HTML textarea
	* Also, can help users having formatting issues
	*
	* @return $out
	*
	* Since 1.5.1
	*
	*/
	
	$out = apply_filters( 'wpv_filter_start_filter_form', $out, $view_settings, $view_id, $is_required );
    
    return $out;
}
 function check_force_disable_dependant_parametric_search()
 {
     $force_disable = false;
     $view_settings = $this->get_view_settings();
     if (isset($view_settings['dps']) && isset($view_settings['dps']['enable_dependency']) && $view_settings['dps']['enable_dependency'] == 'enable') {
         $controls_per_kind = wpv_count_filter_controls($view_settings);
         $controls_count = 0;
         $no_intersection = array();
         if (!isset($controls_per_kind['error'])) {
             // $controls_count = array_sum( $controls_per_kind );
             $controls_count = $controls_per_kind['cf'] + $controls_per_kind['tax'] + $controls_per_kind['pr'] + $controls_per_kind['search'];
             if ($controls_per_kind['cf'] > 1 && (!isset($view_settings['custom_fields_relationship']) || $view_settings['custom_fields_relationship'] != 'AND')) {
                 $no_intersection[] = __('custom field', 'wpv-views');
             }
             if ($controls_per_kind['tax'] > 1 && (!isset($view_settings['taxonomy_relationship']) || $view_settings['taxonomy_relationship'] != 'AND')) {
                 $no_intersection[] = __('taxonomy', 'wpv-views');
             }
         } else {
             $force_disable = true;
         }
         if ($controls_count > 0) {
             if (count($no_intersection) > 0) {
                 $force_disable = true;
             }
         } else {
             $force_disable = true;
         }
     }
     $this->set_force_disable_dependant_parametric_search($force_disable);
     return $force_disable;
 }
function wpv_filter_extend_query_for_parametric_and_counters($post_query, $view_settings, $id)
{
    $dps_enabled = false;
    $counters_enabled = false;
    if (!isset($view_settings['dps']) || !is_array($view_settings['dps'])) {
        $view_settings['dps'] = array();
    }
    if (isset($view_settings['dps']['enable_dependency']) && $view_settings['dps']['enable_dependency'] == 'enable') {
        $dps_enabled = true;
        $controls_per_kind = wpv_count_filter_controls($view_settings);
        $controls_count = 0;
        $no_intersection = array();
        if (!isset($controls_per_kind['error'])) {
            //	$controls_count = array_sum( $controls_per_kind );
            $controls_count = $controls_per_kind['cf'] + $controls_per_kind['tax'] + $controls_per_kind['pr'] + $controls_per_kind['search'];
            if ($controls_per_kind['cf'] > 1 && (!isset($view_settings['custom_fields_relationship']) || $view_settings['custom_fields_relationship'] != 'AND')) {
                $no_intersection[] = __('custom field', 'wpv-views');
            }
            if ($controls_per_kind['tax'] > 1 && (!isset($view_settings['taxonomy_relationship']) || $view_settings['taxonomy_relationship'] != 'AND')) {
                $no_intersection[] = __('taxonomy', 'wpv-views');
            }
        } else {
            $dps_enabled = false;
        }
        if ($controls_count > 0) {
            if (count($no_intersection) > 0) {
                $dps_enabled = false;
            }
        } else {
            $dps_enabled = false;
        }
    }
    if (!isset($view_settings['filter_meta_html'])) {
        $view_settings['filter_meta_html'] = '';
    }
    if (strpos($view_settings['filter_meta_html'], '%%COUNT%%') !== false) {
        $counters_enabled = true;
    }
    global $WP_Views;
    if (!$dps_enabled && !$counters_enabled) {
        // Set the force value
        $WP_Views->set_force_disable_dependant_parametric_search(true);
        return $post_query;
    }
    // If after all we have dps, we need to populate the $wp_object_cache
    // Check if we need to create all the cache or just for the missing ones
    global $wp_object_cache;
    $cache_exclude_queried_posts = false;
    // we will only exclude already queried posts if there are any queried posts and the native cache exists (so they are already cached)
    $cache_use_native = true;
    if (is_object($wp_object_cache)) {
        if (isset($wp_object_cache->cache)) {
            // existing queried posts were already cached
            if (empty($post_query)) {
                $cache_exclude_queried_posts = false;
                // we passed an empty $post_query so there are no queried posts at all (surely coming from a form View shortcode)
            } else {
                $cache_exclude_queried_posts = true;
            }
        } else {
            $wp_object_cache->cache = array();
            $cache_exclude_queried_posts = false;
            // already queried posts were not cached where we need them
            $cache_use_native = false;
            // the native $wp_object_cache->cache property is not set, so we will recreate it instead of naturally caching metadata
        }
    }
    // In any case, we need to mimic the process that we used to generate the $query
    $view_settings_defaults = array('post_type' => 'any', 'orderby' => 'post-date', 'order' => 'DESC', 'paged' => '1', 'posts_per_page' => -1);
    extract($view_settings_defaults);
    $view_settings['view_id'] = $id;
    extract($view_settings, EXTR_OVERWRITE);
    $query = array('posts_per_page' => $posts_per_page, 'paged' => $paged, 'post_type' => $post_type, 'order' => $order, 'suppress_filters' => false, 'ignore_sticky_posts' => true);
    // Add special check for media (attachments) as their default status in not usually published
    if (sizeof($post_type) == 1 && $post_type[0] == 'attachment') {
        $query['post_status'] = 'any';
        // Note this can be overriden by adding a status filter.
    }
    $query = apply_filters('wpv_filter_query', $query, $view_settings, $id);
    // Now we have the $query as in the original one
    // We now need to overwrite the limit, offset, paged and pagination options
    // Also, we set it to just return the IDs
    $query['posts_per_page'] = -1;
    $query['ĺimit'] = -1;
    $query['paged'] = 1;
    $query['offset'] = 0;
    $query['fields'] = 'ids';
    if ($cache_exclude_queried_posts) {
        // do not query again already queried and cached posts
        $already = array();
        if (isset($post_query->posts) && !empty($post_query->posts)) {
            foreach ((array) $post_query->posts as $post_object) {
                $already[] = $post_object->ID;
            }
        }
        $WP_Views->returned_ids_for_parametric_search = $already;
        if (isset($query['pr_filter_post__in'])) {
            $query['post__in'] = $query['pr_filter_post__in'];
        } else {
            // If just for the missing ones, generate the post__not_in argument
            if (isset($query['post__not_in'])) {
                $query['post__not_in'] = array_merge((array) $query['post__not_in'], (array) $already);
            } else {
                $query['post__not_in'] = (array) $already;
            }
            // And adjust on the post__in argument
            if (isset($query['post__in'])) {
                $query['post__in'] = array_diff((array) $query['post__in'], (array) $query['post__not_in']);
                //unset( $query['post__in'] );
            }
        }
    }
    // Perform the query
    $aux_cache_query = new WP_Query($query);
    // In case we need to recreate our own cache object, we do not need to load there all the postmeta and taxonomy data, just for the elements involved in parametric search controls
    $filter_c_mode = isset($view_settings['filter_controls_mode']) && is_array($view_settings['filter_controls_mode']) ? $view_settings['filter_controls_mode'] : array();
    $filter_c_name = isset($view_settings['filter_controls_field_name']) && is_array($view_settings['filter_controls_field_name']) ? $view_settings['filter_controls_field_name'] : array();
    $f_taxes = array();
    $f_fields = array();
    foreach ($filter_c_mode as $f_index => $f_mode) {
        if (isset($filter_c_name[$f_index])) {
            switch ($f_mode) {
                case 'slug':
                    $f_taxes[] = $filter_c_name[$f_index];
                    break;
                case 'cf':
                    $f_fields[] = $filter_c_name[$f_index];
                    break;
                case 'rel':
                    if (function_exists('wpcf_pr_get_belongs')) {
                        $returned_post_types = $view_settings['post_type'];
                        $returned_post_type_parents = array();
                        if (empty($returned_post_types)) {
                            $returned_post_types = array('any');
                        }
                        foreach ($returned_post_types as $returned_post_type_slug) {
                            $parent_parents_array = wpcf_pr_get_belongs($returned_post_type_slug);
                            if ($parent_parents_array != false && is_array($parent_parents_array)) {
                                $returned_post_type_parents = array_merge($returned_post_type_parents, array_values(array_keys($parent_parents_array)));
                            }
                        }
                        foreach ($returned_post_type_parents as $parent_to_cache) {
                            $f_fields[] = '_wpcf_belongs_' . $parent_to_cache . '_id';
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }
    // If we are using the native caching, update the cache for the posts returned by the aux query
    if (is_array($aux_cache_query->posts) && !empty($aux_cache_query->posts)) {
        $WP_Views->returned_ids_for_parametric_search = array_merge($WP_Views->returned_ids_for_parametric_search, $aux_cache_query->posts);
        $WP_Views->returned_ids_for_parametric_search = array_unique($WP_Views->returned_ids_for_parametric_search);
        if ($cache_use_native) {
            // If we are using the native caching, update the cache for the posts returned by the aux query
            update_postmeta_cache($aux_cache_query->posts);
            update_object_term_cache($aux_cache_query->posts, $view_settings['post_type']);
        } else {
            // Else, we need to fake an $wp_object_cache->cache
            $f_data = array('cf' => $f_fields, 'tax' => $f_taxes);
            $cache_combined = wpv_custom_cache_metadata($aux_cache_query->posts, $f_data);
            $wp_object_cache->cache = $cache_combined;
        }
    }
    return $post_query;
}
function wpv_get_dps_related() {
	if ( ! current_user_can( 'manage_options' ) ) {
		die( "Security check" );
	}
	if ( ! wp_verify_nonce( $_POST["nonce"], 'wpv_view_edit_general_nonce' ) ) {
		die( "Security check" );
	}
	$return_result = array(
		'existence' => '',
		'intersection' => '',
		'missing' => ''
	);
	if ( isset( $_POST['id'] ) ) {
		global $WP_Views;
		$view_id = (int) $_POST['id'];
		$view_settings = $WP_Views->get_view_settings( $view_id );
		$controls_per_kind = wpv_count_filter_controls( $view_settings );
		$controls_count = $controls_per_kind['cf'] + $controls_per_kind['tax'] + $controls_per_kind['pr'] + $controls_per_kind['search'];
		$no_intersection = array();				
		if ( 
			isset( $controls_per_kind['cf'] ) 
			&& $controls_per_kind['cf'] > 1 
			&& (
				! isset( $view_settings['custom_fields_relationship'] ) 
				|| $view_settings['custom_fields_relationship'] != 'AND' 
			) 
		) {
			$no_intersection[] = __( 'custom field', 'wpv-views' );
		}
		if ( 
			isset( $controls_per_kind['tax'] ) 
			&& $controls_per_kind['tax'] > 1 && ( 
				! isset( $view_settings['taxonomy_relationship'] ) 
				|| $view_settings['taxonomy_relationship'] != 'AND' 
			) 
		) {
			$no_intersection[] = __( 'taxonomy', 'wpv-views' );
		}
		// Existence
		if ( $controls_count == 0 ) {
			$return_result['existence'] = '<p>' . __('Remember to add filters here. Right now, this parametric search has no filter items.', 'wpv-views') . '</p>';
		}
		// Intersection
		if ( count( $no_intersection ) > 0 ) {
			$glue = __( ' and ', 'wpv-views' );
			$no_intersection_text = implode( $glue , $no_intersection );
			$return_result['intersection'] = sprintf( __( 'Your %s filters are using an internal "OR" kind of relationship, and dependant parametric search for those filters needs "AND" relationships.', 'wpv-views' ), $no_intersection_text );
			$return_result['intersection'] .= '<br /><br />';
			$return_result['intersection'] .= '<button class="button-secondary js-make-intersection-filters" data-nonce="' . wp_create_nonce( 'wpv_view_make_intersection_filters' ) .'"';
			if ( in_array( 'cf', $no_intersection ) ) {
				$return_result['intersection'] .= ' data-cf="true"';
			} else {
				$return_result['intersection'] .= ' data-cf="false"';
			}
			if ( in_array( 'tax', $no_intersection ) ) {
				$return_result['intersection'] .= ' data-tax="true"';
			} else {
				$return_result['intersection'] .= ' data-tax="false"';
			}
			$return_result['intersection'] .= '>';
				$return_result['intersection'] .= __('Fix filters relationship', 'wpv-views');
			$return_result['intersection'] .= '</button>';
		}
		// Missing
		if ( 
			isset( $controls_per_kind['missing'] ) 
			&& is_array( $controls_per_kind['missing'] ) 
			&& ! empty( $controls_per_kind['missing'] ) 
		) {
			$return_result['missing'] = '<div class="toolset-help-content">';
			$return_result['missing'] .= __( 'This View has some query filters that are missing from the form. Maybe you have removed them:', 'wpv-views' );
			$return_result['missing'] .= '<ul class="js-wpv-filter-missing">';
			foreach ( $controls_per_kind['missing'] as $missed ) {
				$return_result['missing'] .= '<li class="js-wpv-missing-filter" data-type="' . $missed['type'] . '" data-name="' . $missed['name'] . '">';
				$return_result['missing'] .= sprintf( __( 'Filter by <strong>%s</strong>', 'wpv-views' ), $missed['name'] );
				$return_result['missing'] .= '</li>';
			}
			$return_result['missing'] .= '</ul>';
			$return_result['missing'] .= __( 'Can they also be removed from the query filtering?', 'wpv-views' );
			$return_result['missing'] .= '<p>';
				$return_result['missing'] .= '<a href="#" class="button button-primary js-wpv-filter-missing-delete" data-nonce="' . wp_create_nonce( 'wpv_view_filter_missing_delete' ) . '">' . __( 'Yes (recommended)', 'wpv-views' ) . '</a> <a href="#" class="button button-secondary js-wpv-filter-missing-close">' . __( 'No', 'wpv-views' ) . '</a>';
			$return_result['missing'] .= '</p>';
			$return_result['missing'] .= '</div>';
			$return_result['missing'] .= '<div class="toolset-help-sidebar"><div class="toolset-help-sidebar-ico"></div></div>';
		}
	}
	echo json_encode( $return_result );
	die();
}