Easy Forms for MailChimp - Version 6.0.4.4

Version Description

Download this release

Release Info

Developer eherman24
Plugin Icon 128x128 Easy Forms for MailChimp
Version 6.0.4.4
Comparing to
See all releases

Code changes from version 6.0.4.3 to 6.0.4.4

admin/class-yikes-inc-easy-mailchimp-extender-admin.php CHANGED
@@ -1710,9 +1710,8 @@ class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
1710
  <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" />
1711
 
1712
  <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
1713
- $choices = json_decode( $field['choices'] , true );
1714
  ?>
1715
-
1716
  <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' />
1717
  <?php } ?>
1718
 
@@ -1753,7 +1752,7 @@ class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
1753
  </label>
1754
  </td>
1755
  <td>
1756
- <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? stripslashes( wp_strip_all_tags( $field['placeholder'] ) ) : '' ; ?>" />
1757
  <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
1758
  </td>
1759
  </tr>
@@ -1800,11 +1799,11 @@ class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
1800
  </label>
1801
  </td>
1802
  <td>
1803
- <?php if( ! isset( $field['default_choice'] ) || empty( $field['default_choice'] ) ) { $decode = json_decode( stripslashes_deep( $field['choices'] ) , true ); $field['default_choice'] = $decode[0]; }
1804
  $x = 0;
1805
- foreach( json_decode( stripslashes( $field['choices'] ) , true ) as $choice => $value ) { ?>
1806
  <label for="<?php echo $field['merge'].'-'.$x; ?>">
1807
- <input id="<?php echo $field['merge'].'-'.$x; ?>" type="radio" name="field[<?php echo $field['merge']; ?>][default_choice]" value="<?php echo $value; ?>" <?php checked( $field['default_choice'] , $value ); ?>><?php echo $value; ?>&nbsp;
1808
  </label>
1809
  <?php $x++; } ?>
1810
  <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
@@ -2005,7 +2004,7 @@ class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
2005
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo $field['label']; ?>" />
2006
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" />
2007
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" />
2008
- <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo stripslashes( $field['groups'] ); ?>' />
2009
 
2010
  <!-- Single or Double Optin -->
2011
  <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); -->
@@ -2032,7 +2031,7 @@ class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
2032
  if( !isset( $field['default_choice'] ) ) { $field['default_choice'] = array(); }
2033
  }
2034
  $i = 0;
2035
- foreach( json_decode( stripslashes( $field['groups'] ) , true ) as $group ) { ?>
2036
  <label for="<?php echo $field['group_id'].'-'.$i; ?>">
2037
  <input id="<?php echo $field['group_id'].'-'.$i; ?>" type="<?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { ?>radio<?php } else if( $field['type'] == 'checkboxes' ) { ?>checkbox<?php } ?>" name="field[<?php echo $field['group_id']; ?>][default_choice]<?php if( $field['type'] == 'checkboxes' ) {echo '[]';}?>" value="<?php echo $i; ?>" <?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { checked( $field['default_choice'][0] , $i ); } else if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $field['default_choice'] ) ) { echo 'checked="checked"'; } }?>><?php echo stripslashes( str_replace( '~' , '\'' , $group['name'] ) ); ?>&nbsp;
2038
  </label>
1710
  <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" />
1711
 
1712
  <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
1713
+ $choices = json_decode( $field['choices'], true );
1714
  ?>
 
1715
  <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' />
1716
  <?php } ?>
1717
 
1752
  </label>
1753
  </td>
1754
  <td>
1755
+ <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" />
1756
  <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
1757
  </td>
1758
  </tr>
1799
  </label>
1800
  </td>
1801
  <td>
1802
+ <?php if( ! isset( $field['default_choice'] ) || empty( $field['default_choice'] ) ) { $decode = json_decode( $field['choices'], true ); $field['default_choice'] = $decode[0]; }
1803
  $x = 0;
1804
+ foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?>
1805
  <label for="<?php echo $field['merge'].'-'.$x; ?>">
