| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Optin Forms |
| 4 |
Plugin URI: http://www.codeleon.com/wordpress/plugins/optin-forms |
| 5 |
Description: Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click. |
| 6 |
Author: Codeleon |
| 7 |
Version: 1.1.2 |
| 8 |
Author URI: http://www.codeleon.com |
| 9 |
Text Domain: optinforms |
| 10 |
Domain Path: /languages/ |
| 11 |
License: |
| 12 |
Copyright 2014 codeleon.com |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License, version 2, as |
| 16 |
published by the Free Software Foundation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
*/ |
| 27 |
|
| 28 |
// Add translation to plugin |
| 29 |
function optinforms_init() { |
| 30 |
$plugin_dir = basename(dirname(__FILE__)); |
| 31 |
load_plugin_textdomain( 'optinforms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 32 |
} |
| 33 |
add_action('plugins_loaded', 'optinforms_init'); |
| 34 |
|
| 35 |
// Allow for translation of plugin description |
| 36 |
$plugin_header_translate = array( |
| 37 |
__('Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click.', 'optinforms'), |
| 38 |
); |
| 39 |
|
| 40 |
// Add our menu to WordPress |
| 41 |
add_action( 'admin_menu', 'optinforms_menu' ); |
| 42 |
|
| 43 |
function optinforms_menu() |
| 44 |
{ |
| 45 |
// @since 1.1.2 added a menu position decimal fix to prevent conflict with other themes using 31, such as Thesis Theme |
| 46 |
// @http://gabrielharper.com/blog/2012/08/wordpress-admin-menu-positioning-conflicts/ |
| 47 |
$submenu = add_menu_page(__('Optin Forms','menu-test'), __('Optin Forms','menu-test'), 'manage_options', 'optinforms', 'optinforms_main_page', plugins_url('optin-forms/images/icon.png'), '30.1'); |
| 48 |
|
| 49 |
// * We want our JS and CSS loaded on our admin pages only, so let's just load them for now |
| 50 |
add_action( 'load-' . $submenu, 'load_optinforms_admin_scripts' ); |
| 51 |
} |
| 52 |
|
| 53 |
// Enqueue our CSS and JS on WP Video Coach admin pages only |
| 54 |
function load_optinforms_admin_scripts() { |
| 55 |
add_action( 'admin_enqueue_scripts', 'optinforms_admin_scripts' ); |
| 56 |
} |
| 57 |
|
| 58 |
// Include our registration settings |
| 59 |
include( plugin_dir_path( __FILE__ ) . 'includes/register-settings.php'); |
| 60 |
// Include our regular functions |
| 61 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions.php'); |
| 62 |
// Include our form functions |
| 63 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-form-1.php'); |
| 64 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-form-2.php'); |
| 65 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-form-3.php'); |
| 66 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-form-4.php'); |
| 67 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-form-5.php'); |
| 68 |
include( plugin_dir_path( __FILE__ ) . 'includes/functions-forms.php'); |
| 69 |
|
| 70 |
|
| 71 |
// Add our CSS and JS to admin head, but just for our pages (see load_optinforms_admin_scripts above!) |
| 72 |
function optinforms_admin_scripts() |
| 73 |
{ |
| 74 |
wp_enqueue_style('optinforms-admin-stylesheet', plugins_url('/css/optinforms-admin.css', __FILE__ ), array('googleFont')); |
| 75 |
wp_enqueue_script('tabcontent', plugins_url('/js/tabcontent.js', __FILE__ )); |
| 76 |
wp_enqueue_style('wp-color-picker'); |
| 77 |
wp_enqueue_script('optinforms-color', plugins_url('/js/optinforms-color.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); |
| 78 |
wp_enqueue_script('placeholder', plugins_url('/js/placeholder.js', __FILE__ )); |
| 79 |
wp_enqueue_script('toggle', plugins_url('/js/custom.js', __FILE__ )); |
| 80 |
wp_register_style('googleFont', 'http://fonts.googleapis.com/css?family=Share+Tech|Droid+Sans|Lobster|Fenix|Unkempt|Flavors|Viga|Damion|Oleo+Script|Racing+Sans+One|Nixie+One|Fredoka+One|Open+Sans|Overlock+SC|Bubbler+One|Contrail+One|Gochi+Hand|Roboto+Condensed|Russo+One|Cinzel+Decorative|News+Cycle|Marcellus+SC|Chewy|Quicksand|Sanchez|Signika+Negative|Gloria+Hallelujah|Grand+Hotel|Droid+Serif|Englebert|Oswald|Pacifico|Titan+One|Shadows+Into+Light|Dancing+Script|Luckiest+Guy|Parisienne|Coming+Soon|Baumans|Belgrano'); |
| 81 |
} |
| 82 |
|
| 83 |
// Enqueue our form CSS on front end |
| 84 |
add_action( 'wp_enqueue_scripts', 'optinforms_scripts' ); |
| 85 |
|
| 86 |
|
| 87 |
// Add our CSS and JS to admin head, but just for our pages (see load_optinforms_admin_scripts above!) |
| 88 |
function optinforms_scripts() |
| 89 |
{ |
| 90 |
global $optinforms_form_design; |
| 91 |
wp_enqueue_script('jquery'); |
| 92 |
wp_enqueue_style('optinforms-stylesheet', plugins_url('/css/optinforms.css', __FILE__ ), array('googleFont')); |
| 93 |
wp_enqueue_script('placeholder', plugins_url('/js/placeholder.js', __FILE__ )); |
| 94 |
wp_register_style('googleFont', optinforms_used_fonts()); |
| 95 |
} |
| 96 |
|
| 97 |
// Make sure user can manage options |
| 98 |
function optinforms_options() { |
| 99 |
if ( !current_user_can( 'manage_options' ) ) { |
| 100 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
| 101 |
} |
| 102 |
?> |
| 103 |
|
| 104 |
<?php } |
| 105 |
function optinforms_main_page() { |
| 106 |
|
| 107 |
{ ?> |
| 108 |
<div class="wrap"> |
| 109 |
<div id="icon-optinforms" class="icon32"> |
| 110 |
</div><!--icon-32--> |
| 111 |
<h2 class="title"><?php echo optinforms_menu_tabs(); ?></h2> |
| 112 |
</div><!--wrap--> |
| 113 |
|
| 114 |
<?php echo optinforms_configuration(); ?> |
| 115 |
|
| 116 |
<?php if( isset($_GET['settings-updated']) ) { ?> |
| 117 |
<div id="message" class="updated"> |
| 118 |
<p><strong><?php _e('Settings updated') ?></strong> - <?php echo __('If you enjoy our plugin, why not tweet about it?', 'optinforms'); ?> <a href="https://twitter.com/intent/tweet?original_referer=http://www.codeleon.com/wordpress/plugins/optin-forms/&related=codeleoncom&text=Create%20Beautiful%20Optin%20Forms%20in%20WordPress%20with%20This%20FREE%20Plugin:&url=http://www.codeleon.com/wordpress/plugins/optin-forms" target="_blank"><?php echo __('Share on Twitter', 'optinforms'); ?></a></p> |
| 119 |
</div> |
| 120 |
<?php } ?> |
| 121 |
|
| 122 |
<div id="optinforms"> |
| 123 |
<form method="post" action="options.php" id="frm1"> |
| 124 |
<?php settings_fields( 'optinforms-settings-group' ); ?> |
| 125 |
|
| 126 |
<div id="optinforms-email-solution-tab" class="tabcontent"> |
| 127 |
<div class="optinforms-container-left"> |
| 128 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-email-solution.php'); ?> |
| 129 |
</div><!--optinforms-container-left--> |
| 130 |
<div class="optinforms-container-right"> |
| 131 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/sidebar.php'); ?> |
| 132 |
</div><!--optinforms-container-right--> |
| 133 |
<div class="clear"></div> |
| 134 |
</div><!--optinforms-email-solution-tab--> |
| 135 |
|
| 136 |
<div id="optinforms-posts-tab" class="tabcontent"> |
| 137 |
<div class="optinforms-container-left"> |
| 138 |
<div class="optiongroup"> |
| 139 |
<p><?php echo __('Add a beautiful optin form to your posts, custom post types and pages. Include the form on your website with a simple mouse-click, or use the shortcode to add it to specific posts and pages.', 'optinforms'); ?></p> |
| 140 |
<div class="optionleft"> |
| 141 |
<label for="optinforms_form_design" class="nopointer"><?php echo __('Form design', 'optinforms'); ?></label> |
| 142 |
</div><!--optionleft--> |
| 143 |
<div class="optionmiddle"> |
| 144 |
<select name="optinforms_form_design" id="optinforms_form_design"> |
| 145 |
<option value="optinforms_form_design_option1" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option1') echo 'selected="selected"'; ?>>01</option> |
| 146 |
<option value="optinforms_form_design_option2" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option2') echo 'selected="selected"'; ?>>02</option> |
| 147 |
<option value="optinforms_form_design_option3" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option3') echo 'selected="selected"'; ?>>03</option> |
| 148 |
<option value="optinforms_form_design_option4" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option4') echo 'selected="selected"'; ?>>04</option> |
| 149 |
<option value="optinforms_form_design_option5" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option5') echo 'selected="selected"'; ?>>05</option> |
| 150 |
</select> |
| 151 |
<script type="text/javascript"> |
| 152 |
document.getElementById('optinforms_form_design').onchange = function() { |
| 153 |
var i = 1; |
| 154 |
var myDiv = document.getElementById("optinforms_form_design_option" + i); |
| 155 |
while(myDiv) { |
| 156 |
myDiv.style.display = 'none'; |
| 157 |
myDiv = document.getElementById("optinforms_form_design_option" + ++i); |
| 158 |
} |
| 159 |
document.getElementById(this.value).style.display = 'block'; |
| 160 |
}; |
| 161 |
</script> |
| 162 |
</div><!--optionmiddle--> |
| 163 |
<div class="optionlast"> |
| 164 |
|
| 165 |
</div><!--optionlast--> |
| 166 |
<div class="clear"></div> |
| 167 |
|
| 168 |
</div><!--optiongroup--> |
| 169 |
|
| 170 |
<div class="optiongroup"> |
| 171 |
<div id="optinforms_form_design_option1" <?php if (get_option('optinforms_form_design')== '' || get_option('optinforms_form_design')== 'optinforms_form_design_option1') echo 'style="display:block;"'; ?>> |
| 172 |
|
| 173 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/preview-form-1.php'); ?> |
| 174 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-1.php'); ?> |
| 175 |
|
| 176 |
</div><!--optinforms_form_design_option1--> |
| 177 |
<div id="optinforms_form_design_option2" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option2') echo 'style="display:block;"'; ?>> |
| 178 |
|
| 179 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/preview-form-2.php'); ?> |
| 180 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-2.php'); ?> |
| 181 |
|
| 182 |
</div><!--optinforms_form_design_option2--> |
| 183 |
<div id="optinforms_form_design_option3" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option3') echo 'style="display:block;"'; ?>> |
| 184 |
|
| 185 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/preview-form-3.php'); ?> |
| 186 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-3.php'); ?> |
| 187 |
|
| 188 |
</div><!--optinforms_form_design_option3--> |
| 189 |
<div id="optinforms_form_design_option4" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option4') echo 'style="display:block;"'; ?>> |
| 190 |
|
| 191 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/preview-form-4.php'); ?> |
| 192 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-4.php'); ?> |
| 193 |
|
| 194 |
</div><!--optinforms_form_design_option4--> |
| 195 |
<div id="optinforms_form_design_option5" <?php if (get_option('optinforms_form_design')== 'optinforms_form_design_option5') echo 'style="display:block;"'; ?>> |
| 196 |
|
| 197 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/preview-form-5.php'); ?> |
| 198 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-5.php'); ?> |
| 199 |
|
| 200 |
</div><!--optinforms_form_design_option5--> |
| 201 |
</div><!--optiongroup--> |
| 202 |
|
| 203 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-functionality.php'); ?> |
| 204 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/options-form-placement.php'); ?> |
| 205 |
|
| 206 |
</div><!--optinforms-container-left--> |
| 207 |
<div class="optinforms-container-right"> |
| 208 |
<?php include( plugin_dir_path( __FILE__ ) . 'includes/sidebar.php'); ?> |
| 209 |
</div><!--optinforms-container-right--> |
| 210 |
<div class="clear"></div> |
| 211 |
</div><!--optinforms-posts-tab--> |
| 212 |
|
| 213 |
<script type="text/javascript"> |
| 214 |
var wpthumbs=new ddtabcontent("optinforms-menu-tabs") //enter ID of Tab Container |
| 215 |
wpthumbs.setpersist(true) //toogle persistence of the tabs' state |
| 216 |
wpthumbs.setselectedClassTarget("link") //"link" or "linkparent" |
| 217 |
wpthumbs.init() |
| 218 |
</script> |
| 219 |
|
| 220 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> |
| 221 |
</form> |
| 222 |
|
| 223 |
<div id="emailbox"> |
| 224 |
<form method="post" action="http://www.codeleon.com/send/form.php?form=5" id="frmSS5"> |
| 225 |
<h3><?php echo __('Sign up to receive news about the plugin and other WordPress news', 'optinforms'); ?></h3> |
| 226 |
<span><?php echo __('My email is', 'optinforms'); ?></span> |
| 227 |
<input type="text" name="email" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->user_email; ?>" /> |
| 228 |
<span><?php echo __('and my name is', 'optinforms'); ?></span> |
| 229 |
<input type="text" name="CustomFields[1]" id="CustomFields_1_5" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->display_name; ?>"> |
| 230 |
<input type="hidden" name="format" value="h" /> |
| 231 |
<input type="submit" class="emailbox-subscribe" value="<?php echo __('Subscribe', 'optinforms'); ?>" /> |
| 232 |
</form> |
| 233 |
</div><!--emailbox--> |
| 234 |
</div><!--optinforms--> |
| 235 |
|
| 236 |
<?php } |
| 237 |
|
| 238 |
|
| 239 |
} ?> |