<?php $disabled = (ihc_is_curl_enable()) ? 'disabled' : '';?>
<?php do_action( "ihc_admin_dashboard_after_top_menu" );?>
<?php
$responseNumber = isset($_GET['response']) ? $_GET['response'] : false;
if ( !empty($_GET['token'] ) && $responseNumber == 1 ){
		$ElCheck = new \Indeed\Ihc\Services\ElCheck();
		$responseNumber = $ElCheck->responseFromGet();
}
if ( $responseNumber !== false ){
		$ElCheck = new \Indeed\Ihc\Services\ElCheck();
		$responseMessage = $ElCheck->responseCodeToMessage( $responseNumber, 'ihc-danger-box', 'ihc-success-box', 'ihc' );
}
$license = get_option('ihc_license_set');
$envato_code = get_option('ihc_envato_code');
?>

<div>
	<div class="ihc-dashboard-title">
		Assinantes -
		<span class="second-text">
			<?php esc_html_e('Help Section', 'ihc');?>
		</span>
	</div>


	<div class="metabox-holder indeed">
		<div class="ihc-stuffbox">
			<h3>
				<label>
					<?php esc_html_e('assinantes', 'ihc');?>
				</label>
			</h3>
			<form method="post" >
				<div class="inside">
					<?php if ($disabled):?>
						<div class="iump-form-line iump-no-border"><strong><?php esc_html_e("cURL is disabled. You need to enable if for further activation request.")?></strong></div>
					<?php endif;?>
					<div class="iump-form-line iump-no-border ihc-help-settings-licenselabel">
						<label for="tag-name" class="iump-labels"><?php esc_html_e('Codigo', 'ihc');?></label>
					</div>
					<div class="iump-form-line iump-no-border ihc-help-settings-licensefield">
						<input name="ihc_licensing_code_v2" type="password" value="<?php echo $envato_code;?>"/>
					</div>

					<div class="ihc-stuffbox-submit-wrap iump-submit-form ihc-help-settings-licensebutton">
						<?php if ( $license ):?>
		            <div class="ihc-revoke-license ihc-js-revoke-license"><?php esc_html_e( 'Revogar', 'ihc' );?></div>
		        <?php else: ?>
								<input type="submit" value="<?php esc_html_e('Activate License', 'ihc');?>" name="ihc_save_licensing_code" <?php echo $disabled;?> class="button button-primary button-large" />
		        <?php endif;?>
					</div>

					<div class="ihc-clear"></div>

					<div class="ihc-license-status">
		        	<?php
								if ( $responseNumber !== false ){
										echo $responseMessage;
								} else if ( !empty( $_GET['revoke'] ) ){
										?>
										<div class="ihc-success-box"><?php esc_html_e( 'You have just revoke your license for Ultimate Membership Pro plugin.', 'ihc' );?></div>
										<?php
								} else if ( $license ){ ?>
											<div class="ihc-success-box"><?php esc_html_e( 'Licença OK.', 'ihc' );?></div>
		          <?php } ?>
		      </div>

					<div class="ihc-license-status">
						<?php
						if ( isset($_GET['extraCode']) && isset( $_GET['extraMess'] ) && $_GET['extraMess'] != '' ){
								$_GET['extraMess'] = stripslashes($_GET['extraMess']);
								if ( $_GET['extraCode'] > 0 ){
										// success
										?>
										<div class="ihc-success-box"><?php echo urldecode( $_GET['extraMess'] );?></div>
										<?php
								} else if ( $_GET['extraCode'] < 0 ){
										// errors
										?>
										<div class="ihc-danger-box"><?php echo urldecode( $_GET['extraMess'] );?></div>
										<?php
								} else if ( $_GET['extraCode'] == 0 ){
										// warning
										?>
										<div class="ihc-warning-box"><?php echo urldecode( $_GET['extraMess'] );?></div>
										<?php
								}
						}
					?>
					</div>

					
</div>
<span class="ihc-js-help-page-data"
			data-nonce="<?php echo wp_create_nonce('ihc_license_nonce');?>"
			data-revoke_url="<?php echo admin_url('admin.php?page=ihc_manage&tab=help&revoke=true');?>"
			data-help="<?php esc_html_e( 'Error!', 'ihc' );?>"
></span>