1806
+ <input id="<?php echo $field['merge'].'-'.$x; ?>" type="radio" name="field[<?php echo $field['merge']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>><?php echo $value; ?>&nbsp;
1807
  </label>
1808
  <?php $x++; } ?>
1809
  <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
2004
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo $field['label']; ?>" />
2005
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" />
2006
  <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" />
2007
+ <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' />
2008
 
2009
  <!-- Single or Double Optin -->
2010
  <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); -->
2031
  if( !isset( $field['default_choice'] ) ) { $field['default_choice'] = array(); }
2032
  }
2033
  $i = 0;
2034
+ foreach( json_decode( $field['groups'], true ) as $group ) { ?>
2035
  <label for="<?php echo $field['group_id'].'-'.$i; ?>">
2036
  <input id="<?php echo $field['group_id'].'-'.$i; ?>" type="<?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { ?>radio<?php } else if( $field['type'] == 'checkboxes' ) { ?>checkbox<?php } ?>" name="field[<?php echo $field['group_id']; ?>][default_choice]<?php if( $field['type'] == 'checkboxes' ) {echo '[]';}?>" value="<?php echo $i; ?>" <?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { checked( $field['default_choice'][0] , $i ); } else if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $field['default_choice'] ) ) { echo 'checked="checked"'; } }?>><?php echo stripslashes( str_replace( '~' , '\'' , $group['name'] ) ); ?>&nbsp;
2037
  </label>
admin/partials/ajax/add_field_to_form.php CHANGED
@@ -145,13 +145,15 @@
145
  </label>
146
  </td>
147
  <td>
148
- <?php foreach( $merge_field_data['choices'] as $choice => $value ) {
 
 
149
  $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0';
150
  ?>
151
  <label>
152
- <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $value; ?>" <?php checked( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?>
153
  </label>
154
- <?php } ?>
155
  <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
156
  </td>
157
  </tr>
145
  </label>
146
  </td>
147
  <td>
148
+ <?php
149
+ $x = 0;
150
+ foreach( $merge_field_data['choices'] as $choice => $value ) {
151
  $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0';
152
  ?>
153
  <label>
154
+ <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected , $choice ); ?>><?php echo $value; ?>
155
  </label>
156
+ <?php $x++; } ?>
157
  <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
158
  </td>
159
  </tr>
admin/partials/ajax/add_interest_group_to_form.php CHANGED
@@ -104,7 +104,7 @@
104
  <?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) {
105
  $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0';
106
  ?>
107
- <option value="<?php echo $i; ?>" <?php selected( $pre_selected , $i ); ?>><?php echo stripslashes( $interest_group['name'] ); ?></option>
108
  <?php $i++; } ?>
109
  </select>
110
  <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
104
  <?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) {
105
  $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0';
106
  ?>
107
+ <option value="<?php echo $i; ?>" <?php selected( $pre_selected , $i ); ?>><?php echo $interest_group['name']; ?></option>
108
  <?php $i++; } ?>
109
  </select>
110
  <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p>
includes/class-yikes-inc-easy-mailchimp-extender.php CHANGED
@@ -62,7 +62,7 @@ class Yikes_Inc_Easy_Mailchimp_Extender {
62
  */
63
  public function __construct() {
64
  $this->yikes_inc_easy_mailchimp_extender = 'yikes-inc-easy-mailchimp-extender';
65
- $this->version = '6.0.4.3';
66
  $this->load_dependencies();
67
  $this->define_admin_hooks();
68
  $this->define_public_hooks();
62
  */
63
  public function __construct() {
64
  $this->yikes_inc_easy_mailchimp_extender = 'yikes-inc-easy-mailchimp-extender';
65
+ $this->version = '6.0.4.4';
66
  $this->load_dependencies();
67
  $this->define_admin_hooks();
68
  $this->define_public_hooks();
public/partials/ajax/class.public_ajax.php CHANGED
@@ -114,14 +114,14 @@
114
  if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_content ), $headers ) ) {
115
  wp_send_json_success(
116
  array(
117
- 'response_text' => '<span class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</span>',
118
  )
119
  );
120
  exit;
121
  } else {
122
  wp_send_json_error(
123
  array(
124
- 'response_text' => '<span class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</span>',
125
  )
126
  );
127
  exit;
@@ -131,7 +131,7 @@
131
  $errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error:</strong> %s. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), $e->getMessage() );
