<?php

use ThemeAtelier\EventfulForElementor\Frontend\Helpers\EventfulForElementorFunctions;

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

/**
 * Content
 *
 * This template can be overridden by copying it to yourtheme/eventful-por-elementor/templates/item/content.php
 *
 * @package    eventful-for-elementor
 * @subpackage eventful-for-elementor/src/Frontend/templates
 */

?>
<div class="eventful__item__content">
	<?php
	if ($show_content) {
		$content_to_sanitize = EventfulForElementorFunctions::efpe_content($options, $post, $efpe_settings);

		// Check if $content_to_sanitize is not null before using wp_kses
		if ($content_to_sanitize !== null) {
			$allowed_tags = apply_filters('ta_wp_efpe_allowed_tags', EventfulForElementorFunctions::allowed_tags());
			$sanitized_content = wp_kses($content_to_sanitize, $allowed_tags);

			// Output or use the sanitized content
			echo wp_kses_post($sanitized_content);
		} else {
			// Handle the case where $content_to_sanitize is null, e.g., provide a default value
			echo esc_html('Default content', 'eventful-for-elementor');
		}
	}
	if ($show_read_more) {
		$readmore_content = self::efpe_readmore($options, $post, $efpe_settings);
		if ($readmore_content !== null) {
			$sanitized_content = wp_kses_data(wp_strip_all_tags($readmore_content));
		} else {
			$sanitized_content = wp_kses_post('Default content');
		}
	}
	?>
</div>