<?php

if (! defined('ABSPATH')) {
	die;
} // Cannot access directly.

if (! class_exists('DOMAIN_FOR_SALE_Field_shortcode')) {
	/**
	 * DOMAIN_FOR_SALE_Field_shortcode
	 */
	class DOMAIN_FOR_SALE_Field_shortcode extends DOMAIN_FOR_SALE_Fields
	{
		/**
		 * Field constructor.
		 *
		 * @param array  $field The field type.
		 * @param string $value The values of the field.
		 * @param string $unique The unique ID for the field.
		 * @param string $where To where show the output CSS.
		 * @param string $parent The parent args.
		 */
		public function __construct($field, $value = '', $unique = '', $where = '', $parent = '')
		{
			parent::__construct($field, $value, $unique, $where, $parent);
		}
		/**
		 * Render method.
		 *
		 * @return void
		 */
		public function render()
		{
			// Get the Post ID.
			$post_id = get_the_ID();

			if (!empty($this->field['shortcode']) && 'manage_view' === $this->field['shortcode']) {
				echo (! empty($post_id)) ? '<div class="domain-for-sale-scode-wrap-side"><p>'. __('To display your template, add the following shortcode into your page, post, custom post types, widget or block editor.', 'domain-for-sale') .'</p><span class="domain-for-sale-shortcode-selectable">[domain_for_sale id="' . esc_attr($post_id) . '"]</span></div><div class="domain-for-sale-after-copy-text"><i class="icofont-check-circled"></i> '. esc_html__('Shortcode Copied to Clipboard!', 'domain-for-sale') .' </div>' : '';
			} elseif (!empty($this->field['shortcode']) && 'pro_notice' === $this->field['shortcode']) {
				if (! empty($post_id)) {
					echo '<div class="domain-for-sale_shortcode-area domain-for-sale-notice-wrapper">';
					echo '<div class="domain-for-sale-notice-heading">' . sprintf(
						/* translators: 1: start span tag, 2: close tag. */
						esc_html__('Additional Features in %1$sPRO%2$s', 'domain-for-sale'),
						'<span>',
						'</span>'
					) . '</div>';

					echo '<p class="domain-for-sale-notice-desc">' . sprintf(
						/* translators: 1: start bold tag, 2: close tag. */
						esc_html__('Here are some additional features available in Pro!', 'domain-for-sale'),
						'<b>',
						'</b>'
					) . '</p>';

					echo '<ul>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Advanced Template Options', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Receive Domain Bids', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Escrow.com Payment Processing', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('View Transactions in Admin', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Send Purchase Invitations', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Dual Offer & Escrow Workflow', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Export Offers As CSV', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Bidder Email Verification', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('Google reCAPTCHA (v3 & v2)', 'domain-for-sale') . '</li>';
					echo '<li><i class="icofont-verification-check"></i> ' . esc_html__('70+ Customizations & More', 'domain-for-sale') . '</li>';
					echo '</ul>';

					echo '<div class="domain-for-sale-notice-button">';
					echo '<a class="domain-for-sale-open-live-demo" href="https://wpdomainforsale.com/pricing/?ref=1" target="_blank">';
					echo esc_html__('Upgrade to Pro Now', 'domain-for-sale') . ' <i class="icofont-rocket-alt-2"></i>';
					echo '</a>';
					echo '</div>';
					echo '</div>';
				}
			} else {
				echo (!empty($post_id)) ? '<div class="domain-for-sale-scode-wrap-side"><p>Domain For Sale has seamless integration with Gutenberg, Classic Editor, <strong>Elementor,</strong> Divi, Bricks, Beaver, Oxygen, WPBakery Builder, etc.</p></div>' : '';
			}
		}
	}
}
