Easy Forms for MailChimp - Version 6.4.6

Version Description

  • September 10th, 2018 =
  • Added the ability to re-subscribe to a list via an integration checkbox. Previously, users who were unsubscribed or pending confirmation were unable to re-subscribe. This only works when using the [default] double opt-in method.
  • Added a check for reCAPTCHA/GDPR Compliance for MailChimp when calculating inline styles. If you have the reCAPTCHA or GDPR Compliance for MailChimp plugin active, then the submit button will become full width, drop below these items, and the fields will take up 100% of the width. A similar conversion occurs when the screen size is below 768px regardless of the reCAPTCHA or GDPR Compliance for MailChimp plugin being active.
  • Changed the calculation and rounding of form conversion statistics to be slightly more accurate.
  • Cleaned up duplicate IDs in hidden HTML elements when multiple forms were on the same page.
Download this release

Release Info

Developer yikesitskevin
Plugin Icon 128x128 Easy Forms for MailChimp
Version 6.4.6
Comparing to
See all releases

Code changes from version 6.4.5 to 6.4.6

admin/partials/menu/manage-forms.php CHANGED
@@ -185,7 +185,7 @@ if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) {
185
  <td class="column-columnname num stat-container">
186
  <?php
187
  if( $impressions != 0 ) {
188
- $conversion_rate = ( round( $form['submissions'] / $form['impressions'] , 2 ) * 100 );
189
  if( $conversion_rate >= '15' ) {
190
  $conversion_color = '#00cc00'; // green (unicorn!)
191
  } else if( $conversion_rate < '15' && $conversion_rate >= '10' ) {
185
  <td class="column-columnname num stat-container">
186
  <?php
187
  if( $impressions != 0 ) {
188
+ $conversion_rate = ( round( 100 * $form['submissions'] / $form['impressions'] , 3 ) );
189
  if( $conversion_rate >= '15' ) {
190
  $conversion_color = '#00cc00'; // green (unicorn!)
191
  } else if( $conversion_rate < '15' && $conversion_rate >= '10' ) {
admin/partials/menu/options-sections/recaptcha-settings.php CHANGED
@@ -29,7 +29,7 @@
29
  <?php settings_fields( 'yikes_inc_easy_mc_recaptcha_settings_page' ); ?>
30
 
31
  <label for="yikes-mc-recaptcha-setting">
32
- <input type="checkbox" name="yikes-mc-recaptcha-status" class="recaptcha-setting-checkbox" value="1" <?php checked( get_option( 'yikes-mc-recaptcha-status', '' ) , '1' ); ?>>
33
  <strong><?php _e( 'Enable reCAPTCHA Protection', 'yikes-inc-easy-mailchimp-extender' ); ?></strong>
34
  </label>
35
 
29
  <?php settings_fields( 'yikes_inc_easy_mc_recaptcha_settings_page' ); ?>
30
 
31
  <label for="yikes-mc-recaptcha-setting">
32
+ <input type="checkbox" id="yikes-mc-recaptcha-setting" name="yikes-mc-recaptcha-status" class="recaptcha-setting-checkbox" value="1" <?php checked( get_option( 'yikes-mc-recaptcha-status', '' ) , '1' ); ?>>
33
  <strong><?php _e( 'Enable reCAPTCHA Protection', 'yikes-inc-easy-mailchimp-extender' ); ?></strong>
34
  </label>
35
 
changelog.txt CHANGED
@@ -1,5 +1,11 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
3
  = 6.4.5 - July 25th, 2018 =
4
  * Fixed an issue where subscriptions would not be processed if only an email field was sent. Shoutout to Kamil (@paszczak000) for reporting this issue and working with us to resolve it, thank you!
5
 
1
  == Changelog ==
2
 
3
+ = 6.4.6 - September 10th, 2018 =
4
+ * Added the ability to re-subscribe to a list via an integration checkbox. Previously, users who were unsubscribed or pending confirmation were unable to re-subscribe. This only works when using the [default] double opt-in method.
5
+ * Added a check for reCAPTCHA/[GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) when calculating inline styles. If you have the reCAPTCHA or [GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) plugin active, then the submit button will become full width, drop below these items, and the fields will take up 100% of the width. A similar conversion occurs when the screen size is below 768px regardless of the reCAPTCHA or [GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) plugin being active.
6
+ * Changed the calculation and rounding of form conversion statistics to be slightly more accurate.
7
+ * Cleaned up duplicate IDs in hidden HTML elements when multiple forms were on the same page.
8
+
9
  = 6.4.5 - July 25th, 2018 =
10
  * Fixed an issue where subscriptions would not be processed if only an email field was sent. Shoutout to Kamil (@paszczak000) for reporting this issue and working with us to resolve it, thank you!
11
 
public/classes/checkbox-integrations.php CHANGED
@@ -177,6 +177,7 @@
177
  'email_address' => sanitize_email( $email ),
178
  'merge_fields' => apply_filters( 'yikes-mailchimp-checkbox-integration-merge-variables', $merge_vars, $type ),
179
  'status_if_new' => 'pending',
 
180
  'timestamp_signup' => (string) current_time( 'timestamp', true ),
181
  'ip_signup' => $user_ip,
182
  );
177
  'email_address' => sanitize_email( $email ),
178
  'merge_fields' => apply_filters( 'yikes-mailchimp-checkbox-integration-merge-variables', $merge_vars, $type ),
179
  'status_if_new' => 'pending',
180
+ 'status' => 'pending',
181
  'timestamp_signup' => (string) current_time( 'timestamp', true ),
182
  'ip_signup' => $user_ip,
183
  );
public/classes/process/class.process_form_submission_handler.php CHANGED
@@ -239,7 +239,6 @@ class Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler {
239
  // Define our hardcoded fields
240
  $this->skipped_form_fields = array(
241
  'yikes_easy_mc_new_subscriber' => 1,
242
- '_wp_http_referer' => 1,
243
  );
244
 
245
  // Define our error messages
239
  // Define our hardcoded fields
240
  $this->skipped_form_fields = array(
241
  'yikes_easy_mc_new_subscriber' => 1,
 
242
  );
243
 
244
  // Define our error messages
public/js/yikes-mc-ajax-forms.js CHANGED
@@ -153,7 +153,7 @@ window.Yikes_Mailchimp_Ajax = window.Yikes_Mailchimp_Ajax || {};
153
  }
154
 
155
  /* clear the inputs - but don't clear submit button, radio, select, list_id, or form */
156
- submitted_form.find( 'input' ).not( '.yikes-easy-mc-submit-button, input[type="radio"], input[type="select"], input[type="checkbox"], #yikes-mailchimp-associated-list-id, #yikes-mailchimp-submitted-form' ).val( '' );
157
  /* ajax to increase submission count by 1 */
158
  var new_data = {
159
  'action' : 'increase_submission_count',
153
  }
154
 
155
  /* clear the inputs - but don't clear submit button, radio, select, list_id, or form */
156
+ submitted_form.find( 'input' ).not( '.yikes-easy-mc-submit-button, input[type="radio"], input[type="select"], input[type="checkbox"], input[name="yikes-mailchimp-associated-list-id"], input[name="yikes-mailchimp-submitted-form"]' ).val( '' );
157
  /* ajax to increase submission count by 1 */
158
  var new_data = {
159
  'action' : 'increase_submission_count',
public/js/yikes-mc-ajax-forms.min.js CHANGED
@@ -1 +1 @@
1
- window.Yikes_Mailchimp_Ajax=window.Yikes_Mailchimp_Ajax||{},function(e,i,m,u,s){"use strict";u.l10n=e.yikes_mailchimp_ajax||{},m(i).ready(function(){m("body").on("submit",".yikes-easy-mc-form",function(){var l=m(this);l.addClass("yikes-mc-submitted-form-loading"),l.find("input, label, button").not(":hidden").fadeTo("fast",.5),"string"==typeof u.l10n.preloader_url&&1<u.l10n.preloader_url.length&&l.append('<img src="'+u.l10n.preloader_url+'" class="yikes-mailchimp-preloader" />'),m(".yikes-mc-required-field-not-filled").removeClass("yikes-mc-required-field-not-filled"),m(".yikes-mailchimp-submit-button-span-text").hide(),"string"==typeof u.l10n.loading_dots&&1<u.l10n.loading_dots.length&&l.find(".yikes-easy-mc-submit-button").append('<img src="'+u.l10n.loading_dots+'" class="loading-dots yikes-mc-loading-dots" />');var c=l.attr("data-attr-form-id"),i=[];if(0<l.find(".yikes-interest-group-required").length&&l.find(".yikes-interest-group-required").each(function(){var e=jQuery(this).attr("name").replace("[]","");0==l.find('input[name="'+e+'[]"]:checked').length&&(i[e]=l.find("span."+e+"-label").text())}),0<i.length){if(0<l.find(".yikes-mailchimp-required-interest-group-error").length)l.find(".yikes-mailchimp-required-interest-group-error").fadeOut("fast",function(){for(var e in l.find(".yikes-mailchimp-required-interest-group-error").remove(),i)l.find("span."+e+"-label").after('<p class="yikes-mailchimp-required-interest-group-error">'+u.l10n.interest_group_checkbox_error+"</p>")});else for(var e in i)l.find("span."+e+"-label").after('<p class="yikes-mailchimp-required-interest-group-error">'+u.l10n.interest_group_checkbox_error+"</p>");return l.find(".yikes-easy-mc-submit-button").removeAttr("disabled","disabled"),l.find("input, label, button").not(":hidden").fadeTo("fast",1),l.find(".yikes-mailchimp-preloader").remove(),m(".yikes-mc-loading-dots").remove(),m(".yikes-mailchimp-submit-button-span-text").show(),l.removeClass("yikes-mc-submitted-form-loading"),!1}l.find(".yikes-easy-mc-submit-button").attr("disabled","disabled"),m(".yikes-easy-mc-error-message").remove(),m(".yikes-easy-mc-success-message").remove();var s={action:"process_form_submission",form_data:l.serialize(),form_id:c,page_data:u.l10n.page_data,ajax_security_nonce:u.l10n.ajax_security_nonce};return m.ajax({url:u.l10n.ajax_url,type:"POST",data:s,success:function(e,i,s){if(l.find("input, label, button").not(":hidden").fadeTo("fast",1),l.find(".yikes-mailchimp-preloader").remove(),m(".yikes-mc-loading-dots").remove(),m(".yikes-mailchimp-submit-button-span-text").show(),l.removeClass("yikes-mc-submitted-form-loading"),e.success){e=e.data,"function"==typeof yikes_mailchimp_google_analytics_success&&yikes_mailchimp_google_analytics_success(e),1==e.hide&&(0<m(".yikes-easy-mc-form-description-"+c).length&&m(".yikes-easy-mc-form-description-"+c).hide(),l.hide()),0<m(".yikes-easy-mc-form-description-"+c).length?m(".yikes-easy-mc-form-description-"+c).before('<p class="yikes-easy-mc-success-message yikes-easy-mc-success-message-'+c+' yikes-easy-mc-hidden">'+e.response+"</p>"):l.before('<p class="yikes-easy-mc-success-message yikes-easy-mc-success-message-'+c+' yikes-easy-mc-hidden">'+e.response+"</p>"),m(".yikes-easy-mc-success-message-"+c).fadeIn(),m(".yikes-mailchimp-required-interest-group-error").remove(),1===e.redirection&&yikes_mc_redirect_after_submission(e.redirect,e.redirect_timer,e.new_window),l.find("input").not('.yikes-easy-mc-submit-button, input[type="radio"], input[type="select"], input[type="checkbox"], #yikes-mailchimp-associated-list-id, #yikes-mailchimp-submitted-form').val("");var r={action:"increase_submission_count",form_id:c};m.ajax({url:u.l10n.ajax_url,type:"POST",data:r,success:function(e,i,s){},error:function(e,i,s){console.error(s)}})}else{if(e=e.data,"function"==typeof yikes_mailchimp_google_analytics_failure&&yikes_mailchimp_google_analytics_failure(e),0<m(".yikes-easy-mc-form-description-"+c).length)m(".yikes-easy-mc-form-description-"+c).before('<p class="yikes-easy-mc-error-message yikes-easy-mc-error-message-'+c+'" yikes-easy-mc-hidden"> '+e.response+"</p>");else{var a=void 0!==e&&void 0!==e.response?e.response:"Error collecting the API response.";l.before('<p class="yikes-easy-mc-error-message yikes-easy-mc-error-message-'+c+' yikes-easy-mc-hidden">'+a+"</p>")}if(void 0!==e&&void 0!==e.missing_required_field&&!0===e.missing_required_field&&void 0!==e.missing_required_field_data){var o=e.missing_required_field_data,t=void 0!==e.is_interest_group&&e.is_interest_group;d=t,void 0!==(n=o)&&m.each(n,function(e,i){!0===d?0<m("span."+e+"-label").length?m("span."+e+"-label").addClass("yikes-mc-required-field-not-filled"):m("."+e+"-label").addClass("yikes-mc-required-field-not-filled"):m('label[for="'+e+'"]').children("input").addClass("yikes-mc-required-field-not-filled")})}m(".yikes-easy-mc-error-message").fadeIn()}var n,d},error:function(e,i,s){console.error(s),console.log(e),console.log(i)},complete:function(e,i){l.find(".yikes-easy-mc-submit-button").removeAttr("disabled","disabled")}}),!1})})}(window,document,jQuery,Yikes_Mailchimp_Ajax);
1
+ window.Yikes_Mailchimp_Ajax=window.Yikes_Mailchimp_Ajax||{},function(e,i,m,u,s){"use strict";u.l10n=e.yikes_mailchimp_ajax||{},m(i).ready(function(){m("body").on("submit",".yikes-easy-mc-form",function(){var l=m(this);l.addClass("yikes-mc-submitted-form-loading"),l.find("input, label, button").not(":hidden").fadeTo("fast",.5),"string"==typeof u.l10n.preloader_url&&1<u.l10n.preloader_url.length&&l.append('<img src="'+u.l10n.preloader_url+'" class="yikes-mailchimp-preloader" />'),m(".yikes-mc-required-field-not-filled").removeClass("yikes-mc-required-field-not-filled"),m(".yikes-mailchimp-submit-button-span-text").hide(),"string"==typeof u.l10n.loading_dots&&1<u.l10n.loading_dots.length&&l.find(".yikes-easy-mc-submit-button").append('<img src="'+u.l10n.loading_dots+'" class="loading-dots yikes-mc-loading-dots" />');var c=l.attr("data-attr-form-id"),i=[];if(0<l.find(".yikes-interest-group-required").length&&l.find(".yikes-interest-group-required").each(function(){var e=jQuery(this).attr("name").replace("[]","");0==l.find('input[name="'+e+'[]"]:checked').length&&(i[e]=l.find("span."+e+"-label").text())}),0<i.length){if(0<l.find(".yikes-mailchimp-required-interest-group-error").length)l.find(".yikes-mailchimp-required-interest-group-error").fadeOut("fast",function(){for(var e in l.find(".yikes-mailchimp-required-interest-group-error").remove(),i)l.find("span."+e+"-label").after('<p class="yikes-mailchimp-required-interest-group-error">'+u.l10n.interest_group_checkbox_error+"</p>")});else for(var e in i)l.find("span."+e+"-label").after('<p class="yikes-mailchimp-required-interest-group-error">'+u.l10n.interest_group_checkbox_error+"</p>");return l.find(".yikes-easy-mc-submit-button").removeAttr("disabled","disabled"),l.find("input, label, button").not(":hidden").fadeTo("fast",1),l.find(".yikes-mailchimp-preloader").remove(),m(".yikes-mc-loading-dots").remove(),m(".yikes-mailchimp-submit-button-span-text").show(),l.removeClass("yikes-mc-submitted-form-loading"),!1}l.find(".yikes-easy-mc-submit-button").attr("disabled","disabled"),m(".yikes-easy-mc-error-message").remove(),m(".yikes-easy-mc-success-message").remove();var s={action:"process_form_submission",form_data:l.serialize(),form_id:c,page_data:u.l10n.page_data,ajax_security_nonce:u.l10n.ajax_security_nonce};return m.ajax({url:u.l10n.ajax_url,type:"POST",data:s,success:function(e,i,s){if(l.find("input, label, button").not(":hidden").fadeTo("fast",1),l.find(".yikes-mailchimp-preloader").remove(),m(".yikes-mc-loading-dots").remove(),m(".yikes-mailchimp-submit-button-span-text").show(),l.removeClass("yikes-mc-submitted-form-loading"),e.success){e=e.data,"function"==typeof yikes_mailchimp_google_analytics_success&&yikes_mailchimp_google_analytics_success(e),1==e.hide&&(0<m(".yikes-easy-mc-form-description-"+c).length&&m(".yikes-easy-mc-form-description-"+c).hide(),l.hide()),0<m(".yikes-easy-mc-form-description-"+c).length?m(".yikes-easy-mc-form-description-"+c).before('<p class="yikes-easy-mc-success-message yikes-easy-mc-success-message-'+c+' yikes-easy-mc-hidden">'+e.response+"</p>"):l.before('<p class="yikes-easy-mc-success-message yikes-easy-mc-success-message-'+c+' yikes-easy-mc-hidden">'+e.response+"</p>"),m(".yikes-easy-mc-success-message-"+c).fadeIn(),m(".yikes-mailchimp-required-interest-group-error").remove(),1===e.redirection&&yikes_mc_redirect_after_submission(e.redirect,e.redirect_timer,e.new_window),l.find("input").not('.yikes-easy-mc-submit-button, input[type="radio"], input[type="select"], input[type="checkbox"], input[name="yikes-mailchimp-associated-list-id"], input[name="yikes-mailchimp-submitted-form"]').val("");var r={action:"increase_submission_count",form_id:c};m.ajax({url:u.l10n.ajax_url,type:"POST",data:r,success:function(e,i,s){},error:function(e,i,s){console.error(s)}})}else{if(e=e.data,"function"==typeof yikes_mailchimp_google_analytics_failure&&yikes_mailchimp_google_analytics_failure(e),0<m(".yikes-easy-mc-form-description-"+c).length)m(".yikes-easy-mc-form-description-"+c).before('<p class="yikes-easy-mc-error-message yikes-easy-mc-error-message-'+c+'" yikes-easy-mc-hidden"> '+e.response+"</p>");else{var a=void 0!==e&&void 0!==e.response?e.response:"Error collecting the API response.";l.before('<p class="yikes-easy-mc-error-message yikes-easy-mc-error-message-'+c+' yikes-easy-mc-hidden">'+a+"</p>")}if(void 0!==e&&void 0!==e.missing_required_field&&!0===e.missing_required_field&&void 0!==e.missing_required_field_data){var n=e.missing_required_field_data,t=void 0!==e.is_interest_group&&e.is_interest_group;d=t,void 0!==(o=n)&&m.each(o,function(e,i){!0===d?0<m("span."+e+"-label").length?m("span."+e+"-label").addClass("yikes-mc-required-field-not-filled"):m("."+e+"-label").addClass("yikes-mc-required-field-not-filled"):m('label[for="'+e+'"]').children("input").addClass("yikes-mc-required-field-not-filled")})}m(".yikes-easy-mc-error-message").fadeIn()}var o,d},error:function(e,i,s){console.error(s),console.log(e),console.log(i)},complete:function(e,i){l.find(".yikes-easy-mc-submit-button").removeAttr("disabled","disabled")}}),!1})})}(window,document,jQuery,Yikes_Mailchimp_Ajax);
public/partials/shortcodes/process_form_shortcode.php CHANGED
@@ -30,7 +30,7 @@ function process_mailchimp_shortcode( $atts ) {
30
  $form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
31
 
32
  /* If the user hasn't authenticated yet, lets kill off */
33
- if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
34
  return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
35
  }
36
 
@@ -40,7 +40,7 @@ function process_mailchimp_shortcode( $atts ) {
40
  }
41
 
42
  // store our variables
43
- $form_id = (int) $atts['form']; // form id (the id of the form in the database)
44
  $interface = yikes_easy_mailchimp_extender_get_form_interface();
45
  $form_data = $interface->get_form( $form_id );
46
 
@@ -53,46 +53,49 @@ function process_mailchimp_shortcode( $atts ) {
53
  * Check if the user wants to use reCAPTCHA Spam Prevention
54
  */
55
  if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
56
- // allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
 
57
  if ( $atts['recaptcha'] != '0' ) {
58
- // if either of the Private the Secret key is left blank, we should display an error back to the user
59
- if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
 
60
  return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61
  }
62
- if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
  return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64
  }
65
 
66
- if( ! empty( $atts['recaptcha_type'] ) ) {
67
- echo $atts['recaptcha_type'];
68
- }
69
 
70
- // Store the site language (to load recaptcha in a specific language)
71
- $locale = get_locale();
72
  $locale_split = explode( '_', $locale );
73
- // Setup reCAPTCHA parameters
74
- $lang = ( ! empty( $locale_split ) ? $locale_split[0] : $locale );
75
- $lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang;
76
- $type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
- $theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
- $size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
- $data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
- $expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
81
- // Pass the shortcode parameters through a filter
 
 
82
  $recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83
- 'language' => $lang,
84
- 'theme' => $theme,
85
- 'type' => $type,
86
- 'size' => $size,
87
- 'success_callback' => $data_callback,
88
- 'expired_callback' => $expired_callback,
89
  ), $atts['form'] );
90
 
91
- // enqueue Google recaptcha JS
92
  wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ) , 'all' );