132
  wp_send_json_error(
133
  array(
134
- 'response_text' => '<span class="yikes-easy-mc-error-message">&#10005; ' . $errorMessage . '</span>',
135
  )
136
  );
137
  exit;
114
  if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_content ), $headers ) ) {
115
  wp_send_json_success(
116
  array(
117
+ 'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</div>',
118
  )
119
  );
120
  exit;
121
  } else {
122
  wp_send_json_error(
123
  array(
124
+ 'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</div>',
125
  )
126
  );
127
  exit;
131
  $errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error:</strong> %s. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), $e->getMessage() );
132
  wp_send_json_error(
133
  array(
134
+ 'response_text' => '<div class="yikes-easy-mc-error-message">&#10005; ' . $errorMessage . '</div>',
135
  )
136
  );
137
  exit;
public/partials/shortcodes/process/process_form_submission.php CHANGED
@@ -38,14 +38,18 @@ if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_P
38
  $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] );
39
  $response = wp_remote_get( $url );
40
  $response_body = json_decode( $response['body'] , true );
 
41
  // if we've hit an error, lets return the error!
42
  if( $response_body['success'] != 1 ) {
43
  $recaptcha_error = array(); // empty array to store error messages
44
- foreach( $response_body['erorr-codes'] as $error_code ) {
 
 
 
45
  $recaptcha_error[] = $error_code;
46
  }
47
- $process_submission_response = "<p>" . __( "It looks like we've run into a reCaptcha error. Please refresh the page and try again." , "yikes-inc-easy-mailchimp-extender" ) . "</p>";
48
- $process_submission_response .= "<p>" . __( 'Errors' , 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ' , $recaptcha_error ) . "</p>";
49
  }
50
  }
51
 
@@ -69,7 +73,6 @@ if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_P
69
 
70
  if( ! empty( $missing_required_checkbox_interest_groups ) ) {
71
  $process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-mailchimp-interest-group-required-top-error', sprintf( _n( 'It looks like you forgot to fill in a required field.', 'It looks like you forgot to fill in %s required fields.', count( $missing_required_checkbox_interest_groups ), 'yikes-inc-easy-mailchimp-extender' ), count( $missing_required_checkbox_interest_groups ) ), count( $missing_required_checkbox_interest_groups ), $form_id ) . '</p>';
72
- // echo '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-mailchimp-interest-group-required-top-error', sprintf( _n( 'It looks like you forgot to fill in a required field.', 'It looks like you forgot to fill in %s required fields.', count( $missing_required_checkbox_interest_groups ), 'yikes-inc-easy-mailchimp-extender' ), count( $missing_required_checkbox_interest_groups ) ), count( $missing_required_checkbox_interest_groups ), $form_id ) . '</p>';
73
  return;
74
  }
75
 
38
  $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] );
39
  $response = wp_remote_get( $url );
40
  $response_body = json_decode( $response['body'] , true );
41
+
42
  // if we've hit an error, lets return the error!
43
  if( $response_body['success'] != 1 ) {
44
  $recaptcha_error = array(); // empty array to store error messages
45
+ foreach( $response_body['error-codes'] as $error_code ) {
46
+ if( $error_code == 'missing-input-response' ) {
47
+ $error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
48
+ }
49
  $recaptcha_error[] = $error_code;
50
  }
51
+ $process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ' , $recaptcha_error ) ) . "</p>";
52
+ return;
53
  }
54
  }
55
 
73
 
74
  if( ! empty( $missing_required_checkbox_interest_groups ) ) {
75
  $process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-mailchimp-interest-group-required-top-error', sprintf( _n( 'It looks like you forgot to fill in a required field.', 'It looks like you forgot to fill in %s required fields.', count( $missing_required_checkbox_interest_groups ), 'yikes-inc-easy-mailchimp-extender' ), count( $missing_required_checkbox_interest_groups ) ), count( $missing_required_checkbox_interest_groups ), $form_id ) . '</p>';
 
76
  return;
77
  }
