<?php

/**
 * Upgrade Theme Info and offer
 * @package Glaciers
 * @since 1.0.5
 */

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

// Load the premium upgrade info when using the free version
function glaciers_customizer_glaciers_upgrade($wp_customize)
{

	$wp_customize->add_section('glaciers_upgrade', array(
		'title'       => esc_html__('Glaciers Pro Version Features', 'glaciers'),
		'priority'    => 5,
	));

	/** Important Links */
	$wp_customize->add_setting(
		'glaciers_upgrade_theme',
		array(
			'default' => '',
			'sanitize_callback' => 'wp_kses_post',
		)
	);

	$glaciers_upgrade_screenshot = get_template_directory_uri() . '/assets/images/upgrade-screenshot.png';

	$glaciers_upgrade = '<div class="upgrade-pro"><img src="' . esc_url($glaciers_upgrade_screenshot) . '" alt="' . esc_attr__('Upgrade Screenshot', 'glaciers') . '" />';
	$glaciers_upgrade .= '<p class="rp-discount">';
	$glaciers_upgrade .= wp_kses_post(__('Get more features with the Pro version for a Limited time <span class="rp-discount-ends">(Ends Soon)</span>. ', 'glaciers'));
	$glaciers_upgrade .= wp_kses_post(__('We are offering a <strong>Huge Savings</strong> of <span class="rp-savings-amount">$10</span> if you decide to upgrade to the Personal Year or Personal Lifetime option.  Use the discount code: <strong>GLACIERS10</strong> on checkout.', 'glaciers')) . '</p>';
	$glaciers_upgrade .= '<p class="rp-pro-title">';
	$glaciers_upgrade .= esc_html__('Pro Features: ', 'glaciers');
	$glaciers_upgrade .= '</p><ul class="rp-pro-list"><li>' . esc_html('3 Header Styles', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('9 Blog Styles', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('6 Post Styles', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('3 Footer Styles', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Custom Blog Intro', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Featured Posts Slider', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Customizable Text Labels', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Custom Excerpt Sizing', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Custom Banner Sizing', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Auto Create Featured Image Thumbnails', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Make All Images Black &amp; White', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Customized Mailchimp Signup', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Customized WPForms Support', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Customized Contact 7 Form Support', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Related Posts w/Thumbnails', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Author Widget w/Thumbnail', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Comments Widget w/Thumbnails', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Show/Hide Blog &amp; Post Elements', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('Disable Gutenberg Theme Styles', 'glaciers') . '</li>';
	$glaciers_upgrade .= '<li>' . esc_html('...and much more!', 'glaciers') . '</li></ul><p>';
	$glaciers_upgrade .= esc_html__('Even though the FREE version of Glaciers offers a lot, you may want to opt-in for more features.', 'glaciers');

	$glaciers_upgrade .= '</p><p><a class="rp-get-pro button" href="' . esc_url('https://roughpixels.ch/themes/glaciers/') . '" target="_blank">' . esc_html__('Save 50% Now ', 'glaciers') . '</a></p></div>';

	$wp_customize->add_control(
		new Glaciers_Note_Control(
			$wp_customize,
			'glaciers_upgrade_theme',
			array(
				'section'     => 'glaciers_upgrade',
				'label'	      => esc_html__('Pro Version', 'glaciers'),
				'description' => $glaciers_upgrade
			)
		)
	);
}

add_action('customize_register', 'glaciers_customizer_glaciers_upgrade', 10);