93
  wp_enqueue_script( 'google-recaptcha-js' );
 
94
  $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
95
- $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params['theme'] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params['type'] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params['size'] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params['success_callback'] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params['expired_callback'] ) . '"></div>';
96
  }
97
  }
98
 
@@ -228,25 +231,45 @@ function process_mailchimp_shortcode( $atts ) {
228
  }
229
  }
230
 
231
- if( $form_inline ) {
 
 
 
232
  $field_width = (float) ( 100 / $field_count );
233
- $submit_button_width = (float) ( 20 / $field_count );
234
  $inline_offset = apply_filters( 'yikes-mailchimp-inline-offset', 1.0, $form_id );
235
  $total_inline_offset = (float) $submit_button_width + $inline_offset;
236
  $inline_padding_right = apply_filters( 'yikes-mailchimp-inline-padding-right', '10px', $form_id );
237
  $inline_field_width = apply_filters( 'yikes-mailchimp-inline-field-width', $field_width - $total_inline_offset, $form_id );
238
  $custom_inline_styles = apply_filters( 'yikes-mailchimp-custom-inline-styles', '', $form_id );
 
 
 
239
  /*
240
  * Add inline styles after calculating the percentage etc.
241
  * @since 6.0.3.8
242
  */
243
  $inline_label_css = "
244
  .yikes-easy-mc-form label.label-inline {
245
- float: left;
246
  width: {$inline_field_width}%;
247
  padding-right: {$inline_padding_right};
248
  {$custom_inline_styles}
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  ";
251
  wp_add_inline_style( 'yikes-inc-easy-mailchimp-public-styles', $inline_label_css );
252
  }
@@ -1208,30 +1231,29 @@ function process_mailchimp_shortcode( $atts ) {
1208
 
1209
  do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1210
 
1211
- /* if we've enabled reCAPTCHA protection */
1212
- if( isset( $recaptcha_box ) ) {
1213
  echo $recaptcha_box;
1214
  }
1215
- if( is_user_logged_in() ) {
1216
- $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1217
- } else {
1218
- $admin_class = '';
1219
- }
1220
  ?>
1221
 
1222
  <!-- Honeypot Trap -->
1223
- <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1224
 
1225
  <!-- List ID -->
1226
- <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data['list_id'] ); ?>">
1227
 
1228
  <!-- The form that is being submitted! Used to display error/success messages above the correct form -->
1229
- <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo esc_attr( $form_id ); ?>">
1230
 
1231
  <!-- Submit Button -->
1232
  <?php
1233
- if( $form_inline ) {
 
1234
  $submit_button_label_classes = array( 'empty-label' );
 
1235
  // If the number of fields, is equal to the hidden label count, add our class
1236
  // eg: All field labels are set to hidden.
1237
  if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
@@ -1239,19 +1261,18 @@ function process_mailchimp_shortcode( $atts ) {
1239
  }
1240
  echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1241
  }
1242
- // display the image or text based button
1243
- if( $submit_button_type == 'text' ) {
1244
  echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</span></button>', $form_data['id'] );
1245
  } else {
1246
  echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] );
