|
@@ -255,13 +255,13 @@ discard block |
|
|
block discarded – undo |
|
255
|
255
|
$this->handle_updating_existing_user_link_message = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
|
256
|
256
|
$this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
|
257
|
257
|
$this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
|
258
|
|
- $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
|
258
|
+ $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
259
|
259
|
$this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
|
260
|
260
|
$this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
261
|
261
|
|
|
262
|
262
|
// Define our success messages |
|
263
|
|
- $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
264
|
|
- $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
|
263
|
+ $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
|
264
|
+ $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
265
|
265
|
$this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
|
266
|
266
|
} |
|
267
|
267
|
|
|
@@ -373,16 +373,16 @@ discard block |
|
|
block discarded – undo |
|
373
|
373
|
} |
|
374
|
374
|
|
|
375
|
375
|
// Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
|
376
|
|
- if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
377
|
|
- $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
|
376
|
+ if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
|
377
|
+ $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
378
|
378
|
} |
|
379
|
379
|
|
|
380
|
380
|
$merge_variables[ $merge_tag ] = $sanitized; |
|
381
|
381
|
} |
|
382
|
382
|
|
|
383
|
383
|
// Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request. |
|
384
|
|
- if ( isset( $merge_variables['EMAIL'] ) ) { |
|
385
|
|
- $merge_variables['EMAIL'] = $this->email; |
|
|
384
|
+ if ( isset( $merge_variables[ 'EMAIL' ] ) ) { |
|
|
385
|
+ $merge_variables[ 'EMAIL' ] = $this->email; |
|
386
|
386
|
} |
|
387
|
387
|
|
|
388
|
388
|
/** |
|
@@ -459,7 +459,7 @@ discard block |
|
|
block discarded – undo |
|
459
|
459
|
if ( count( $pieces ) === 3 ) { |
|
460
|
460
|
|
|
461
|
461
|
// $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
|
462
|
|
- $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
|
462
|
+ $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
463
|
463
|
} |
|
464
|
464
|
|
|
465
|
465
|
return $date; |
|
@@ -484,7 +484,7 @@ discard block |
|
|
block discarded – undo |
|
484
|
484
|
if ( count( $pieces ) === 2 ) { |
|
485
|
485
|
|
|
486
|
486
|
// $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
|
487
|
|
- $birthday = $pieces[1] . '/' . $pieces[0]; |
|
|
487
|
+ $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
488
|
488
|
} |
|
489
|
489
|
|
|
490
|
490
|
return $birthday; |
|
@@ -517,12 +517,12 @@ discard block |
|
|
block discarded – undo |
|
517
|
517
|
// Loop through the interest groups and create a single array like {group_id} => false |
|
518
|
518
|
foreach ( $interest_groupings as $group_data ) { |
|
519
|
519
|
|
|
520
|
|
- if ( empty( $group_data['items'] ) || ! is_array( $group_data['items'] ) ) { |
|
|
520
|
+ if ( empty( $group_data[ 'items' ] ) || ! is_array( $group_data[ 'items' ] ) ) { |
|
521
|
521
|
continue; |
|
522
|
522
|
} |
|
523
|
523
|
|
|
524
|
|
- foreach ( $group_data['items'] as $item ) { |
|
525
|
|
- $groups[ $item['id'] ] = false; |
|
|
524
|
+ foreach ( $group_data[ 'items' ] as $item ) { |
|
|
525
|
+ $groups[ $item[ 'id' ] ] = false; |
|
526
|
526
|
} |
|
527
|
527
|
|
|
528
|
528
|
} |
|
@@ -635,7 +635,7 @@ discard block |
|
|
block discarded – undo |
|
635
|
635
|
do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
|
636
|
636
|
|
|
637
|
637
|
// Get the optin value |
|
638
|
|
- $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
|
638
|
+ $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
639
|
639
|
|
|
640
|
640
|
if ( 1 === $optin ) { |
|
641
|
641
|
|
|
@@ -665,13 +665,13 @@ discard block |
|
|
block discarded – undo |
|
665
|
665
|
|
|
666
|
666
|
// Construct our success array variables |
|
667
|
667
|
$return_success_array = array( |
|
668
|
|
- 'hide' => $submission_settings['hide_form_post_signup'], |
|
|
668
|
+ 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
669
|
669
|
'error' => 0, |
|
670
|
670
|
'response' => $response_message, |
|
671
|
|
- 'redirection' => $redirect_array['redirection'], |
|
672
|
|
- 'redirect' => $redirect_array['redirect'], |
|
673
|
|
- 'new_window' => $redirect_array['new_window'], |
|
674
|
|
- 'redirect_timer' => $redirect_array['redirect_timer'], |
|
|
671
|
+ 'redirection' => $redirect_array[ 'redirection' ], |
|
|
672
|
+ 'redirect' => $redirect_array[ 'redirect' ], |
|
|
673
|
+ 'new_window' => $redirect_array[ 'new_window' ], |
|
|
674
|
+ 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
675
|
675
|
); |
|
676
|
676
|
|
|
677
|
677
|
// Return success array |
|
@@ -693,12 +693,12 @@ discard block |
|
|
block discarded – undo |
|
693
|
693
|
$details = ''; |
|
694
|
694
|
|
|
695
|
695
|
// Loop through the error data and retrieve any fields and messages |
|
696
|
|
- if ( isset( $error_data['data'] ) ) { |
|
697
|
|
- foreach ( $error_data['data'] as $datum ) { |
|
698
|
|
- if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
|
696
|
+ if ( isset( $error_data[ 'data' ] ) ) { |
|
|
697
|
+ foreach ( $error_data[ 'data' ] as $datum ) { |
|
|
698
|
+ if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
699
|
699
|
continue; |
|
700
|
700
|
} |
|
701
|
|
- $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
|
701
|
+ $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
702
|
702
|
} |
|
703
|
703
|
} |
|
704
|
704
|
|
|
@@ -741,21 +741,21 @@ discard block |
|
|
block discarded – undo |
|
741
|
741
|
$missing_fields = array(); |
|
742
|
742
|
|
|
743
|
743
|
// Loop through submitted form data |
|
744
|
|
- foreach( $data as $merge_tag => $value ) { |
|
|
744
|
+ foreach ( $data as $merge_tag => $value ) { |
|
745
|
745
|
|
|
746
|
746
|
// Skip interest groups |
|
747
|
|
- if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
|
747
|
+ if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
748
|
748
|
continue; |
|
749
|
749
|
} |
|
750
|
750
|
|
|
751
|
751
|
// check if this field is required |
|
752
|
|
- if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
|
752
|
+ if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
753
|
753
|
|
|
754
|
754
|
// Check if the field(s) are empty |
|
755
|
755
|
if ( is_array( $value ) ) { |
|
756
|
756
|
|
|
757
|
757
|
// Loop through the data and check if any are empty |
|
758
|
|
- foreach( $value as $field => $val ) { |
|
|
758
|
+ foreach ( $value as $field => $val ) { |
|
759
|
759
|
|
|
760
|
760
|
/** |
|
761
|
761
|
* 'yikes-mailchimp-ignore-required-array-field' |
|
@@ -774,13 +774,13 @@ discard block |
|
|
block discarded – undo |
|
774
|
774
|
|
|
775
|
775
|
// Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
|
776
|
776
|
// (e.g. For arrays, like an address, where multiple address fields are empty) |
|
777
|
|
- $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
|
777
|
+ $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
778
|
778
|
} |
|
779
|
779
|
} |
|
780
|
780
|
|
|
781
|
781
|
} else if ( empty( $value ) ) { |
|
782
|
782
|
$field_is_missing = true; |
|
783
|
|
- $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
|
783
|
+ $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
784
|
784
|
} |
|
785
|
785
|
} |
|
786
|
786
|
} |
|
@@ -830,7 +830,7 @@ discard block |
|
|
block discarded – undo |
|
830
|
830
|
foreach ( $form_fields as $merge_tag => $field_data ) { |
|
831
|
831
|
|
|
832
|
832
|
// If an interest group and it's required |
|
833
|
|
- if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
|
833
|
+ if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
834
|
834
|
|
|
835
|
835
|
// Check if it was submitted (meaning, check if it's set in our $data array) |
|
836
|
836
|
if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
|
@@ -892,30 +892,30 @@ discard block |
|
|
block discarded – undo |
|
892
|
892
|
} |
|
893
|
893
|
|
|
894
|
894
|
// Construct the API URL |
|
895
|
|
- $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
|
895
|
+ $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
896
|
896
|
$response = wp_remote_get( $url ); |
|
897
|
|
- $response_body = json_decode( $response['body'], true ); |
|
|
897
|
+ $response_body = json_decode( $response[ 'body' ], true ); |
|
898
|
898
|
|
|
899
|
899
|
// Set up errors array |
|
900
|
900
|
$recaptcha_errors = array(); |
|
901
|
901
|
|
|
902
|
902
|
// if we've hit an error, lets return the error! |
|
903
|
|
- if ( true !== $response_body['success'] ) { |
|
|
903
|
+ if ( true !== $response_body[ 'success' ] ) { |
|
904
|
904
|
|
|
905
|
|
- if( isset( $response_body['error-codes'] ) ) { |
|
|
905
|
+ if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
906
|
906
|
|
|
907
|
907
|
// Loop through response error codes |
|
908
|
|
- foreach ( $response_body['error-codes'] as $error_code ) { |
|
|
908
|
+ foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
909
|
909
|
if ( 'missing-input-response' === $error_code ) { |
|
910
|
910
|
$error_code = $this->handle_non_filled_recaptcha_message; |
|
911
|
911
|
} |
|
912
|
912
|
|
|
913
|
913
|
// Add our error_code to the errors array |
|
914
|
|
- $recaptcha_errors[] = $error_code; |
|
|
914
|
+ $recaptcha_errors[ ] = $error_code; |
|
915
|
915
|
} |
|
916
|
916
|
|
|
917
|
917
|
} else { |
|
918
|
|
- $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
|
918
|
+ $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
919
|
919
|
} |
|
920
|
920
|
|
|
921
|
921
|
/** |
|
@@ -1023,7 +1023,7 @@ discard block |
|
|
block discarded – undo |
|
1023
|
1023
|
* @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
1024
|
1024
|
*/ |
|
1025
|
1025
|
public function handle_empty_fields_generic( $fields_array ) { |
|
1026
|
|
- foreach( $fields_array as $field ) { |
|
|
1026
|
+ foreach ( $fields_array as $field ) { |
|
1027
|
1027
|
if ( $field === null ) { |
|
1028
|
1028
|
return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
|
1029
|
1029
|
} |
|
@@ -1089,7 +1089,7 @@ discard block |
|
|
block discarded – undo |
|
1089
|
1089
|
|
|
1090
|
1090
|
// Append our 'send-update-email' link and text |
|
1091
|
1091
|
$response .= $link_start_tag; |
|
1092
|
|
- $response .= $this->handle_updating_existing_user_link_message; |
|
|
1092
|
+ $response .= $this->handle_updating_existing_user_link_message; |
|
1093
|
1093
|
$response .= $link_close_tag; |
|
1094
|
1094
|
|
|
1095
|
1095
|
// Check for a user-defined message |
|
@@ -1112,14 +1112,14 @@ discard block |
|
|
block discarded – undo |
|
1112
|
1112
|
*/ |
|
1113
|
1113
|
protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
|
1114
|
1114
|
|
|
1115
|
|
- switch( $slug ) { |
|
|
1115
|
+ switch ( $slug ) { |
|
1116
|
1116
|
case 'already-subscribed': |
|
1117
|
1117
|
|
|
1118
|
1118
|
// Check if this error message exists |
|
1119
|
|
- if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
|
1119
|
+ if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
1120
|
1120
|
|
|
1121
|
1121
|
// Check if the substring (that we replace) '[email]' is located in the string and replace it |
|
1122
|
|
- $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
|
1122
|
+ $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
1123
|
1123
|
} |
|
1124
|
1124
|
|
|
1125
|
1125
|
/** |
|
@@ -1138,13 +1138,13 @@ discard block |
|
|
block discarded – undo |
|
1138
|
1138
|
case 'update-link': |
|
1139
|
1139
|
|
|
1140
|
1140
|
// Check if this error message exists |
|
1141
|
|
- if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
|
1141
|
+ if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
1142
|
1142
|
|
|
1143
|
1143
|
// Check if the substring (that we replace) '[link]' is located in the string and replace it |
|
1144
|
|
- $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
|
1144
|
+ $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
1145
|
1145
|
|
|
1146
|
1146
|
// Remove [/link] |
|
1147
|
|
- $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
|
1147
|
+ $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
1148
|
1148
|
} |
|
1149
|
1149
|
|
|
1150
|
1150
|
/** |
|
@@ -1163,8 +1163,8 @@ discard block |
|
|
block discarded – undo |
|
1163
|
1163
|
case 'success': |
|
1164
|
1164
|
|
|
1165
|
1165
|
// 'success' is the user-defined success message for double opt-in |
|
1166
|
|
- if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
1167
|
|
- $response_text = $this->error_messages['success']; |
|
|
1166
|
+ if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
|
1167
|
+ $response_text = $this->error_messages[ 'success' ]; |
|
1168
|
1168
|
} |
|
1169
|
1169
|
|
|
1170
|
1170
|
/** |
|
@@ -1183,8 +1183,8 @@ discard block |
|
|
block discarded – undo |
|
1183
|
1183
|
|
|
1184
|
1184
|
case 'success-single-optin': |
|
1185
|
1185
|
|
|
1186
|
|
- if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
1187
|
|
- $response_text = $this->error_messages['success-single-optin']; |
|
|
1186
|
+ if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
|
1187
|
+ $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
1188
|
1188
|
} |
|
1189
|
1189
|
|
|
1190
|
1190
|
/** |
|
@@ -1203,8 +1203,8 @@ discard block |
|
|
block discarded – undo |
|
1203
|
1203
|
|
|
1204
|
1204
|
case 'success-resubscribed': |
|
1205
|
1205
|
|
|
1206
|
|
- if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
1207
|
|
- $response_text = $this->error_messages['success-resubscribed']; |
|
|
1206
|
+ if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
|
1207
|
+ $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
1208
|
1208
|
} |
|
1209
|
1209
|
|
|
1210
|
1210
|
/** |
|
@@ -1226,8 +1226,8 @@ discard block |
|
|
block discarded – undo |
|
1226
|
1226
|
$original_response_text = $response_text; |
|
1227
|
1227
|
$user_defined_response_text = ''; |
|
1228
|
1228
|
|
|
1229
|
|
- if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
1230
|
|
- $user_defined_response_text = $this->error_messages['general-error']; |
|
|
1229
|
+ if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
|
1230
|
+ $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
1231
|
1231
|
} |
|
1232
|
1232
|
|
|
1233
|
1233
|
/** |
|
@@ -1289,7 +1289,7 @@ discard block |
|
|
block discarded – undo |
|
1289
|
1289
|
} else { |
|
1290
|
1290
|
global $process_submission_response; |
|
1291
|
1291
|
|
|
1292
|
|
- $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
|
1292
|
+ $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
1293
|
1293
|
$process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
|
1294
|
1294
|
} |
|
1295
|
1295
|
} |
|
@@ -1342,8 +1342,8 @@ discard block |
|
|
block discarded – undo |
|
1342
|
1342
|
// Add additional fields we've been supplied |
|
1343
|
1343
|
if ( ! empty( $additional_fields ) ) { |
|
1344
|
1344
|
|
|
1345
|
|
- foreach( $additional_fields as $key => $value ) { |
|
1346
|
|
- $response_array[$key] = $value; |
|
|
1345
|
+ foreach ( $additional_fields as $key => $value ) { |
|
|
1346
|
+ $response_array[ $key ] = $value; |
|
1347
|
1347
|
} |
|
1348
|
1348
|
} |
|
1349
|
1349
|
|
|
@@ -1374,20 +1374,20 @@ discard block |
|
|
block discarded – undo |
|
1374
|
1374
|
); |
|
1375
|
1375
|
|
|
1376
|
1376
|
// Let's confirm we have a value before trying to use it |
|
1377
|
|
- $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
|
1377
|
+ $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
1378
|
1378
|
|
|
1379
|
1379
|
// Check the redirect flag |
|
1380
|
1380
|
if ( '1' === $redirect_setting ) { |
|
1381
|
1381
|
|
|
1382
|
1382
|
// Supply return array with default value of 1 |
|
1383
|
|
- $redirect_array['redirection'] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
|
1383
|
+ $redirect_array[ 'redirection' ] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
1384
|
1384
|
|
|
1385
|
1385
|
// Let's confirm we have redirect_page/custom_redirect_url/new_window values |
|
1386
|
|
- $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
1387
|
|
- $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
1388
|
|
- $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
|
1386
|
+ $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
|
1387
|
+ $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
|
1388
|
+ $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
1389
|
1389
|
|
|
1390
|
|
- $redirect_array['new_window'] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
|
1390
|
+ $redirect_array[ 'new_window' ] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
1391
|
1391
|
|
|
1392
|
1392
|
// Check if we're redirecting to a custom_url or just the redirect_page |
|
1393
|
1393
|
$redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
|
@@ -1412,9 +1412,9 @@ discard block |
|
|
block discarded – undo |
|
1412
|
1412
|
*/ |
|
1413
|
1413
|
$redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
|
1414
|
1414
|
|
|
1415
|
|
- $redirect_array['redirect_timer'] = $redirect_timer; |
|
|
1415
|
+ $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
1416
|
1416
|
|
|
1417
|
|
- $redirect_array['redirect'] = $redirect_url; |
|
|
1417
|
+ $redirect_array[ 'redirect' ] = $redirect_url; |
|
1418
|
1418
|
} |
|
1419
|
1419
|
|
|
1420
|
1420
|
return $redirect_array; |
|
@@ -1423,7 +1423,7 @@ discard block |
|
|
block discarded – undo |
|
1423
|
1423
|
public function maybe_add_tags( $form_data, $subscriber_data ) { |
|
1424
|
1424
|
|
|
1425
|
1425
|
// Add the form's tags |
|
1426
|
|
- $form_tags = isset( $form_data['tags'] ) ? $form_data['tags'] : array(); |
|
|
1426
|
+ $form_tags = isset( $form_data[ 'tags' ] ) ? $form_data[ 'tags' ] : array(); |
|
1427
|
1427
|
$form_tags = apply_filters( 'yikes_mailchimp_subscriber_tags', $form_tags, $form_data, $this->list_id, $subscriber_data ); |
|
1428
|
1428
|
|
|
1429
|
1429
|
if ( ! empty( $form_tags ) ) { |
|
@@ -1432,7 +1432,7 @@ discard block |
|
|
block discarded – undo |
|
1432
|
1432
|
$add_tag = apply_filters( 'yikes_mailchimp_subscriber_tag_active', true, $tag, $this->list_id, $subscriber_data ); |
|
1433
|
1433
|
|
|
1434
|
1434
|
if ( $add_tag ) { |
|
1435
|
|
- $list_handler->create_member_tags( $this->list_id, $tag['id'], array( 'email_address' => $this->email ) ); |
|
|
1435
|
+ $list_handler->create_member_tags( $this->list_id, $tag[ 'id' ], array( 'email_address' => $this->email ) ); |
|
1436
|
1436
|
} |
|
1437
|
1437
|
} |
|
1438
|
1438
|
} |