<?php
$help_links = array(
	array(
		'url'   => 'https://docs.ignitiondeck.com/article/69-modules-recaptcha',
		'text'  => 'Documentation',
		'title' => 'Documentation',
	)
);
$recaptcha_settings = get_option('id_recaptcha_settings');
idf_render_menu_page_section_header( __( 'reCAPTCHA Settings', 'idf' ), $help_links );
?>

<table class="form-table">
	<tr>
		<th scope="row">
			<a href="https://www.google.com/recaptcha/admin#list" target="_blank"><?php esc_html_e('Generate API Keys', 'idf'); ?></a>
			<span class="dashicons dashicons-external" style="cursor: pointer;"></span>
		</th>
	</tr>
	<tr>
		<th scope="row" style="padding: 0;font-weight: bold;"><?php esc_html_e('reCAPTCHA Type', 'idf'); ?></th>
	</tr>
	<tr>
		<th scope="row">
			<input type="radio" name="id_recaptcha_type" id="v2" value="v2" <?php echo (isset($recaptcha_settings['id_recaptcha_type']) && $recaptcha_settings['id_recaptcha_type'] == 'v2') ? 'checked="checked"' : ''; ?> />
			<label for="v2" style="margin-right: 60px; vertical-align: top;"><?php esc_html_e('Version 2', 'idf'); ?></label>
			<input type="radio" name="id_recaptcha_type" id="v3" value="v3" <?php echo (isset($recaptcha_settings['id_recaptcha_type']) && $recaptcha_settings['id_recaptcha_type'] == 'v3') ? 'checked="checked"' : ''; ?> />
			<label for="v3" style="vertical-align: top;"><?php esc_html_e('Version 3', 'idf'); ?></label>
		</th>
	</tr>
	<tr>
		<th scope="row" style="padding: 0;font-weight: bold;"><?php esc_html_e('API Keys', 'idf'); ?></th>
	</tr>
	<tr>
		<th scope="row"><?php esc_html_e('Site Key', 'idf'); ?></th>
		<td>
			<input type="text" name="id_recaptcha_site_id" id="id_recaptcha_site_id" value="<?php echo esc_attr(isset($recaptcha_settings['id_recaptcha_site_id']) ? $recaptcha_settings['id_recaptcha_site_id'] : ''); ?>"/>
		</td>
	</tr>

	<tr>
		<th scope="row"><?php esc_html_e('Secret Key', 'idf'); ?></th>
		<td>
			<input type="text" name="id_recaptcha_secret_key" id="id_recaptcha_secret_key" value="<?php echo esc_attr(isset($recaptcha_settings['id_recaptcha_secret_key']) ? $recaptcha_settings['id_recaptcha_secret_key'] : ''); ?>"/>
		</td>
	</tr>

	<tr>
		<td scope="row">
			<input type="hidden" name="recaptcha_settings_security" value="<?php echo esc_attr( wp_create_nonce('recaptcha-settings-nonce') ); ?>"/>
		</td>
	</tr>

</table>