1247
  }
1248
- if( $form_inline ) {
1249
  echo '</label>';
1250
  }
1251
  ?>
1252
  <!-- Nonce Security Check -->
1253
- <?php wp_nonce_field( 'yikes_easy_mc_form_submit', 'yikes_easy_mc_new_subscriber' ); ?>
1254
-
1255
  </form>
1256
  <!-- MailChimp Form generated by Easy Forms for MailChimp v<?php echo YIKES_MC_VERSION; ?> (https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/) -->
1257
 
30
  $form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
31
 
32
  /* If the user hasn't authenticated yet, lets kill off */
33
+ if ( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
34
  return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
35
  }
36
 
40
  }
41
 
42
  // store our variables
43
+ $form_id = (int) $atts['form']; // form id (the id of the form in the database)
44
  $interface = yikes_easy_mailchimp_extender_get_form_interface();
45
  $form_data = $interface->get_form( $form_id );
46
 
53
  * Check if the user wants to use reCAPTCHA Spam Prevention
54
  */
55
  if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
56
+
57
+ // Allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page).
58
  if ( $atts['recaptcha'] != '0' ) {
59
+
60
+ // If either of the Private the Secret key is left blank, we should display an error back to the user.
61
+ if ( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
62
  return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
63
  }
64
+ if ( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
65
  return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
66
  }
67
 
68
+ $has_recaptcha = true;
 
 
69
 
70
+ // Store the site language (to load recaptcha in a specific language).
71
+ $locale = get_locale();
72
  $locale_split = explode( '_', $locale );
73
+
74
+ // Setup reCAPTCHA parameters.
75
+ $lang = ! empty( $locale_split ) ? $locale_split[0] : $locale;
76
+ $lang = ! empty( $atts['recaptcha_lang'] ) ? $atts['recaptcha_lang'] : $lang;
77
+ $type = ! empty( $atts['recaptcha_type'] ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
78
+ $theme = ! empty( $atts['recaptcha_theme'] ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
79
+ $size = ! empty( $atts['recaptcha_size'] ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
80
+ $data_cb = ! empty( $atts['recaptcha_data_callback'] ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
81
+ $expired_cb = ! empty( $atts['recaptcha_expired_callback'] ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
82
+
83
+ // Pass the shortcode parameters through a filter.
84
  $recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
85
+ 'language' => $lang,
86
+ 'theme' => $theme,
87
+ 'type' => $type,
88
+ 'size' => $size,
89
+ 'success_callback' => $data_cb,
90
+ 'expired_callback' => $expired_cb,
91
  ), $atts['form'] );
92
 
93
+ // Enqueue Google recaptcha JS.
94
  wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ) , 'all' );
95
  wp_enqueue_script( 'google-recaptcha-js' );
96
+
97
  $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
98
+ $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params['theme'] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params['type'] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params['size'] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params['success_callback'] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params['expired_callback'] ) . '"></div>';
99
  }
