<?php
if (!defined('ABSPATH')) {
    exit;
}
// Urls
$upvimeo_url_guide = upvimeo_get_guide_url();
$upvimeo_url_purchase = upvimeo_get_purchase_url();

// Check if Pro version using the existing freemius logic
$upvimeo_is_pro = function_exists('upvimeo_fs') && upvimeo_fs()->is_premium();

// Dismiss Init
$upvimeo_nonce = wp_create_nonce('upvimeo_instructions_dismiss');
$upvimeo_server_host = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : '';
$upvimeo_server_uri  = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '';
$upvimeo_actual_link = (isset($_SERVER['HTTPS']) && sanitize_text_field(wp_unslash($_SERVER['HTTPS'])) === 'on' ? "https" : "http") . "://$upvimeo_server_host$upvimeo_server_uri";
$upvimeo_dismiss_link = add_query_arg('upvimeo_nonce', $upvimeo_nonce, $upvimeo_actual_link);
$upvimeo_dismiss_link = add_query_arg('upvimeo_dismiss_instructions', 1, $upvimeo_dismiss_link);

if ($upvimeo_is_pro) {
    $upvimeo_headline = __('Welcome to Upvimeo Pro - You are all set!', 'upvimeo-direct-uploads');
    $upvimeo_subtitle = __('Empowering you to build a video experience that truly stands out with advanced features and seamless integration.', 'upvimeo-direct-uploads');
    $upvimeo_cta_text = __('Plugin Settings', 'upvimeo-direct-uploads');
    $upvimeo_cta_link = upvimeo_get_settings_url();
    $upvimeo_cta_target = '_self';
    $upvimeo_badge_class = 'upvimeo-badge-pro';
    $upvimeo_badge_text  = __('Verified PRO', 'upvimeo-direct-uploads');
} else {
    $upvimeo_headline = __('Unlock the Full Power of Video Hosting', 'upvimeo-direct-uploads');
    $upvimeo_subtitle = __('Seamlessly upload high-quality videos to Vimeo directly from WordPress. fluctuating server limits are a thing of the past.', 'upvimeo-direct-uploads');
    $upvimeo_cta_text = __('Get Upvimeo Pro', 'upvimeo-direct-uploads');
    $upvimeo_cta_link = 'https://upvimeo.com';
    $upvimeo_cta_target = '_blank';
    $upvimeo_badge_class = 'upvimeo-badge-free';
    $upvimeo_badge_text  = __('Upvimeo', 'upvimeo-direct-uploads');
}
?>
<div class="upvimeo-hero-banner-wrapper notice welcome-panel">
    <a href="<?php echo esc_url($upvimeo_dismiss_link); ?>" class="upvimeo-hero-dismiss" aria-label="<?php esc_attr_e('Dismiss', 'upvimeo-direct-uploads'); ?>">
        <span class="dashicons dashicons-no-alt"></span>
    </a>

    <div class="upvimeo-hero-content-left">
        <div class="upvimeo-hero-badge <?php echo esc_attr($upvimeo_badge_class); ?>">
            <?php if ($upvimeo_is_pro): ?>
                <span class="dashicons dashicons-yes-alt"></span>
            <?php endif; ?>
            <?php echo esc_html($upvimeo_badge_text); ?>
        </div>
        <h2 class="upvimeo-hero-headline"><?php echo esc_html($upvimeo_headline); ?></h2>
        <p class="upvimeo-hero-subtitle"><?php echo esc_html($upvimeo_subtitle); ?></p>

        <div class="upvimeo-hero-actions">
            <a href="<?php echo esc_url($upvimeo_cta_link); ?>" target="<?php echo esc_attr($upvimeo_cta_target); ?>" class="upvimeo-hero-cta button button-primary button-hero">
                <?php echo esc_html($upvimeo_cta_text); ?>
                <?php if (!$upvimeo_is_pro): ?>
                    <span class="dashicons dashicons-external"></span>
                <?php endif; ?>
            </a>
            <?php if (!$upvimeo_is_pro): ?>
                <a href="<?php echo esc_url('https://upvimeo.com/docs/'); ?>" target="_blank" class="upvimeo-hero-link">
                    <?php esc_html_e('Read Setup Guide', 'upvimeo-direct-uploads'); ?>
                </a>
            <?php endif; ?>
        </div>
    </div>

    <div class="upvimeo-hero-content-right">
        <div class="upvimeo-hero-illustration">
            <img src="<?php echo esc_url( plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'assets/images/branding/upv-icon-white.svg' ); ?>" alt="Upvimeo Illustration" data-no-lazy="1" class="no-lazy skip-lazy">
        </div>
    </div>
</div>