<?php

/*
    Template Name: Squeeze Page
*/

/*
sqz_meta_title
sqz_meta_description
sqz_meta_keywords
sqz_lead_text
sqz_hd_bold_text
sqz_hd_red_text
sqz_highlight_text
sqz_icontact_id
sqz_aweber_id
sqz_list_type
*/

remove_filter ('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

//Get URL of most recent post
if (have_posts()) :
query_posts("showposts=1");
while (have_posts()) : the_post();
	$return_url =  get_permalink();
endwhile;
else: 
	$return_url = bloginfo('url');
endif;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title><?= htmlspecialchars(get_option('sqz_meta_title')); ?></title>
<meta name="Description" content="<?= htmlspecialchars(get_option('sqz_meta_description')); ?>" />
<meta name="Keywords" content="putting tip, golf putting tips, golf swing tips, golf tips" />

<link rel="stylesheet" type="text/css" href="<? bloginfo('template_url'); ?>/squeeze_page/reset.css" />
<link rel="stylesheet" type="text/css" href="<? bloginfo('template_url'); ?>/squeeze_page/style.css" />

</head>

<body>
<div id="wrapper">
    <div id="contentWrap">
        <div id="contentTop"> </div>
        <!-- /Content Top-->
        <div id="content">
            <h2 class="subheadline"><span class="strong red">Attention:</span> <?= htmlspecialchars(get_option('sqz_highlight_text')); ?></h2>
            <div class="line"></div>

            <br />
            <h1><span class="red"><?= htmlspecialchars(get_option('sqz_hd_red_text')); ?></span> <br />
			&ldquo;<?= htmlspecialchars(get_option('sqz_hd_bold_text')); ?>&rdquo;</h1>
            <div class="line"></div>
            <br />
            <h3 style="width: 550px; margin: 10px auto;"><?= htmlspecialchars(get_option('sqz_lead_text')); ?></h3>


            <div id="form">
                <h3>&ldquo;<?= htmlspecialchars(get_option('sqz_meta_title')); ?>&rdquo;</h3>
                <h5>Enter your email address in the form below<br />
                    and you'll receive free instant access</h5>



<? if(get_option('sqz_list_type') == 'aweber'): ?>

	<form action="http://www.aweber.com/scripts/addlead.pl" method="post">
	<div class="info-wrap">
	<label class="hide">Email Address:</label>
	<input type=text name="email" value="Email Address" onclick="if(this.value=='Email Address') this.value=''" class="txt-field">
	</div>

	<input type="hidden" value="<?= htmlspecialchars(get_option('sqz_aweber_id')); ?>" name="listname" />
	<input type="hidden" value="<?= $return_url; ?>" name="redirect" />
	<input type="hidden" value="<?= $return_url; ?>" name="meta_redirect_onlist" />
	<input type="hidden" name="meta_adtracking" value="capture">
	<input type="hidden" value="1" name="meta_message" />
	<input type="hidden" value="email" name="meta_required" />
	<input type="hidden" value="0" name="meta_forward_vars" />
	<div class="button-wrap">
		<button type="submit" value="Submit" id="submit" name="cmdSubmit" class="link button"><span>Get Instant Access</span></button>
	</div>

	</form>

<? else: ?>

	<form method=post action="https://app.icontact.com/icp/signup.php">
		<div class="info-wrap">
		<label class="hide">Email Address:</label>
		<input type=text name="fields_email" value="Email Address" onclick="if(this.value=='Email Address') this.value=''" class="txt-field">
		</div>

		<input type=hidden name=redirect value="<?= $return_url; ?>" />
		<input type=hidden name=errorredirect value="<?= $return_url; ?>?error&msg=" />
<?
		// parse icontact form to get important inputs
		$icontact_form = get_option('sqz_icontact_form');
		$sniff_fields = array('listid', 'clientid', 'formid', 'reallistid', 'doubleopt');
		if(preg_match_all('/<input?.*?name=(.*)[\s]+.*value="(.*)".*>/imU', $icontact_form, $matches)){
			unset($matches[0]);
			foreach($matches[1] as $value => $name){
				$field_name = preg_replace('/[^A-Za-z0-9-_ :]/', '', $name);
				$field_value = preg_replace('/[^A-Za-z0-9-_ :]/', '_', $matches[2][$value]);

				if(in_array($field_name, $sniff_fields) || substr($field_name, 0, 9) == 'specialid'){
					echo '<input type="hidden" name="' . $field_name . '" value="' . $field_value . '" />';
				}

			}
		}
?>
		<div class="button-wrap">
			<button type="submit" value="Submit" id="submit" name="cmdSubmit" class="link button"><span>Get Instant Access</span></button>
		</div>
	</form>

<? endif; ?>


            </div>
            <!-- /Form -->
            <div class="line"></div>
            <p class="note">Double-check your email for accuracy to ensure you receive access to the information. Our privacy policy keeps your email safe &amp; secure.</p>

        </div>
        <!-- /Content -->
        <div id="contentBtm"></div>
    </div>
    <!-- /Content Wrap -->
    <div id="footer">
        <p>
        
        <A href="mailto:<?= bloginfo('admin_email'); ?>">Contact us</A> | <A href="/articles/">Blog</A>
        
        <br />
            &copy; <?= date('Y'); ?>. <?= $_SERVER['SERVER_NAME']; ?> is a registered trademark of puttingtip.net. All other marks are the property of their respective owners.<br />
            All rights reserved. Unauthorized duplication or publication of any materials from this site is expressly prohibited.<br />
        </p>
    </div>
    <!-- /Footer -->
</div>
<!-- /Wrapper -->

</body>
</html>