100
  }
101
 
231
  }
232
  }
233
 
234
+ // If the recaptcha or GDPR compliance plugins are active, traditional inline styles will not work.
235
+ $inline_form_override = isset( $has_recaptcha ) || ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'eu-opt-in-compliance-for-mailchimp/yikes-inc-easy-mailchimp-eu-law-compliance-extension.php' ) );
236
+
237
+ if ( $form_inline ) {
238
  $field_width = (float) ( 100 / $field_count );
239
+ $submit_button_width = ! $inline_form_override ? (float) ( 20 / $field_count ) : 0;
240
  $inline_offset = apply_filters( 'yikes-mailchimp-inline-offset', 1.0, $form_id );
241
  $total_inline_offset = (float) $submit_button_width + $inline_offset;
242
  $inline_padding_right = apply_filters( 'yikes-mailchimp-inline-padding-right', '10px', $form_id );
243
  $inline_field_width = apply_filters( 'yikes-mailchimp-inline-field-width', $field_width - $total_inline_offset, $form_id );
244
  $custom_inline_styles = apply_filters( 'yikes-mailchimp-custom-inline-styles', '', $form_id );
245
+ $float_style = apply_filters( 'yikes-mailchimp-inline-float', ! $inline_form_override ? 'left' : 'none', $form_id );
246
+ $mobile_width = $field_width - $inline_offset;
247
+
248
  /*
249
  * Add inline styles after calculating the percentage etc.
250
  * @since 6.0.3.8
251
  */
252
  $inline_label_css = "
253
  .yikes-easy-mc-form label.label-inline {
254
+ float: {$float_style};
255
  width: {$inline_field_width}%;
256
  padding-right: {$inline_padding_right};
257
  {$custom_inline_styles}
258
  }
259
+
260
+ @media (max-width: 768px) {
261
+ .yikes-easy-mc-form label.label-inline {
262
+ width: {$mobile_width}%;
263
+ padding-right: {$inline_padding_right};
264
+ }
265
+ .yikes-easy-mc-form .submit-button-inline-label {
266
+ width: 100%;
267
+ float: none;
268
+ }
269
+ .yikes-easy-mc-form .submit-button-inline-label .empty-label {
270
+ display: none;
271
+ }
272
+ }
273
  ";
274
  wp_add_inline_style( 'yikes-inc-easy-mailchimp-public-styles', $inline_label_css );
275
  }
