<?php

/**
 * The template for displaying email footer
 *
 * This template can be overridden by copying it to yourtheme/movie-engine/emails/footer.php.
 *
 * HOWEVER, on occasion MovieEngine will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * NOTE: Inline styles in email templates are intentional for email client compatibility.
 *
 * @note Please do not delete our CSS classes when you customize, as it may break functionality.
 * @package Movie_Engine
 * @subpackage Movie_Engine/templates
 * @version 1.0.0
 * @since 1.0.0
 */

if (! defined("ABSPATH")) {
    exit; // Exit if accessed directly
}

$movie_engine_email_options = get_option('movie_engine_email_settings', []);
$movie_engine_email_footer_bg_color = !empty($movie_engine_email_options['footer_bg_color']) ? $movie_engine_email_options['footer_bg_color'] : '#1a1a1a';
$movie_engine_email_footer_text = !empty($movie_engine_email_options['footer_text']) ? $movie_engine_email_options['footer_text'] : sprintf(
    /* translators: 1: current year, 2: site name */
    esc_html__('© %1$s %2$s. All rights reserved.', 'cine-movie-engine'),
    gmdate('Y'),
    get_bloginfo('name')
);
$movie_engine_email_privacy_text = !empty($movie_engine_email_options['privacy_text']) ? $movie_engine_email_options['privacy_text'] : esc_html__('Privacy Policy', 'cine-movie-engine');
$movie_engine_email_terms_text = !empty($movie_engine_email_options['terms_text']) ? $movie_engine_email_options['terms_text'] : esc_html__('Terms of Service', 'cine-movie-engine');
$movie_engine_email_link_color = !empty($movie_engine_email_options['link_color']) ? $movie_engine_email_options['link_color'] : '#E50914';
?>
</div>
<div class="footer" style="background-color: <?php echo esc_attr($movie_engine_email_footer_bg_color); ?>;">
    <p><?php echo \MovieEngine\Utils\Helpers::kses_post($movie_engine_email_footer_text); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_post sanitizes HTML ?></p>
    <div style="margin-top: 10px;">
        <a href="<?php echo esc_url($movie_engine_email_options['privacy_url'] ?? home_url('/privacy-policy')); ?>" style="color: <?php echo esc_attr($movie_engine_email_link_color); ?>; text-decoration: none; margin: 0 10px;"><?php echo esc_html($movie_engine_email_privacy_text); ?></a>
        <a href="<?php echo esc_url($movie_engine_email_options['terms_url'] ?? home_url('/terms')); ?>" style="color: <?php echo esc_attr($movie_engine_email_link_color); ?>; text-decoration: none; margin: 0 10px;"><?php echo esc_html($movie_engine_email_terms_text); ?></a>
    </div>
</div>
</div>
</div>
</body>

</html>