78
 
public/partials/shortcodes/process/process_form_submission_ajax.php CHANGED
@@ -64,6 +64,9 @@
64
  $error_messages = array(); // empty array to store error messages
65
  if( isset( $response_body['error-codes'] ) ) {
66
  foreach( $response_body['error-codes'] as $error_code ) {
 
 
 
67
  $error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
68
  }
69
  } else {
@@ -73,7 +76,7 @@
73
  wp_send_json( array(
74
  'hide' => '0',
75
  'error' => $error ,
76
- 'response' => __( "It looks like we've run into a reCaptcha error." , 'yikes-inc-easy-mailchimp-extender' ) .' '. implode( ' ', $error_messages ),
77
  ) );
78
  exit();
79
  }
64
  $error_messages = array(); // empty array to store error messages
65
  if( isset( $response_body['error-codes'] ) ) {
66
  foreach( $response_body['error-codes'] as $error_code ) {
67
+ if( $error_code == 'missing-input-response' ) {
68
+ $error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
69
+ }
70
  $error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
71
  }
72
  } else {
76
  wp_send_json( array(
77
  'hide' => '0',
78
  'error' => $error ,
79
+ 'response' => apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $error_messages ) ),
80
  ) );
81
  exit();
82
  }
public/partials/shortcodes/process_form_shortcode.php CHANGED
@@ -830,7 +830,7 @@ function process_mailchimp_shortcode( $atts ) {
830
  </span>
831
  <?php } ?>
832
 
833
- <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
834
 
835
  <!-- description -->
836
  <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
@@ -891,7 +891,7 @@ function process_mailchimp_shortcode( $atts ) {
891
  case 'checkbox':
892
  // remove the ID (as to not assign the same ID to every radio button)
893
  unset( $field_array['id'] );
894
- $choices = json_decode( stripslashes( $field['choices'] ) , true );
895
  // assign a default choice
896
  $default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
897
  // if the form was submit, but failed, let's reset the post data
@@ -917,7 +917,7 @@ function process_mailchimp_shortcode( $atts ) {
917
  foreach( $choices as $choice ) {
918
  ?>
919
  <label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>>
920
- <input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $choice ); ?> value="<?php echo esc_attr( $choice ); ?>">
921
  <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
922
  </label>
923
  <?php
@@ -953,7 +953,7 @@ function process_mailchimp_shortcode( $atts ) {
953
  }
954
 
955
  // get our groups
956
- $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( stripslashes_deep( $field['groups'] ), true ) : array();
957
 
958
  $count = count( $groups );
959
 
@@ -976,7 +976,7 @@ function process_mailchimp_shortcode( $atts ) {
976
  <?php if( ! isset( $field['hide-label'] ) ) { ?>
977
  <!-- dictate label visibility -->
978
  <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
979
- <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
980
  </span>
981
  <?php
982
  }
@@ -1006,7 +1006,7 @@ function process_mailchimp_shortcode( $atts ) {
1006
  ?>
1007
  <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?>last-selection<?php } ?>">
1008
  <input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1009
- <?php echo esc_attr( stripslashes( str_replace( '~' , '\'', $group['name'] ) ) ); ?>
1010
  </label>
1011
  <?php
1012
  $i++;
@@ -1017,7 +1017,7 @@ function process_mailchimp_shortcode( $atts ) {
1017
  if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1018
  <p class="form-field-description">
1019
  <small>
1020
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1021
  </small>
1022
  </p>
1023
  <?php } ?>
@@ -1035,7 +1035,7 @@ function process_mailchimp_shortcode( $atts ) {
1035
  <!-- dictate label visibility -->
1036
  <?php if( ! isset( $field['hide-label'] ) ) { ?>
1037
  <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1038
- <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1039
  </span>
1040
  <?php } ?>
1041
 
@@ -1043,7 +1043,7 @@ function process_mailchimp_shortcode( $atts ) {
1043
  <?php
1044
  $i = 0;
1045
  foreach( $groups as $group ) {
1046
- ?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( stripslashes( $group['name'] ) ); ?></option><?php
1047
  $i++;
1048
  }
1049
  ?>
@@ -1052,7 +1052,7 @@ function process_mailchimp_shortcode( $atts ) {
1052
  <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1053
  <p class="form-field-description">
1054
  <small>
1055
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1056
  </small>
1057
  </p>
1058
  <?php } ?>
830
  </span>
831
  <?php } ?>
832
 
833
+ <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $field['default'] ); } ?>">
834
 
835
  <!-- description -->
836
  <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
891
  case 'checkbox':
892
  // remove the ID (as to not assign the same ID to every radio button)
893
  unset( $field_array['id'] );
894
+ $choices = json_decode( $field['choices'], true );
895
  // assign a default choice
896
  $default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
897
  // if the form was submit, but failed, let's reset the post data
917
  foreach( $choices as $choice ) {
918
  ?>
919
  <label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>>
920
+ <input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
921
  <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
922
  </label>
923
  <?php
953
  }
954
 
955
  // get our groups
956
+ $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
957
 
958
  $count = count( $groups );
959
 
976
  <?php if( ! isset( $field['hide-label'] ) ) { ?>
977
  <!-- dictate label visibility -->
978
  <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
979
+ <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
980
  </span>
981
  <?php
982
  }
1006
  ?>
1007
  <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?>last-selection<?php } ?>">
1008
  <input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1009
+ <?php echo $group['name']; ?>
1010
  </label>
1011
  <?php
1012
  $i++;
1017
  if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1018
  <p class="form-field-description">
1019
  <small>
1020
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1021
  </small>
1022
  </p>
1023
  <?php } ?>