1231
 
1232
  do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1233
 
1234
+ // Show the recaptcha.
1235
+ if ( isset( $recaptcha_box ) ) {
1236
  echo $recaptcha_box;
1237
  }
1238
+
1239
+ $admin_class = is_user_logged_in() && current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ? ' admin-logged-in' : '';
 
 
 
1240
  ?>
1241
 
1242
  <!-- Honeypot Trap -->
1243
+ <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot-<?php echo esc_attr( $form_id ); ?>" value="">
1244
 
1245
  <!-- List ID -->
1246
+ <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id-<?php echo esc_attr( $form_id ); ?>" value="<?php echo esc_attr( $form_data['list_id'] ); ?>">
1247
 
1248
  <!-- The form that is being submitted! Used to display error/success messages above the correct form -->
1249
+ <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form-<?php echo esc_attr( $form_id ); ?>" value="<?php echo esc_attr( $form_id ); ?>">
1250
 
1251
  <!-- Submit Button -->
1252
  <?php
1253
+ if ( $form_inline && ! $inline_form_override ) {
1254
+
1255
  $submit_button_label_classes = array( 'empty-label' );
1256
+
1257
  // If the number of fields, is equal to the hidden label count, add our class
1258
  // eg: All field labels are set to hidden.
1259
  if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1261
  }
