<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;?>

<table class="form-table">

	<?php do_action( 'geotr/metaboxes/before_options', $opts );?>

	<tr valign="top">
		<th><label for="geotr_trigger"><?php _e( 'Destination URL', 'geotr' ); ?></label></th>
		<td>
			<input type="text" class="widefat" name="geotr[url]" min="0" value="<?php echo esc_attr($opts['url']); ?>"  />
            <p class="help"><?php _e( 'Enter redirection url.', 'geotr' ); ?></p>
		</td>
	</tr>

	<tr valign="top">
		<th><label for="geotr_trigger"><?php _e( 'One time redirect ?', 'geotr' ); ?></label></th>
		<td>
            <select id="one_time_redirect" name="geotr[one_time_redirect]" class="widefat">
                <option value="0" <?php selected($opts['one_time_redirect'], '0'); ?> > <?php _e( 'No', 'geotr' ); ?></option>
                <option value="0" <?php selected($opts['one_time_redirect'], '1'); ?> > <?php _e( 'Yes', 'geotr' ); ?> (premium)</option>
				<option value="0" <?php selected($opts['one_time_redirect'], '2'); ?> > <?php _e( 'Yes, one per user session', 'geotr' ); ?> (premium)</option>
			</select>
            <p class="help"><?php _e( 'Select if user will be redirected every time, once per browser session or only once in total', 'geotr' ); ?></p>
		</td>
	</tr>

	<tr valign="top">
		<th><label for="geotr_trigger"><?php _e( 'Exclude Search Engines ?', 'geotr' ); ?></label></th>
		<td>
            <select id="exclude_se" name="geotr[exclude_se]" class="widefat">
                <option value="0" <?php selected($opts['exclude_se'], '0'); ?> > <?php _e( 'No', 'geotr' ); ?></option>
                <option value="1" <?php selected($opts['exclude_se'], '1'); ?> > <?php _e( 'Yes', 'geotr' ); ?></option>
			</select>
            <p class="help"><?php _e( 'Exclude bots and crawlers from being redirected', 'geotr' ); ?></p>
		</td>
	</tr>

    <tr valign="top">
		<th><label for="geotr_trigger"><?php _e( 'Redirection code?', 'geotr' ); ?></label></th>
		<td>
			<input type="text"  name="geotr[status]" value="<?php echo esc_attr($opts['status']); ?>" placeholder="302"/>
            <p class="help"><?php _e( 'Add redirection code. Default to 302', 'geotr' ); ?></p>
		</td>
	</tr>
    <tr valign="top">
		<th><label for="geotr_trigger"><?php _e( 'IP Whitelist', 'geotr' ); ?></label></th>
		<td>
			<textarea class="widefat" name="geotr[whitelist]" disabled><?php echo esc_attr($opts['whitelist']); ?></textarea>
            <p class="help"><?php _e( 'Exclude the following IPs from being redirected. Enter one per line', 'geotr' ); ?> (premium)</p>
		</td>
	</tr>
	<?php do_action( 'geotr/metaboxes/after_options', $opts );?>
</table>
<div style="padding: 20px;border: 3px dashed #444444">
<h3 style="text-align: center"><strong>Premium Version</strong> available at <a href="https://geotargetingwp.com/?utm_source=geo_redirects_lite_plugin&utm_medium=banner">https://geotargetingwp.com</a></h3>
	<p><strong>Some of the premium features:</strong></p>
	<ul>
		<li>Redirect based on countries, states or cities</li>
		<li>Create regions/groups of cities or countries for easily targeting</li>
		<li>Exclude bots</li>
		<li>Target devices</li>
		<li>Whitelist by IP</li>
		<li>One time redirection per session or for ever</li>
		<li>Fallback country</li>
		<li>Access to Geotargeting PRO plugin</li>
	</ul>
</div>
<?php wp_nonce_field( 'geotr_options', 'geotr_options_nonce' ); ?>
