|
@@ -30,54 +30,54 @@ discard block |
|
|
block discarded – undo |
|
30
|
30
|
$form_submitted = isset( $form_submitted ) ? $form_submitted : 0; |
|
31
|
31
|
|
|
32
|
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>'; |
|
|
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
|
35
|
} |
|
36
|
36
|
|
|
37
|
37
|
// if the user forgot to specify a form ID, lets kill of and warn them. |
|
38
|
|
- if( ! $atts['form'] ) { |
|
|
38
|
+ if ( ! $atts[ 'form' ] ) { |
|
39
|
39
|
return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' ); |
|
40
|
40
|
} |
|
41
|
41
|
|
|
42
|
42
|
// store our variables |
|
43
|
|
- $form_id = (int) $atts['form']; // form id (the id of the form in the database) |
|
|
43
|
+ $form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database) |
|
44
|
44
|
$interface = yikes_easy_mailchimp_extender_get_form_interface(); |
|
45
|
45
|
$form_data = $interface->get_form( $form_id ); |
|
46
|
46
|
|
|
47
|
47
|
// confirm we have some results, or return an error |
|
48
|
48
|
if ( empty( $form_data ) ) { |
|
49
|
|
- return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' ); |
|
|
49
|
+ return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' ); |
|
50
|
50
|
} |
|
51
|
51
|
|
|
52
|
52
|
/* |
|
53
|
53
|
* Check if the user wants to use reCAPTCHA Spam Prevention |
|
54
|
54
|
*/ |
|
55
|
|
- if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) { |
|
|
55
|
+ if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) { |
|
56
|
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' ) { |
|
|
57
|
+ if ( $atts[ 'recaptcha' ] != '0' ) { |
|
58
|
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§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
|
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§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
61
|
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§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
|
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§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
|
- if( ! empty( $atts['recaptcha_type'] ) ) { |
|
67
|
|
- echo $atts['recaptcha_type']; |
|
|
66
|
+ if ( ! empty( $atts[ 'recaptcha_type' ] ) ) { |
|
|
67
|
+ echo $atts[ 'recaptcha_type' ]; |
|
68
|
68
|
} |
|
69
|
69
|
|
|
70
|
70
|
// Store the site language (to load recaptcha in a specific language) |
|
71
|
71
|
$locale = get_locale(); |
|
72
|
72
|
$locale_split = explode( '_', $locale ); |
|
73
|
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 |
|
|
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
|
81
|
// Pass the shortcode parameters through a filter |
|
82
|
82
|
$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array( |
|
83
|
83
|
'language' => $lang, |
|
@@ -86,48 +86,48 @@ discard block |
|
|
block discarded – undo |
|
86
|
86
|
'size' => $size, |
|
87
|
87
|
'success_callback' => $data_callback, |
|
88
|
88
|
'expired_callback' => $expired_callback, |
|
89
|
|
- ), $atts['form'] ); |
|
|
89
|
+ ), $atts[ 'form' ] ); |
|
90
|
90
|
|
|
91
|
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' ); |
|
|
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
|
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>'; |
|
|
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
|
96
|
} |
|
97
|
97
|
} |
|
98
|
98
|
|
|
99
|
99
|
// place our results into a separate variable for easy looping |
|
100
|
|
- $additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false; |
|
|
100
|
+ $additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false; |
|
101
|
101
|
|
|
102
|
102
|
// store our options from the additional form settings array |
|
103
|
|
- $form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : ''; |
|
104
|
|
- $inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : ''; |
|
105
|
|
- $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text'; |
|
106
|
|
- $submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
107
|
|
- $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : ''; |
|
108
|
|
- $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : ''; |
|
|
103
|
+ $form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : ''; |
|
|
104
|
+ $inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : ''; |
|
|
105
|
+ $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text'; |
|
|
106
|
+ $submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
|
107
|
+ $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : ''; |
|
|
108
|
+ $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : ''; |
|
109
|
109
|
|
|
110
|
110
|
// scheuldes |
|
111
|
|
- $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false; |
|
112
|
|
- $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';; |
|
113
|
|
- $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : ''; |
|
114
|
|
- $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : ''; |
|
115
|
|
- $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : ''; |
|
|
111
|
+ $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false; |
|
|
112
|
+ $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ; |
|
|
113
|
+ $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : ''; |
|
|
114
|
+ $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : ''; |
|
|
115
|
+ $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : ''; |
|
116
|
116
|
|
|
117
|
117
|
// register required |
|
118
|
|
- $form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false; |
|
119
|
|
- $form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : ''; |
|
|
118
|
+ $form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false; |
|
|
119
|
+ $form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : ''; |
|
120
|
120
|
|
|
121
|
121
|
// store number of fields |
|
122
|
|
- $field_count = (int) count( $form_data['fields'] ); |
|
|
122
|
+ $field_count = (int) count( $form_data[ 'fields' ] ); |
|
123
|
123
|
|
|
124
|
124
|
// confirm we actually have fields, before looping |
|
125
|
|
- if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
|
125
|
+ if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
126
|
126
|
// loop over each field, if it's set to hidden -- subtract it from the field count |
|
127
|
127
|
// this throws off the layout for inline forms setup below |
|
128
|
|
- foreach ( $form_data['fields'] as $form_field ) { |
|
129
|
|
- if ( isset( $form_field['hide'] ) && (string) $form_field['hide'] === '1' ) { |
|
130
|
|
- $field_count --; |
|
|
128
|
+ foreach ( $form_data[ 'fields' ] as $form_field ) { |
|
|
129
|
+ if ( isset( $form_field[ 'hide' ] ) && (string) $form_field[ 'hide' ] === '1' ) { |
|
|
130
|
+ $field_count--; |
|
131
|
131
|
} |
|
132
|
132
|
} |
|
133
|
133
|
} |
|
@@ -136,8 +136,8 @@ discard block |
|
|
block discarded – undo |
|
136
|
136
|
* If login is required, abort |
|
137
|
137
|
* @since 6.0.3.8 |
|
138
|
138
|
*/ |
|
139
|
|
- if( $form_login_required ) { |
|
140
|
|
- if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
|
139
|
+ if ( $form_login_required ) { |
|
|
140
|
+ if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
141
|
141
|
ob_start(); |
|
142
|
142
|
?> |
|
143
|
143
|
<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required"> |
|
@@ -153,19 +153,19 @@ discard block |
|
|
block discarded – undo |
|
153
|
153
|
* Check if schedule is set for this form |
|
154
|
154
|
* @since 6.0.3.8 |
|
155
|
155
|
*/ |
|
156
|
|
- if( $form_schedule_state ) { |
|
|
156
|
+ if ( $form_schedule_state ) { |
|
157
|
157
|
// store current date |
|
158
|
158
|
$current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
|
159
|
159
|
|
|
160
|
160
|
// the the current date is less than the form scheduled start date |
|
161
|
|
- if( $current_date < $form_schedule_start ) { |
|
|
161
|
+ if ( $current_date < $form_schedule_start ) { |
|
162
|
162
|
echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message, $form_id, $form_schedule_start ); |
|
163
|
163
|
return; |
|
164
|
164
|
// abort |
|
165
|
165
|
} |
|
166
|
166
|
|
|
167
|
167
|
// The current date is past or equal to the end date, aka form has now expired |
|
168
|
|
- if( $current_date >= $form_schedule_end ) { |
|
|
168
|
+ if ( $current_date >= $form_schedule_end ) { |
|
169
|
169
|
echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message, $form_id, $form_schedule_end ); |
|
170
|
170
|
return; |
|
171
|
171
|
// abort |
|
@@ -174,14 +174,14 @@ discard block |
|
|
block discarded – undo |
|
174
|
174
|
|
|
175
|
175
|
// setup the submit button text |
|
176
|
176
|
// shortcode parameter takes precedence over option |
|
177
|
|
- $submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text; |
|
|
177
|
+ $submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text; |
|
178
|
178
|
|
|
179
|
179
|
/* |
|
180
|
180
|
* Check for the constant to prevent styles from loading |
|
181
|
181
|
* to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php |
|
182
|
182
|
* @since 6.0.3.8 |
|
183
|
183
|
*/ |
|
184
|
|
- if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
|
184
|
+ if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
185
|
185
|
// enqueue the form styles |
|
186
|
186
|
wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css' ); |
|
187
|
187
|
} |
|
@@ -189,19 +189,19 @@ discard block |
|
|
block discarded – undo |
|
189
|
189
|
/** |
|
190
|
190
|
* Check for form inline parameter |
|
191
|
191
|
*/ |
|
192
|
|
- $form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
|
192
|
+ $form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
193
|
193
|
// recheck from our form options |
|
194
|
194
|
if ( ! $form_inline ) { |
|
195
|
|
- $form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form']; |
|
|
195
|
+ $form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ]; |
|
196
|
196
|
} |
|
197
|
197
|
|
|
198
|
198
|
/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
|
199
|
|
- if( is_user_logged_in() ) { |
|
200
|
|
- if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
|
199
|
+ if ( is_user_logged_in() ) { |
|
|
200
|
+ if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
201
|
201
|
$edit_form_link = '<span class="edit-link">'; |
|
202
|
|
- $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
|
202
|
+ $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
203
|
203
|
$edit_form_link .= '</span>'; |
|
204
|
|
- $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) ); |
|
|
204
|
+ $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) ); |
|
205
|
205
|
} else { |
|
206
|
206
|
$edit_form_link = ''; |
|
207
|
207
|
} |
|
@@ -211,16 +211,16 @@ discard block |
|
|
block discarded – undo |
|
211
|
211
|
// or else MailChimp throws errors at you |
|
212
|
212
|
// extract our array keys |
|
213
|
213
|
// @todo Remove array_keys() and in_array() usage here. |
|
214
|
|
- if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
215
|
|
- $array_keys = array_keys( $form_data['fields'] ); |
|
|
214
|
+ if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
|
215
|
+ $array_keys = array_keys( $form_data[ 'fields' ] ); |
|
216
|
216
|
// check for EMAIL in that array |
|
217
|
|
- if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) { |
|
218
|
|
- return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
|
217
|
+ if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) { |
|
|
218
|
+ return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
219
|
219
|
} |
|
220
|
220
|
} else { |
|
221
|
|
- $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
222
|
|
- if( is_user_logged_in() ) { |
|
223
|
|
- if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
|
221
|
+ $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
|
222
|
+ if ( is_user_logged_in() ) { |
|
|
223
|
+ if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
224
|
224
|
return $error . $edit_form_link; |
|
225
|
225
|
} |
|
226
|
226
|
} else { |
|
@@ -228,7 +228,7 @@ discard block |
|
|
block discarded – undo |
|
228
|
228
|
} |
|
229
|
229
|
} |
|
230
|
230
|
|
|
231
|
|
- if( $form_inline ) { |
|
|
231
|
+ if ( $form_inline ) { |
|
232
|
232
|
$field_width = (float) ( 100 / $field_count ); |
|
233
|
233
|
$submit_button_width = (float) ( 20 / $field_count ); |
|
234
|
234
|
$inline_offset = apply_filters( 'yikes-mailchimp-inline-offset', 1.0, $form_id ); |
|
@@ -293,17 +293,17 @@ discard block |
|
|
block discarded – undo |
|
293
|
293
|
* Set a custom title using custom_title="lorem ipsum" parameter in the shortcode |
|
294
|
294
|
* - This takes precedence over the title set |
|
295
|
295
|
*/ |
|
296
|
|
- if ( $atts['title'] ) { |
|
297
|
|
- if ( ! empty( $atts['custom_title'] ) ) { |
|
|
296
|
+ if ( $atts[ 'title' ] ) { |
|
|
297
|
+ if ( ! empty( $atts[ 'custom_title' ] ) ) { |
|
298
|
298
|
/** |
|
299
|
299
|
* Filter the title that is displayed through the shortcode. |
|
300
|
300
|
* |
|
301
|
301
|
* @param string $title The title to display. |
|
302
|
302
|
* @param int $form_id The form ID. |
|
303
|
303
|
*/ |
|
304
|
|
- $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ); |
|
|
304
|
+ $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ); |
|
305
|
305
|
} else { |
|
306
|
|
- $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id ); |
|
|
306
|
+ $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id ); |
|
307
|
307
|
} |
|
308
|
308
|
|
|
309
|
309
|
echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title ); |
|
@@ -313,24 +313,24 @@ discard block |
|
|
block discarded – undo |
|
313
|
313
|
* Allow users to specify a custom description for this form, no html support |
|
314
|
314
|
* @since 6.0.3.8 |
|
315
|
315
|
*/ |
|
316
|
|
- if ( $atts['description'] ) { |
|
317
|
|
- if ( ! empty( $atts['custom_description'] ) ) { |
|
|
316
|
+ if ( $atts[ 'description' ] ) { |
|
|
317
|
+ if ( ! empty( $atts[ 'custom_description' ] ) ) { |
|
318
|
318
|
/** |
|
319
|
319
|
* Filter the description that is displayed through the shortcode. |
|
320
|
320
|
* |
|
321
|
321
|
* @param string $title The title to display. |
|
322
|
322
|
* @param int $form_id The form ID. |
|
323
|
323
|
*/ |
|
324
|
|
- $description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ); |
|
|
324
|
+ $description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ); |
|
325
|
325
|
} else { |
|
326
|
|
- $description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id ); |
|
|
326
|
+ $description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id ); |
|
327
|
327
|
} |
|
328
|
328
|
|
|
329
|
329
|
echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description ); |
|
330
|
330
|
} |
|
331
|
331
|
|
|
332
|
332
|
// Check for AJAX |
|
333
|
|
- if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) { |
|
|
333
|
+ if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) { |
|
334
|
334
|
|
|
335
|
335
|
// Used in `yikes-mailchimp-redirect-url` filter |
|
336
|
336
|
// Note: as of 6.4, this is now just the post ID - not the entire post object. |
|
@@ -339,7 +339,7 @@ discard block |
|
|
block discarded – undo |
|
339
|
339
|
|
|
340
|
340
|
// enqueue our ajax script |
|
341
|
341
|
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
342
|
|
- wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
|
342
|
+ wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
343
|
343
|
wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array( |
|
344
|
344
|
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
|
345
|
345
|
'page_data' => apply_filters( 'yikes-mailchimp-page-data', $page_data, $form_id ), |
|
@@ -351,7 +351,7 @@ discard block |
|
|
block discarded – undo |
|
351
|
351
|
} |
|
352
|
352
|
|
|
353
|
353
|
// Generic JavaScript functions for interacting with the form |
|
354
|
|
- wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . 'public/js/form-submission-helpers.min.js' , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
|
354
|
+ wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . 'public/js/form-submission-helpers.min.js', array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
355
|
355
|
wp_localize_script( 'form-submission-helpers', 'form_submission_helpers', array( |
|
356
|
356
|
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
|
357
|
357
|
'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ), |
|
@@ -369,67 +369,67 @@ discard block |
|
|
block discarded – undo |
|
369
|
369
|
|
|
370
|
370
|
// render the form! |
|
371
|
371
|
?> |
|
372
|
|
- <form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
|
372
|
+ <form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
373
|
373
|
|
|
374
|
374
|
<?php |
|
375
|
375
|
// Set a default constant for hidden fields |
|
376
|
376
|
$hidden_label_count = 0; |
|
377
|
377
|
|
|
378
|
378
|
// Loop over our form fields |
|
379
|
|
- foreach( $form_data['fields'] as $field ) { |
|
|
379
|
+ foreach ( $form_data[ 'fields' ] as $field ) { |
|
380
|
380
|
// input array |
|
381
|
381
|
$field_array = array(); |
|
382
|
382
|
// label array |
|
383
|
383
|
$label_array = array(); |
|
384
|
384
|
// label classes array |
|
385
|
385
|
$label_class_array = array(); |
|
386
|
|
- if( $field['additional-classes'] != '' ) { |
|
|
386
|
+ if ( $field[ 'additional-classes' ] != '' ) { |
|
387
|
387
|
// split custom classes at spaces |
|
388
|
|
- $custom_classes = explode( ' ' , $field['additional-classes'] ); |
|
|
388
|
+ $custom_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
389
|
389
|
// check our custom class array for field-left/field-right |
|
390
|
390
|
// if it's set we need to assign it to our label and remove it from the field classes |
|
391
|
391
|
// input half left |
|
392
|
|
- if( in_array( 'field-left-half' , $custom_classes ) ) { |
|
|
392
|
+ if ( in_array( 'field-left-half', $custom_classes ) ) { |
|
393
|
393
|
// $label_array['class'] = 'class="field-left-half"'; |
|
394
|
|
- $label_class_array[] = 'field-left-half'; |
|
395
|
|
- $key = array_search( 'field-left-half' , $custom_classes ); |
|
396
|
|
- unset( $custom_classes[$key] ); |
|
|
394
|
+ $label_class_array[ ] = 'field-left-half'; |
|
|
395
|
+ $key = array_search( 'field-left-half', $custom_classes ); |
|
|
396
|
+ unset( $custom_classes[ $key ] ); |
|
397
|
397
|
} // input half right |
|
398
|
|
- if( in_array( 'field-right-half' , $custom_classes ) ) { |
|
|
398
|
+ if ( in_array( 'field-right-half', $custom_classes ) ) { |
|
399
|
399
|
// $label_array['class'] = 'class="field-right-half"'; |
|
400
|
|
- $label_class_array[] = 'field-right-half'; |
|
401
|
|
- $key = array_search( 'field-right-half' , $custom_classes ); |
|
402
|
|
- unset( $custom_classes[$key] ); |
|
|
400
|
+ $label_class_array[ ] = 'field-right-half'; |
|
|
401
|
+ $key = array_search( 'field-right-half', $custom_classes ); |
|
|
402
|
+ unset( $custom_classes[ $key ] ); |
|
403
|
403
|
} // input thirds (1/3 width, floated left) |
|
404
|
|
- if( in_array( 'field-third' , $custom_classes ) ) { |
|
|
404
|
+ if ( in_array( 'field-third', $custom_classes ) ) { |
|
405
|
405
|
// $label_array['class'] = 'class="field-third"'; |
|
406
|
|
- $label_class_array[] = 'field-third'; |
|
407
|
|
- $key = array_search( 'field-third' , $custom_classes ); |
|
408
|
|
- unset( $custom_classes[$key] ); |
|
|
406
|
+ $label_class_array[ ] = 'field-third'; |
|
|
407
|
+ $key = array_search( 'field-third', $custom_classes ); |
|
|
408
|
+ unset( $custom_classes[ $key ] ); |
|
409
|
409
|
} // 2 column radio |
|
410
|
|
- if( in_array( 'option-2-col' , $custom_classes ) ) { |
|
|
410
|
+ if ( in_array( 'option-2-col', $custom_classes ) ) { |
|
411
|
411
|
// $label_array['class'] = 'class="option-2-col"'; |
|
412
|
|
- $label_class_array[] = 'option-2-col'; |
|
413
|
|
- $key = array_search( 'option-2-col' , $custom_classes ); |
|
414
|
|
- unset( $custom_classes[$key] ); |
|
|
412
|
+ $label_class_array[ ] = 'option-2-col'; |
|
|
413
|
+ $key = array_search( 'option-2-col', $custom_classes ); |
|
|
414
|
+ unset( $custom_classes[ $key ] ); |
|
415
|
415
|
} // 3 column radio |
|
416
|
|
- if( in_array( 'option-3-col' , $custom_classes ) ) { |
|
|
416
|
+ if ( in_array( 'option-3-col', $custom_classes ) ) { |
|
417
|
417
|
// $label_array['class'] = 'class="option-3-col"'; |
|
418
|
|
- $label_class_array[] = 'option-3-col'; |
|
419
|
|
- $key = array_search( 'option-3-col' , $custom_classes ); |
|
420
|
|
- unset( $custom_classes[$key] ); |
|
|
418
|
+ $label_class_array[ ] = 'option-3-col'; |
|
|
419
|
+ $key = array_search( 'option-3-col', $custom_classes ); |
|
|
420
|
+ unset( $custom_classes[ $key ] ); |
|
421
|
421
|
} // 4 column radio |
|
422
|
|
- if( in_array( 'option-4-col' , $custom_classes ) ) { |
|
|
422
|
+ if ( in_array( 'option-4-col', $custom_classes ) ) { |
|
423
|
423
|
// $label_array['class'] = 'class="option-4-col"'; |
|
424
|
|
- $label_class_array[] = 'option-4-col'; |
|
425
|
|
- $key = array_search( 'option-4-col' , $custom_classes ); |
|
426
|
|
- unset( $custom_classes[$key] ); |
|
|
424
|
+ $label_class_array[ ] = 'option-4-col'; |
|
|
425
|
+ $key = array_search( 'option-4-col', $custom_classes ); |
|
|
426
|
+ unset( $custom_classes[ $key ] ); |
|
427
|
427
|
} // inline radio & checkboxes etc |
|
428
|
|
- if( in_array( 'option-inline' , $custom_classes ) ) { |
|
|
428
|
+ if ( in_array( 'option-inline', $custom_classes ) ) { |
|
429
|
429
|
// $label_array['class'] = 'class="option-inline"'; |
|
430
|
|
- $label_class_array[] = 'option-inline'; |
|
431
|
|
- $key = array_search( 'option-inline' , $custom_classes ); |
|
432
|
|
- unset( $custom_classes[$key] ); |
|
|
430
|
+ $label_class_array[ ] = 'option-inline'; |
|
|
431
|
+ $key = array_search( 'option-inline', $custom_classes ); |
|
|
432
|
+ unset( $custom_classes[ $key ] ); |
|
433
|
433
|
} |
|
434
|
434
|
} else { |
|
435
|
435
|
$custom_classes = array(); |
|
@@ -437,19 +437,19 @@ discard block |
|
|
block discarded – undo |
|
437
|
437
|
|
|
438
|
438
|
// if the form is set to inline, add the inline class to our labels |
|
439
|
439
|
// since @6.0.3.8 |
|
440
|
|
- if( $form_inline ) { |
|
441
|
|
- $label_class_array[] = 'label-inline'; |
|
|
440
|
+ if ( $form_inline ) { |
|
|
441
|
+ $label_class_array[ ] = 'label-inline'; |
|
442
|
442
|
} |
|
443
|
443
|
|
|
444
|
|
- if( isset( $field['hide-label'] ) ) { |
|
445
|
|
- if( absint( $field['hide-label'] ) === 1 ) { |
|
|
444
|
+ if ( isset( $field[ 'hide-label' ] ) ) { |
|
|
445
|
+ if ( absint( $field[ 'hide-label' ] ) === 1 ) { |
|
446
|
446
|
$hidden_label_count++; |
|
447
|
|
- $custom_classes[] = 'field-no-label'; |
|
|
447
|
+ $custom_classes[ ] = 'field-no-label'; |
|
448
|
448
|
} |
|
449
|
449
|
} |
|
450
|
450
|
|
|
451
|
451
|
/* Store tag variable based on field type */ |
|
452
|
|
- if( isset( $field['merge'] ) ) { |
|
|
452
|
+ if ( isset( $field[ 'merge' ] ) ) { |
|
453
|
453
|
$group = ''; |
|
454
|
454
|
$tag = 'merge'; |
|
455
|
455
|
} else { |
|
@@ -459,28 +459,28 @@ discard block |
|
|
block discarded – undo |
|
459
|
459
|
|
|
460
|
460
|
// build up our array |
|
461
|
461
|
$field_id_string = 'yikes-easy-mc-form-' . $form_id . '-' . $field[ $tag ]; |
|
462
|
|
- $field_array['id'] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
463
|
|
- $field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
464
|
|
- $field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : ''; |
|
465
|
|
- $field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' . esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" '; |
|
|
462
|
+ $field_array[ 'id' ] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
|
463
|
+ $field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
|
464
|
+ $field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : ''; |
|
|
465
|
+ $field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" '; |
|
466
|
466
|
|
|
467
|
467
|
// email must always be required and visible |
|
468
|
|
- if( $field['type'] == 'email' ) { |
|
469
|
|
- $field_array['required'] = 'required="required"'; |
|
470
|
|
- $label_array['visible'] = ''; |
|
471
|
|
- $label_class_array[] = $field['merge'] . '-label'; |
|
472
|
|
- $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
|
468
|
+ if ( $field[ 'type' ] == 'email' ) { |
|
|
469
|
+ $field_array[ 'required' ] = 'required="required"'; |
|
|
470
|
+ $label_array[ 'visible' ] = ''; |
|
|
471
|
+ $label_class_array[ ] = $field[ 'merge' ] . '-label'; |
|
|
472
|
+ $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
473
|
473
|
} else { |
|
474
|
|
- $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
475
|
|
- $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
476
|
|
- $label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label'; |
|
477
|
|
- if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
|
474
|
+ $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
|
475
|
+ $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
|
476
|
+ $label_class_array[ ] = ( $tag === 'merge' ) ? $field[ 'merge' ] . '-label' : $field[ 'group_id' ] . '-label'; |
|
|
477
|
+ if ( isset( $field[ 'require' ] ) ) $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
478
|
478
|
} |
|
479
|
479
|
|
|
480
|
480
|
// if both hide label and hide field are checked, we gotta hide the field! |
|
481
|
|
- if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
482
|
|
- if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
483
|
|
- $field_array['visible'] = 'style="display:none;"'; |
|
|
481
|
+ if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
|
482
|
+ if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
|
483
|
+ $field_array[ 'visible' ] = 'style="display:none;"'; |
|
484
|
484
|
} |
|
485
|
485
|
} |
|
486
|
486
|
|
|
@@ -488,20 +488,20 @@ discard block |
|
|
block discarded – undo |
|
488
|
488
|
$label_class_array = function_exists( 'sanitize_html_class' ) ? array_map( 'sanitize_html_class', $label_class_array ) : $label_class_array; |
|
489
|
489
|
|
|
490
|
490
|
// Turn the clases into a string |
|
491
|
|
- $label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
|
491
|
+ $label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
492
|
492
|
|
|
493
|
493
|
// Filter the field array data |
|
494
|
494
|
$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id ); |
|
495
|
495
|
|
|
496
|
496
|
/* Loop Over Standard Fields (aka merge variables) */ |
|
497
|
|
- if( isset( $field['merge'] ) ) { |
|
|
497
|
+ if ( isset( $field[ 'merge' ] ) ) { |
|
498
|
498
|
|
|
499
|
499
|
// Handle the Description logic in one spot, here: |
|
500
|
|
- $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
501
|
|
- $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
|
500
|
+ $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
|
501
|
+ $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
502
|
502
|
if ( $show_description === true ) { |
|
503
|
|
- $description = '<p class="form-field-description" id="form-field-description-' . $field['merge'] . '">'; |
|
504
|
|
- $description .= apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
|
503
|
+ $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'merge' ] . '">'; |
|
|
504
|
+ $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
505
|
505
|
$description .= '</p>'; |
|
506
|
506
|
|
|
507
|
507
|
/** |
|
@@ -513,11 +513,11 @@ discard block |
|
|
block discarded – undo |
|
513
|
513
|
* @param string | $field['description'] | The field's description text |
|
514
|
514
|
* @param int | $form_id |
|
515
|
515
|
*/ |
|
516
|
|
- $description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
|
516
|
+ $description = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
517
|
517
|
} |
|
518
|
518
|
|
|
519
|
519
|
// loop over our fields by Type |
|
520
|
|
- switch ( $field['type'] ) { |
|
|
520
|
+ switch ( $field[ 'type' ] ) { |
|
521
|
521
|
|
|
522
|
522
|
default: |
|
523
|
523
|
case 'email': |
|
@@ -525,24 +525,24 @@ discard block |
|
|
block discarded – undo |
|
525
|
525
|
case 'number': |
|
526
|
526
|
|
|
527
|
527
|
// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
|
528
|
|
- $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
|
528
|
+ $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
529
|
529
|
$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
|
530
|
|
- $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
|
530
|
+ $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
531
|
531
|
|
|
532
|
532
|
?> |
|
533
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
533
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
534
|
534
|
|
|
535
|
535
|
<!-- dictate label visibility --> |
|
536
|
|
- <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
537
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
538
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?> |
|
|
536
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
537
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
538
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?> |
|
539
|
539
|
</span> |
|
540
|
540
|
<?php } ?> |
|
541
|
541
|
|
|
542
|
542
|
<!-- Description Above --> |
|
543
|
543
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
544
|
544
|
|
|
545
|
|
- <input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
|
545
|
+ <input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
546
|
546
|
|
|
547
|
547
|
<!-- Description Below --> |
|
548
|
548
|
<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
|
@@ -554,23 +554,23 @@ discard block |
|
|
block discarded – undo |
|
554
|
554
|
|
|
555
|
555
|
case 'url': |
|
556
|
556
|
case 'imageurl': |
|
557
|
|
- $default_value = ( isset( $field['default'] ) ) ? $field['default'] : ''; |
|
558
|
|
- $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
|
557
|
+ $default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : ''; |
|
|
558
|
+ $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
559
|
559
|
?> |
|
560
|
560
|
|
|
561
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
561
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
562
|
562
|
|
|
563
|
563
|
<!-- dictate label visibility --> |
|
564
|
|
- <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
565
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
566
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
564
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
565
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
566
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
567
|
567
|
</span> |
|
568
|
568
|
<?php } ?> |
|
569
|
569
|
|
|
570
|
570
|
<!-- Description Above --> |
|
571
|
571
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
572
|
572
|
|
|
573
|
|
- <input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
|
573
|
+ <input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
574
|
574
|
|
|
575
|
575
|
<!-- Description Below --> |
|
576
|
576
|
<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
|
@@ -581,24 +581,24 @@ discard block |
|
|
block discarded – undo |
|
581
|
581
|
break; |
|
582
|
582
|
|
|
583
|
583
|
case 'phone': |
|
584
|
|
- $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
585
|
|
- $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
586
|
|
- $phone_format = $field['phone_format']; |
|
|
584
|
+ $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
|
585
|
+ $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
|
586
|
+ $phone_format = $field[ 'phone_format' ]; |
|
587
|
587
|
?> |
|
588
|
588
|
|
|
589
|
|
- <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
589
|
+ <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
590
|
590
|
|
|
591
|
591
|
<!-- dictate label visibility --> |
|
592
|
|
- <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
593
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
594
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
592
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
593
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
594
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
595
|
595
|
</span> |
|
596
|
596
|
<?php } ?> |
|
597
|
597
|
|
|
598
|
598
|
<!-- Description Above --> |
|
599
|
599
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
600
|
600
|
|
|
601
|
|
- <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
|
601
|
+ <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
602
|
602
|
|
|
603
|
603
|
<!-- Description Below --> |
|
604
|
604
|
<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
|
@@ -608,23 +608,23 @@ discard block |
|
|
block discarded – undo |
|
608
|
608
|
break; |
|
609
|
609
|
|
|
610
|
610
|
case 'zip': |
|
611
|
|
- $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
612
|
|
- $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
|
611
|
+ $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
|
612
|
+ $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
613
|
613
|
|
|
614
|
614
|
?> |
|
615
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
615
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
616
|
616
|
|
|
617
|
617
|
<!-- dictate label visibility --> |
|
618
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
619
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
620
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
618
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
619
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
620
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
621
|
621
|
</span> |
|
622
|
622
|
<?php } ?> |
|
623
|
623
|
|
|
624
|
624
|
<!-- Description Above --> |
|
625
|
625
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
626
|
626
|
|
|
627
|
|
- <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
|
627
|
+ <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
628
|
628
|
|
|
629
|
629
|
<!-- Description Below --> |
|
630
|
630
|
<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
|
@@ -637,7 +637,7 @@ discard block |
|
|
block discarded – undo |
|
637
|
637
|
case 'address': |
|
638
|
638
|
|
|
639
|
639
|
// required fields |
|
640
|
|
- $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
|
|
640
|
+ $required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' ); |
|
641
|
641
|
|
|
642
|
642
|
/** |
|
643
|
643
|
* Filter to control the default country (the option pre-selected in the country dropdown). |
|
@@ -653,55 +653,55 @@ discard block |
|
|
block discarded – undo |
|
653
|
653
|
if ( $show_description === true && $description_above === true ) { echo $description; } |
|
654
|
654
|
|
|
655
|
655
|
// Placeholder logic |
|
656
|
|
- if ( ! empty( $field_array['placeholder'] ) ) { |
|
|
656
|
+ if ( ! empty( $field_array[ 'placeholder' ] ) ) { |
|
657
|
657
|
|
|
658
|
658
|
$use_address_placeholder = true; |
|
659
|
659
|
|
|
660
|
660
|
// Don't use the address field's array placeholder - use the custom placeholder |
|
661
|
|
- unset( $field_array['placeholder'] ); |
|
|
661
|
+ unset( $field_array[ 'placeholder' ] ); |
|
662
|
662
|
} |
|
663
|
663
|
|
|
664
|
664
|
// store number for looping |
|
665
|
665
|
$x = 1; |
|
666
|
|
- foreach( $required_fields as $type => $label ) { |
|
|
666
|
+ foreach ( $required_fields as $type => $label ) { |
|
667
|
667
|
|
|
668
|
668
|
// set the field names for the address fields |
|
669
|
|
- $field_array['name'] = 'name="' . $field[$tag] . '[' . $type . ']' . '"'; |
|
|
669
|
+ $field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"'; |
|
670
|
670
|
|
|
671
|
671
|
// Set the placeholder value if we need to |
|
672
|
672
|
$placeholder = isset( $use_address_placeholder ) ? apply_filters( 'yikes-mailchimp-address-' . $type . '-placeholder', ucwords( $label ) ) : ''; |
|
673
|
673
|
|
|
674
|
674
|
// reset the label classes for left-half/right-half for addresses |
|
675
|
|
- if( isset( $label_array['class'] ) ) { |
|
|
675
|
+ if ( isset( $label_array[ 'class' ] ) ) { |
|
676
|
676
|
if ( $x % 2 == 0 ) { |
|
677
|
|
- $label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] ); |
|
|
677
|
+ $label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] ); |
|
678
|
678
|
} else { |
|
679
|
|
- $label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] ); |
|
|
679
|
+ $label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] ); |
|
680
|
680
|
} |
|
681
|
681
|
} |
|
682
|
682
|
|
|
683
|
683
|
// Never force addr2 to be required |
|
684
|
684
|
if ( $type === 'addr2' ) { |
|
685
|
|
- $field_array['required'] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
|
685
|
+ $field_array[ 'required' ] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
686
|
686
|
} |
|
687
|
687
|
|
|
688
|
|
- switch( $type ) { |
|
|
688
|
+ switch ( $type ) { |
|
689
|
689
|
|
|
690
|
690
|
default: |
|
691
|
691
|
case 'addr1': |
|
692
|
692
|
case 'addr2': |
|
693
|
693
|
case 'city': |
|
694
|
694
|
?> |
|
695
|
|
- <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
695
|
+ <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
696
|
696
|
|
|
697
|
697
|
<!-- dictate label visibility --> |
|
698
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
699
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
700
|
|
- <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
|
698
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
699
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
700
|
+ <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
701
|
701
|
</span> |
|
702
|
702
|
<?php } ?> |
|
703
|
703
|
|
|
704
|
|
- <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if( isset( $_POST[$field['merge']][$type] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']][$type] ); } ?>"> |
|
|
704
|
+ <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ][ $type ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ][ $type ] ); } ?>"> |
|
705
|
705
|
|
|
706
|
706
|
</label> |
|
707
|
707
|
<?php |
|
@@ -710,16 +710,16 @@ discard block |
|
|
block discarded – undo |
|
710
|
710
|
|
|
711
|
711
|
case 'state': |
|
712
|
712
|
?> |
|
713
|
|
- <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"> |
|
|
713
|
+ <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"> |
|
714
|
714
|
|
|
715
|
715
|
<!-- dictate label visibility --> |
|
716
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
717
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
718
|
|
- <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
|
716
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
717
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
718
|
+ <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
719
|
719
|
</span> |
|
720
|
720
|
<?php } ?> |
|
721
|
721
|
|
|
722
|
|
- <select <?php echo implode( ' ' , $field_array ); ?>> |
|
|
722
|
+ <select <?php echo implode( ' ', $field_array ); ?>> |
|
723
|
723
|
<?php |
|
724
|
724
|
$state_and_province_list = file_get_contents( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-and-province-dropdown.php' ); |
|
725
|
725
|
/** |
|
@@ -745,21 +745,21 @@ discard block |
|
|
block discarded – undo |
|
745
|
745
|
case 'zip': |
|
746
|
746
|
|
|
747
|
747
|
?> |
|
748
|
|
- <label for="<?php echo esc_attr( $field['merge'] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
|
748
|
+ <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
749
|
749
|
|
|
750
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
751
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
752
|
|
- <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
|
750
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
751
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
752
|
+ <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
753
|
753
|
</span> |
|
754
|
754
|
<?php } ?> |
|
755
|
755
|
|
|
756
|
756
|
<?php |
|
757
|
757
|
// If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently... |
|
758
|
|
- if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
759
|
|
- if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) { |
|
760
|
|
- $zip_value = $_POST[$field['merge']]['zip']; |
|
|
758
|
+ if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
|
759
|
+ if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) { |
|
|
760
|
+ $zip_value = $_POST[ $field[ 'merge' ] ][ 'zip' ]; |
|
761
|
761
|
} else { |
|
762
|
|
- $zip_value = $_POST[$field['merge']]; |
|
|
762
|
+ $zip_value = $_POST[ $field[ 'merge' ] ]; |
|
763
|
763
|
} |
|
764
|
764
|
} else { |
|
765
|
765
|
|
|
@@ -779,7 +779,7 @@ discard block |
|
|
block discarded – undo |
|
779
|
779
|
} |
|
780
|
780
|
?> |
|
781
|
781
|
|
|
782
|
|
- <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
|
782
|
+ <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
783
|
783
|
|
|
784
|
784
|
</label> |
|
785
|
785
|
<?php |
|
@@ -789,16 +789,16 @@ discard block |
|
|
block discarded – undo |
|
789
|
789
|
case 'country': |
|
790
|
790
|
?> |
|
791
|
791
|
|
|
792
|
|
- <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
792
|
+ <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
793
|
793
|
|
|
794
|
794
|
<!-- dictate label visibility --> |
|
795
|
|
- <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
796
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
797
|
|
- <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
|
795
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
796
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
797
|
+ <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
798
|
798
|
</span> |
|
799
|
799
|
<?php } ?> |
|
800
|
800
|
|
|
801
|
|
- <select <?php echo implode( ' ' , $field_array ); ?> data-country="true"> |
|
|
801
|
+ <select <?php echo implode( ' ', $field_array ); ?> data-country="true"> |
|
802
|
802
|
<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?> |
|
803
|
803
|
</select> |
|
804
|
804
|
</label> |
|
@@ -844,40 +844,40 @@ discard block |
|
|
block discarded – undo |
|
844
|
844
|
wp_register_script( 'yikes-datepicker-scripts', YIKES_MC_URL . 'public/js/yikes-datepicker-scripts.min.js', array( 'jquery-ui-datepicker' ), YIKES_MC_VERSION, false ); |
|
845
|
845
|
wp_localize_script( 'yikes-datepicker-scripts', 'datepicker_settings', $datepicker_options ); |
|
846
|
846
|
wp_enqueue_script( 'yikes-datepicker-scripts' ); |
|
847
|
|
- wp_enqueue_style( 'jquery-datepicker-styles' , YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
848
|
|
- wp_enqueue_style( 'yikes-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
|
847
|
+ wp_enqueue_style( 'jquery-datepicker-styles', YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
|
848
|
+ wp_enqueue_style( 'yikes-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
849
|
849
|
|
|
850
|
|
- switch ( $field['type'] ) { |
|
|
850
|
+ switch ( $field[ 'type' ] ) { |
|
851
|
851
|
default: |
|
852
|
852
|
case 'date': |
|
853
|
|
- $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yyyy'; |
|
|
853
|
+ $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yyyy'; |
|
854
|
854
|
break; |
|
855
|
855
|
|
|
856
|
856
|
case 'birthday': |
|
857
|
|
- $date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd'; |
|
|
857
|
+ $date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd'; |
|
858
|
858
|
break; |
|
859
|
859
|
} |
|
860
|
860
|
|
|
861
|
|
- $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
862
|
|
- $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
|
861
|
+ $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
|
862
|
+ $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
863
|
863
|
|
|
864
|
864
|
// store empty number for looping |
|
865
|
865
|
$x = 0; |
|
866
|
866
|
|
|
867
|
867
|
?> |
|
868
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
868
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
869
|
869
|
|
|
870
|
870
|
<!-- dictate label visibility --> |
|
871
|
|
- <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
872
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
873
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
871
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
872
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
873
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
874
|
874
|
</span> |
|
875
|
875
|
<?php } ?> |
|
876
|
876
|
|
|
877
|
877
|
<!-- Description Above --> |
|
878
|
878
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
879
|
879
|
|
|
880
|
|
- <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 esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
|
880
|
+ <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 esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
881
|
881
|
|
|
882
|
882
|
<!-- Description Below --> |
|
883
|
883
|
<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
|
@@ -888,26 +888,26 @@ discard block |
|
|
block discarded – undo |
|
888
|
888
|
break; |
|
889
|
889
|
|
|
890
|
890
|
case 'dropdown': |
|
891
|
|
- $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
892
|
|
- $default_choice = is_array( $field['default_choice'] ) ? $field['default_choice'] : array( $field['default_choice'] ); |
|
|
891
|
+ $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
|
892
|
+ $default_choice = is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : array( $field[ 'default_choice' ] ); |
|
893
|
893
|
|
|
894
|
894
|
// store empty number for looping |
|
895
|
895
|
$x = 0; |
|
896
|
896
|
?> |
|
897
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
897
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
898
|
898
|
<!-- dictate label visibility --> |
|
899
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
900
|
|
- <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
901
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
899
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
900
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
|
901
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
902
|
902
|
</span> |
|
903
|
903
|
<?php } |
|
904
|
904
|
|
|
905
|
905
|
// decode for looping |
|
906
|
|
- $choices = json_decode( $field['choices'], true ); |
|
|
906
|
+ $choices = json_decode( $field[ 'choices' ], true ); |
|
907
|
907
|
|
|
908
|
908
|
// If the form was submitted, but failed, let's default to the chosen option |
|
909
|
|
- if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
910
|
|
- $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
|
909
|
+ if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
|
910
|
+ $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
911
|
911
|
} |
|
912
|
912
|
|
|
913
|
913
|
?> |
|
@@ -915,11 +915,11 @@ discard block |
|
|
block discarded – undo |
|
915
|
915
|
<!-- Description Above --> |
|
916
|
916
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
917
|
917
|
|
|
918
|
|
- <select <?php echo implode( ' ' , $field_array ); ?>> |
|
|
918
|
+ <select <?php echo implode( ' ', $field_array ); ?>> |
|
919
|
919
|
<?php |
|
920
|
920
|
$no_default_name = apply_filters( 'yikes-mailchimp-dropdown-field-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
|
921
|
921
|
echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
|
922
|
|
- foreach( $choices as $choice ) { ?> |
|
|
922
|
+ foreach ( $choices as $choice ) { ?> |
|
923
|
923
|
<option |
|
924
|
924
|
value="<?php echo esc_attr( $choice ); ?>" |
|
925
|
925
|
<?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'selected="selected"'; } ?>> |
|
@@ -942,17 +942,17 @@ discard block |
|
|
block discarded – undo |
|
942
|
942
|
case 'radio': |
|
943
|
943
|
case 'checkbox': |
|
944
|
944
|
// remove the ID (as to not assign the same ID to every radio button) |
|
945
|
|
- unset( $field_array['id'] ); |
|
946
|
|
- $choices = json_decode( $field['choices'], true ); |
|
|
945
|
+ unset( $field_array[ 'id' ] ); |
|
|
946
|
+ $choices = json_decode( $field[ 'choices' ], true ); |
|
947
|
947
|
|
|
948
|
948
|
// assign a default choice |
|
949
|
|
- $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
950
|
|
- $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? $field['default_choice'] : $choices[0]; |
|
|
949
|
+ $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
|
950
|
+ $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : $choices[ 0 ]; |
|
951
|
951
|
$default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
|
952
|
952
|
|
|
953
|
953
|
// If the form was submitted, but failed, let's default to the chosen option |
|
954
|
|
- if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
955
|
|
- $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
|
954
|
+ if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
|
955
|
+ $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
956
|
956
|
} |
|
957
|
957
|
|
|
958
|
958
|
$count = count( $choices ); |
|
@@ -960,29 +960,29 @@ discard block |
|
|
block discarded – undo |
|
960
|
960
|
$x = 0; |
|
961
|
961
|
|
|
962
|
962
|
?> |
|
963
|
|
- <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
963
|
+ <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
964
|
964
|
|
|
965
|
965
|
<!-- dictate label visibility --> |
|
966
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
967
|
|
- <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label"> |
|
968
|
|
- <?php echo esc_attr( apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label', stripslashes( $field['label'] ) ) ); ?> |
|
|
966
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
967
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label"> |
|
|
968
|
+ <?php echo esc_attr( apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', stripslashes( $field[ 'label' ] ) ) ); ?> |
|
969
|
969
|
</span> |
|
970
|
970
|
<?php } |
|
971
|
971
|
|
|
972
|
972
|
// <!-- Description Above --> |
|
973
|
973
|
if ( $show_description === true && $description_above === true ) { echo $description; } |
|
974
|
974
|
|
|
975
|
|
- foreach( $choices as $choice ) { |
|
|
975
|
+ foreach ( $choices as $choice ) { |
|
976
|
976
|
?> |
|
977
|
|
- <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 } ?>"> |
|
|
977
|
+ <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 } ?>"> |
|
978
|
978
|
<input |
|
979
|
|
- type="<?php echo esc_attr( $field['type'] ); ?>" |
|
980
|
|
- name="<?php echo esc_attr( $field['merge'] ); ?>" |
|
981
|
|
- id="<?php echo esc_attr( $field['merge'] . '-' . $i ); ?>" |
|
|
979
|
+ type="<?php echo esc_attr( $field[ 'type' ] ); ?>" |
|
|
980
|
+ name="<?php echo esc_attr( $field[ 'merge' ] ); ?>" |
|
|
981
|
+ id="<?php echo esc_attr( $field[ 'merge' ] . '-' . $i ); ?>" |
|
982
|
982
|
<?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'checked="checked"'; } ?> |
|
983
|
|
- <?php echo $field_array['required']; ?> |
|
|
983
|
+ <?php echo $field_array[ 'required' ]; ?> |
|
984
|
984
|
value="<?php echo esc_attr( $choice ); ?>"> |
|
985
|
|
- <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
|
985
|
+ <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
986
|
986
|
</label> |
|
987
|
987
|
<?php |
|
988
|
988
|
$i++; |
|
@@ -1003,11 +1003,11 @@ discard block |
|
|
block discarded – undo |
|
1003
|
1003
|
/**** Interest Groups ****/ |
|
1004
|
1004
|
|
|
1005
|
1005
|
// Handle the Description logic in one spot, here: |
|
1006
|
|
- $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
1007
|
|
- $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
|
1006
|
+ $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
|
1007
|
+ $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
1008
|
1008
|
if ( $show_description === true ) { |
|
1009
|
|
- $description = '<p class="form-field-description" id="form-field-description-' . $field['group_id'] . '">'; |
|
1010
|
|
- $description .= apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
|
1009
|
+ $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'group_id' ] . '">'; |
|
|
1010
|
+ $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
1011
|
1011
|
$description .= '</p>'; |
|
1012
|
1012
|
|
|
1013
|
1013
|
/** |
|
@@ -1019,26 +1019,26 @@ discard block |
|
|
block discarded – undo |
|
1019
|
1019
|
* @param string | $field['description'] | The field's description text |
|
1020
|
1020
|
* @param int | $form_id |
|
1021
|
1021
|
*/ |
|
1022
|
|
- $description = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
|
1022
|
+ $description = apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
1023
|
1023
|
} |
|
1024
|
1024
|
|
|
1025
|
1025
|
// Get the default choice(s) from the field settings and turn them into an array if not already |
|
1026
|
|
- $default_choice = ( isset( $field['default_choice'] ) ) ? $field['default_choice'] : ''; |
|
|
1026
|
+ $default_choice = ( isset( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : ''; |
|
1027
|
1027
|
$default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
|
1028
|
1028
|
|
|
1029
|
1029
|
// get our groups |
|
1030
|
|
- $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array(); |
|
|
1030
|
+ $groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array(); |
|
1031
|
1031
|
|
|
1032
|
1032
|
$count = count( $groups ); |
|
1033
|
1033
|
|
|
1034
|
|
- if( $field['type'] === 'checkboxes' ) { |
|
|
1034
|
+ if ( $field[ 'type' ] === 'checkboxes' ) { |
|
1035
|
1035
|
$type = 'checkbox'; |
|
1036
|
|
- } else if( $field['type'] === 'radio' ) { |
|
|
1036
|
+ } else if ( $field[ 'type' ] === 'radio' ) { |
|
1037
|
1037
|
$type = 'radio'; |
|
1038
|
1038
|
} |
|
1039
|
1039
|
|
|
1040
|
1040
|
// loop over the interest group field types |
|
1041
|
|
- switch ( $field['type'] ) { |
|
|
1041
|
+ switch ( $field[ 'type' ] ) { |
|
1042
|
1042
|
|
|
1043
|
1043
|
case 'checkboxes': |
|
1044
|
1044
|
case 'radio': |
|
@@ -1046,11 +1046,11 @@ discard block |
|
|
block discarded – undo |
|
1046
|
1046
|
$x = 1; // used to find the last item of our array |
|
1047
|
1047
|
|
|
1048
|
1048
|
?> |
|
1049
|
|
- <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
1050
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
|
1049
|
+ <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
|
1050
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
1051
|
1051
|
<!-- dictate label visibility --> |
|
1052
|
|
- <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label"> |
|
1053
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
1052
|
+ <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label"> |
|
|
1053
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
1054
|
1054
|
</span> |
|
1055
|
1055
|
<?php |
|
1056
|
1056
|
} |
|
@@ -1059,8 +1059,8 @@ discard block |
|
|
block discarded – undo |
|
1059
|
1059
|
if ( $show_description === true && $description_above === true ) { echo $description; } |
|
1060
|
1060
|
|
|
1061
|
1061
|
// Display Submission Errors |
|
1062
|
|
- if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
1063
|
|
- if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) { |
|
|
1062
|
+ if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
|
1063
|
+ if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) { |
|
1064
|
1064
|
?> |
|
1065
|
1065
|
<p class="yikes-mailchimp-required-interest-group-error"> |
|
1066
|
1066
|
<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?> |
|
@@ -1072,20 +1072,20 @@ discard block |
|
|
block discarded – undo |
|
1072
|
1072
|
foreach ( $groups as $group_id => $name ) { |
|
1073
|
1073
|
|
|
1074
|
1074
|
// If the form was submitted and failed, set the submitted/chosen values as the default |
|
1075
|
|
- if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
|
1075
|
+ if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
1076
|
1076
|
|
|
1077
|
1077
|
// Format default choice as array |
|
1078
|
|
- $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
|
1078
|
+ $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
1079
|
1079
|
} |
|
1080
|
1080
|
|
|
1081
|
1081
|
?> |
|
1082
|
|
- <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>"> |
|
|
1082
|
+ <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>"> |
|
1083
|
1083
|
<input |
|
1084
|
|
- <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { if ( $field['type'] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
|
1084
|
+ <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { if ( $field[ 'type' ] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
1085
|
1085
|
class="yikes-interest-group-required" <?php } ?> |
|
1086
|
1086
|
type="<?php echo esc_attr( $type ); ?>" |
|
1087
|
|
- name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
1088
|
|
- id="<?php echo esc_attr( $field['group_id'] . '-' . $i ); ?>" |
|
|
1087
|
+ name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
|
1088
|
+ id="<?php echo esc_attr( $field[ 'group_id' ] . '-' . $i ); ?>" |
|
1089
|
1089
|
<?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
|
1090
|
1090
|
value="<?php echo esc_attr( $group_id ); ?>"> |
|
1091
|
1091
|
<?php echo esc_attr( $name ); ?> |
|
@@ -1107,32 +1107,32 @@ discard block |
|
|
block discarded – undo |
|
1107
|
1107
|
|
|
1108
|
1108
|
?> |
|
1109
|
1109
|
|
|
1110
|
|
- <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
1110
|
+ <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
1111
|
1111
|
<!-- dictate label visibility --> |
|
1112
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
1113
|
|
- <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>"> |
|
1114
|
|
- <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
1112
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
1113
|
+ <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>"> |
|
|
1114
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
1115
|
1115
|
</span> |
|
1116
|
1116
|
<?php } ?> |
|
1117
|
1117
|
|
|
1118
|
1118
|
<!-- Description Above --> |
|
1119
|
1119
|
<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
|
1120
|
1120
|
|
|
1121
|
|
- <select <?php echo implode( ' ' , $field_array ); ?>> |
|
|
1121
|
+ <select <?php echo implode( ' ', $field_array ); ?>> |
|
1122
|
1122
|
|
|
1123
|
1123
|
<?php |
|
1124
|
|
- $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
|
1124
|
+ $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
1125
|
1125
|
$no_default_name = apply_filters( 'yikes-mailchimp-dropdown-ig-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
|
1126
|
1126
|
echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
|
1127
|
1127
|
|
|
1128
|
1128
|
$i = 0; |
|
1129
|
|
- foreach( $groups as $group_id => $name ) { |
|
|
1129
|
+ foreach ( $groups as $group_id => $name ) { |
|
1130
|
1130
|
|
|
1131
|
1131
|
// If the form was submitted and failed, set the submitted/chosen values as the default |
|
1132
|
|
- if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
|
1132
|
+ if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
1133
|
1133
|
|
|
1134
|
1134
|
// Format default choice as array |
|
1135
|
|
- $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
|
1135
|
+ $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
1136
|
1136
|
} |
|
1137
|
1137
|
?> |
|
1138
|
1138
|
<option |
|
@@ -1160,12 +1160,12 @@ discard block |
|
|
block discarded – undo |
|
1160
|
1160
|
|
|
1161
|
1161
|
?> |
|
1162
|
1162
|
|
|
1163
|
|
- <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
|
1163
|
+ <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
1164
|
1164
|
|
|
1165
|
1165
|
<!-- dictate label visibility --> |
|
1166
|
|
- <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
1167
|
|
- <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
1168
|
|
- <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
|
1166
|
+ <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
|
1167
|
+ <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
|
1168
|
+ <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
1169
|
1169
|
</span> |
|
1170
|
1170
|
<?php } |
|
1171
|
1171
|
|
|
@@ -1175,17 +1175,17 @@ discard block |
|
|
block discarded – undo |
|
1175
|
1175
|
// Turn $default_choice into an array if it isn't already |
|
1176
|
1176
|
$default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
|
1177
|
1177
|
|
|
1178
|
|
- foreach( $groups as $group_id => $name ) { |
|
|
1178
|
+ foreach ( $groups as $group_id => $name ) { |
|
1179
|
1179
|
?> |
|
1180
|
|
- <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
|
1180
|
+ <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
1181
|
1181
|
<input |
|
1182
|
1182
|
type="checkbox" |
|
1183
|
|
- name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
1184
|
|
- id="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" |
|
|
1183
|
+ name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
|
1184
|
+ id="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" |
|
1185
|
1185
|
value="<?php echo esc_attr( $group_id ) ?>" |
|
1186
|
1186
|
<?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
|
1187
|
1187
|
> |
|
1188
|
|
- <?php echo esc_attr( stripslashes( str_replace( '' , '\'', $name ) ) ); ?> |
|
|
1188
|
+ <?php echo esc_attr( stripslashes( str_replace( '', '\'', $name ) ) ); ?> |
|
1189
|
1189
|
</label> |
|
1190
|
1190
|
<?php |
|
1191
|
1191
|
$i++; |
|
@@ -1206,11 +1206,11 @@ discard block |
|
|
block discarded – undo |
|
1206
|
1206
|
do_action( 'yikes-mailchimp-additional-form-fields', $form_data ); |
|
1207
|
1207
|
|
|
1208
|
1208
|
/* if we've enabled reCAPTCHA protection */ |
|
1209
|
|
- if( isset( $recaptcha_box ) ) { |
|
|
1209
|
+ if ( isset( $recaptcha_box ) ) { |
|
1210
|
1210
|
echo $recaptcha_box; |
|
1211
|
1211
|
} |
|
1212
|
|
- if( is_user_logged_in() ) { |
|
1213
|
|
- $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
|
1212
|
+ if ( is_user_logged_in() ) { |
|
|
1213
|
+ $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
1214
|
1214
|
} else { |
|
1215
|
1215
|
$admin_class = ''; |
|
1216
|
1216
|
} |
|
@@ -1220,29 +1220,29 @@ discard block |
|
|
block discarded – undo |
|
1220
|
1220
|
<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value=""> |
|
1221
|
1221
|
|
|
1222
|
1222
|
<!-- List ID --> |
|
1223
|
|
- <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data['list_id'] ); ?>"> |
|
|
1223
|
+ <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data[ 'list_id' ] ); ?>"> |
|
1224
|
1224
|
|
|
1225
|
1225
|
<!-- The form that is being submitted! Used to display error/success messages above the correct form --> |
|
1226
|
1226
|
<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo esc_attr( $form_id ); ?>"> |
|
1227
|
1227
|
|
|
1228
|
1228
|
<!-- Submit Button --> |
|
1229
|
1229
|
<?php |
|
1230
|
|
- if( $form_inline ) { |
|
|
1230
|
+ if ( $form_inline ) { |
|
1231
|
1231
|
$submit_button_label_classes = array( 'empty-label' ); |
|
1232
|
1232
|
// If the number of fields, is equal to the hidden label count, add our class |
|
1233
|
1233
|
// eg: All field labels are set to hidden. |
|
1234
|
1234
|
if ( absint( $field_count ) === absint( $hidden_label_count ) ) { |
|
1235
|
|
- $submit_button_label_classes[] = 'labels-hidden'; |
|
|
1235
|
+ $submit_button_label_classes[ ] = 'labels-hidden'; |
|
1236
|
1236
|
} |
|
1237
|
1237
|
echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '"> </span>'; |
|
1238
|
1238
|
} |
|
1239
|
1239
|
// display the image or text based button |
|
1240
|
|
- if( $submit_button_type == 'text' ) { |
|
1241
|
|
- 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'] ); |
|
|
1240
|
+ if ( $submit_button_type == 'text' ) { |
|
|
1241
|
+ 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' ] ); |
|
1242
|
1242
|
} else { |
|
1243
|
|
- 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'] ); |
|
|
1243
|
+ 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' ] ); |
|
1244
|
1244
|
} |
|
1245
|
|
- if( $form_inline ) { |
|
|
1245
|
+ if ( $form_inline ) { |
|
1246
|
1246
|
echo '</label>'; |
|
1247
|
1247
|
} |
|
1248
|
1248
|
?> |
|
@@ -1254,8 +1254,8 @@ discard block |
|
|
block discarded – undo |
|
1254
|
1254
|
|
|
1255
|
1255
|
<?php |
|
1256
|
1256
|
/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
|
1257
|
|
- if( is_user_logged_in() ) { |
|
1258
|
|
- if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
|
1257
|
+ if ( is_user_logged_in() ) { |
|
|
1258
|
+ if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
1259
|
1259
|
echo $edit_form_link; |
|
1260
|
1260
|
} |
|
1261
|
1261
|
} |
|
@@ -1271,7 +1271,7 @@ discard block |
|
|
block discarded – undo |
|
1271
|
1271
|
* for non-admins |
|
1272
|
1272
|
*/ |
|
1273
|
1273
|
if ( ! current_user_can( 'manage_options' ) ) { |
|
1274
|
|
- $impressions = $form_data['impressions'] + 1; |
|
|
1274
|
+ $impressions = $form_data[ 'impressions' ] + 1; |
|
1275
|
1275
|
$interface->update_form_field( $form_id, 'impressions', $impressions ); |
|
1276
|
1276
|
} |
|
1277
|
1277
|
|