1262
  echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1263
  }
1264
+ // Display the image or text based button.
1265
+ if ( $submit_button_type === 'text' ) {
1266
  echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</span></button>', $form_data['id'] );
1267
  } else {
1268
  echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] );
1269
  }
1270
+ if ( $form_inline && ! $inline_form_override ) {
1271
  echo '</label>';
1272
  }
1273
  ?>
1274
  <!-- Nonce Security Check -->
1275
+ <input type="hidden" id="yikes_easy_mc_new_subscriber_<?php echo esc_attr( $form_id ); ?>" name="yikes_easy_mc_new_subscriber" value="<?php echo wp_create_nonce( 'yikes_easy_mc_form_submit' ); ?>">
 
1276
  </form>
1277
  <!-- MailChimp Form generated by Easy Forms for MailChimp v<?php echo YIKES_MC_VERSION; ?> (https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/) -->
1278
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: yikesinc, eherman24, liljimmi, JPry, yikesitskevin
3
  Donate link: https://yikesplugins.com/?utm_source=wp_plugin_repo&utm_medium=donate_link&utm_campaign=easy_forms_for_mailchimp
4
  Tags: MailChimp, MailChimp forms, MailChimp lists, opt-in forms, sign up form, MailChimp, email, forms, mailing lists, marketing, newsletter, sign up
