<?php
/*
License: Copyright 2010 Daniel Watrous, All Rights Reserved (see README.txt in the plugin directory)
*/

// Actual function that handles the settings sub-page
function myplugin_menu() {
   ?>
	<link rel="stylesheet" href="<?php echo get_plugin_url() ?>/style.css" type="text/css" />
	<script type="text/javascript" src="<?php echo get_plugin_url() ?>/optincrusher.js"></script>
	<script type="text/javascript" src="<?php echo get_plugin_url() ?>/jscolor/jscolor.js"></script>

	<div class="wrap" style="width: 700px;">
		<img src="<?php echo get_plugin_url() ?>/images/optincrusher-logo.png" style="padding-top: 15px;">

		<p>optincrusher is designed to get attention without getting in the way.  When someone visits your site, the optin footer slides up from the bottom, which gets their attention, but doesn't interrupt their reading.  There are a lot of details that you can configure below.</p>
		
		<p>
			This plugin has been tested and is <strong>100% compatible</strong> with recent versions of the following browsers: <br />
			<img src="<?php echo get_plugin_url() ?>/images/internet-explorer.gif">
			<img src="<?php echo get_plugin_url() ?>/images/firefox.gif">
			<img src="<?php echo get_plugin_url() ?>/images/safari.gif">
			<img src="<?php echo get_plugin_url() ?>/images/google-chrome.gif">
			<img src="<?php echo get_plugin_url() ?>/images/opera.gif">
		</p>

		<p>
			optincrusher has been tested with for the following email services, and should generally work with all service providers that produce an HTML webform that you can paste on your website.: <br />
			<a target="blank" style="border: none;" href="http://www.danielwatrous.com/aweber"><img src="<?php echo get_plugin_url() ?>/images/service-tested-aweber.gif" width="100" style="padding: 2px;"></a>
			<a target="blank" style="border: none;" href="http://danielwatrous.icontact.com/"><img src="<?php echo get_plugin_url() ?>/images/service-tested-iContact.png" width="100" style="padding: 2px;"></a>
			<a target="blank" style="border: none;" href="http://www.danielwatrous.com/constantcontact"><img src="<?php echo get_plugin_url() ?>/images/service-tested-constantcontact.gif" width="100" style="padding: 2px;"></a>
			<a target="blank" style="border: none;" href="http://www.danielwatrous.com/feedburner"><img src="<?php echo get_plugin_url() ?>/images/service-tested-feedburner.png" width="100" style="padding: 2px;"></a>
			<a target="blank" style="border: none;" href="http://www.danielwatrous.com/getresponse"><img src="<?php echo get_plugin_url() ?>/images/service-tested-getresponse.png" width="100" style="padding: 2px;"></a>
			<a target="blank" style="border: none;" href="http://www.danielwatrous.com/mailchimp"><img src="<?php echo get_plugin_url() ?>/images/service-tested-mailchimp.png" width="100" style="padding: 2px;"></a>
		</p>

		<p><STRONG>Do you need HELP!</STRONG>  I created a collection of High Definition (HD) videos that literally walk you through all of the options below. You can view them on the plugin website.  <a target="_blank" href="http://optincrusher.com/">Go there now.</a></p>

		<h2>Share optincrusher</h2>
		<p>
			<a name="fb_share" type="button" share_url="http://www.danielwatrous.com/optin-footer-plugin" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br /><br />
			<a target="_blank" href="http://twitter.com/home?status=I just downloaded this Free email list building software for WordPress: http://bit.ly/optincrusher" title="Click to share this post on Twitter"><img src="http://www.danielwatrous.com/wp-content/uploads/2010/07/twitter_share.png" alt="Share on Twitter"></a>
		</p>

      <?php
         /* These three items below must stay if you want to be able to easily save
            data in your settings pages. */
      ?>
      <form name="optincrushersettings" method="post" action="options.php">
      <?php wp_nonce_field('update-options'); ?>
      <input type="hidden" name="action" value="update" />

      <?php
        /* You need to add each field in this area (separated by commas) that you want to update
           every time you click "Save"
        */
      ?>
      <input type="hidden" name="page_options" value="optincrusher_displayDelay,optincrusher_slidespeed,optincrusher_slidestep,optincrusher_thumbnail,optincrusher_calltoaction,optincrusher_xrunner,optincrusher_pitchfontcolor,optincrusher_optinfontcolor,optincrusher_showforadmin,optincrusher_titleonhover,optincrusher_pitchfontfamily,optincrusher_pitchfontsize,optincrusher_pitchfontweight,optincrusher_optinfontfamily,optincrusher_optinfontsize,optincrusher_optinfontweight,optincrusher_pitchtopoffset,optincrusher_pitchleftoffset,optincrusher_lightboxmessage,optincrusher_attribution,optincrusher_lightboxbgcolor,optincrusher_remembershowhidestate,optincrusher_processedoptinform,optincrusher_excludepages,optincrusher_hidesubscribers" />

	<!-- ****************************************************** -->
	<fieldset>
	<legend>General settings</legend>

		<?php
        /*
		<label>Enable plugin for Apple mobile products:</label> <?php optincrusher_radio("optincrusher_iphoneenabled", array("Enable"=>'enable', "Disable"=>'disable'), 'enable'); ?><br />
		<small>This is a limited version due to limited realestate on the iPhone/iPod/iPad. No optin form shown.</small>
		<br />
		*/
		?>

		<label>Show when logged in:</label> <?php optincrusher_radio("optincrusher_showforadmin", array("Yes"=>1, "No"=>0), 0); ?><br />
		<small>Select no here so that you won't see the footer or skew statistics about views</small>
		<br />

		<label>Remember Show/Hide state:</label> <?php optincrusher_radio("optincrusher_remembershowhidestate", array("Yes"=>'true', "No"=>'false'), 'false'); ?><br />
		<small>If checked, this will remember whether the user has hidden the optin bar and will show just the special offer button. You'll probably get more optins with this set to No.</small>
		<br />

		<label>Exclude post/page:</label> <?php optincrusher_textbox("optincrusher_excludepages", "", 45); ?><br />
		<small>Provide a comma separated list of post/page ID. These posts/pages will not show the optincrusher.</small>
		<br />
		
		<label>Hide from subscribed visitors:</label> <?php optincrusher_radio("optincrusher_hidesubscribers", array("Yes"=>1, "No"=>0), 0); ?><br />
		<small>Select yes here to hide optincrusher from visitors that have already subscribed. NOTE: You must use the shortcode below on your thank you page. <?php if (isset($_COOKIE['oc_subscribed'])) {?><a href="#" style="color: red;" onclick="delCookie('oc_subscribed'); window.location.reload(); return false;">Reset Subscribed Cookie</a><?php } ?></small>
		<br />

		<label>Thank you page shortcode:</label> <input type="text" size="50" onClick="select()" readonly value="[optincrusher_thankyou]" /><br />
		<small>Paste the above code, exactly as it appears in the field, into your thank you page. This will enable your site to remember subscribers.</small>
		<br />
		
		<!--<label>Hover text:</label> <?php optincrusher_textbox("optincrusher_titleonhover", "Sign up on my list", 45); ?>
		<small>This text appears when the user places the mouse cursor over the footer</small>
		<br />-->
	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	<!-- ****************************************************** -->
	<fieldset>
	<legend>Optin animation settings</legend>

		<?php
		/* Now add each of those items below as a text box, checkbox, dropdown etc */
		?>
		<label>Delay before showing optin:</label> <?php optincrusher_textbox("optincrusher_displayDelay", 2500); ?>
		<small>In milliseconds.  That means for 2 seconds you would enter 2000 here.</small>

		<label>Speed to slide:</label> <?php optincrusher_textbox("optincrusher_slidespeed", 25); ?>
		<small>Average 25, lower=faster</small>

		<label>Slide step percent:</label> <?php optincrusher_textbox("optincrusher_slidestep", 10); ?>
		<small>Average 10, lower=faster</small>
	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	<!-- ****************************************************** -->
	<fieldset style="width: 740px; background-color: #dddddd;">
	<legend style="background-color: #F9F9F9; padding: 0px 3px 2px 3px; border: 1px solid black;">Optin appearance settings</legend>

		<a target="blank" href="http://www.danielwatrous.com/optincrusher-installation-and-customization-webcast"><strong>Watch a video recording of a webcast that will show you how to create and integrate your own custom icon that matches your site and brand.</strong></a><br />
      <div>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-audio-podcast.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-audio-podcast.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-ebook.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-ebook.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-report.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-report.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-software-01.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-software-01.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-software-02.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-software-02.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-training.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-training.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-special-offer.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-special-offer.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-free-video.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-free-video.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-newsletter.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-newsletter.png" width="360" height="92"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_thumbnail.value='<?php echo get_plugin_url()."/images/thumbnail-early-bird.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/thumbnail-early-bird.png" width="360" height="92"></a>
      </div>

      <label>Path to optin thumbnail (360x92): </label>
         <?php optincrusher_textbox("optincrusher_thumbnail", get_plugin_url()."/images/thumbnail-newsletter.png", 80); ?>
      <small>This is an image with dimensions 360x92 which appears on the left before the form</small>
      <br />

      <div>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-blue.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-blue.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-blue-light.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-blue-light.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-brown.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-brown.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-gray.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-gray.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-green.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-green.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-duo-lavender.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-duo-lavender.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-black-red.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-black-red.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-blue.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-blue.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-blue-dark.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-blue-dark.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-blue-pale.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-blue-pale.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-brown.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-brown.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-gray.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-gray.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-green.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-green.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-orange.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-orange.png" width="60" height="68"></a>
         <a href="" onclick="document.optincrushersettings.optincrusher_xrunner.value='<?php echo get_plugin_url()."/images/x-runner-simple-red.png" ?>'; return false;" title="Click to select" alt="Click to select"><img src="<?php echo get_plugin_url() ?>/images/x-runner-simple-red.png" width="60" height="68"></a>
      </div>

      <label>Footer Background: </label>
         <?php optincrusher_textbox("optincrusher_xrunner", get_plugin_url()."/images/x-runner-duo-blue.png", 80); ?>
      <small>This is an image with the dimensions 1x68 which is repeated across the bottom of the page</small>
      <br />
	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	<!-- ****************************************************** -->
	<fieldset>
	<legend>Optin/Lightbox Message settings</legend>

		<label>Optin call to action: <br></label>
		<?php optincrusher_textbox("optincrusher_calltoaction", "Sign up below to join my eNewsletter", 80); ?>
		<br />

		<label>Optin lightbox message: <br></label>
		<?php optincrusher_textarea("optincrusher_lightboxmessage", "Sales pitch to optin to your list"); ?>
		<small>This is the long'er' form message that will be shown if they click the lightbox.  Provide key benefits here.  HTML accepted.</small>

		<label>Font family: <br></label>
		<?php optincrusher_dropdown("optincrusher_pitchfontfamily", array("Arial","Arial Black","Arial Narrow","Courier New","Georgia","Times New Roman","Trebuchet","Verdana"), "Arial"); ?>
		<br />

		<label>Font size (default 22px):</label> <?php optincrusher_textbox("optincrusher_pitchfontsize", "22px"); ?>
		<br />

		<label>Font weight: </label>
		<?php optincrusher_radio("optincrusher_pitchfontweight", array("Bold"=>'bold', "Normal"=>'normal'), 'bold'); ?>
		<br />

		<label>Vertical offset in pixels (+/-): </label>
		<?php optincrusher_textbox("optincrusher_pitchtopoffset", 0); ?>
		<br />

		<label>Horixontal offset in pixels (+/-): </label>
		<?php optincrusher_textbox("optincrusher_pitchleftoffset", 0); ?>
		<br />

		<label>Call to action font color:</label><?php optincrusher_colorpickertextbox("optincrusher_pitchfontcolor", "000000"); ?>
		<small><strong>Click in field to choose color</strong></small>

		<label>Lightbox background color:</label><?php optincrusher_colorpickertextbox("optincrusher_lightboxbgcolor", "FFFFFF"); ?>
		<small><strong>Click in field to choose color</strong></small>
		<br />
	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	<!-- ****************************************************** -->
	<fieldset>
	<legend>Optin form details</legend>
		<p>This step requires you to get the HTML form code from your email service provider. Once you have that, just paste it into the top large box below and click the green button. After that you should usually be able to just click Update Settings and be done.</p>
		<br />

		<label>Font family: </label>
		 <?php optincrusher_dropdown("optincrusher_optinfontfamily", array("Arial","Arial Black","Arial Narrow","Courier New","Georgia","Times New Roman","Trebuchet","Verdana"), "Arial"); ?>
		<br />

		<label>Font size (default 16px): </label>
		 <?php optincrusher_textbox("optincrusher_optinfontsize", "16px"); ?>
		<br />

		<label>Font weight: </label>
		 <?php optincrusher_radio("optincrusher_optinfontweight", array("Bold"=>'bold', "Normal"=>'normal'), 'bold'); ?>
		<br />

		<label>Font color: </label>
		<?php optincrusher_colorpickertextbox("optincrusher_optinfontcolor", "000000"); ?>
		<small><strong>Click in field to choose color</strong></small>

		<label>Paste your optin form here: <br></label>
		<?php optincrusher_textarea("optincrusher_rawhtmloptinform", ""); ?>
		<small>Your email service provider will generate this HTML code for you to place on your website. Make sure this isn't the javascript version, but the full or raw HTML version of the optin form.</small>
		
		<small><div id="process_button" style="height: 42px;"><a href="" onclick="processForm(); return false;"><img src="<?php echo get_plugin_url() ?>/images/process_form.png" style="border: 0px;"></a></div></small>

		<label>Processed optin form: <br></label>
		<?php optincrusher_textarea("optincrusher_processedoptinform", ""); ?>
		<small>This is the resulting form that will be placed in your footer. It is generated by placing your email service provider's HTML in the form above and clicking Process Form.</small>

	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	<!-- ****************************************************** -->
	<fieldset>
	<legend>Attribution</legend>

		<label>Show attribution link:</label> <?php optincrusher_radio("optincrusher_attribution", array("Yes"=>'true', "No"=>'false'), 'true'); ?><br />
		<small>When enabled, a small link is shown in the footer of your blog telling others where they can get this software. If you disable this, please consider writing a review or placing a link elsewhere.</small>
		<br />

	</fieldset>
	<input type="submit" class="button" value="Update All Settings" style="font-weight: bold;" />
	<br /><br />

	</div>


   <?php
}


?>