1035
  <!-- dictate label visibility -->
1036
  <?php if( ! isset( $field['hide-label'] ) ) { ?>
1037
  <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1038
+ <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1039
  </span>
1040
  <?php } ?>
1041
 
1043
  <?php
1044
  $i = 0;
1045
  foreach( $groups as $group ) {
1046
+ ?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1047
  $i++;
1048
  }
1049
  ?>
1052
  <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1053
  <p class="form-field-description">
1054
  <small>
1055
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1056
  </small>
1057
  </p>
1058
  <?php } ?>
readme.txt CHANGED
@@ -1 +1 @@
1
- === Easy Forms for MailChimp ===
2
- added `stripslashes()` to the following settings fields :
3
- Updated readme FAQ section
4
- added `stripslashes()` to the following settings fields :
5
- Updated readme FAQ section
6
- added `stripslashes()` to the following settings fields :
7
- Updated readme FAQ section
8
- added `stripslashes()` to the following settings fields :
9
- Updated readme FAQ section
1
+ === Easy Forms for MailChimp ===
 
 
 
 
 
 
 
 
yikes-inc-easy-mailchimp-extender.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Forms for MailChimp by YIKES
4
  * Plugin URI: http://www.yikesinc.com/services/yikes-inc-easy-mailchimp-extender/
5
  * Description: YIKES Easy Forms for MailChimp links your site to MailChimp and allows you to generate and display mailing list opt-in forms anywhere on your site with ease.
6
- * Version: 6.0.4.3
7
  * Author: YIKES
8
  * Author URI: http://www.yikesinc.com/
9
  * License: GPL-3.0+
3
  * Plugin Name: Easy Forms for MailChimp by YIKES
4
  * Plugin URI: http://www.yikesinc.com/services/yikes-inc-easy-mailchimp-extender/
5
  * Description: YIKES Easy Forms for MailChimp links your site to MailChimp and allows you to generate and display mailing list opt-in forms anywhere on your site with ease.
6
+ * Version: 6.0.4.4
7
  * Author: YIKES
8
  * Author URI: http://www.yikesinc.com/
9
  * License: GPL-3.0+