5
  Requires at least: 4.0
6
- Tested up to: 4.9.7
7
- Stable tag: 6.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -171,5 +171,8 @@ For information and code examples on how to implement the hooks and filters prov
171
 
172
  == Changelog ==
173
 
174
- = 6.4.5 - July 25th, 2018 =
175
- * Fixed an issue where subscriptions would not be processed if only an email field was sent. Shoutout to Kamil (@paszczak000) for reporting this issue and working with us to resolve it, thank you!
 
 
 
3
  Donate link: https://yikesplugins.com/?utm_source=wp_plugin_repo&utm_medium=donate_link&utm_campaign=easy_forms_for_mailchimp
4
  Tags: MailChimp, MailChimp forms, MailChimp lists, opt-in forms, sign up form, MailChimp, email, forms, mailing lists, marketing, newsletter, sign up
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.8
7
+ Stable tag: 6.4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
171
 
172
  == Changelog ==
173
 
174
+ = 6.4.6 - September 10th, 2018 =
175
+ * Added the ability to re-subscribe to a list via an integration checkbox. Previously, users who were unsubscribed or pending confirmation were unable to re-subscribe. This only works when using the [default] double opt-in method.
176
+ * Added a check for reCAPTCHA/[GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) when calculating inline styles. If you have the reCAPTCHA or [GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) plugin active, then the submit button will become full width, drop below these items, and the fields will take up 100% of the width. A similar conversion occurs when the screen size is below 768px regardless of the reCAPTCHA or [GDPR Compliance for MailChimp](https://wordpress.org/plugins/eu-opt-in-compliance-for-mailchimp/) plugin being active.
177
+ * Changed the calculation and rounding of form conversion statistics to be slightly more accurate.
178
+ * Cleaned up duplicate IDs in hidden HTML elements when multiple forms were on the same page.
yikes-inc-easy-mailchimp-extender.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Forms for MailChimp
4
  * Plugin URI: https://yikesplugins.com/plugin/easy-forms-for-mailchimp/
5
  * Description: The ultimate MailChimp WordPress plugin. Easily build <strong>unlimited forms for your MailChimp lists</strong>, add them to your site and track subscriber activity. To get started, go to the settings page and enter your <a href="https://yikesplugins.com/support/knowledge-base/finding-your-mailchimp-api-key/" target="_blank">MailChimp API key</a>.
6
- * Version: 6.4.5
7
  * Author: YIKES, Inc.
8
  * Author URI: https://www.yikesplugins.com/
9
  * License: GPL-3.0+
@@ -43,7 +43,7 @@ if ( ! defined( 'WPINC' ) ) {
43
  * @since 6.1.3
44
  */
45
  if ( ! defined( 'YIKES_MC_VERSION' ) ) {
46
- define( 'YIKES_MC_VERSION' , '6.4.5' );
47
  }
48
 
49
  /**
3
  * Plugin Name: Easy Forms for MailChimp
4
  * Plugin URI: https://yikesplugins.com/plugin/easy-forms-for-mailchimp/
5
  * Description: The ultimate MailChimp WordPress plugin. Easily build <strong>unlimited forms for your MailChimp lists</strong>, add them to your site and track subscriber activity. To get started, go to the settings page and enter your <a href="https://yikesplugins.com/support/knowledge-base/finding-your-mailchimp-api-key/" target="_blank">MailChimp API key</a>.
6
+ * Version: 6.4.6
7
  * Author: YIKES, Inc.
8
  * Author URI: https://www.yikesplugins.com/
9
  * License: GPL-3.0+
43
  * @since 6.1.3
44
  */
45
  if ( ! defined( 'YIKES_MC_VERSION' ) ) {
46
+ define( 'YIKES_MC_VERSION' , '6.4.6' );
47
  }
48
 
49
  /**