<?php

use ThemeAtelier\EventfulForElementor\Frontend\Helpers\EventfulForElementorLiveFilter;

if (! defined('ABSPATH')) exit; // Exit if accessed directly

/**
 *  Shuffle filter bar file
 *
 * This template can be overridden by copying it to yourtheme/eventful-por-elementor/filter-bar.php
 *
 * @package    eventful-for-elementor
 * @subpackage eventful-for-elementor/src/Frontend/templates
 */

if (is_array($advanced_filter) && ! $efpe_query->is_main_query()) {
	ob_start();
	EventfulForElementorLiveFilter::efpe_live_filter($view_options, $efpe_settings, $efpe_event_limit, $query_args, $efpe_gl_id);
	EventfulForElementorLiveFilter::efpe_author_filter($view_options, $efpe_settings, $efpe_event_limit, $query_args);
	$filter_bar = ob_get_clean();

	ob_start();
	EventfulForElementorLiveFilter::efpe_orderby_filter_bar($view_options, $efpe_settings, $efpe_query, $efpe_gl_id);
	EventfulForElementorLiveFilter::efpe_order_filter_bar($view_options, $efpe_settings, $efpe_gl_id);
	EventfulForElementorLiveFilter::efpe_live_search_bar($view_options, $efpe_settings, $efpe_gl_id);
	$ex_filter_bar = ob_get_clean();


	if (! empty($filter_bar)) { ?>
		<div class="efpe-filter-bar">
			<?php
			$allowed_tags = array(
				'form'  => array(
					'class' => array(),
					'style' => array(),
				),
				'p'     => array(),
				'div'   => array(
					'style' => array(),
					'class' => array(),
				),
				'label' => array(),
				'input' => array(
					'checked'       => array(),
					'type'          => array(),
					'name'          => array(),
					'data-taxonomy' => array(),
					'value'         => array(),
				),
			);

			echo wp_kses(
				$filter_bar,
				$allowed_tags
			);
			?>
		</div>
	<?php }
	if (! empty($ex_filter_bar)) { ?>
		<div class="efpe_ex_filter_bar">
			<?php
			$allowed_tags = array(
				'form'  => array(
					'class' => array(),
					'style' => array(),
				),
				'p'     => array(),
				'div'   => array(
					'style' => array(),
					'class' => array(),
				),
				'label' => array(),
				'input' => array(
					'checked'       => array(),
					'type'          => array(),
					'name'          => array(),
					'data-taxonomy' => array(),
					'value'         => array(),
				),
			);

			echo wp_kses(
				$ex_filter_bar,
				$allowed_tags
			);
			?>
		</div>
<?php }
} ?>