@@ -66,47 +66,47 @@ |
||
66 | 66 | */ |
67 | 67 | public function render_block( $attributes, $content ) { |
68 | 68 | |
69 | - if ( ! isset( $attributes['form_id'] ) ) { |
|
69 | + if ( ! isset( $attributes[ 'form_id' ] ) ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $shortcode_attributes = array( |
74 | - 'form' => $attributes['form_id'], |
|
75 | - 'submit' => isset( $attributes['submit_button_text'] ) && ! empty( $attributes['submit_button_text'] ) ? $attributes['submit_button_text'] : '', |
|
76 | - 'title' => isset( $attributes['show_title'] ) && true === $attributes['show_title'] ? '1' : '0', |
|
77 | - 'custom_title' => isset( $attributes['form_title'] ) ? $attributes['form_title'] : '', |
|
78 | - 'description' => isset( $attributes['show_description'] ) && true === $attributes['show_description'] ? '1' : '0', |
|
79 | - 'custom_description' => isset( $attributes['form_description'] ) ? $attributes['form_description'] : '', |
|
80 | - 'ajax' => isset( $attributes['is_ajax'] ) && true === $attributes['is_ajax'] ? '1' : '0', |
|
81 | - 'recaptcha' => isset( $attributes['recaptcha'] ) && false === $attributes['recaptcha'] ? '0' : '', |
|
82 | - 'recaptcha_lang' => isset( $attributes['recaptcha_lang'] ) ? $attributes['recaptcha_lang'] : '', |
|
83 | - 'recaptcha_type' => isset( $attributes['recaptcha_type'] ) ? $attributes['recaptcha_type'] : '', |
|
84 | - 'recaptcha_theme' => isset( $attributes['recaptcha_theme'] ) ? $attributes['recaptcha_theme'] : '', |
|
85 | - 'recaptcha_size' => isset( $attributes['recaptcha_size'] ) ? $attributes['recaptcha_size'] : '', |
|
86 | - 'recaptcha_data_callback' => isset( $attributes['recaptcha_verify_callback'] ) ? $attributes['recaptcha_verify_callback'] : '', |
|
87 | - 'recaptcha_expired_callback' => isset( $attributes['recaptcha_expired_callback'] ) ? $attributes['recaptcha_expired_callback'] : '', |
|
88 | - 'inline' => isset( $attributes['inline'] ) && true === $attributes['inline'] ? '1' : '0', |
|
74 | + 'form' => $attributes[ 'form_id' ], |
|
75 | + 'submit' => isset( $attributes[ 'submit_button_text' ] ) && ! empty( $attributes[ 'submit_button_text' ] ) ? $attributes[ 'submit_button_text' ] : '', |
|
76 | + 'title' => isset( $attributes[ 'show_title' ] ) && true === $attributes[ 'show_title' ] ? '1' : '0', |
|
77 | + 'custom_title' => isset( $attributes[ 'form_title' ] ) ? $attributes[ 'form_title' ] : '', |
|
78 | + 'description' => isset( $attributes[ 'show_description' ] ) && true === $attributes[ 'show_description' ] ? '1' : '0', |
|
79 | + 'custom_description' => isset( $attributes[ 'form_description' ] ) ? $attributes[ 'form_description' ] : '', |
|
80 | + 'ajax' => isset( $attributes[ 'is_ajax' ] ) && true === $attributes[ 'is_ajax' ] ? '1' : '0', |
|
81 | + 'recaptcha' => isset( $attributes[ 'recaptcha' ] ) && false === $attributes[ 'recaptcha' ] ? '0' : '', |
|
82 | + 'recaptcha_lang' => isset( $attributes[ 'recaptcha_lang' ] ) ? $attributes[ 'recaptcha_lang' ] : '', |
|
83 | + 'recaptcha_type' => isset( $attributes[ 'recaptcha_type' ] ) ? $attributes[ 'recaptcha_type' ] : '', |
|
84 | + 'recaptcha_theme' => isset( $attributes[ 'recaptcha_theme' ] ) ? $attributes[ 'recaptcha_theme' ] : '', |
|
85 | + 'recaptcha_size' => isset( $attributes[ 'recaptcha_size' ] ) ? $attributes[ 'recaptcha_size' ] : '', |
|
86 | + 'recaptcha_data_callback' => isset( $attributes[ 'recaptcha_verify_callback' ] ) ? $attributes[ 'recaptcha_verify_callback' ] : '', |
|
87 | + 'recaptcha_expired_callback' => isset( $attributes[ 'recaptcha_expired_callback' ] ) ? $attributes[ 'recaptcha_expired_callback' ] : '', |
|
88 | + 'inline' => isset( $attributes[ 'inline' ] ) && true === $attributes[ 'inline' ] ? '1' : '0', |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | // We want to run process_mailchimp_shortcode() but we need to return |
92 | 92 | // the plaintext shortcode or Gutenberg will autop() the shortcode content. |
93 | 93 | return sprintf( |
94 | 94 | '[yikes-mailchimp form="%s" submit="%s" title="%s" custom_title="%s" description="%s" custom_description="%s" ajax="%s" recaptcha="%s" recaptcha_lang="%s" recaptcha_type="%s" recaptcha_theme="%s" recaptcha_size="%s" recaptcha_data_callback="%s" recaptcha_expired_callback="%s" inline="%s"]', |
95 | - $shortcode_attributes['form'], |
|
96 | - $shortcode_attributes['submit'], |
|
97 | - $shortcode_attributes['title'], |
|
98 | - $shortcode_attributes['custom_title'], |
|
99 | - $shortcode_attributes['description'], |
|
100 | - $shortcode_attributes['custom_description'], |
|
101 | - $shortcode_attributes['ajax'], |
|
102 | - $shortcode_attributes['recaptcha'], |
|
103 | - $shortcode_attributes['recaptcha_lang'], |
|
104 | - $shortcode_attributes['recaptcha_type'], |
|
105 | - $shortcode_attributes['recaptcha_theme'], |
|
106 | - $shortcode_attributes['recaptcha_size'], |
|
107 | - $shortcode_attributes['recaptcha_data_callback'], |
|
108 | - $shortcode_attributes['recaptcha_expired_callback'], |
|
109 | - $shortcode_attributes['inline'] |
|
95 | + $shortcode_attributes[ 'form' ], |
|
96 | + $shortcode_attributes[ 'submit' ], |
|
97 | + $shortcode_attributes[ 'title' ], |
|
98 | + $shortcode_attributes[ 'custom_title' ], |
|
99 | + $shortcode_attributes[ 'description' ], |
|
100 | + $shortcode_attributes[ 'custom_description' ], |
|
101 | + $shortcode_attributes[ 'ajax' ], |
|
102 | + $shortcode_attributes[ 'recaptcha' ], |
|
103 | + $shortcode_attributes[ 'recaptcha_lang' ], |
|
104 | + $shortcode_attributes[ 'recaptcha_type' ], |
|
105 | + $shortcode_attributes[ 'recaptcha_theme' ], |
|
106 | + $shortcode_attributes[ 'recaptcha_size' ], |
|
107 | + $shortcode_attributes[ 'recaptcha_data_callback' ], |
|
108 | + $shortcode_attributes[ 'recaptcha_expired_callback' ], |
|
109 | + $shortcode_attributes[ 'inline' ] |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
@@ -3,234 +3,234 @@ discard block |
||
3 | 3 | class Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler { |
4 | 4 | |
5 | 5 | /** |
6 | - * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
7 | - * |
|
8 | - * @since 6.3.0 |
|
9 | - * @access protected |
|
10 | - * @var bool | $is_ajax |
|
11 | - */ |
|
6 | + * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
7 | + * |
|
8 | + * @since 6.3.0 |
|
9 | + * @access protected |
|
10 | + * @var bool | $is_ajax |
|
11 | + */ |
|
12 | 12 | protected $is_ajax; |
13 | 13 | |
14 | 14 | /**** Hardcoded Internal Variables ****/ |
15 | 15 | |
16 | 16 | /** |
17 | - * An array of form fields we don't process |
|
18 | - * |
|
19 | - * @since 6.3.0 |
|
20 | - * @access protected |
|
21 | - * @var array | $skipped_form_fields |
|
22 | - */ |
|
17 | + * An array of form fields we don't process |
|
18 | + * |
|
19 | + * @since 6.3.0 |
|
20 | + * @access protected |
|
21 | + * @var array | $skipped_form_fields |
|
22 | + */ |
|
23 | 23 | protected $skipped_form_fields; |
24 | 24 | |
25 | 25 | /**** Form Variables ****/ |
26 | 26 | |
27 | 27 | /** |
28 | - * The ID of the corresponding YIKES MailChimp form |
|
29 | - * |
|
30 | - * @since 6.3.0 |
|
31 | - * @access public |
|
32 | - * @var int | $form_id |
|
33 | - */ |
|
28 | + * The ID of the corresponding YIKES MailChimp form |
|
29 | + * |
|
30 | + * @since 6.3.0 |
|
31 | + * @access public |
|
32 | + * @var int | $form_id |
|
33 | + */ |
|
34 | 34 | public $form_id; |
35 | 35 | |
36 | 36 | /** |
37 | - * The ID of the corresponding MailChimp list |
|
38 | - * |
|
39 | - * @since 6.3.0 |
|
40 | - * @access public |
|
41 | - * @var int | $list_id |
|
42 | - */ |
|
37 | + * The ID of the corresponding MailChimp list |
|
38 | + * |
|
39 | + * @since 6.3.0 |
|
40 | + * @access public |
|
41 | + * @var int | $list_id |
|
42 | + */ |
|
43 | 43 | public $list_id; |
44 | 44 | |
45 | 45 | /** |
46 | - * The submitted email |
|
47 | - * |
|
48 | - * @since 6.3.0 |
|
49 | - * @access public |
|
50 | - * @var string | $email |
|
51 | - */ |
|
46 | + * The submitted email |
|
47 | + * |
|
48 | + * @since 6.3.0 |
|
49 | + * @access public |
|
50 | + * @var string | $email |
|
51 | + */ |
|
52 | 52 | public $email; |
53 | 53 | |
54 | 54 | /** |
55 | - * The array of error messages defined by the user and attached to this form |
|
56 | - * |
|
57 | - * @since 6.3.0 |
|
58 | - * @access public |
|
59 | - * @var array | $error_messages |
|
60 | - */ |
|
55 | + * The array of error messages defined by the user and attached to this form |
|
56 | + * |
|
57 | + * @since 6.3.0 |
|
58 | + * @access public |
|
59 | + * @var array | $error_messages |
|
60 | + */ |
|
61 | 61 | public $error_messages; |
62 | 62 | |
63 | 63 | /**** Default Error Messages ****/ |
64 | 64 | |
65 | 65 | /** |
66 | - * The error message for no form ID |
|
67 | - * |
|
68 | - * @since 6.3.0 |
|
69 | - * @access public |
|
70 | - * @var string | $handle_empty_form_id_message |
|
71 | - */ |
|
66 | + * The error message for no form ID |
|
67 | + * |
|
68 | + * @since 6.3.0 |
|
69 | + * @access public |
|
70 | + * @var string | $handle_empty_form_id_message |
|
71 | + */ |
|
72 | 72 | public $handle_empty_form_id_message; |
73 | 73 | |
74 | 74 | /** |
75 | - * The error message for no form found |
|
76 | - * |
|
77 | - * @since 6.3.0 |
|
78 | - * @access public |
|
79 | - * @var string | $handle_empty_form_message |
|
80 | - */ |
|
75 | + * The error message for no form found |
|
76 | + * |
|
77 | + * @since 6.3.0 |
|
78 | + * @access public |
|
79 | + * @var string | $handle_empty_form_message |
|
80 | + */ |
|
81 | 81 | public $handle_empty_form_message; |
82 | 82 | |
83 | 83 | /** |
84 | - * The error message for missing form fields |
|
85 | - * |
|
86 | - * @since 6.3.0 |
|
87 | - * @access public |
|
88 | - * @var string | $handle_empty_fields_generic_message |
|
89 | - */ |
|
84 | + * The error message for missing form fields |
|
85 | + * |
|
86 | + * @since 6.3.0 |
|
87 | + * @access public |
|
88 | + * @var string | $handle_empty_fields_generic_message |
|
89 | + */ |
|
90 | 90 | public $handle_empty_fields_generic_message; |
91 | 91 | |
92 | 92 | /** |
93 | - * The error message for missing $list_handler class |
|
94 | - * |
|
95 | - * @since 6.3.0 |
|
96 | - * @access public |
|
97 | - * @var string | $handle_empty_list_handler_message |
|
98 | - */ |
|
93 | + * The error message for missing $list_handler class |
|
94 | + * |
|
95 | + * @since 6.3.0 |
|
96 | + * @access public |
|
97 | + * @var string | $handle_empty_list_handler_message |
|
98 | + */ |
|
99 | 99 | public $handle_empty_list_handler_message; |
100 | 100 | |
101 | 101 | /** |
102 | - * The error message for no email |
|
103 | - * |
|
104 | - * @since 6.3.0 |
|
105 | - * @access public |
|
106 | - * @var string | $handle_empty_email_message |
|
107 | - */ |
|
102 | + * The error message for no email |
|
103 | + * |
|
104 | + * @since 6.3.0 |
|
105 | + * @access public |
|
106 | + * @var string | $handle_empty_email_message |
|
107 | + */ |
|
108 | 108 | public $handle_empty_email_message; |
109 | 109 | |
110 | 110 | /** |
111 | - * The error message for a filled in honeypot |
|
112 | - * |
|
113 | - * @since 6.3.0 |
|
114 | - * @access public |
|
115 | - * @var string | $handle_non_empty_honeypot_message |
|
116 | - */ |
|
111 | + * The error message for a filled in honeypot |
|
112 | + * |
|
113 | + * @since 6.3.0 |
|
114 | + * @access public |
|
115 | + * @var string | $handle_non_empty_honeypot_message |
|
116 | + */ |
|
117 | 117 | public $handle_non_empty_honeypot_message; |
118 | 118 | |
119 | 119 | /** |
120 | - * The error message for existing users trying to update when it's disallowed |
|
121 | - * |
|
122 | - * @since 6.3.0 |
|
123 | - * @access public |
|
124 | - * @var string | $handle_disallowed_existing_user_update_message |
|
125 | - */ |
|
120 | + * The error message for existing users trying to update when it's disallowed |
|
121 | + * |
|
122 | + * @since 6.3.0 |
|
123 | + * @access public |
|
124 | + * @var string | $handle_disallowed_existing_user_update_message |
|
125 | + */ |
|
126 | 126 | public $handle_disallowed_existing_user_update_message; |
127 | 127 | |
128 | 128 | /** |
129 | - * The first half of the error message for updating an existing user when it's done via a profile link |
|
130 | - * |
|
131 | - * @since 6.3.0 |
|
132 | - * @access public |
|
133 | - * @var string | $handle_updating_existing_user_message |
|
134 | - */ |
|
129 | + * The first half of the error message for updating an existing user when it's done via a profile link |
|
130 | + * |
|
131 | + * @since 6.3.0 |
|
132 | + * @access public |
|
133 | + * @var string | $handle_updating_existing_user_message |
|
134 | + */ |
|
135 | 135 | public $handle_updating_existing_user_message; |
136 | 136 | |
137 | 137 | /** |
138 | - * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
139 | - * |
|
140 | - * @since 6.3.0 |
|
141 | - * @access public |
|
142 | - * @var string | $handle_updating_existing_user_link_message |
|
143 | - */ |
|
138 | + * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
139 | + * |
|
140 | + * @since 6.3.0 |
|
141 | + * @access public |
|
142 | + * @var string | $handle_updating_existing_user_link_message |
|
143 | + */ |
|
144 | 144 | public $handle_updating_existing_user_link_message; |
145 | 145 | |
146 | 146 | /** |
147 | - * A default, generic error message |
|
148 | - * |
|
149 | - * @since 6.3.0 |
|
150 | - * @access public |
|
151 | - * @var string | $default_error_response_message |
|
152 | - */ |
|
147 | + * A default, generic error message |
|
148 | + * |
|
149 | + * @since 6.3.0 |
|
150 | + * @access public |
|
151 | + * @var string | $default_error_response_message |
|
152 | + */ |
|
153 | 153 | public $default_error_response_message; |
154 | 154 | |
155 | 155 | /** |
156 | - * The error message for not filling out a required form field |
|
157 | - * |
|
158 | - * @since 6.3.0 |
|
159 | - * @access public |
|
160 | - * @var string | $handle_empty_required_field_message |
|
161 | - */ |
|
156 | + * The error message for not filling out a required form field |
|
157 | + * |
|
158 | + * @since 6.3.0 |
|
159 | + * @access public |
|
160 | + * @var string | $handle_empty_required_field_message |
|
161 | + */ |
|
162 | 162 | public $handle_empty_required_field_message; |
163 | 163 | |
164 | 164 | /** |
165 | - * The error message for not filling out a required interest group |
|
166 | - * |
|
167 | - * @since 6.3.0 |
|
168 | - * @access public |
|
169 | - * @var string | $handle_empty_required_interest_group_message |
|
170 | - */ |
|
165 | + * The error message for not filling out a required interest group |
|
166 | + * |
|
167 | + * @since 6.3.0 |
|
168 | + * @access public |
|
169 | + * @var string | $handle_empty_required_interest_group_message |
|
170 | + */ |
|
171 | 171 | public $handle_empty_required_interest_group_message; |
172 | 172 | |
173 | 173 | /** |
174 | - * The error message for nonce failures |
|
175 | - * |
|
176 | - * @since 6.3.0 |
|
177 | - * @access public |
|
178 | - * @var string | $handle_nonce_message |
|
179 | - */ |
|
174 | + * The error message for nonce failures |
|
175 | + * |
|
176 | + * @since 6.3.0 |
|
177 | + * @access public |
|
178 | + * @var string | $handle_nonce_message |
|
179 | + */ |
|
180 | 180 | public $handle_nonce_message; |
181 | 181 | |
182 | 182 | /** |
183 | - * The error message for a recaptcha that is not checked/filled out |
|
184 | - * |
|
185 | - * @since 6.3.0 |
|
186 | - * @access public |
|
187 | - * @var string | $handle_nonce_message |
|
188 | - */ |
|
183 | + * The error message for a recaptcha that is not checked/filled out |
|
184 | + * |
|
185 | + * @since 6.3.0 |
|
186 | + * @access public |
|
187 | + * @var string | $handle_nonce_message |
|
188 | + */ |
|
189 | 189 | public $handle_non_filled_recaptcha_message_message; |
190 | 190 | |
191 | 191 | /** |
192 | - * The error message for recaptcha errors that we're not sure of |
|
193 | - * |
|
194 | - * @since 6.3.0 |
|
195 | - * @access public |
|
196 | - * @var string | $handle_nonce_message |
|
197 | - */ |
|
192 | + * The error message for recaptcha errors that we're not sure of |
|
193 | + * |
|
194 | + * @since 6.3.0 |
|
195 | + * @access public |
|
196 | + * @var string | $handle_nonce_message |
|
197 | + */ |
|
198 | 198 | public $generic_recaptcha_error_message; |
199 | 199 | |
200 | 200 | /**** Default Success Messages ****/ |
201 | 201 | |
202 | 202 | /** |
203 | - * The success message for single-optin forms |
|
204 | - * |
|
205 | - * @since 6.3.0 |
|
206 | - * @access public |
|
207 | - * @var string | $default_response_single_optin_success_message |
|
208 | - */ |
|
203 | + * The success message for single-optin forms |
|
204 | + * |
|
205 | + * @since 6.3.0 |
|
206 | + * @access public |
|
207 | + * @var string | $default_response_single_optin_success_message |
|
208 | + */ |
|
209 | 209 | public $default_response_single_optin_success_message; |
210 | 210 | |
211 | 211 | /** |
212 | - * The default success message for double-optin forms |
|
213 | - * |
|
214 | - * @since 6.3.0 |
|
215 | - * @access public |
|
216 | - * @var string | $default_response_double_optin_success_message |
|
217 | - */ |
|
212 | + * The default success message for double-optin forms |
|
213 | + * |
|
214 | + * @since 6.3.0 |
|
215 | + * @access public |
|
216 | + * @var string | $default_response_double_optin_success_message |
|
217 | + */ |
|
218 | 218 | public $default_response_double_optin_success_message; |
219 | 219 | |
220 | 220 | /** |
221 | - * The default success message for already subscribed users re-subscribing |
|
222 | - * |
|
223 | - * @since 6.3.0 |
|
224 | - * @access public |
|
225 | - * @var string | $existing_subscriber_profile_update_message |
|
226 | - */ |
|
221 | + * The default success message for already subscribed users re-subscribing |
|
222 | + * |
|
223 | + * @since 6.3.0 |
|
224 | + * @access public |
|
225 | + * @var string | $existing_subscriber_profile_update_message |
|
226 | + */ |
|
227 | 227 | public $existing_subscriber_profile_update_message; |
228 | 228 | |
229 | 229 | /** |
230 | - * The construct function - sets all of our hardcoded variables |
|
231 | - * |
|
232 | - * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
233 | - */ |
|
230 | + * The construct function - sets all of our hardcoded variables |
|
231 | + * |
|
232 | + * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
233 | + */ |
|
234 | 234 | public function __construct( $is_ajax ) { |
235 | 235 | |
236 | 236 | // Set up our variables |
@@ -268,45 +268,45 @@ discard block |
||
268 | 268 | /**** Setters for our Form Variables ****/ |
269 | 269 | |
270 | 270 | /** |
271 | - * Set the form ID class property |
|
272 | - * |
|
273 | - * @since 6.3.0 |
|
274 | - * |
|
275 | - * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
276 | - */ |
|
271 | + * Set the form ID class property |
|
272 | + * |
|
273 | + * @since 6.3.0 |
|
274 | + * |
|
275 | + * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
276 | + */ |
|
277 | 277 | public function set_form_id( $form_id ) { |
278 | 278 | $this->form_id = $form_id; |
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * Set the list ID class property |
|
283 | - * |
|
284 | - * @since 6.3.0 |
|
285 | - * |
|
286 | - * @param int | $list_id | ID of the corresponding MailChimp list |
|
287 | - */ |
|
282 | + * Set the list ID class property |
|
283 | + * |
|
284 | + * @since 6.3.0 |
|
285 | + * |
|
286 | + * @param int | $list_id | ID of the corresponding MailChimp list |
|
287 | + */ |
|
288 | 288 | public function set_list_id( $list_id ) { |
289 | 289 | $this->list_id = $list_id; |
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | - * Set the email class property |
|
294 | - * |
|
295 | - * @since 6.3.0 |
|
296 | - * |
|
297 | - * @param string | $sanitized_email | The sanitized email |
|
298 | - */ |
|
293 | + * Set the email class property |
|
294 | + * |
|
295 | + * @since 6.3.0 |
|
296 | + * |
|
297 | + * @param string | $sanitized_email | The sanitized email |
|
298 | + */ |
|
299 | 299 | public function set_email( $sanitized_email ) { |
300 | 300 | $this->email = $sanitized_email; |
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
304 | - * Set the $error_messages class property |
|
305 | - * |
|
306 | - * @since 6.3.0 |
|
307 | - * |
|
308 | - * @param array | $error_messages | The array of user-defined error messages for this form |
|
309 | - */ |
|
304 | + * Set the $error_messages class property |
|
305 | + * |
|
306 | + * @since 6.3.0 |
|
307 | + * |
|
308 | + * @param array | $error_messages | The array of user-defined error messages for this form |
|
309 | + */ |
|
310 | 310 | public function set_error_messages( $error_messages ) { |
311 | 311 | $this->error_messages = $error_messages; |
312 | 312 | } |
@@ -315,24 +315,24 @@ discard block |
||
315 | 315 | /**** Simple Return Functions ****/ |
316 | 316 | |
317 | 317 | /** |
318 | - * Return a sanitized email |
|
319 | - * |
|
320 | - * @since 6.3.0 |
|
321 | - * |
|
322 | - * @param string | $email | The user's email |
|
323 | - * @return string| $email | The user's email, lowercased and sanitized |
|
324 | - */ |
|
318 | + * Return a sanitized email |
|
319 | + * |
|
320 | + * @since 6.3.0 |
|
321 | + * |
|
322 | + * @param string | $email | The user's email |
|
323 | + * @return string| $email | The user's email, lowercased and sanitized |
|
324 | + */ |
|
325 | 325 | public function get_sanitized_email( $email ) { |
326 | 326 | return sanitize_email( strtolower( $email ) ); |
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | - * Return the class property $skipped_form_fields |
|
331 | - * |
|
332 | - * @since 6.3.0 |
|
333 | - * |
|
334 | - * @return array | $skipped_form_fields |
|
335 | - */ |
|
330 | + * Return the class property $skipped_form_fields |
|
331 | + * |
|
332 | + * @since 6.3.0 |
|
333 | + * |
|
334 | + * @return array | $skipped_form_fields |
|
335 | + */ |
|
336 | 336 | protected function get_skipped_merge_tags() { |
337 | 337 | return $this->skipped_form_fields; |
338 | 338 | } |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | /**** Collection of functions handling the incoming form and interest group data ****/ |
342 | 342 | |
343 | 343 | /** |
344 | - * Loop through form data to sanitize, format, filter, and return. |
|
345 | - * |
|
346 | - * @since 6.3.0 |
|
347 | - * |
|
348 | - * @param array | $data | The array of user-submitted form values |
|
349 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
350 | - * @return array| $merge_variables| The array of sanitized and formatted form values |
|
351 | - */ |
|
344 | + * Loop through form data to sanitize, format, filter, and return. |
|
345 | + * |
|
346 | + * @since 6.3.0 |
|
347 | + * |
|
348 | + * @param array | $data | The array of user-submitted form values |
|
349 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
350 | + * @return array| $merge_variables| The array of sanitized and formatted form values |
|
351 | + */ |
|
352 | 352 | public function get_submitted_merge_values( $data, $form_fields ) { |
353 | 353 | |
354 | 354 | // Array to return |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | - * Sanitize form values and return them |
|
404 | - * |
|
405 | - * @since 6.3.0 |
|
406 | - * |
|
407 | - * @param string | $key | The MERGE/Field-name for this value |
|
408 | - * @param mixed | $value | The form value - this could be an array or a string |
|
409 | - * @return mixed | $sanitized | The $value sanitized |
|
410 | - */ |
|
403 | + * Sanitize form values and return them |
|
404 | + * |
|
405 | + * @since 6.3.0 |
|
406 | + * |
|
407 | + * @param string | $key | The MERGE/Field-name for this value |
|
408 | + * @param mixed | $value | The form value - this could be an array or a string |
|
409 | + * @return mixed | $sanitized | The $value sanitized |
|
410 | + */ |
|
411 | 411 | protected function sanitize_form_values( $key, $value ) { |
412 | 412 | if ( is_scalar( $value ) ) { |
413 | 413 | $sanitized = sanitize_text_field( $value ); |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | - * Check a date field's date format and pass it along to the appropriate function |
|
425 | - * |
|
426 | - * @since 6.3.0 |
|
427 | - * |
|
428 | - * @param string | $date | The unformatted date value |
|
429 | - * @param string | $date_format | The date format |
|
430 | - * @return string| $date | The date formatted according to the $date_format |
|
431 | - */ |
|
424 | + * Check a date field's date format and pass it along to the appropriate function |
|
425 | + * |
|
426 | + * @since 6.3.0 |
|
427 | + * |
|
428 | + * @param string | $date | The unformatted date value |
|
429 | + * @param string | $date_format | The date format |
|
430 | + * @return string| $date | The date formatted according to the $date_format |
|
431 | + */ |
|
432 | 432 | protected function handle_date_format_merge_values( $date, $date_format ) { |
433 | 433 | // Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM') |
434 | 434 | if ( 'DD/MM/YYYY' === $date_format ) { |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * Format a date field whose date format is dd/mm/yyyy |
|
445 | - * |
|
446 | - * @since 6.3.0 |
|
447 | - * |
|
448 | - * @param string | $date | A date in the format dd/mm/yyyy |
|
449 | - * @return string| $date | A date in the format mm/dd/yyyy |
|
450 | - */ |
|
444 | + * Format a date field whose date format is dd/mm/yyyy |
|
445 | + * |
|
446 | + * @since 6.3.0 |
|
447 | + * |
|
448 | + * @param string | $date | A date in the format dd/mm/yyyy |
|
449 | + * @return string| $date | A date in the format mm/dd/yyyy |
|
450 | + */ |
|
451 | 451 | protected function handle_dd_mm_yyyy_date( $date ) { |
452 | 452 | |
453 | 453 | // MailChimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
469 | - * Format a birthday field whose date format is dd/mm |
|
470 | - * |
|
471 | - * @since 6.3.0 |
|
472 | - * |
|
473 | - * @param string | $birthday | A date in the format dd/mm |
|
474 | - * @return string| $birthday | A date in the format mm/dd |
|
475 | - */ |
|
469 | + * Format a birthday field whose date format is dd/mm |
|
470 | + * |
|
471 | + * @since 6.3.0 |
|
472 | + * |
|
473 | + * @param string | $birthday | A date in the format dd/mm |
|
474 | + * @return string| $birthday | A date in the format mm/dd |
|
475 | + */ |
|
476 | 476 | protected function handle_dd_mm_birthday( $birthday ) { |
477 | 477 | |
478 | 478 | // MailChimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | |
493 | 493 | |
494 | 494 | /** |
495 | - * Create an array of available interest groups based on the $replace_interests flag |
|
496 | - * |
|
497 | - * @since 6.3.0 |
|
498 | - * |
|
499 | - * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
500 | - * @param class | $list_class | Class for interacting with the current list |
|
501 | - * @return array | $groups | Array of interest groups |
|
502 | - */ |
|
495 | + * Create an array of available interest groups based on the $replace_interests flag |
|
496 | + * |
|
497 | + * @since 6.3.0 |
|
498 | + * |
|
499 | + * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
500 | + * @param class | $list_class | Class for interacting with the current list |
|
501 | + * @return array | $groups | Array of interest groups |
|
502 | + */ |
|
503 | 503 | public function get_default_interest_groups( $replace_interests, $list_class ) { |
504 | 504 | |
505 | 505 | // If $replace_interests flag is true then loop through interest groups and set them all to false to start. |
@@ -537,15 +537,15 @@ discard block |
||
537 | 537 | |
538 | 538 | |
539 | 539 | /** |
540 | - * Loop through the interest group form data to sanitize, format, filter, and return. |
|
541 | - * |
|
542 | - * @since 6.3.0 |
|
543 | - * |
|
544 | - * @param array | $data | The array of user-submitted form values |
|
545 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
546 | - * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
547 | - * @return array| $groups | The array of sanitized and formatted form values |
|
548 | - */ |
|
540 | + * Loop through the interest group form data to sanitize, format, filter, and return. |
|
541 | + * |
|
542 | + * @since 6.3.0 |
|
543 | + * |
|
544 | + * @param array | $data | The array of user-submitted form values |
|
545 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
546 | + * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
547 | + * @return array| $groups | The array of sanitized and formatted form values |
|
548 | + */ |
|
549 | 549 | public function get_submitted_interest_groups( $data, $form_fields, $groups ) { |
550 | 550 | |
551 | 551 | // loop to push variables to our array |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
577 | - * yikes-mailchimp-filter-groups-before-submission |
|
578 | - * |
|
579 | - * Catch the interest groups before they get sent over to MailChimp |
|
580 | - * @param array | $groups | User submitted interest group data |
|
581 | - * @optional int| $form_id| the ID of the form to filter |
|
582 | - * @since 6.3.0 |
|
583 | - */ |
|
577 | + * yikes-mailchimp-filter-groups-before-submission |
|
578 | + * |
|
579 | + * Catch the interest groups before they get sent over to MailChimp |
|
580 | + * @param array | $groups | User submitted interest group data |
|
581 | + * @optional int| $form_id| the ID of the form to filter |
|
582 | + * @since 6.3.0 |
|
583 | + */ |
|
584 | 584 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id ); |
585 | 585 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id ); |
586 | 586 | |
@@ -591,17 +591,17 @@ discard block |
||
591 | 591 | /**** Functions to Handle Subscribe API Response ****/ |
592 | 592 | |
593 | 593 | /** |
594 | - * Handle the response to a successful subscribe request |
|
595 | - * |
|
596 | - * @since 6.3.0 |
|
597 | - * |
|
598 | - * @param array | $submission_settings | Array of the form's submission settings |
|
599 | - * @param array | $page_data | Array of the page data |
|
600 | - * @param array | $merge_variables | Array of the submitted form variables |
|
601 | - * @param array | $notifications | Literally don't know what this is yet. |
|
602 | - * @param array | $optin_settings | Array of the form's optin settings |
|
603 | - * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
604 | - */ |
|
594 | + * Handle the response to a successful subscribe request |
|
595 | + * |
|
596 | + * @since 6.3.0 |
|
597 | + * |
|
598 | + * @param array | $submission_settings | Array of the form's submission settings |
|
599 | + * @param array | $page_data | Array of the page data |
|
600 | + * @param array | $merge_variables | Array of the submitted form variables |
|
601 | + * @param array | $notifications | Literally don't know what this is yet. |
|
602 | + * @param array | $optin_settings | Array of the form's optin settings |
|
603 | + * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
604 | + */ |
|
605 | 605 | public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) { |
606 | 606 | |
607 | 607 | // Check if we should redirect, and collect the redirect info in an array |
@@ -610,27 +610,27 @@ discard block |
||
610 | 610 | // Fire off our actions |
611 | 611 | |
612 | 612 | /** |
613 | - * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
614 | - * |
|
615 | - * Catch the merge variables after they've been sent over to MailChimp |
|
616 | - * @since 6.0.0 |
|
617 | - * |
|
618 | - * @param array | $merge_variables | The array of user submitted form data |
|
619 | - */ |
|
613 | + * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
614 | + * |
|
615 | + * Catch the merge variables after they've been sent over to MailChimp |
|
616 | + * @since 6.0.0 |
|
617 | + * |
|
618 | + * @param array | $merge_variables | The array of user submitted form data |
|
619 | + */ |
|
620 | 620 | do_action( 'yikes-mailchimp-after-submission', $merge_variables, $this->form_id ); |
621 | 621 | do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables, $this->form_id ); |
622 | 622 | |
623 | 623 | /** |
624 | - * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
625 | - * |
|
626 | - * Catch our notifications and other form data |
|
627 | - * |
|
628 | - * @param string | $email | The user's email |
|
629 | - * @param array | $merge_variables | The array of user submitted form data |
|
630 | - * @param string | $form_id | The form ID |
|
631 | - * @param array | $notifications | Array of notification messages |
|
632 | - * |
|
633 | - */ |
|
624 | + * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
625 | + * |
|
626 | + * Catch our notifications and other form data |
|
627 | + * |
|
628 | + * @param string | $email | The user's email |
|
629 | + * @param array | $merge_variables | The array of user submitted form data |
|
630 | + * @param string | $form_id | The form ID |
|
631 | + * @param array | $notifications | Array of notification messages |
|
632 | + * |
|
633 | + */ |
|
634 | 634 | do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications ); |
635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
636 | 636 | |
@@ -652,15 +652,15 @@ discard block |
||
652 | 652 | $default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response; |
653 | 653 | |
654 | 654 | /** |
655 | - * yikes-mailchimp-success-response |
|
656 | - * |
|
657 | - * Filter the success message displayed to the user |
|
658 | - * |
|
659 | - * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
660 | - * @param string | $form_id | The form ID |
|
661 | - * @param array | $merge_variables | The array of user submitted form data |
|
662 | - * |
|
663 | - */ |
|
655 | + * yikes-mailchimp-success-response |
|
656 | + * |
|
657 | + * Filter the success message displayed to the user |
|
658 | + * |
|
659 | + * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
660 | + * @param string | $form_id | The form ID |
|
661 | + * @param array | $merge_variables | The array of user submitted form data |
|
662 | + * |
|
663 | + */ |
|
664 | 664 | $response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables ); |
665 | 665 | |
666 | 666 | // Construct our success array variables |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
682 | - * Handle an unsuccessful/error subscribe request |
|
683 | - * |
|
684 | - * @since 6.3.0 |
|
685 | - * |
|
686 | - * @param object | $subscribe_response | The response from the API |
|
687 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
688 | - */ |
|
682 | + * Handle an unsuccessful/error subscribe request |
|
683 | + * |
|
684 | + * @since 6.3.0 |
|
685 | + * |
|
686 | + * @param object | $subscribe_response | The response from the API |
|
687 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
688 | + */ |
|
689 | 689 | public function handle_submission_response_error( $subscribe_response, $form_fields ) { |
690 | 690 | |
691 | 691 | // Get the error data |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | // Note: All of these functions return `return $this->yikes_fail()`. Check function for more info. |
728 | 728 | |
729 | 729 | /** |
730 | - * Check if the submitted form data is missing any required fields |
|
731 | - * |
|
732 | - * @since 6.3.0 |
|
733 | - * |
|
734 | - * @param array | $data | The array of user-submitted form values |
|
735 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
736 | - */ |
|
730 | + * Check if the submitted form data is missing any required fields |
|
731 | + * |
|
732 | + * @since 6.3.0 |
|
733 | + * |
|
734 | + * @param array | $data | The array of user-submitted form values |
|
735 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
736 | + */ |
|
737 | 737 | public function check_for_required_form_fields( $data, $form_fields ) { |
738 | 738 | |
739 | 739 | // Set up our defaults |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | foreach( $value as $field => $val ) { |
759 | 759 | |
760 | 760 | /** |
761 | - * 'yikes-mailchimp-ignore-required-array-field' |
|
762 | - * |
|
763 | - * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
764 | - * |
|
765 | - * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
766 | - * @param int | $form_id |
|
767 | - * |
|
768 | - * @return Array of fields to ignore. |
|
769 | - */ |
|
761 | + * 'yikes-mailchimp-ignore-required-array-field' |
|
762 | + * |
|
763 | + * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
764 | + * |
|
765 | + * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
766 | + * @param int | $form_id |
|
767 | + * |
|
768 | + * @return Array of fields to ignore. |
|
769 | + */ |
|
770 | 770 | $ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id ); |
771 | 771 | |
772 | 772 | if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) { |
@@ -797,14 +797,14 @@ discard block |
||
797 | 797 | ); |
798 | 798 | |
799 | 799 | /** |
800 | - * yikes-mailchimp-required-form-field-missing |
|
801 | - * |
|
802 | - * Alter the response message shown to the user for missing required form fields |
|
803 | - * |
|
804 | - * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
805 | - * @param int | $form_id | The ID of the form |
|
806 | - * @param array | $missing_fields | Array of the missing required fields |
|
807 | - */ |
|
800 | + * yikes-mailchimp-required-form-field-missing |
|
801 | + * |
|
802 | + * Alter the response message shown to the user for missing required form fields |
|
803 | + * |
|
804 | + * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
805 | + * @param int | $form_id | The ID of the form |
|
806 | + * @param array | $missing_fields | Array of the missing required fields |
|
807 | + */ |
|
808 | 808 | $default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields ); |
809 | 809 | |
810 | 810 | // If we've found a missing field, return the array of field data |
@@ -813,13 +813,13 @@ discard block |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
816 | - * Check if the submitted form interest group data is missing any required fields |
|
817 | - * |
|
818 | - * @since 6.3.0 |
|
819 | - * |
|
820 | - * @param array | $data | The array of user-submitted form values |
|
821 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
822 | - */ |
|
816 | + * Check if the submitted form interest group data is missing any required fields |
|
817 | + * |
|
818 | + * @since 6.3.0 |
|
819 | + * |
|
820 | + * @param array | $data | The array of user-submitted form values |
|
821 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
822 | + */ |
|
823 | 823 | public function check_for_required_interest_groups( $data, $form_fields ) { |
824 | 824 | |
825 | 825 | // Set up our defaults |
@@ -853,14 +853,14 @@ discard block |
||
853 | 853 | ); |
854 | 854 | |
855 | 855 | /** |
856 | - * yikes-mailchimp-required-interest-group-missing |
|
857 | - * |
|
858 | - * Alter the response message shown to the user for missing required form fields |
|
859 | - * |
|
860 | - * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
861 | - * @param int | $form_id | The ID of the form |
|
862 | - * @param array | $missing_fields | Array of the missing required fields |
|
863 | - */ |
|
856 | + * yikes-mailchimp-required-interest-group-missing |
|
857 | + * |
|
858 | + * Alter the response message shown to the user for missing required form fields |
|
859 | + * |
|
860 | + * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
861 | + * @param int | $form_id | The ID of the form |
|
862 | + * @param array | $missing_fields | Array of the missing required fields |
|
863 | + */ |
|
864 | 864 | $default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields ); |
865 | 865 | |
866 | 866 | // If we find a required interest group with an empty value, send an error |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | } |
870 | 870 | |
871 | 871 | /** |
872 | - * Handle the reCAPTCHA |
|
873 | - * |
|
874 | - * @since 6.3.0 |
|
875 | - * |
|
876 | - * @param string | $recaptcha_response | The form value of the recaptcha field |
|
877 | - */ |
|
872 | + * Handle the reCAPTCHA |
|
873 | + * |
|
874 | + * @since 6.3.0 |
|
875 | + * |
|
876 | + * @param string | $recaptcha_response | The form value of the recaptcha field |
|
877 | + */ |
|
878 | 878 | public function handle_recaptcha( $recaptcha_response ) { |
879 | 879 | |
880 | 880 | // Before we the hit the API, let's check that we actually got a response. |
@@ -882,11 +882,11 @@ discard block |
||
882 | 882 | if ( empty( $recaptcha_response ) ) { |
883 | 883 | |
884 | 884 | /** |
885 | - * yikes-mailchimp-recaptcha-required-error |
|
886 | - * |
|
887 | - * Catch the recaptcha errors before they're returned to the user |
|
888 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
889 | - */ |
|
885 | + * yikes-mailchimp-recaptcha-required-error |
|
886 | + * |
|
887 | + * Catch the recaptcha errors before they're returned to the user |
|
888 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
889 | + */ |
|
890 | 890 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id ); |
891 | 891 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
892 | 892 | } |
@@ -919,40 +919,40 @@ discard block |
||
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
922 | - * yikes-mailchimp-recaptcha-required-error |
|
923 | - * |
|
924 | - * Catch the recaptcha errors before they're returned to the user |
|
925 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
926 | - */ |
|
922 | + * yikes-mailchimp-recaptcha-required-error |
|
923 | + * |
|
924 | + * Catch the recaptcha errors before they're returned to the user |
|
925 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
926 | + */ |
|
927 | 927 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id ); |
928 | 928 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
929 | 929 | } |
930 | 930 | } |
931 | 931 | |
932 | 932 | /** |
933 | - * Handle the nonce field |
|
934 | - * |
|
935 | - * @since 6.3.0 |
|
936 | - * |
|
937 | - * @param string | $nonce_value | The form value of the nonce |
|
938 | - * @param string | $nonce_name | The name of the nonce |
|
939 | - */ |
|
933 | + * Handle the nonce field |
|
934 | + * |
|
935 | + * @since 6.3.0 |
|
936 | + * |
|
937 | + * @param string | $nonce_value | The form value of the nonce |
|
938 | + * @param string | $nonce_name | The name of the nonce |
|
939 | + */ |
|
940 | 940 | public function handle_nonce( $nonce_value, $nonce_name ) { |
941 | 941 | |
942 | 942 | // First, check our option - this is set in the general settings page |
943 | 943 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { |
944 | 944 | |
945 | 945 | /** |
946 | - * yikes-mailchimp-use-nonce-verification |
|
947 | - * |
|
948 | - * Decide if we're going to check the nonce value. |
|
949 | - * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
950 | - * The default will always be to use the nonce. |
|
951 | - * |
|
952 | - * @param int | $form_id | The form id |
|
953 | - * |
|
954 | - * @return bool | True if we should check the nonce |
|
955 | - */ |
|
946 | + * yikes-mailchimp-use-nonce-verification |
|
947 | + * |
|
948 | + * Decide if we're going to check the nonce value. |
|
949 | + * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
950 | + * The default will always be to use the nonce. |
|
951 | + * |
|
952 | + * @param int | $form_id | The form id |
|
953 | + * |
|
954 | + * @return bool | True if we should check the nonce |
|
955 | + */ |
|
956 | 956 | $use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id ); |
957 | 957 | |
958 | 958 | // We let the filter override the option because the filter is on a per-form basis |
@@ -965,24 +965,24 @@ discard block |
||
965 | 965 | } |
966 | 966 | |
967 | 967 | /** |
968 | - * Handle a merge_variables error |
|
969 | - * |
|
970 | - * @since 6.3.0 |
|
971 | - * |
|
972 | - * @param int | $error | Int $error = 1 if an error |
|
973 | - * @param string | $message | The message shown to the user |
|
974 | - */ |
|
968 | + * Handle a merge_variables error |
|
969 | + * |
|
970 | + * @since 6.3.0 |
|
971 | + * |
|
972 | + * @param int | $error | Int $error = 1 if an error |
|
973 | + * @param string | $message | The message shown to the user |
|
974 | + */ |
|
975 | 975 | public function handle_merge_variables_error( $error, $message ) { |
976 | 976 | return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true ); |
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
980 | - * Handle an empty email field and return the corresponding error message |
|
981 | - * |
|
982 | - * @since 6.3.0 |
|
983 | - * |
|
984 | - * @param string | $email |
|
985 | - */ |
|
980 | + * Handle an empty email field and return the corresponding error message |
|
981 | + * |
|
982 | + * @since 6.3.0 |
|
983 | + * |
|
984 | + * @param string | $email |
|
985 | + */ |
|
986 | 986 | public function handle_empty_email( $email ) { |
987 | 987 | if ( empty( $email ) ) { |
988 | 988 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message ); |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
993 | - * Check if the form is empty and return the corresponding error message |
|
994 | - * |
|
995 | - * @since 6.3.0 |
|
996 | - * |
|
997 | - * @param array | $form_data |
|
998 | - */ |
|
993 | + * Check if the form is empty and return the corresponding error message |
|
994 | + * |
|
995 | + * @since 6.3.0 |
|
996 | + * |
|
997 | + * @param array | $form_data |
|
998 | + */ |
|
999 | 999 | public function handle_empty_form( $form_data ) { |
1000 | 1000 | if ( empty( $form_data ) ) { |
1001 | 1001 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message ); |
@@ -1003,12 +1003,12 @@ discard block |
||
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
1006 | - * Check if the honeypot is NOT empty and return the corresponding error message |
|
1007 | - * |
|
1008 | - * @since 6.3.0 |
|
1009 | - * |
|
1010 | - * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
1011 | - */ |
|
1006 | + * Check if the honeypot is NOT empty and return the corresponding error message |
|
1007 | + * |
|
1008 | + * @since 6.3.0 |
|
1009 | + * |
|
1010 | + * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
1011 | + */ |
|
1012 | 1012 | public function handle_non_empty_honeypot( $honey_pot_filled ) { |
1013 | 1013 | if ( $honey_pot_filled === true ) { |
1014 | 1014 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message ); |
@@ -1016,12 +1016,12 @@ discard block |
||
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | /** |
1019 | - * Loop through fields looking for null and return the corresponding error message |
|
1020 | - * |
|
1021 | - * @since 6.3.0 |
|
1022 | - * |
|
1023 | - * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
1024 | - */ |
|
1019 | + * Loop through fields looking for null and return the corresponding error message |
|
1020 | + * |
|
1021 | + * @since 6.3.0 |
|
1022 | + * |
|
1023 | + * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
1024 | + */ |
|
1025 | 1025 | public function handle_empty_fields_generic( $fields_array ) { |
1026 | 1026 | foreach( $fields_array as $field ) { |
1027 | 1027 | if ( $field === null ) { |
@@ -1031,12 +1031,12 @@ discard block |
||
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | /** |
1034 | - * Check if the list handler is empty and return the corresponding error message |
|
1035 | - * |
|
1036 | - * @since 6.3.0 |
|
1037 | - * |
|
1038 | - * @param class | $list_handler | A class that handles list functions |
|
1039 | - */ |
|
1034 | + * Check if the list handler is empty and return the corresponding error message |
|
1035 | + * |
|
1036 | + * @since 6.3.0 |
|
1037 | + * |
|
1038 | + * @param class | $list_handler | A class that handles list functions |
|
1039 | + */ |
|
1040 | 1040 | public function handle_empty_list_handler( $list_handler ) { |
1041 | 1041 | if ( empty( $list_handler ) ) { |
1042 | 1042 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message ); |
@@ -1044,12 +1044,12 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | /** |
1047 | - * Check if the form id is empty and return the corresponding error message |
|
1048 | - * |
|
1049 | - * @since 6.3.0 |
|
1050 | - * |
|
1051 | - * @param int | $form_id | The form ID |
|
1052 | - */ |
|
1047 | + * Check if the form id is empty and return the corresponding error message |
|
1048 | + * |
|
1049 | + * @since 6.3.0 |
|
1050 | + * |
|
1051 | + * @param int | $form_id | The form ID |
|
1052 | + */ |
|
1053 | 1053 | public function handle_empty_form_id( $form_id ) { |
1054 | 1054 | if ( empty( $form_id ) ) { |
1055 | 1055 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message ); |
@@ -1057,10 +1057,10 @@ discard block |
||
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | /** |
1060 | - * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
1061 | - * |
|
1062 | - * @since 6.3.0 |
|
1063 | - */ |
|
1060 | + * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
1061 | + * |
|
1062 | + * @since 6.3.0 |
|
1063 | + */ |
|
1064 | 1064 | public function handle_disallowed_existing_user_update() { |
1065 | 1065 | |
1066 | 1066 | // Get the default response |
@@ -1073,10 +1073,10 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | /** |
1076 | - * Construct and filter the error message related to the profile link to update user's profile |
|
1077 | - * |
|
1078 | - * @since 6.3.0 |
|
1079 | - */ |
|
1076 | + * Construct and filter the error message related to the profile link to update user's profile |
|
1077 | + * |
|
1078 | + * @since 6.3.0 |
|
1079 | + */ |
|
1080 | 1080 | public function handle_updating_existing_user() { |
1081 | 1081 | |
1082 | 1082 | // Get the first half of the message |
@@ -1101,15 +1101,15 @@ discard block |
||
1101 | 1101 | /**** Helper Functions ****/ |
1102 | 1102 | |
1103 | 1103 | /** |
1104 | - * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
1105 | - * |
|
1106 | - * @since 6.3.0 |
|
1107 | - * |
|
1108 | - * @param string | $slug | The type of message we're looking for |
|
1109 | - * @param string | $response_text| The default response message |
|
1110 | - * @param array | $data | An array of data that may be needed to construct the user's error message |
|
1111 | - * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
1112 | - */ |
|
1104 | + * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
1105 | + * |
|
1106 | + * @since 6.3.0 |
|
1107 | + * |
|
1108 | + * @param string | $slug | The type of message we're looking for |
|
1109 | + * @param string | $response_text| The default response message |
|
1110 | + * @param array | $data | An array of data that may be needed to construct the user's error message |
|
1111 | + * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
1112 | + */ |
|
1113 | 1113 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
1114 | 1114 | |
1115 | 1115 | switch( $slug ) { |
@@ -1123,13 +1123,13 @@ discard block |
||
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | /** |
1126 | - * yikes-easy-mailchimp-user-already-subscribed-text |
|
1127 | - * |
|
1128 | - * Catch the message for user's already subscrbed before we show it to the user |
|
1129 | - * @param string | $message | The response message |
|
1130 | - * @param int | $form_id | The form id |
|
1131 | - * @param string | $email | The user's email |
|
1132 | - */ |
|
1126 | + * yikes-easy-mailchimp-user-already-subscribed-text |
|
1127 | + * |
|
1128 | + * Catch the message for user's already subscrbed before we show it to the user |
|
1129 | + * @param string | $message | The response message |
|
1130 | + * @param int | $form_id | The form id |
|
1131 | + * @param string | $email | The user's email |
|
1132 | + */ |
|
1133 | 1133 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email ); |
1134 | 1134 | |
1135 | 1135 | return $response_text; |
@@ -1148,13 +1148,13 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
1151 | - * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
1152 | - * |
|
1153 | - * Catch the message for user's already subscrbed link text before we show it to the user |
|
1154 | - * |
|
1155 | - * @param string | $response_text | The response message that will be shown to the user |
|
1156 | - * @param string | $form_id | The form ID |
|
1157 | - */ |
|
1151 | + * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
1152 | + * |
|
1153 | + * Catch the message for user's already subscrbed link text before we show it to the user |
|
1154 | + * |
|
1155 | + * @param string | $response_text | The response message that will be shown to the user |
|
1156 | + * @param string | $form_id | The form ID |
|
1157 | + */ |
|
1158 | 1158 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id ); |
1159 | 1159 | |
1160 | 1160 | return $response_text; |
@@ -1168,14 +1168,14 @@ discard block |
||
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
1171 | - * yikes-mailchimp-success-double-optin-response |
|
1172 | - * |
|
1173 | - * Filter the success message displayed to the user |
|
1174 | - * |
|
1175 | - * @param string | $response_text | The response message that will be shown to the user |
|
1176 | - * @param string | $form_id | The form ID |
|
1177 | - * |
|
1178 | - */ |
|
1171 | + * yikes-mailchimp-success-double-optin-response |
|
1172 | + * |
|
1173 | + * Filter the success message displayed to the user |
|
1174 | + * |
|
1175 | + * @param string | $response_text | The response message that will be shown to the user |
|
1176 | + * @param string | $form_id | The form ID |
|
1177 | + * |
|
1178 | + */ |
|
1179 | 1179 | $response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id ); |
1180 | 1180 | |
1181 | 1181 | return $response_text; |
@@ -1188,14 +1188,14 @@ discard block |
||
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | /** |
1191 | - * yikes-mailchimp-success-single-optin-response |
|
1192 | - * |
|
1193 | - * Filter the success message displayed to the user |
|
1194 | - * |
|
1195 | - * @param string | $response_text | The response message that will be shown to the user |
|
1196 | - * @param string | $form_id | The form ID |
|
1197 | - * |
|
1198 | - */ |
|
1191 | + * yikes-mailchimp-success-single-optin-response |
|
1192 | + * |
|
1193 | + * Filter the success message displayed to the user |
|
1194 | + * |
|
1195 | + * @param string | $response_text | The response message that will be shown to the user |
|
1196 | + * @param string | $form_id | The form ID |
|
1197 | + * |
|
1198 | + */ |
|
1199 | 1199 | $response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id ); |
1200 | 1200 | |
1201 | 1201 | return $response_text; |
@@ -1208,14 +1208,14 @@ discard block |
||
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | /** |
1211 | - * yikes-mailchimp-success-resubscribed-response |
|
1212 | - * |
|
1213 | - * Filter the success message displayed to the user |
|
1214 | - * |
|
1215 | - * @param string | $response_text | The response message that will be shown to the user |
|
1216 | - * @param string | $form_id | The form ID |
|
1217 | - * |
|
1218 | - */ |
|
1211 | + * yikes-mailchimp-success-resubscribed-response |
|
1212 | + * |
|
1213 | + * Filter the success message displayed to the user |
|
1214 | + * |
|
1215 | + * @param string | $response_text | The response message that will be shown to the user |
|
1216 | + * @param string | $form_id | The form ID |
|
1217 | + * |
|
1218 | + */ |
|
1219 | 1219 | $response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id ); |
1220 | 1220 | |
1221 | 1221 | return $response_text; |
@@ -1231,16 +1231,16 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | /** |
1234 | - * yikes-mailchimp-general-error-response |
|
1235 | - * |
|
1236 | - * Filter the error message displayed to the user |
|
1237 | - * |
|
1238 | - * @param string | $original_response_text | The original response message returned from the API |
|
1239 | - * @param string | $user_defined_response_text | The response message defined by the user |
|
1240 | - * @param string | $form_id | The form ID |
|
1241 | - * |
|
1242 | - * @return string | $response_text | The message that will be shown to the user |
|
1243 | - */ |
|
1234 | + * yikes-mailchimp-general-error-response |
|
1235 | + * |
|
1236 | + * Filter the error message displayed to the user |
|
1237 | + * |
|
1238 | + * @param string | $original_response_text | The original response message returned from the API |
|
1239 | + * @param string | $user_defined_response_text | The response message defined by the user |
|
1240 | + * @param string | $form_id | The form ID |
|
1241 | + * |
|
1242 | + * @return string | $response_text | The message that will be shown to the user |
|
1243 | + */ |
|
1244 | 1244 | $response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id ); |
1245 | 1245 | |
1246 | 1246 | return $response_text; |
@@ -1254,14 +1254,14 @@ discard block |
||
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
1257 | - * Wrap the response message in HTML for Non-AJAX form submissions |
|
1258 | - * |
|
1259 | - * @since 6.3.0 |
|
1260 | - * |
|
1261 | - * @param string | $message | The response message |
|
1262 | - * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
1263 | - * @return string| The $message wrapping in HTML |
|
1264 | - */ |
|
1257 | + * Wrap the response message in HTML for Non-AJAX form submissions |
|
1258 | + * |
|
1259 | + * @since 6.3.0 |
|
1260 | + * |
|
1261 | + * @param string | $message | The response message |
|
1262 | + * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
1263 | + * @return string| The $message wrapping in HTML |
|
1264 | + */ |
|
1265 | 1265 | public function wrap_form_submission_response( $message, $is_success ) { |
1266 | 1266 | |
1267 | 1267 | // If we're successful, we wrap the $message differently |
@@ -1275,14 +1275,14 @@ discard block |
||
1275 | 1275 | /**** Returning Success / Failure Functions ****/ |
1276 | 1276 | |
1277 | 1277 | /** |
1278 | - * Return success. Method of returning success based on the $is_ajax flag |
|
1279 | - * |
|
1280 | - * @since 6.3.0 |
|
1281 | - * |
|
1282 | - * @param array | $success_array | Array of success values to return |
|
1283 | - * |
|
1284 | - * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
1285 | - */ |
|
1278 | + * Return success. Method of returning success based on the $is_ajax flag |
|
1279 | + * |
|
1280 | + * @since 6.3.0 |
|
1281 | + * |
|
1282 | + * @param array | $success_array | Array of success values to return |
|
1283 | + * |
|
1284 | + * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
1285 | + */ |
|
1286 | 1286 | protected function yikes_success( $success_array ) { |
1287 | 1287 | if ( $this->is_ajax === true ) { |
1288 | 1288 | wp_send_json_success( $success_array ); |
@@ -1295,18 +1295,18 @@ discard block |
||
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | /** |
1298 | - * Return failure. Method of returning failure based on the $is_ajax flag |
|
1299 | - * |
|
1300 | - * @since 6.3.0 |
|
1301 | - * |
|
1302 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1303 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1304 | - * @param string | $response | The response message to display to the user |
|
1305 | - * @param array | $additional_fields | An array of additional fields to return |
|
1306 | - * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
1307 | - * |
|
1308 | - * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
1309 | - */ |
|
1298 | + * Return failure. Method of returning failure based on the $is_ajax flag |
|
1299 | + * |
|
1300 | + * @since 6.3.0 |
|
1301 | + * |
|
1302 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1303 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1304 | + * @param string | $response | The response message to display to the user |
|
1305 | + * @param array | $additional_fields | An array of additional fields to return |
|
1306 | + * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
1307 | + * |
|
1308 | + * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
1309 | + */ |
|
1310 | 1310 | protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) { |
1311 | 1311 | if ( $this->is_ajax === true ) { |
1312 | 1312 | $this->yikes_send_json_error( $hide, $error, $response, $additional_fields ); |
@@ -1319,17 +1319,17 @@ discard block |
||
1319 | 1319 | } |
1320 | 1320 | |
1321 | 1321 | /** |
1322 | - * Wrapper function for wp_send_json_error() |
|
1323 | - * |
|
1324 | - * @since 6.3.0 |
|
1325 | - * |
|
1326 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1327 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1328 | - * @param string | $translated_string | The response message to display to the user |
|
1329 | - * @param array | $additional_fields | An array of additional fields to return |
|
1330 | - * |
|
1331 | - * @return func | wp_send_json_error() |
|
1332 | - */ |
|
1322 | + * Wrapper function for wp_send_json_error() |
|
1323 | + * |
|
1324 | + * @since 6.3.0 |
|
1325 | + * |
|
1326 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1327 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1328 | + * @param string | $translated_string | The response message to display to the user |
|
1329 | + * @param array | $additional_fields | An array of additional fields to return |
|
1330 | + * |
|
1331 | + * @return func | wp_send_json_error() |
|
1332 | + */ |
|
1333 | 1333 | protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) { |
1334 | 1334 | |
1335 | 1335 | // Default response array |
@@ -1353,14 +1353,14 @@ discard block |
||
1353 | 1353 | /** Static functions used in other places **/ |
1354 | 1354 | |
1355 | 1355 | /** |
1356 | - * Handle the redirect logic for successful submissions |
|
1357 | - * |
|
1358 | - * @since 6.3.0 |
|
1359 | - * |
|
1360 | - * @param array | $submission_settings | Array of the form's submission settings |
|
1361 | - * @param array | $page_data | Page ID |
|
1362 | - * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
1363 | - */ |
|
1356 | + * Handle the redirect logic for successful submissions |
|
1357 | + * |
|
1358 | + * @since 6.3.0 |
|
1359 | + * |
|
1360 | + * @param array | $submission_settings | Array of the form's submission settings |
|
1361 | + * @param array | $page_data | Page ID |
|
1362 | + * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
1363 | + */ |
|
1364 | 1364 | public static function handle_submission_response_success_redirect( $form_id, $submission_settings, $page_data ) { |
1365 | 1365 | |
1366 | 1366 | $default_redirect_time_ms = 1500; |
@@ -1393,23 +1393,23 @@ discard block |
||
1393 | 1393 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
1394 | 1394 | |
1395 | 1395 | /** |
1396 | - * yikes-mailchimp-redirect-url |
|
1397 | - * |
|
1398 | - * Catch the redirect URL before it's shown to the user |
|
1399 | - * |
|
1400 | - * @param string | $redirect_url | The URL that we will redirect to |
|
1401 | - * @param string | $form_id | The ID of the current form being subscribed to |
|
1402 | - * @param array | $page_data | An array of data related to the page the form is on |
|
1403 | - */ |
|
1396 | + * yikes-mailchimp-redirect-url |
|
1397 | + * |
|
1398 | + * Catch the redirect URL before it's shown to the user |
|
1399 | + * |
|
1400 | + * @param string | $redirect_url | The URL that we will redirect to |
|
1401 | + * @param string | $form_id | The ID of the current form being subscribed to |
|
1402 | + * @param array | $page_data | An array of data related to the page the form is on |
|
1403 | + */ |
|
1404 | 1404 | $redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $form_id, $page_data ); |
1405 | 1405 | |
1406 | 1406 | /** |
1407 | - * yikes-mailchimp-redirect-timer |
|
1408 | - * |
|
1409 | - * Catch the redirect timer before it's sent to the JavaScript file |
|
1410 | - * |
|
1411 | - * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
1412 | - */ |
|
1407 | + * yikes-mailchimp-redirect-timer |
|
1408 | + * |
|
1409 | + * Catch the redirect timer before it's sent to the JavaScript file |
|
1410 | + * |
|
1411 | + * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
1412 | + */ |
|
1413 | 1413 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
1414 | 1414 | |
1415 | 1415 | $redirect_array['redirect_timer'] = $redirect_timer; |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | $this->handle_updating_existing_user_link_message = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
256 | 256 | $this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
257 | 257 | $this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
258 | - $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
258 | + $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
259 | 259 | $this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
260 | 260 | $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
261 | 261 | |
262 | 262 | // Define our success messages |
263 | - $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
264 | - $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
263 | + $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
264 | + $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
265 | 265 | $this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
266 | 266 | } |
267 | 267 | |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | // Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
376 | - if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
377 | - $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
376 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
377 | + $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $merge_variables[ $merge_tag ] = $sanitized; |
381 | 381 | } |
382 | 382 | |
383 | 383 | // Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request. |
384 | - if ( isset( $merge_variables['EMAIL'] ) ) { |
|
385 | - $merge_variables['EMAIL'] = $this->email; |
|
384 | + if ( isset( $merge_variables[ 'EMAIL' ] ) ) { |
|
385 | + $merge_variables[ 'EMAIL' ] = $this->email; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | if ( count( $pieces ) === 3 ) { |
460 | 460 | |
461 | 461 | // $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
462 | - $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
462 | + $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | return $date; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | if ( count( $pieces ) === 2 ) { |
485 | 485 | |
486 | 486 | // $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
487 | - $birthday = $pieces[1] . '/' . $pieces[0]; |
|
487 | + $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $birthday; |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | // Loop through the interest groups and create a single array like {group_id} => false |
518 | 518 | foreach ( $interest_groupings as $group_data ) { |
519 | 519 | |
520 | - if ( ! isset( $group_data['items'] ) || isset( $group_data['items'] ) && ( empty( $group_data['items'] ) || ! is_array( $group_data['items'] ) ) ) { |
|
520 | + if ( ! isset( $group_data[ 'items' ] ) || isset( $group_data[ 'items' ] ) && ( empty( $group_data[ 'items' ] ) || ! is_array( $group_data[ 'items' ] ) ) ) { |
|
521 | 521 | continue; |
522 | 522 | } |
523 | 523 | |
524 | - foreach ( $group_data['items'] as $item ) { |
|
525 | - $groups[$item['id']] = false; |
|
524 | + foreach ( $group_data[ 'items' ] as $item ) { |
|
525 | + $groups[ $item[ 'id' ] ] = false; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
636 | 636 | |
637 | 637 | // Get the optin value |
638 | - $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
638 | + $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
639 | 639 | |
640 | 640 | if ( 1 === $optin ) { |
641 | 641 | |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | |
666 | 666 | // Construct our success array variables |
667 | 667 | $return_success_array = array( |
668 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
668 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
669 | 669 | 'error' => 0, |
670 | 670 | 'response' => $response_message, |
671 | - 'redirection' => $redirect_array['redirection'], |
|
672 | - 'redirect' => $redirect_array['redirect'], |
|
673 | - 'new_window' => $redirect_array['new_window'], |
|
674 | - 'redirect_timer' => $redirect_array['redirect_timer'], |
|
671 | + 'redirection' => $redirect_array[ 'redirection' ], |
|
672 | + 'redirect' => $redirect_array[ 'redirect' ], |
|
673 | + 'new_window' => $redirect_array[ 'new_window' ], |
|
674 | + 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
675 | 675 | ); |
676 | 676 | |
677 | 677 | // Return success array |
@@ -693,12 +693,12 @@ discard block |
||
693 | 693 | $details = ''; |
694 | 694 | |
695 | 695 | // Loop through the error data and retrieve any fields and messages |
696 | - if ( isset( $error_data['data'] ) ) { |
|
697 | - foreach ( $error_data['data'] as $datum ) { |
|
698 | - if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
696 | + if ( isset( $error_data[ 'data' ] ) ) { |
|
697 | + foreach ( $error_data[ 'data' ] as $datum ) { |
|
698 | + if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
699 | 699 | continue; |
700 | 700 | } |
701 | - $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
701 | + $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
@@ -741,21 +741,21 @@ discard block |
||
741 | 741 | $missing_fields = array(); |
742 | 742 | |
743 | 743 | // Loop through submitted form data |
744 | - foreach( $data as $merge_tag => $value ) { |
|
744 | + foreach ( $data as $merge_tag => $value ) { |
|
745 | 745 | |
746 | 746 | // Skip interest groups |
747 | - if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
747 | + if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
748 | 748 | continue; |
749 | 749 | } |
750 | 750 | |
751 | 751 | // check if this field is required |
752 | - if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
752 | + if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
753 | 753 | |
754 | 754 | // Check if the field(s) are empty |
755 | 755 | if ( is_array( $value ) ) { |
756 | 756 | |
757 | 757 | // Loop through the data and check if any are empty |
758 | - foreach( $value as $field => $val ) { |
|
758 | + foreach ( $value as $field => $val ) { |
|
759 | 759 | |
760 | 760 | /** |
761 | 761 | * 'yikes-mailchimp-ignore-required-array-field' |
@@ -774,13 +774,13 @@ discard block |
||
774 | 774 | |
775 | 775 | // Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
776 | 776 | // (e.g. For arrays, like an address, where multiple address fields are empty) |
777 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
777 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
778 | 778 | } |
779 | 779 | } |
780 | 780 | |
781 | 781 | } else if ( empty( $value ) ) { |
782 | 782 | $field_is_missing = true; |
783 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
783 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | foreach ( $form_fields as $merge_tag => $field_data ) { |
831 | 831 | |
832 | 832 | // If an interest group and it's required |
833 | - if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
833 | + if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
834 | 834 | |
835 | 835 | // Check if it was submitted (meaning, check if it's set in our $data array) |
836 | 836 | if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
@@ -892,30 +892,30 @@ discard block |
||
892 | 892 | } |
893 | 893 | |
894 | 894 | // Construct the API URL |
895 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
895 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
896 | 896 | $response = wp_remote_get( $url ); |
897 | - $response_body = json_decode( $response['body'], true ); |
|
897 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
898 | 898 | |
899 | 899 | // Set up errors array |
900 | 900 | $recaptcha_errors = array(); |
901 | 901 | |
902 | 902 | // if we've hit an error, lets return the error! |
903 | - if ( true !== $response_body['success'] ) { |
|
903 | + if ( true !== $response_body[ 'success' ] ) { |
|
904 | 904 | |
905 | - if( isset( $response_body['error-codes'] ) ) { |
|
905 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
906 | 906 | |
907 | 907 | // Loop through response error codes |
908 | - foreach ( $response_body['error-codes'] as $error_code ) { |
|
908 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
909 | 909 | if ( 'missing-input-response' === $error_code ) { |
910 | 910 | $error_code = $this->handle_non_filled_recaptcha_message; |
911 | 911 | } |
912 | 912 | |
913 | 913 | // Add our error_code to the errors array |
914 | - $recaptcha_errors[] = $error_code; |
|
914 | + $recaptcha_errors[ ] = $error_code; |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | } else { |
918 | - $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
918 | + $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
1024 | 1024 | */ |
1025 | 1025 | public function handle_empty_fields_generic( $fields_array ) { |
1026 | - foreach( $fields_array as $field ) { |
|
1026 | + foreach ( $fields_array as $field ) { |
|
1027 | 1027 | if ( $field === null ) { |
1028 | 1028 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
1029 | 1029 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | // Append our 'send-update-email' link and text |
1091 | 1091 | $response .= $link_start_tag; |
1092 | - $response .= $this->handle_updating_existing_user_link_message; |
|
1092 | + $response .= $this->handle_updating_existing_user_link_message; |
|
1093 | 1093 | $response .= $link_close_tag; |
1094 | 1094 | |
1095 | 1095 | // Check for a user-defined message |
@@ -1112,14 +1112,14 @@ discard block |
||
1112 | 1112 | */ |
1113 | 1113 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
1114 | 1114 | |
1115 | - switch( $slug ) { |
|
1115 | + switch ( $slug ) { |
|
1116 | 1116 | case 'already-subscribed': |
1117 | 1117 | |
1118 | 1118 | // Check if this error message exists |
1119 | - if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
1119 | + if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
1120 | 1120 | |
1121 | 1121 | // Check if the substring (that we replace) '[email]' is located in the string and replace it |
1122 | - $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
1122 | + $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | /** |
@@ -1138,13 +1138,13 @@ discard block |
||
1138 | 1138 | case 'update-link': |
1139 | 1139 | |
1140 | 1140 | // Check if this error message exists |
1141 | - if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
1141 | + if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
1142 | 1142 | |
1143 | 1143 | // Check if the substring (that we replace) '[link]' is located in the string and replace it |
1144 | - $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
1144 | + $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
1145 | 1145 | |
1146 | 1146 | // Remove [/link] |
1147 | - $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
1147 | + $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
@@ -1163,8 +1163,8 @@ discard block |
||
1163 | 1163 | case 'success': |
1164 | 1164 | |
1165 | 1165 | // 'success' is the user-defined success message for double opt-in |
1166 | - if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
1167 | - $response_text = $this->error_messages['success']; |
|
1166 | + if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
1167 | + $response_text = $this->error_messages[ 'success' ]; |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1183,8 +1183,8 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | case 'success-single-optin': |
1185 | 1185 | |
1186 | - if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
1187 | - $response_text = $this->error_messages['success-single-optin']; |
|
1186 | + if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
1187 | + $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | /** |
@@ -1203,8 +1203,8 @@ discard block |
||
1203 | 1203 | |
1204 | 1204 | case 'success-resubscribed': |
1205 | 1205 | |
1206 | - if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
1207 | - $response_text = $this->error_messages['success-resubscribed']; |
|
1206 | + if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
1207 | + $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | /** |
@@ -1226,8 +1226,8 @@ discard block |
||
1226 | 1226 | $original_response_text = $response_text; |
1227 | 1227 | $user_defined_response_text = ''; |
1228 | 1228 | |
1229 | - if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
1230 | - $user_defined_response_text = $this->error_messages['general-error']; |
|
1229 | + if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
1230 | + $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | /** |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | } else { |
1290 | 1290 | global $process_submission_response; |
1291 | 1291 | |
1292 | - $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
1292 | + $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
1293 | 1293 | $process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
1294 | 1294 | } |
1295 | 1295 | } |
@@ -1342,8 +1342,8 @@ discard block |
||
1342 | 1342 | // Add additional fields we've been supplied |
1343 | 1343 | if ( ! empty( $additional_fields ) ) { |
1344 | 1344 | |
1345 | - foreach( $additional_fields as $key => $value ) { |
|
1346 | - $response_array[$key] = $value; |
|
1345 | + foreach ( $additional_fields as $key => $value ) { |
|
1346 | + $response_array[ $key ] = $value; |
|
1347 | 1347 | } |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1374,20 +1374,20 @@ discard block |
||
1374 | 1374 | ); |
1375 | 1375 | |
1376 | 1376 | // Let's confirm we have a value before trying to use it |
1377 | - $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
1377 | + $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
1378 | 1378 | |
1379 | 1379 | // Check the redirect flag |
1380 | 1380 | if ( '1' === $redirect_setting ) { |
1381 | 1381 | |
1382 | 1382 | // Supply return array with default value of 1 |
1383 | - $redirect_array['redirection'] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
1383 | + $redirect_array[ 'redirection' ] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
1384 | 1384 | |
1385 | 1385 | // Let's confirm we have redirect_page/custom_redirect_url/new_window values |
1386 | - $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
1387 | - $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
1388 | - $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
1386 | + $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
1387 | + $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
1388 | + $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
1389 | 1389 | |
1390 | - $redirect_array['new_window'] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
1390 | + $redirect_array[ 'new_window' ] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
1391 | 1391 | |
1392 | 1392 | // Check if we're redirecting to a custom_url or just the redirect_page |
1393 | 1393 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
@@ -1412,9 +1412,9 @@ discard block |
||
1412 | 1412 | */ |
1413 | 1413 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
1414 | 1414 | |
1415 | - $redirect_array['redirect_timer'] = $redirect_timer; |
|
1415 | + $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
1416 | 1416 | |
1417 | - $redirect_array['redirect'] = $redirect_url; |
|
1417 | + $redirect_array[ 'redirect' ] = $redirect_url; |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | return $redirect_array; |
@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function __construct() { |
13 | 13 | // ajax process form submission |
14 | - add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
15 | - add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
14 | + add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
15 | + add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
16 | 16 | |
17 | 17 | // ajax send update emails |
18 | - add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
19 | - add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
18 | + add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
19 | + add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
20 | 20 | |
21 | 21 | // increase submission count for a given form on successful submit |
22 | - add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
23 | - add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
22 | + add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
23 | + add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * Increase the submission count for a given form. |
38 | 38 | */ |
39 | 39 | public function increase_submission_count() { |
40 | - $form_id = intval( $_POST['form_id'] ); |
|
40 | + $form_id = intval( $_POST[ 'form_id' ] ); |
|
41 | 41 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
42 | 42 | $form = $interface->get_form( $form_id ); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // Update the form. |
50 | - $submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1; |
|
50 | + $submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1; |
|
51 | 51 | $interface->update_form_field( $form_id, 'submissions', $submission_count ); |
52 | 52 | |
53 | 53 | exit(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | @since v6.0.4.1 |
59 | 59 | */ |
60 | 60 | public function sendUpdateProfileEmail() { |
61 | - $user_email = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING ); |
|
61 | + $user_email = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING ); |
|
62 | 62 | $user_id = md5( $user_email ); |
63 | - $list_id = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING ); |
|
64 | - $form_id = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
65 | - $page_id = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
63 | + $list_id = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING ); |
|
64 | + $form_id = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
65 | + $page_id = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
66 | 66 | $full_site_url = get_bloginfo( 'url' ); |
67 | 67 | $manager = yikes_get_mc_api_manager(); |
68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'class.public_ajax.php' |
80 | 80 | ); |
81 | 81 | $is_error = true; |
82 | - $errors[] = $list_details->get_error_message(); |
|
82 | + $errors[ ] = $list_details->get_error_message(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Subscriber details API call. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
89 | 89 | $error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( 'Send Update Profile Email - Get Member Info.', 'yikes-inc-easy-mailchimp-extender' ), 'class.public_ajax.php' ); |
90 | 90 | $is_error = true; |
91 | - $errors[] = $subscriber_account_details->get_error_message(); |
|
91 | + $errors[ ] = $subscriber_account_details->get_error_message(); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // Form details API call. |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) { |
97 | 97 | $form_data = $interface->get_form( $form_id ); |
98 | 98 | if ( ! empty( $form_data ) ) { |
99 | - if ( isset( $form_data['error_messages'] ) ) { |
|
99 | + if ( isset( $form_data[ 'error_messages' ] ) ) { |
|
100 | 100 | |
101 | - if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) { |
|
102 | - $email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] ); |
|
101 | + if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) { |
|
102 | + $email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] ); |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) { |
|
106 | - $email_subject = $form_data['error_messages']['email-subject']; |
|
105 | + if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) { |
|
106 | + $email_subject = $form_data[ 'error_messages' ][ 'email-subject' ]; |
|
107 | 107 | } |
108 | 108 | |
109 | - if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) { |
|
110 | - $update_email_success_message = $form_data['error_messages']['update-email-success']; |
|
109 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) { |
|
110 | + $update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) { |
|
114 | - $update_email_failed_message = $form_data['error_messages']['update-email-failure']; |
|
113 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) { |
|
114 | + $update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ]; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // Construct the headers & email message content. |
135 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
136 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
135 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
136 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
137 | 137 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
138 | 138 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
139 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
139 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
140 | 140 | $headers .= 'Content-type: text/html'; |
141 | 141 | |
142 | 142 | if ( ! isset( $email_subject ) ) { |
@@ -178,26 +178,26 @@ discard block |
||
178 | 178 | $email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body ); |
179 | 179 | |
180 | 180 | // We let the user use [form_name] for the form's name so replace [form_name] with the form's name. |
181 | - $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body ); |
|
181 | + $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body ); |
|
182 | 182 | |
183 | 183 | // We let the user use [fname] and [lname] so replace those. |
184 | - $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body ); |
|
185 | - $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body ); |
|
184 | + $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body ); |
|
185 | + $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body ); |
|
186 | 186 | |
187 | 187 | /* Confirm that the email was sent */ |
188 | 188 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) { |
189 | 189 | |
190 | 190 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
191 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
191 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
192 | 192 | $redirect_settings = Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
193 | 193 | |
194 | 194 | wp_send_json_success( |
195 | 195 | array( |
196 | 196 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
197 | - 'redirection' => $redirect_settings['redirection'], |
|
198 | - 'redirect' => $redirect_settings['redirect'], |
|
199 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
200 | - 'new_window' => $redirect_settings['new_window'], |
|
197 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
198 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
199 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
200 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
201 | 201 | ) |
202 | 202 | ); |
203 | 203 | } else { |
@@ -2,23 +2,23 @@ discard block |
||
2 | 2 | <?php |
3 | 3 | |
4 | 4 | // if an error was returned in the most recent query |
5 | - if( isset( $_GET['sql_error'] ) ) { |
|
5 | + if ( isset( $_GET[ 'sql_error' ] ) ) { |
|
6 | 6 | // if error logging is turned on, lets display a better error to help narrow things down |
7 | 7 | // lets also log things to the error log |
8 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
9 | - wp_die( '<strong>' . __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong> <p>' . stripslashes( urldecode( $_GET['sql_error'] ) ) . '</p>' , __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
8 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
9 | + wp_die( '<strong>' . __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) . '</strong> <p>' . stripslashes( urldecode( $_GET[ 'sql_error' ] ) ) . '</p>', __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | } else { |
11 | - wp_die( '<strong>' . __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p>' . __( "Please try again. If the error persists please get in contact with the YIKES Inc. support team." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>' ); |
|
11 | + wp_die( '<strong>' . __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p>' . __( "Please try again. If the error persists please get in contact with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>' ); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | 15 | /* Get The Form ID we need to edit */ |
16 | - if ( ! isset( $_GET['id'] ) ) { |
|
16 | + if ( ! isset( $_GET[ 'id' ] ) ) { |
|
17 | 17 | wp_die( __( 'Oh No!', 'yikes-inc-easy-mailchimp-extender' ), __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) ); |
18 | 18 | } |
19 | 19 | |
20 | 20 | // grab and store the form ID |
21 | - $form_id = (int) $_GET['id']; |
|
21 | + $form_id = (int) $_GET[ 'id' ]; |
|
22 | 22 | |
23 | 23 | // Get our form interface. |
24 | 24 | $form_interface = yikes_easy_mailchimp_extender_get_form_interface(); |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | |
32 | 32 | // if the form was not found return an error |
33 | 33 | if ( empty( $form ) ) { |
34 | - wp_die( printf( __( "Whoops! It looks like this form doesn't exist. If this error persists you may want to toggle on debugging on the <a href='%s'>%s</a> " , 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ), __( 'debug settings page' , 'yikes-inc-easy-mailchimp-extender' ) ), __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
34 | + wp_die( printf( __( "Whoops! It looks like this form doesn't exist. If this error persists you may want to toggle on debugging on the <a href='%s'>%s</a> ", 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ), __( 'debug settings page', 'yikes-inc-easy-mailchimp-extender' ) ), __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // set global form data, mainly for use in custom form field declarations |
38 | - $GLOBALS["form_data"] = $form; |
|
38 | + $GLOBALS[ "form_data" ] = $form; |
|
39 | 39 | |
40 | - $custom_styles = $form['custom_styles']; |
|
41 | - $optin_settings = $form['optin_settings']; |
|
42 | - $submission_settings = $form['submission_settings']; |
|
43 | - $error_messages = $form['error_messages']; |
|
40 | + $custom_styles = $form[ 'custom_styles' ]; |
|
41 | + $optin_settings = $form[ 'optin_settings' ]; |
|
42 | + $submission_settings = $form[ 'submission_settings' ]; |
|
43 | + $error_messages = $form[ 'error_messages' ]; |
|
44 | 44 | |
45 | - if ( isset( $form['form_settings'] ) ) { |
|
46 | - $form_settings = $form['form_settings']; |
|
45 | + if ( isset( $form[ 'form_settings' ] ) ) { |
|
46 | + $form_settings = $form[ 'form_settings' ]; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // get defaults if none are saved in the database yet |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // Get the merge fields |
89 | - $available_merge_variables = $list_handler->get_merge_fields( $form['list_id'] ); |
|
89 | + $available_merge_variables = $list_handler->get_merge_fields( $form[ 'list_id' ] ); |
|
90 | 90 | if ( is_wp_error( $available_merge_variables ) ) { |
91 | 91 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
92 | 92 | $error_logging->maybe_write_to_log( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // get the interest group data |
101 | - $interest_groupings = $list_handler->get_interest_categories( $form['list_id'] ); |
|
101 | + $interest_groupings = $list_handler->get_interest_categories( $form[ 'list_id' ] ); |
|
102 | 102 | if ( is_wp_error( $interest_groupings ) ) { |
103 | 103 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
104 | 104 | $error_logging->maybe_write_to_log( |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | add_query_arg( |
116 | 116 | array( |
117 | 117 | 'action' => 'yikes-easy-mc-update-form', |
118 | - 'nonce' => wp_create_nonce( 'update-mailchimp-form'.-$form['id'] ) |
|
118 | + 'nonce' => wp_create_nonce( 'update-mailchimp-form' . -$form[ 'id' ] ) |
|
119 | 119 | ) |
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | /* Display Our Form */ |
123 | 123 | ?> |
124 | 124 | <!-- Freddie Logo --> |
125 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
125 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
126 | 126 | |
127 | - <h1>YIKES Easy Forms for MailChimp | <?php echo __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $form['form_name']; ?></h1> |
|
127 | + <h1>YIKES Easy Forms for MailChimp | <?php echo __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $form[ 'form_name' ]; ?></h1> |
|
128 | 128 | |
129 | 129 | <!-- Settings Page Description --> |
130 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Update this MailChimp form\'s fields, styles and settings below.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
130 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Update this MailChimp form\'s fields, styles and settings below.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
131 | 131 | |
132 | 132 | <?php |
133 | - if ( isset( $_REQUEST['updated-form'] ) && $_REQUEST['updated-form'] == 'true' ) { |
|
133 | + if ( isset( $_REQUEST[ 'updated-form' ] ) && $_REQUEST[ 'updated-form' ] == 'true' ) { |
|
134 | 134 | ?> |
135 | 135 | <div class="updated manage-form-admin-notice"> |
136 | 136 | <p><?php _e( 'Opt-in form successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | <div class="inside"> |
155 | 155 | |
156 | 156 | <label for="form-name"> |
157 | - <h3 class="bg-transparent"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
158 | - <input autocomplete="disabled" id="form-name" name="form-name" type="text" value="<?php echo stripslashes( esc_html( $form['form_name'] ) ); ?>" class="widefat" /> |
|
159 | - <p class="description"><?php _e( "The title of this signup form." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
157 | + <h3 class="bg-transparent"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
158 | + <input autocomplete="disabled" id="form-name" name="form-name" type="text" value="<?php echo stripslashes( esc_html( $form[ 'form_name' ] ) ); ?>" class="widefat" /> |
|
159 | + <p class="description"><?php _e( "The title of this signup form.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
160 | 160 | </label> |
161 | 161 | |
162 | 162 | <label for="form-description"> |
163 | - <h3 class="bg-transparent"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
164 | - <textarea name="form-description" id="form-description" class="large-text edit-form-form-description"><?php echo isset( $form['form_description'] ) ? stripslashes( esc_textarea( $form['form_description'] ) ) : ''; ?></textarea> |
|
165 | - <p class="description"><?php _e( "Descriptions are optional and you may choose to display it to visitors to your site." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
163 | + <h3 class="bg-transparent"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
164 | + <textarea name="form-description" id="form-description" class="large-text edit-form-form-description"><?php echo isset( $form[ 'form_description' ] ) ? stripslashes( esc_textarea( $form[ 'form_description' ] ) ) : ''; ?></textarea> |
|
165 | + <p class="description"><?php _e( "Descriptions are optional and you may choose to display it to visitors to your site.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
166 | 166 | <p class="description"><?php printf( __( 'To display the number of subscribers for the list associated with this form, use %s in the form description field above.', 'yikes-inc-easy-mailchimp-extender' ), '<code>[yikes-mailchimp-subscriber-count]</code>' ); ?><p> |
167 | 167 | </label> |
168 | 168 | |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | |
179 | 179 | <ul id="yikes_easy_mc_toolbar_links"> |
180 | 180 | <li class="hidden_setting_list"> |
181 | - <a class="hidden_setting form-builder selected_hidden_setting" data-attr-container="form-builder" onclick="return false;" title="<?php esc_attr_e( 'Customize Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
181 | + <a class="hidden_setting form-builder selected_hidden_setting" data-attr-container="form-builder" onclick="return false;" title="<?php esc_attr_e( 'Customize Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
182 | 182 | <div class="selected_setting_triangle"></div> |
183 | 183 | </li> |
184 | 184 | <li class="hidden_setting_list"> |
185 | - <a class="hidden_setting form-settings" onclick="return false;" data-attr-container="form-settings" title="<?php esc_attr_e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
185 | + <a class="hidden_setting form-settings" onclick="return false;" data-attr-container="form-settings" title="<?php esc_attr_e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
186 | 186 | </li> |
187 | 187 | <li class="hidden_setting_list"> |
188 | - <a class="hidden_setting error-messages" onclick="return false;" data-attr-container="error-messages" title="<?php esc_attr_e( 'Customize Form Messages' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Custom Messages' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
188 | + <a class="hidden_setting error-messages" onclick="return false;" data-attr-container="error-messages" title="<?php esc_attr_e( 'Customize Form Messages', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Custom Messages', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
189 | 189 | </li> |
190 | - <?php do_action( 'yikes-mailchimp-edit-form-section-links' , $form ); ?> |
|
190 | + <?php do_action( 'yikes-mailchimp-edit-form-section-links', $form ); ?> |
|
191 | 191 | </ul> |
192 | 192 | |
193 | 193 | </div> |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | <div class="meta-box-sortables ui-sortable"> |
209 | 209 | <div class="postbox yikes-easy-mc-postbox"> |
210 | 210 | <!-- container title --> |
211 | - <h3 class="edit-form-title" id="form-builder-div" data-list-id="<?php echo $form['list_id'] ?>" ><?php _e( 'Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
212 | - <p id="edit-form-description" class="description edit-form-description-form-builder"><?php _e( 'Click a field to show its advanced options or drag fields to re-arrange them. Click <span class="dashicons dashicons-edit"></span> to edit a field label. Make sure you hit "Update Form" to save all of your changes.' , 'yikes-inc-easy-mailchimp-extender' );?></p> |
|
211 | + <h3 class="edit-form-title" id="form-builder-div" data-list-id="<?php echo $form[ 'list_id' ] ?>" ><?php _e( 'Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
212 | + <p id="edit-form-description" class="description edit-form-description-form-builder"><?php _e( 'Click a field to show its advanced options or drag fields to re-arrange them. Click <span class="dashicons dashicons-edit"></span> to edit a field label. Make sure you hit "Update Form" to save all of your changes.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
213 | 213 | <div id="form-builder-container" class="inside"> |
214 | 214 | <!-- #poststuff --> |
215 | - <?php echo $this->generate_form_editor( $form['fields'], $form['list_id'] , $available_merge_variables , isset( $interest_groupings ) ? $interest_groupings : array() ); ?> |
|
215 | + <?php echo $this->generate_form_editor( $form[ 'fields' ], $form[ 'list_id' ], $available_merge_variables, isset( $interest_groupings ) ? $interest_groupings : array() ); ?> |
|
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <!-- Bulk Delete Form Fields --> |
219 | - <a href="#" class="clear-form-fields" <?php if( isset( $form['fields'] ) && count( $form['fields'] ) <= 0 ) { ?> style="display:none;" <?php } ?>><?php _e( 'Clear Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
219 | + <a href="#" class="clear-form-fields" <?php if ( isset( $form[ 'fields' ] ) && count( $form[ 'fields' ] ) <= 0 ) { ?> style="display:none;" <?php } ?>><?php _e( 'Clear Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
220 | 220 | |
221 | 221 | <?php |
222 | - $display_none = ( isset( $form['fields'] ) && count( $form['fields'] ) <= 0 ) ? 'display:none;' : ''; |
|
222 | + $display_none = ( isset( $form[ 'fields' ] ) && count( $form[ 'fields' ] ) <= 0 ) ? 'display:none;' : ''; |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <!-- Save Fields Button --> |
226 | - <?php submit_button( __( 'Update Form' ) , 'primary' , '' , false , array( 'onclick' => '', 'style' => 'float:right;margin-right:12px;'.$display_none ) ); ?> |
|
226 | + <?php submit_button( __( 'Update Form' ), 'primary', '', false, array( 'onclick' => '', 'style' => 'float:right;margin-right:12px;' . $display_none ) ); ?> |
|
227 | 227 | |
228 | 228 | <!-- .inside --> |
229 | 229 | </div> |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | <div id="postbox-container-1" class="postbox-container"> |
237 | 237 | <div class="meta-box-sortables"> |
238 | 238 | <div class="postbox yikes-easy-mc-postbox"> |
239 | - <h3 class="edit-form-title"><span><?php _e( "Form Fields & Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
239 | + <h3 class="edit-form-title"><span><?php _e( "Form Fields & Interest Groups", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
240 | 240 | <div class="inside"> |
241 | 241 | |
242 | 242 | <h3 class="nav-tab-wrapper mv_ig_list"> |
243 | - <a href="#" class="nav-tab nav-tab-active" alt="merge-variables"><div class="arrow-down"></div><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
244 | - <?php if( !isset( $merge_variable_error ) ) { ?> |
|
245 | - <a href="#" class="nav-tab"><?php _e( 'Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
243 | + <a href="#" class="nav-tab nav-tab-active" alt="merge-variables"><div class="arrow-down"></div><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
244 | + <?php if ( ! isset( $merge_variable_error ) ) { ?> |
|
245 | + <a href="#" class="nav-tab"><?php _e( 'Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
246 | 246 | <?php } else { ?> |
247 | - <a href="#" class="nav-tab no-interest-groups-found-message" disabled="disabled" title="<?php _e( "No Interest Groups Exist" , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
247 | + <a href="#" class="nav-tab no-interest-groups-found-message" disabled="disabled" title="<?php _e( "No Interest Groups Exist", 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
248 | 248 | <?php } ?> |
249 | 249 | </h3> |
250 | 250 | |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | |
253 | 253 | <div id="merge-variables-container" class="list-container"> |
254 | 254 | <?php |
255 | - if( ! isset( $merge_variable_error ) ) { |
|
255 | + if ( ! isset( $merge_variable_error ) ) { |
|
256 | 256 | // build a list of available merge variables, |
257 | 257 | // but exclude the ones already assigned to the form |
258 | - echo '<p class="description">' . __( "Select the fields below to add to the form builder." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
259 | - $this->build_available_merge_vars( $form['fields'] , $available_merge_variables ); |
|
258 | + echo '<p class="description">' . __( "Select the fields below to add to the form builder.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
259 | + $this->build_available_merge_vars( $form[ 'fields' ], $available_merge_variables ); |
|
260 | 260 | } else { |
261 | 261 | echo $merge_variable_error; |
262 | 262 | } |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | |
266 | 266 | <div id="interest-groups-container" class="list-container"> |
267 | 267 | <?php |
268 | - if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) { |
|
268 | + if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) { |
|
269 | 269 | // build a list of available merge variables, |
270 | 270 | // but exclude the ones already assigned to the form |
271 | - echo '<p class="description">' . __( "Select an interest group below to add to the form builder." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
271 | + echo '<p class="description">' . __( "Select an interest group below to add to the form builder.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
272 | 272 | // $this->build_available_merge_vars( $form['fields'] , $available_merge_variables ); |
273 | - $this->build_available_interest_groups( $form['fields'] , $interest_groupings , $form['list_id'] ); |
|
273 | + $this->build_available_interest_groups( $form[ 'fields' ], $interest_groupings, $form[ 'list_id' ] ); |
|
274 | 274 | } else { |
275 | - echo '<p class="description">' . $interest_groupings['error'] . '</p>'; |
|
275 | + echo '<p class="description">' . $interest_groupings[ 'error' ] . '</p>'; |
|
276 | 276 | } |
277 | 277 | ?> |
278 | 278 | </div> |
@@ -305,19 +305,19 @@ discard block |
||
305 | 305 | <div id="post-body-content"> |
306 | 306 | <div class="meta-box-sortables ui-sortable"> |
307 | 307 | <div class="postbox yikes-easy-mc-postbox"> |
308 | - <h3 class="edit-form-title"><span><?php _e( "Additional Form Settings" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
308 | + <h3 class="edit-form-title"><span><?php _e( "Additional Form Settings", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
309 | 309 | |
310 | 310 | <div class="inside form-settings-container"> |
311 | 311 | |
312 | - <p class="edit-form-description"><?php _e( "Adjust some additional form settings below." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
312 | + <p class="edit-form-description"><?php _e( "Adjust some additional form settings below.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
313 | 313 | |
314 | 314 | <!-- begin form classes section --> |
315 | 315 | <strong class="section-title first"><?php _e( 'Overall Form Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
316 | 316 | <section class="section-interior"> |
317 | 317 | |
318 | 318 | <!-- form classes --> |
319 | - <label for="yikes-easy-mc-form-class-names"><strong><?php _e( 'Form Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
320 | - <input type="text" class="widefat" name="yikes-easy-mc-form-class-names" id="yikes-easy-mc-form-class-names" value="<?php echo $form_settings['yikes-easy-mc-form-class-names']; ?>" placeholder="<?php _e( 'Add additional classes to this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
319 | + <label for="yikes-easy-mc-form-class-names"><strong><?php _e( 'Form Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
320 | + <input type="text" class="widefat" name="yikes-easy-mc-form-class-names" id="yikes-easy-mc-form-class-names" value="<?php echo $form_settings[ 'yikes-easy-mc-form-class-names' ]; ?>" placeholder="<?php _e( 'Add additional classes to this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
321 | 321 | <p class="description"><?php printf( __( 'Add additional class names to the %s element.', 'yikes-inc-easy-mailchimp-extender' ), '<code>' . htmlentities( '<form>' ) . '</code>' ); ?></p> |
322 | 322 | </label> |
323 | 323 | |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | |
331 | 331 | <!-- setup the checked state here --> |
332 | 332 | <!-- inline form --> |
333 | - <strong><?php _e( 'Inline Form' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
333 | + <strong><?php _e( 'Inline Form', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
334 | 334 | <label class="inline-form-label"> |
335 | - <input type="radio" name="yikes-easy-mc-inline-form[]" value="1" <?php checked( $form_settings['yikes-easy-mc-inline-form'], '1' ); ?>/><?php _e( 'Enable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
335 | + <input type="radio" name="yikes-easy-mc-inline-form[]" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-inline-form' ], '1' ); ?>/><?php _e( 'Enable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
336 | 336 | </label> |
337 | 337 | <label class="inline-form-label"> |
338 | - <input type="radio" name="yikes-easy-mc-inline-form[]" value="0" <?php checked( $form_settings['yikes-easy-mc-inline-form'], '0' ); ?> /><?php _e( 'Disable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
338 | + <input type="radio" name="yikes-easy-mc-inline-form[]" value="0" <?php checked( $form_settings[ 'yikes-easy-mc-inline-form' ], '0' ); ?> /><?php _e( 'Disable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
339 | 339 | </label> |
340 | 340 | <p class="description"><?php _e( 'Programatically setup this form so that all fields are on the same line.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
341 | 341 | <p class="description"><?php printf( __( 'If you are having issues with your theme not displaying the inline form properly, please see the following %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="https://yikesplugins.com/support/knowledge-base/my-form-fields-are-not-fully-inline-after-enabling-the-inline-form-option-how-come/" target="_blank">' . __( 'knowledge base article', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></p> |
@@ -348,21 +348,21 @@ discard block |
||
348 | 348 | <section class="section-interior"> |
349 | 349 | |
350 | 350 | <!-- Submit button type --> |
351 | - <strong><?php _e( 'Submit Button Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
351 | + <strong><?php _e( 'Submit Button Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
352 | 352 | <label class="inline-form-label"> |
353 | - <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="text" <?php checked( $form_settings['yikes-easy-mc-submit-button-type'], 'text' ); ?> /><?php _e( 'Text', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
353 | + <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="text" <?php checked( $form_settings[ 'yikes-easy-mc-submit-button-type' ], 'text' ); ?> /><?php _e( 'Text', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
354 | 354 | </label> |
355 | 355 | <label class="inline-form-label"> |
356 | - <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="image" <?php checked( $form_settings['yikes-easy-mc-submit-button-type'], 'image' ); ?> /><?php _e( 'Image', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
356 | + <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="image" <?php checked( $form_settings[ 'yikes-easy-mc-submit-button-type' ], 'image' ); ?> /><?php _e( 'Image', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
357 | 357 | </label> |
358 | 358 | <p class="description"><?php _e( 'Select the submit button type for this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
359 | 359 | <!-- end submit button type --> |
360 | 360 | |
361 | 361 | <!-- Text submit button type --> |
362 | - <section class="submit-button-type-text nested-child<?php if( $form_settings['yikes-easy-mc-submit-button-type'] == 'image' ) { echo ' hidden'; } ?>"> |
|
362 | + <section class="submit-button-type-text nested-child<?php if ( $form_settings[ 'yikes-easy-mc-submit-button-type' ] == 'image' ) { echo ' hidden'; } ?>"> |
|
363 | 363 | <!-- submit button text --> |
364 | - <label for="yikes-easy-mc-submit-button-text"><strong><?php _e( 'Submit Button Text' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
365 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-text" id="yikes-easy-mc-submit-button-text" value="<?php echo $form_settings['yikes-easy-mc-submit-button-text']; ?>" placeholder="<?php _e( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
364 | + <label for="yikes-easy-mc-submit-button-text"><strong><?php _e( 'Submit Button Text', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
365 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-text" id="yikes-easy-mc-submit-button-text" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-text' ]; ?>" placeholder="<?php _e( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
366 | 366 | <p class="description"><?php printf( __( 'Set the submit button text. Leaving this blank will default to %s.', 'yikes-inc-easy-mailchimp-extender' ), '"' . __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ) . '"' ); ?></p> |
367 | 367 | |
368 | 368 | <p class="description"><?php _e( 'The submit button text set above, can be overwritten on a per-form basis using shortcodes.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | <!-- end text submit button type --> |
372 | 372 | |
373 | 373 | <!-- Image submit button type --> |
374 | - <section class="submit-button-type-image nested-child<?php if( $form_settings['yikes-easy-mc-submit-button-type'] == 'text' ) { echo ' hidden'; } ?>"> |
|
375 | - <label for="yikes-easy-mc-submit-button-image"><strong><?php _e( 'Submit Button URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
376 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-image" id="yikes-easy-mc-submit-button-image" value="<?php echo $form_settings['yikes-easy-mc-submit-button-image']; ?>" placeholder="<?php _e( 'http://', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
374 | + <section class="submit-button-type-image nested-child<?php if ( $form_settings[ 'yikes-easy-mc-submit-button-type' ] == 'text' ) { echo ' hidden'; } ?>"> |
|
375 | + <label for="yikes-easy-mc-submit-button-image"><strong><?php _e( 'Submit Button URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
376 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-image" id="yikes-easy-mc-submit-button-image" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-image' ]; ?>" placeholder="<?php _e( 'http://', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
377 | 377 | <p class="description"><?php _e( 'Enter the URL of an image you would like to use as the submit button for this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
378 | 378 | </label> |
379 | 379 | </section> |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | |
382 | 382 | |
383 | 383 | <!-- submit button classes --> |
384 | - <label for="yikes-easy-mc-form-submit-button-classes"><strong style="float:left;"><?php _e( 'Submit Button Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
385 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-classes" id="yikes-easy-mc-submit-button-classes" value="<?php echo $form_settings['yikes-easy-mc-submit-button-classes']; ?>" placeholder="<?php _e( 'Add additional classes to this submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
384 | + <label for="yikes-easy-mc-form-submit-button-classes"><strong style="float:left;"><?php _e( 'Submit Button Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
385 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-classes" id="yikes-easy-mc-submit-button-classes" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-classes' ]; ?>" placeholder="<?php _e( 'Add additional classes to this submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
386 | 386 | <p class="description"><?php _e( 'Add custom classes to the submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
387 | 387 | </label> |
388 | 388 | <!-- end submit button classes --> |
@@ -395,45 +395,45 @@ discard block |
||
395 | 395 | <section class="section-interior"> |
396 | 396 | <!-- Schedule form --> |
397 | 397 | <label class="inline-form-label"> |
398 | - <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-schedule" value="1" <?php checked( $form_settings['yikes-easy-mc-form-schedule'], '1' ); ?>/><?php _e( 'Schedule Form', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
398 | + <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-schedule" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-form-schedule' ], '1' ); ?>/><?php _e( 'Schedule Form', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
399 | 399 | </label> |
400 | 400 | <p class="description" style="margin-bottom:0;"><?php _e( 'Set a time period that this form should be active on your site. (mm/dd/yyyy)', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
401 | 401 | <p class="description" style="margin: 0 0 .5em 0;"><?php _e( 'Once the end date & time have passed, users will no longer be able to signup for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
402 | 402 | <!-- Start Date Limitation Nested --> |
403 | - <section class="date-restriction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-schedule'] == '0' ) { echo ' hidden'; } ?>"> |
|
403 | + <section class="date-restriction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-schedule' ] == '0' ) { echo ' hidden'; } ?>"> |
|
404 | 404 | <!-- Start Date --> |
405 | - <label for="yikes-easy-mc-form-restriction-start-date"><strong><?php _e( 'Start Date' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
406 | - <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-start-date" id="yikes-easy-mc-form-restriction-start-date" value="<?php echo ! empty($form_settings['yikes-easy-mc-form-restriction-start'] ) ? date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings['yikes-easy-mc-form-restriction-start'] ) : ''; ?>" > |
|
405 | + <label for="yikes-easy-mc-form-restriction-start-date"><strong><?php _e( 'Start Date', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
406 | + <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-start-date" id="yikes-easy-mc-form-restriction-start-date" value="<?php echo ! empty( $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ) ? date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ) : ''; ?>" > |
|
407 | 407 | <?php _e( 'at', 'yikes-inc-easy-mailchimp-extender' ); ?> |
408 | 408 | </label> |
409 | 409 | |
410 | 410 | <!-- Start Time --> |
411 | - <label for="yikes-easy-mc-form-restriction-start-time"><strong><?php _e( 'Start Time' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
412 | - <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-start-time" id="yikes-easy-mc-form-restriction-start-time" value="<?php echo ! empty( $form_settings['yikes-easy-mc-form-restriction-start'] ) ? date( 'g:iA', $form_settings['yikes-easy-mc-form-restriction-start'] ) : ''; ?>" > |
|
411 | + <label for="yikes-easy-mc-form-restriction-start-time"><strong><?php _e( 'Start Time', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
412 | + <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-start-time" id="yikes-easy-mc-form-restriction-start-time" value="<?php echo ! empty( $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ) ? date( 'g:iA', $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ) : ''; ?>" > |
|
413 | 413 | </label> |
414 | 414 | <p class="description"><?php _e( 'Set the dates that this form should display on your site.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
415 | 415 | </section> |
416 | 416 | <!-- end Start Date Limitation Nested --> |
417 | 417 | |
418 | 418 | <!-- End Date Limitation Nested --> |
419 | - <section class="date-restriction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-schedule'] == '0' ) { echo ' hidden'; } ?> last"> |
|
419 | + <section class="date-restriction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-schedule' ] == '0' ) { echo ' hidden'; } ?> last"> |
|
420 | 420 | <!-- End Date --> |
421 | - <label for="yikes-easy-mc-form-restriction-end-date"><strong><?php _e( 'End Date' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
422 | - <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-end-date" id="yikes-easy-mc-form-restriction-end-date" value="<?php echo ! empty( $form_settings['yikes-easy-mc-form-restriction-end'] ) ? date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings['yikes-easy-mc-form-restriction-end'] ) : ''; ?>" > |
|
421 | + <label for="yikes-easy-mc-form-restriction-end-date"><strong><?php _e( 'End Date', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
422 | + <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-end-date" id="yikes-easy-mc-form-restriction-end-date" value="<?php echo ! empty( $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ) ? date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ) : ''; ?>" > |
|
423 | 423 | <?php _e( 'at', 'yikes-inc-easy-mailchimp-extender' ); ?> |
424 | 424 | </label> |
425 | 425 | |
426 | 426 | <!-- End Time --> |
427 | - <label for="yikes-easy-mc-form-restriction-end-time"><strong><?php _e( 'End Time' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
428 | - <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-end-time" id="yikes-easy-mc-form-restriction-end-time" value="<?php echo ! empty( $form_settings['yikes-easy-mc-form-restriction-end'] ) ? date( 'g:iA', $form_settings['yikes-easy-mc-form-restriction-end'] ) : ''; ?>" > |
|
427 | + <label for="yikes-easy-mc-form-restriction-end-time"><strong><?php _e( 'End Time', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
428 | + <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-end-time" id="yikes-easy-mc-form-restriction-end-time" value="<?php echo ! empty( $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ) ? date( 'g:iA', $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ) : ''; ?>" > |
|
429 | 429 | </label> |
430 | 430 | <p class="description"><?php _e( 'Set the dates that this form should no longer display on your site.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
431 | 431 | |
432 | 432 | <!-- Form pending message --> |
433 | - <label for="yikes-easy-mc-form-restriction-pending-message"><strong><?php _e( 'Pending Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
433 | + <label for="yikes-easy-mc-form-restriction-pending-message"><strong><?php _e( 'Pending Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
434 | 434 | <?php |
435 | 435 | wp_editor( |
436 | - $form_settings['yikes-easy-mc-form-restriction-pending-message'], |
|
436 | + $form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ], |
|
437 | 437 | 'yikes-easy-mc-form-restriction-pending-message', |
438 | 438 | array( |
439 | 439 | 'editor_class' => 'yikes-easy-mc-form-restriction-pending-message', |
@@ -445,10 +445,10 @@ discard block |
||
445 | 445 | <p class="description"><?php _e( 'Set the message that should display prior to the form being active.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
446 | 446 | |
447 | 447 | <!-- form expired message --> |
448 | - <label for="yikes-easy-mc-form-restriction-expired-message"><strong><?php _e( 'Expired Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
448 | + <label for="yikes-easy-mc-form-restriction-expired-message"><strong><?php _e( 'Expired Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
449 | 449 | <?php |
450 | 450 | wp_editor( |
451 | - $form_settings['yikes-easy-mc-form-restriction-expired-message'], |
|
451 | + $form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ], |
|
452 | 452 | 'yikes-easy-mc-form-restriction-expired-message', |
453 | 453 | array( |
454 | 454 | 'editor_class' => 'yikes-easy-mc-form-restriction-expired-message', |
@@ -463,16 +463,16 @@ discard block |
||
463 | 463 | |
464 | 464 | <!-- Require Users to be Logged In --> |
465 | 465 | <label class="inline-form-label"> |
466 | - <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-login-required" value="1" <?php checked( $form_settings['yikes-easy-mc-form-login-required'], '1' ); ?> /><?php _e( 'Require Login', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
466 | + <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-login-required" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-form-login-required' ], '1' ); ?> /><?php _e( 'Require Login', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
467 | 467 | </label> |
468 | 468 | <p class="description"><?php _e( 'Require users to be logged in before they can view and submit this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
469 | 469 | |
470 | 470 | <!-- Require Login Message --> |
471 | - <section class="login-restriction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-login-required'] == '0' ) { echo ' hidden'; } ?>"> |
|
472 | - <label for="yikes-easy-mc-form-restriction-login-message"><strong><?php _e( 'Required Login Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
471 | + <section class="login-restriction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-login-required' ] == '0' ) { echo ' hidden'; } ?>"> |
|
472 | + <label for="yikes-easy-mc-form-restriction-login-message"><strong><?php _e( 'Required Login Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
473 | 473 | <?php |
474 | 474 | wp_editor( |
475 | - $form_settings['yikes-easy-mc-form-restriction-login-message'], |
|
475 | + $form_settings[ 'yikes-easy-mc-form-restriction-login-message' ], |
|
476 | 476 | 'yikes-easy-mc-form-restriction-login-message', |
477 | 477 | array( |
478 | 478 | 'editor_class' => 'yikes-easy-mc-form-restriction-login-message', |
@@ -501,14 +501,14 @@ discard block |
||
501 | 501 | <div id="postbox-container-1" class="postbox-container"> |
502 | 502 | <div class="meta-box-sortables"> |
503 | 503 | <div class="postbox yikes-easy-mc-postbox"> |
504 | - <h3 class="edit-form-title"><span><?php _e( "Form Settings Explained" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
504 | + <h3 class="edit-form-title"><span><?php _e( "Form Settings Explained", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
505 | 505 | <div class="inside"> |
506 | 506 | |
507 | 507 | <ul> |
508 | - <li><strong><?php _e( 'Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Add additional classes to this form, allowing you to target it more easily for customization via CSS.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
509 | - <li><strong><?php _e( 'Form Layout' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Toggle the layout of this form between single column and an inline layout. The inline layout places all of your form fields and the submit button on a single line.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
510 | - <li><strong><?php _e( 'Submit Button' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust setting specific to the submit button. Change the submit button text, or set it to a specified image. Use the "Submit Button Classes" to assign additional classes to your submit button - ensuring it fits better into your theme.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
511 | - <li><strong><?php _e( 'Form Restrictions' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust the restrictions for this form. Limit form visibility to a given time period, require users to be logged in to sign up or combine the two!' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
508 | + <li><strong><?php _e( 'Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Add additional classes to this form, allowing you to target it more easily for customization via CSS.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
509 | + <li><strong><?php _e( 'Form Layout', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Toggle the layout of this form between single column and an inline layout. The inline layout places all of your form fields and the submit button on a single line.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
510 | + <li><strong><?php _e( 'Submit Button', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust setting specific to the submit button. Change the submit button text, or set it to a specified image. Use the "Submit Button Classes" to assign additional classes to your submit button - ensuring it fits better into your theme.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
511 | + <li><strong><?php _e( 'Form Restrictions', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust the restrictions for this form. Limit form visibility to a given time period, require users to be logged in to sign up or combine the two!', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
512 | 512 | </ul> |
513 | 513 | |
514 | 514 | </div> |
@@ -536,78 +536,78 @@ discard block |
||
536 | 536 | <div id="post-body-content"> |
537 | 537 | <div class="meta-box-sortables ui-sortable"> |
538 | 538 | <div class="postbox yikes-easy-mc-postbox"> |
539 | - <h3 class="edit-form-title"><span><?php _e( "Custom Messages" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
539 | + <h3 class="edit-form-title"><span><?php _e( "Custom Messages", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
540 | 540 | |
541 | 541 | <div class="inside error-message-container"> |
542 | 542 | <?php |
543 | 543 | // build our default options |
544 | 544 | $error_message_array = array( |
545 | - 'success' => __( 'Thank You for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
546 | - 'success-single-optin' => __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ), |
|
545 | + 'success' => __( 'Thank You for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ), |
|
546 | + 'success-single-optin' => __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ), |
|
547 | 547 | 'success-resubscribed' => __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ), |
548 | - 'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ), |
|
549 | - 'email-exists-error' => __( "The email you entered is already a subscriber to this list." , 'yikes-inc-easy-mailchimp-extender' ), |
|
548 | + 'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
|
549 | + 'email-exists-error' => __( "The email you entered is already a subscriber to this list.", 'yikes-inc-easy-mailchimp-extender' ), |
|
550 | 550 | 'update-link' => __( "You're already subscribed. To update your MailChimp profile, please [link]click to send yourself an update link[/link].", 'yikes-inc-easy-mailchimp-extender' ), |
551 | 551 | 'email-subject' => __( 'MailChimp Profile Update', 'yikes-inc-easy-mailchimp-extender' ), |
552 | 552 | 'update-email-success' => sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.', 'yikes-inc-easy-mailchimp-extender' ), '✔' ), |
553 | 553 | 'update-email-failure' => sprintf( __( '%s Email failed to send. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), '✕' ), |
554 | 554 | |
555 | 555 | ); |
556 | - $global_error_messages = get_option( 'yikes-easy-mc-global-error-messages' , $error_message_array ); |
|
556 | + $global_error_messages = get_option( 'yikes-easy-mc-global-error-messages', $error_message_array ); |
|
557 | 557 | ?> |
558 | - <p class="edit-form-description"><?php _e( "Customize the response messages for this form. Leave the field blank to use the default message. The messages shown below depend on the Opt-in Settings chosen." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
558 | + <p class="edit-form-description"><?php _e( "Customize the response messages for this form. Leave the field blank to use the default message. The messages shown below depend on the Opt-in Settings chosen.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
559 | 559 | |
560 | 560 | <!-- Success Message (refactored @ 6.3.0 for double optin) --> |
561 | - <label for="yikes-easy-mc-success-message"><strong><?php _e( 'Success: Double opt-in' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
562 | - <input type="text" class="widefat" name="yikes-easy-mc-success-message" id="yikes-easy-mc-success-message" value="<?php echo isset( $error_messages['success'] ) ? stripslashes( esc_html( $error_messages['success'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['success']; ?>" > |
|
561 | + <label for="yikes-easy-mc-success-message"><strong><?php _e( 'Success: Double opt-in', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
562 | + <input type="text" class="widefat" name="yikes-easy-mc-success-message" id="yikes-easy-mc-success-message" value="<?php echo isset( $error_messages[ 'success' ] ) ? stripslashes( esc_html( $error_messages[ 'success' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'success' ]; ?>" > |
|
563 | 563 | </label> |
564 | 564 | <!-- Success Message (for single optin) --> |
565 | - <label for="yikes-easy-mc-success-single-optin-message"><strong><?php _e( 'Success: Single opt-in' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
566 | - <input type="text" class="widefat" name="yikes-easy-mc-success-single-optin-message" id="yikes-easy-mc-success-single-optin-message" value="<?php echo isset( $error_messages['success-single-optin'] ) ? stripslashes( esc_html( $error_messages['success-single-optin'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['success-single-optin']; ?>" > |
|
565 | + <label for="yikes-easy-mc-success-single-optin-message"><strong><?php _e( 'Success: Single opt-in', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
566 | + <input type="text" class="widefat" name="yikes-easy-mc-success-single-optin-message" id="yikes-easy-mc-success-single-optin-message" value="<?php echo isset( $error_messages[ 'success-single-optin' ] ) ? stripslashes( esc_html( $error_messages[ 'success-single-optin' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'success-single-optin' ]; ?>" > |
|
567 | 567 | </label> |
568 | 568 | <!-- Resubscribing users when updating your profile via the form is allowed --> |
569 | - <label for="yikes-easy-mc-user-resubscribed-success-message"><strong><?php _e( 'Success: Re-subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
570 | - <input type="text" class="widefat" name="yikes-easy-mc-user-resubscribed-success-message" id="yikes-easy-mc-user-resubscribed-success-message" value="<?php echo isset( $error_messages['success-resubscribed'] ) ? stripslashes( esc_html( $error_messages['success-resubscribed'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['success-resubscribed']; ?>"> |
|
569 | + <label for="yikes-easy-mc-user-resubscribed-success-message"><strong><?php _e( 'Success: Re-subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
570 | + <input type="text" class="widefat" name="yikes-easy-mc-user-resubscribed-success-message" id="yikes-easy-mc-user-resubscribed-success-message" value="<?php echo isset( $error_messages[ 'success-resubscribed' ] ) ? stripslashes( esc_html( $error_messages[ 'success-resubscribed' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'success-resubscribed' ]; ?>"> |
|
571 | 571 | </label> |
572 | 572 | |
573 | 573 | <!-- Click the link to update user profile etc. etc. --> |
574 | - <label for="yikes-easy-mc-user-subscribed-update-link"><strong><?php _e( 'Success: Re-subscriber with link to email profile update message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
575 | - <input type="text" class="widefat" name="yikes-easy-mc-user-update-link" id="yikes-easy-mc-user-update-link" value="<?php echo isset( $error_messages['update-link'] ) ? stripslashes( esc_html( $error_messages['update-link'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['update-link']; ?>"> |
|
574 | + <label for="yikes-easy-mc-user-subscribed-update-link"><strong><?php _e( 'Success: Re-subscriber with link to email profile update message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
575 | + <input type="text" class="widefat" name="yikes-easy-mc-user-update-link" id="yikes-easy-mc-user-update-link" value="<?php echo isset( $error_messages[ 'update-link' ] ) ? stripslashes( esc_html( $error_messages[ 'update-link' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'update-link' ]; ?>"> |
|
576 | 576 | </label> |
577 | 577 | |
578 | 578 | <!-- Email Address is already subscribed --> |
579 | - <label for="yikes-easy-mc-user-subscribed-message"><strong><?php _e( 'Error: Re-subscribers not permitted' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
580 | - <input type="text" class="widefat" name="yikes-easy-mc-user-subscribed-message" id="yikes-easy-mc-user-subscribed-message" value="<?php echo isset( $error_messages['already-subscribed'] ) ? stripslashes( esc_html( $error_messages['already-subscribed'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['email-exists-error']; ?>"> |
|
579 | + <label for="yikes-easy-mc-user-subscribed-message"><strong><?php _e( 'Error: Re-subscribers not permitted', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
580 | + <input type="text" class="widefat" name="yikes-easy-mc-user-subscribed-message" id="yikes-easy-mc-user-subscribed-message" value="<?php echo isset( $error_messages[ 'already-subscribed' ] ) ? stripslashes( esc_html( $error_messages[ 'already-subscribed' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'email-exists-error' ]; ?>"> |
|
581 | 581 | </label> |
582 | 582 | |
583 | 583 | <!-- Update email successfully sent --> |
584 | - <label for="yikes-easy-mc-update-email-successful"><strong><?php _e( 'Success: Update email successfully sent' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
585 | - <input type="text" class="widefat" name="yikes-easy-mc-update-email-successful" id="yikes-easy-mc-update-email-successful" value="<?php echo isset( $error_messages['update-email-success'] ) ? stripslashes( esc_attr( $error_messages['update-email-success'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['update-email-success']; ?>" > |
|
584 | + <label for="yikes-easy-mc-update-email-successful"><strong><?php _e( 'Success: Update email successfully sent', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
585 | + <input type="text" class="widefat" name="yikes-easy-mc-update-email-successful" id="yikes-easy-mc-update-email-successful" value="<?php echo isset( $error_messages[ 'update-email-success' ] ) ? stripslashes( esc_attr( $error_messages[ 'update-email-success' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'update-email-success' ]; ?>" > |
|
586 | 586 | </label> |
587 | 587 | |
588 | 588 | <!-- Update email failed to send --> |
589 | - <label for="yikes-easy-mc-update-email-failure"><strong><?php _e( 'Error: Update email failed to send' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
590 | - <input type="text" class="widefat" name="yikes-easy-mc-update-email-failure" id="yikes-easy-mc-update-email-failure" value="<?php echo isset( $error_messages['update-email-failure'] ) ? stripslashes( esc_attr( $error_messages['update-email-failure'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['update-email-failure']; ?>" > |
|
589 | + <label for="yikes-easy-mc-update-email-failure"><strong><?php _e( 'Error: Update email failed to send', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
590 | + <input type="text" class="widefat" name="yikes-easy-mc-update-email-failure" id="yikes-easy-mc-update-email-failure" value="<?php echo isset( $error_messages[ 'update-email-failure' ] ) ? stripslashes( esc_attr( $error_messages[ 'update-email-failure' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'update-email-failure' ]; ?>" > |
|
591 | 591 | </label> |
592 | 592 | |
593 | 593 | <!-- General Error Message --> |
594 | - <label for="yikes-easy-mc-general-error-message"><strong><?php _e( 'Error: General' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
595 | - <input type="text" class="widefat" name="yikes-easy-mc-general-error-message" id="yikes-easy-mc-general-error-message" value="<?php echo isset( $error_messages['general-error'] ) ? stripslashes( esc_html( $error_messages['general-error'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['general-error']; ?>" > |
|
594 | + <label for="yikes-easy-mc-general-error-message"><strong><?php _e( 'Error: General', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
595 | + <input type="text" class="widefat" name="yikes-easy-mc-general-error-message" id="yikes-easy-mc-general-error-message" value="<?php echo isset( $error_messages[ 'general-error' ] ) ? stripslashes( esc_html( $error_messages[ 'general-error' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'general-error' ]; ?>" > |
|
596 | 596 | </label> |
597 | 597 | |
598 | 598 | <!-- Email Section --> |
599 | 599 | |
600 | 600 | <hr> |
601 | 601 | <div class="yikes-easy-mc-custom-messages-email-section"> |
602 | - <p class="edit-form-description"><?php _e( 'Customize the profile verification email sent to re-subscribers. Leave the text unedited to use the default message.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
602 | + <p class="edit-form-description"><?php _e( 'Customize the profile verification email sent to re-subscribers. Leave the text unedited to use the default message.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
603 | 603 | <!-- Email Subject --> |
604 | - <label for="yikes-easy-mc-user-email-subject"><strong><?php _e( 'Email Subject' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
605 | - <input type="text" class="widefat" name="yikes-easy-mc-user-email-subject" id="yikes-easy-mc-user-email-subject" value="<?php echo isset( $error_messages['email-subject'] ) ? stripslashes( esc_html( $error_messages['email-subject'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['email-subject']; ?>"> |
|
604 | + <label for="yikes-easy-mc-user-email-subject"><strong><?php _e( 'Email Subject', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
605 | + <input type="text" class="widefat" name="yikes-easy-mc-user-email-subject" id="yikes-easy-mc-user-email-subject" value="<?php echo isset( $error_messages[ 'email-subject' ] ) ? stripslashes( esc_html( $error_messages[ 'email-subject' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'email-subject' ]; ?>"> |
|
606 | 606 | </label> |
607 | 607 | <!-- Email Body --> |
608 | - <label for="yikes-easy-mc-user-email-body"><strong><?php _e( 'Email Body' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
608 | + <label for="yikes-easy-mc-user-email-body"><strong><?php _e( 'Email Body', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
609 | 609 | <?php |
610 | - $editor_content = ( isset( $error_messages['email-body'] ) && ! empty( $error_messages['email-body'] ) ) ? $error_messages['email-body'] : Yikes_Inc_Easy_Mailchimp_Forms_Admin::generate_default_email_body(); |
|
610 | + $editor_content = ( isset( $error_messages[ 'email-body' ] ) && ! empty( $error_messages[ 'email-body' ] ) ) ? $error_messages[ 'email-body' ] : Yikes_Inc_Easy_Mailchimp_Forms_Admin::generate_default_email_body(); |
|
611 | 611 | wp_editor( $editor_content, 'yikes-easy-mc-user-email-body', array( 'textarea_id' => 'yikes-easy-mc-user-email-body' ) ); |
612 | 612 | ?> |
613 | 613 | </label> |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | <li> |
718 | 718 | <?php |
719 | 719 | /* translators: First two placeholders are HTML <code> tags, third one is the form's name */ |
720 | - echo sprintf( esc_html__( '%1$1s[form_name]%2$2s displays your form\'s name (i.e. %3$3s).', 'yikes-inc-easy-mailchimp-extender' ), '<code>', '</code>', esc_html( $form['form_name'] ) ); |
|
720 | + echo sprintf( esc_html__( '%1$1s[form_name]%2$2s displays your form\'s name (i.e. %3$3s).', 'yikes-inc-easy-mailchimp-extender' ), '<code>', '</code>', esc_html( $form[ 'form_name' ] ) ); |
|
721 | 721 | ?> |
722 | 722 | </li> |
723 | 723 | <li> |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | </label> |
752 | 752 | <!-- End Error Messages --> |
753 | 753 | |
754 | - <?php do_action( 'yikes-mailchimp-edit-form-sections' , $form ); ?> |
|
754 | + <?php do_action( 'yikes-mailchimp-edit-form-sections', $form ); ?> |
|
755 | 755 | |
756 | 756 | </div> |
757 | 757 | <!-- .inside --> |
@@ -766,103 +766,103 @@ discard block |
||
766 | 766 | <div id="postbox-container-1" class="postbox-container yikes-easy-forms-sidebar"> |
767 | 767 | <div class="meta-box-sortables"> |
768 | 768 | <div class="postbox yikes-easy-mc-postbox"> |
769 | - <h3><span><?php _e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
769 | + <h3><span><?php _e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
770 | 770 | |
771 | 771 | <div class="inside"> |
772 | 772 | <p class="inside-section-1"> |
773 | - <label for="shortcode"><?php _e( 'Edit Another Form' , 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
773 | + <label for="shortcode"><?php _e( 'Edit Another Form', 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
774 | 774 | <select class="widefat" name="form_switcher" id="form_switcher" onchange="YIKES_Easy_MC_SwitchForm(jQuery(this).val());"> |
775 | - <?php foreach( $all_forms as $single_form ) { ?> |
|
776 | - <option <?php selected( $form_id , $single_form['id'] ); ?>value="<?php echo $single_form['id']; ?>"><?php echo $single_form['form_name']; ?></option> |
|
775 | + <?php foreach ( $all_forms as $single_form ) { ?> |
|
776 | + <option <?php selected( $form_id, $single_form[ 'id' ] ); ?>value="<?php echo $single_form[ 'id' ]; ?>"><?php echo $single_form[ 'form_name' ]; ?></option> |
|
777 | 777 | <?php } ?> |
778 | 778 | </select> |
779 | 779 | </label> |
780 | 780 | </p> |
781 | 781 | |
782 | 782 | <p class="inside-section-2"> |
783 | - <label for="shortcode"><?php _e( 'Shortcode' , 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
784 | - <input type="text" onclick="this.setSelectionRange(0, this.value.length)" class="widefat shortcode-input-field" readonly value='[yikes-mailchimp form="<?php echo $form['id']; ?>"]' /> |
|
783 | + <label for="shortcode"><?php _e( 'Shortcode', 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
784 | + <input type="text" onclick="this.setSelectionRange(0, this.value.length)" class="widefat shortcode-input-field" readonly value='[yikes-mailchimp form="<?php echo $form[ 'id' ]; ?>"]' /> |
|
785 | 785 | </label> |
786 | 786 | </p> |
787 | 787 | |
788 | 788 | |
789 | 789 | <a href="#" class="expansion-section-title settings-sidebar"> |
790 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Associated List Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
790 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Associated List Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
791 | 791 | </a> |
792 | 792 | <div class="yikes-mc-settings-expansion-section"> |
793 | 793 | <!-- Associated List --> |
794 | 794 | <p class="form-field-container"> |
795 | 795 | <!-- necessary to prevent skipping on slideToggle(); --> |
796 | - <label for="associated-list"><strong><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
796 | + <label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
797 | 797 | <select name="associated-list" id="associated-list" <?php if ( empty( $list_data ) ) { echo 'disabled="disabled"'; } ?> onchange="jQuery('.view-list-link').attr( 'href', '<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' ) ); ?>' + jQuery( this ).val() );"> |
798 | 798 | <?php |
799 | 799 | if ( ! empty( $list_data ) ) { |
800 | - foreach( $list_data as $mailing_list ) { |
|
800 | + foreach ( $list_data as $mailing_list ) { |
|
801 | 801 | ?> |
802 | - <option <?php selected( $form['list_id'] , $mailing_list['id'] ); ?> value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option> |
|
802 | + <option <?php selected( $form[ 'list_id' ], $mailing_list[ 'id' ] ); ?> value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option> |
|
803 | 803 | <?php |
804 | 804 | } |
805 | 805 | } else { |
806 | 806 | ?> |
807 | - <option value="no-forms"><?php _e( 'No Lists Found' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
807 | + <option value="no-forms"><?php _e( 'No Lists Found', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
808 | 808 | <?php |
809 | 809 | } |
810 | 810 | ?> |
811 | 811 | </select> |
812 | - <?php if( ! empty( $form['list_id'] ) ) { ?> |
|
812 | + <?php if ( ! empty( $form[ 'list_id' ] ) ) { ?> |
|
813 | 813 | <p class="description view-list"> |
814 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $form['list_id'] ) ); ?>" class="view-list-link"><?php _e( 'View List', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
814 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $form[ 'list_id' ] ) ); ?>" class="view-list-link"><?php _e( 'View List', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
815 | 815 | </p> |
816 | 816 | <p class="description"> |
817 | - <?php _e( "Users who sign up via this form will be added to the list selected above." , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
817 | + <?php _e( "Users who sign up via this form will be added to the list selected above.", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
818 | 818 | </p> |
819 | 819 | <?php } else { ?> |
820 | 820 | <p class="description"> |
821 | - <?php _e( "It looks like you first need to create a list to assign this form to. Head over to" , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" title="<?php _e( 'Create a new list' , 'yikes-inc-easy-mailchimp-extender' ); ?>">MailChimp</a> <?php _e( 'to create your first list' , 'yikes-inc-easy-mailchimp-extender' ); ?>. |
|
821 | + <?php _e( "It looks like you first need to create a list to assign this form to. Head over to", 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" title="<?php _e( 'Create a new list', 'yikes-inc-easy-mailchimp-extender' ); ?>">MailChimp</a> <?php _e( 'to create your first list', 'yikes-inc-easy-mailchimp-extender' ); ?>. |
|
822 | 822 | </p> |
823 | 823 | <?php } ?> |
824 | 824 | |
825 | 825 | <!-- Display our Clear API Cache button --> |
826 | 826 | <?php if ( false === get_transient( 'yikes-easy-mailchimp-list-data' ) && false === get_transient( 'yikes-easy-mailchimp-profile-data' ) && false === get_transient( 'yikes-easy-mailchimp-account-data' ) && false === get_transient( 'yikesinc_eme_list_ids' ) && false === get_transient( 'yikes_eme_lists' ) ) { ?> |
827 | - <p><a href="#" class="button-secondary" disabled="disabled" title="<?php _e( 'No MailChimp data found in temporary cache storage.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Clear MailChimp API Cache' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
827 | + <p><a href="#" class="button-secondary" disabled="disabled" title="<?php _e( 'No MailChimp data found in temporary cache storage.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Clear MailChimp API Cache', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
828 | 828 | <?php } else { ?> |
829 | - <p><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data' , 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" class="button-primary"><?php _e( 'Clear MailChimp API Cache' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
829 | + <p><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" class="button-primary"><?php _e( 'Clear MailChimp API Cache', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
830 | 830 | <?php } ?> |
831 | 831 | </label> |
832 | 832 | </p> |
833 | 833 | </div> |
834 | 834 | |
835 | 835 | <a href="#" class="expansion-section-title settings-sidebar"> |
836 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Opt-in Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
836 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Opt-in Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
837 | 837 | </a> |
838 | 838 | <div class="yikes-mc-settings-expansion-section"> |
839 | 839 | |
840 | 840 | <!-- Single or Double Opt-in --> |
841 | 841 | <?php |
842 | - if( !isset( $optin_settings['optin'] ) ) { |
|
843 | - $optin_settings['optin'] = '1'; |
|
842 | + if ( ! isset( $optin_settings[ 'optin' ] ) ) { |
|
843 | + $optin_settings[ 'optin' ] = '1'; |
|
844 | 844 | } |
845 | 845 | ?> |
846 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="single-double-optin"><strong><?php _e( 'Single or Double Opt-in' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
846 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="single-double-optin"><strong><?php _e( 'Single or Double Opt-in', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
847 | 847 | <span class="edit-form-field-container-span"> |
848 | - <label for="single"><input id="single" type="radio" name="single-double-optin" value="0" <?php checked( $optin_settings['optin'] , '0' ); ?>><?php _e( 'Single' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
849 | - <label for="double"><input id="double" type="radio" name="single-double-optin" value="1" <?php checked( $optin_settings['optin'] , '1' ); ?>><?php _e( 'Double' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
848 | + <label for="single"><input id="single" type="radio" name="single-double-optin" value="0" <?php checked( $optin_settings[ 'optin' ], '0' ); ?>><?php _e( 'Single', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
849 | + <label for="double"><input id="double" type="radio" name="single-double-optin" value="1" <?php checked( $optin_settings[ 'optin' ], '1' ); ?>><?php _e( 'Double', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
850 | 850 | </span> |
851 | - <p class="description"><?php _e( "Double opt-in requires users to confirm their email address before being added to a list (recommended)" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
851 | + <p class="description"><?php _e( "Double opt-in requires users to confirm their email address before being added to a list (recommended)", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
852 | 852 | </label></p> |
853 | 853 | |
854 | 854 | <!-- Update Existing Users --> |
855 | 855 | <?php |
856 | - if( !isset( $optin_settings['update_existing_user'] ) ) { |
|
857 | - $optin_settings['update_existing_user'] = '1'; |
|
856 | + if ( ! isset( $optin_settings[ 'update_existing_user' ] ) ) { |
|
857 | + $optin_settings[ 'update_existing_user' ] = '1'; |
|
858 | 858 | } |
859 | 859 | ?> |
860 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Update Existing Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
860 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Update Existing Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
861 | 861 | <span class="form-field-container-span"> |
862 | - <label for="update-user"><input type="radio" id="update-user" onchange="toggleUpdateEmailContainer(this);return false;" name="update-existing-user" value="1" <?php checked( $optin_settings['update_existing_user'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
863 | - <label for="do-not-update-user"><input type="radio" onchange="toggleUpdateEmailContainer(this);return false;" id="do-not-update-user" name="update-existing-user" value="0" <?php checked( $optin_settings['update_existing_user'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
862 | + <label for="update-user"><input type="radio" id="update-user" onchange="toggleUpdateEmailContainer(this);return false;" name="update-existing-user" value="1" <?php checked( $optin_settings[ 'update_existing_user' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
863 | + <label for="do-not-update-user"><input type="radio" onchange="toggleUpdateEmailContainer(this);return false;" id="do-not-update-user" name="update-existing-user" value="0" <?php checked( $optin_settings[ 'update_existing_user' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
864 | 864 | </span> |
865 | - <p class="description"><?php printf( __( "Update an existing subscriber's profile information instead of displaying a %s message." , "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></p> |
|
865 | + <p class="description"><?php printf( __( "Update an existing subscriber's profile information instead of displaying a %s message.", "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></p> |
|
866 | 866 | </label></p> |
867 | 867 | |
868 | 868 | <!-- |
@@ -871,101 +871,101 @@ discard block |
||
871 | 871 | - No = Just update the user profile without an email |
872 | 872 | --> |
873 | 873 | <?php |
874 | - $send_update_email = ( isset( $optin_settings['send_update_email'] ) && '' !== $optin_settings['send_update_email'] ) ? $optin_settings['send_update_email'] : 0; |
|
874 | + $send_update_email = ( isset( $optin_settings[ 'send_update_email' ] ) && '' !== $optin_settings[ 'send_update_email' ] ) ? $optin_settings[ 'send_update_email' ] : 0; |
|
875 | 875 | ?> |
876 | - <p class="form-field-container send-update-email" <?php if ( 1 !== absint( $optin_settings['update_existing_user'] ) ) { ?>style="display:none;"<?php } ?>><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Send Update Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
876 | + <p class="form-field-container send-update-email" <?php if ( 1 !== absint( $optin_settings[ 'update_existing_user' ] ) ) { ?>style="display:none;"<?php } ?>><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Send Update Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
877 | 877 | <span class="form-field-container-span"> |
878 | - <label for="update-email"><input type="radio" id="update-email" name="update-existing-email" value="1" <?php checked( $send_update_email , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
879 | - <label for="do-not-update-email"><input type="radio" id="do-not-update-email" name="update-existing-email" value="0" <?php checked( $send_update_email , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
878 | + <label for="update-email"><input type="radio" id="update-email" name="update-existing-email" value="1" <?php checked( $send_update_email, '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
879 | + <label for="do-not-update-email"><input type="radio" id="do-not-update-email" name="update-existing-email" value="0" <?php checked( $send_update_email, '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
880 | 880 | </span> |
881 | - <em><?php printf( __( "Send an email to the user granting their permission to update their profile information. Otherwise, an existing subscriber filling out this form, will have their profile information updated without any further interaction." , "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></em> |
|
881 | + <em><?php printf( __( "Send an email to the user granting their permission to update their profile information. Otherwise, an existing subscriber filling out this form, will have their profile information updated without any further interaction.", "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></em> |
|
882 | 882 | </label></p> |
883 | 883 | |
884 | 884 | </div> |
885 | 885 | |
886 | 886 | <a href="#" class="expansion-section-title settings-sidebar"> |
887 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Submission Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
887 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php _e( 'Submission Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
888 | 888 | </a> |
889 | 889 | <div class="yikes-mc-settings-expansion-section"> |
890 | 890 | <!-- AJAX form Submission --> |
891 | 891 | <?php |
892 | - if( !isset( $submission_settings['ajax'] ) ) { |
|
893 | - $submission_settings['ajax'] = '1'; |
|
892 | + if ( ! isset( $submission_settings[ 'ajax' ] ) ) { |
|
893 | + $submission_settings[ 'ajax' ] = '1'; |
|
894 | 894 | } |
895 | 895 | ?> |
896 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="form-ajax-submission"><strong><?php _e( 'Enable AJAX Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
896 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="form-ajax-submission"><strong><?php _e( 'Enable AJAX Submission', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
897 | 897 | <span class="form-field-container-span"> |
898 | - <label for="enable-ajax"><input type="radio" id="enable-ajax" name="form-ajax-submission" class="yikes-enable-disable-ajax" value="1" <?php checked( $submission_settings['ajax'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
899 | - <label for="disable-ajax"><input type="radio" id="disable-ajax" name="form-ajax-submission" class="yikes-enable-disable-ajax" value="0" <?php checked( $submission_settings['ajax'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
898 | + <label for="enable-ajax"><input type="radio" id="enable-ajax" name="form-ajax-submission" class="yikes-enable-disable-ajax" value="1" <?php checked( $submission_settings[ 'ajax' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
899 | + <label for="disable-ajax"><input type="radio" id="disable-ajax" name="form-ajax-submission" class="yikes-enable-disable-ajax" value="0" <?php checked( $submission_settings[ 'ajax' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
900 | 900 | </span> |
901 | - <p class="description"><?php _e( "AJAX form submissions transmit data without requiring the page to refresh." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
901 | + <p class="description"><?php _e( "AJAX form submissions transmit data without requiring the page to refresh.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
902 | 902 | </label></p> |
903 | 903 | |
904 | 904 | <!-- Redirect User On Submission --> |
905 | 905 | <?php |
906 | - if( !isset( $submission_settings['redirect_on_submission'] ) ) { |
|
907 | - $submission_settings['redirect_on_submission'] = '0'; |
|
908 | - $submission_settings['redirect_page'] = ''; |
|
906 | + if ( ! isset( $submission_settings[ 'redirect_on_submission' ] ) ) { |
|
907 | + $submission_settings[ 'redirect_on_submission' ] = '0'; |
|
908 | + $submission_settings[ 'redirect_page' ] = ''; |
|
909 | 909 | } |
910 | 910 | ?> |
911 | - <p><label for="redirect-user-on-submission"><strong><?php _e( 'Redirect On Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
911 | + <p><label for="redirect-user-on-submission"><strong><?php _e( 'Redirect On Submission', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
912 | 912 | <span class="form-field-container-span"> |
913 | - <label for="redirect-user"><input type="radio" id="redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="1" <?php checked( $submission_settings['redirect_on_submission'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
914 | - <label for="do-not-redirect-user"><input type="radio" id="do-not-redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="0" <?php checked( $submission_settings['redirect_on_submission'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
913 | + <label for="redirect-user"><input type="radio" id="redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="1" <?php checked( $submission_settings[ 'redirect_on_submission' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
914 | + <label for="do-not-redirect-user"><input type="radio" id="do-not-redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="0" <?php checked( $submission_settings[ 'redirect_on_submission' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
915 | 915 | </span> |
916 | - <?php $this->generate_page_redirect_dropdown( $submission_settings['redirect_on_submission'] , $submission_settings['redirect_page'], ( isset( $submission_settings['custom_redirect_url'] ) ) ? esc_url( $submission_settings['custom_redirect_url'] ) : '' ); ?> |
|
917 | - <p class="description"><?php _e( "When the user signs up would you like to redirect them to another page?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
916 | + <?php $this->generate_page_redirect_dropdown( $submission_settings[ 'redirect_on_submission' ], $submission_settings[ 'redirect_page' ], ( isset( $submission_settings[ 'custom_redirect_url' ] ) ) ? esc_url( $submission_settings[ 'custom_redirect_url' ] ) : '' ); ?> |
|
917 | + <p class="description"><?php _e( "When the user signs up would you like to redirect them to another page?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
918 | 918 | </label></p> |
919 | 919 | |
920 | 920 | <?php |
921 | - if ( ! isset( $submission_settings['redirect_new_window'] ) ) { |
|
922 | - $submission_settings['redirect_new_window'] = '0'; |
|
921 | + if ( ! isset( $submission_settings[ 'redirect_new_window' ] ) ) { |
|
922 | + $submission_settings[ 'redirect_new_window' ] = '0'; |
|
923 | 923 | } |
924 | 924 | ?> |
925 | 925 | |
926 | 926 | <!-- Option to open the redirect URL in a new window --> |
927 | - <div class="redirect-new-window-div" <?php if ( ( ! isset( $submission_settings['redirect_on_submission'] ) || $submission_settings['redirect_on_submission'] === '0' ) || ( ! isset( $submission_settings['ajax'] ) || $submission_settings['ajax'] !== '1' ) ) { echo 'style="display:none;"'; } ?>> |
|
928 | - <p><strong><?php _e( "Open Redirect URL in a New Window" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
927 | + <div class="redirect-new-window-div" <?php if ( ( ! isset( $submission_settings[ 'redirect_on_submission' ] ) || $submission_settings[ 'redirect_on_submission' ] === '0' ) || ( ! isset( $submission_settings[ 'ajax' ] ) || $submission_settings[ 'ajax' ] !== '1' ) ) { echo 'style="display:none;"'; } ?>> |
|
928 | + <p><strong><?php _e( "Open Redirect URL in a New Window", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
929 | 929 | <label for="redirect-new-window-yes"> |
930 | - <input type="radio" class="widefat custom-redirect-new-window" id="redirect-new-window-yes" name="redirect_new_window" value="1" <?php checked( $submission_settings['redirect_new_window'], '1' ); ?>/><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
930 | + <input type="radio" class="widefat custom-redirect-new-window" id="redirect-new-window-yes" name="redirect_new_window" value="1" <?php checked( $submission_settings[ 'redirect_new_window' ], '1' ); ?>/><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
931 | 931 | </label> |
932 | 932 | |
933 | 933 | <label for="redirect-new-window-no"> |
934 | - <input type="radio" class="widefat redirect-new-window" id="redirect-new-window-no" name="redirect_new_window" value="0" <?php checked( $submission_settings['redirect_new_window'] , '0' ); ?>/><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
934 | + <input type="radio" class="widefat redirect-new-window" id="redirect-new-window-no" name="redirect_new_window" value="0" <?php checked( $submission_settings[ 'redirect_new_window' ], '0' ); ?>/><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
935 | 935 | </label> |
936 | - <p class="description"><?php _e( "Should the redirect URL open in a new window/tab?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
936 | + <p class="description"><?php _e( "Should the redirect URL open in a new window/tab?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
937 | 937 | </div> |
938 | 938 | |
939 | 939 | <!-- Hide Form On Submission --> |
940 | 940 | <?php |
941 | - if( !isset( $submission_settings['hide_form_post_signup'] ) ) { |
|
942 | - $submission_settings['hide_form_post_signup'] = '0'; |
|
941 | + if ( ! isset( $submission_settings[ 'hide_form_post_signup' ] ) ) { |
|
942 | + $submission_settings[ 'hide_form_post_signup' ] = '0'; |
|
943 | 943 | } |
944 | 944 | ?> |
945 | - <p><label for="hide-form-post-signup"><strong><?php _e( 'Hide Form After Sign Up' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
945 | + <p><label for="hide-form-post-signup"><strong><?php _e( 'Hide Form After Sign Up', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
946 | 946 | <span class="form-field-container-span"> |
947 | - <label for="hide-form"><input type="radio" id="hide-form" name="hide-form-post-signup" value="1" <?php checked( $submission_settings['hide_form_post_signup'] , '1' ); ?> checked><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
948 | - <label for="do-not-hide-form"><input type="radio" id="do-not-hide-form" name="hide-form-post-signup" value="0" <?php checked( $submission_settings['hide_form_post_signup'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
947 | + <label for="hide-form"><input type="radio" id="hide-form" name="hide-form-post-signup" value="1" <?php checked( $submission_settings[ 'hide_form_post_signup' ], '1' ); ?> checked><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
948 | + <label for="do-not-hide-form"><input type="radio" id="do-not-hide-form" name="hide-form-post-signup" value="0" <?php checked( $submission_settings[ 'hide_form_post_signup' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
949 | 949 | </span> |
950 | - <p class="description"><?php _e( "Should the form be hidden after the user successfully signs up?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
950 | + <p class="description"><?php _e( "Should the form be hidden after the user successfully signs up?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
951 | 951 | </label></p> |
952 | 952 | |
953 | 953 | <!-- Append or Replace Interest Groups --> |
954 | 954 | <?php |
955 | - if( !isset( $submission_settings['replace_interests'] ) ) { |
|
956 | - $submission_settings['replace_interests'] = '1'; // defaults to true |
|
955 | + if ( ! isset( $submission_settings[ 'replace_interests' ] ) ) { |
|
956 | + $submission_settings[ 'replace_interests' ] = '1'; // defaults to true |
|
957 | 957 | } |
958 | 958 | ?> |
959 | - <p><label for="replace-interest-groups"><strong><?php _e( 'Existing Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
959 | + <p><label for="replace-interest-groups"><strong><?php _e( 'Existing Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
960 | 960 | <span class="form-field-container-span"> |
961 | - <label for="replace-interest-groups"><input type="radio" id="replace-interest-groups" name="replace-interest-groups" value="1" <?php checked( $submission_settings['replace_interests'] , '1' ); ?> checked><?php _e( 'Replace' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
962 | - <label for="update-interest-groups"><input type="radio" id="update-interest-groups" name="replace-interest-groups" value="0" <?php checked( $submission_settings['replace_interests'] , '0' ); ?>><?php _e( 'Update' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
961 | + <label for="replace-interest-groups"><input type="radio" id="replace-interest-groups" name="replace-interest-groups" value="1" <?php checked( $submission_settings[ 'replace_interests' ], '1' ); ?> checked><?php _e( 'Replace', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
962 | + <label for="update-interest-groups"><input type="radio" id="update-interest-groups" name="replace-interest-groups" value="0" <?php checked( $submission_settings[ 'replace_interests' ], '0' ); ?>><?php _e( 'Update', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
963 | 963 | </span> |
964 | 964 | |
965 | - <p class="description"><small><?php _e( "<strong>Replace</strong>: Replace all interest groups with the new ones submitted." , 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
965 | + <p class="description"><small><?php _e( "<strong>Replace</strong>: Replace all interest groups with the new ones submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
966 | 966 | |
967 | 967 | |
968 | - <p class="description"><small><?php _e( "<strong>Update</strong>: Update <em>only</em> the ones submitted. Leave existing interest groups as is." , 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
968 | + <p class="description"><small><?php _e( "<strong>Update</strong>: Update <em>only</em> the ones submitted. Leave existing interest groups as is.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
969 | 969 | |
970 | 970 | </label></p> |
971 | 971 | |
@@ -978,9 +978,9 @@ discard block |
||
978 | 978 | |
979 | 979 | <span class="form-buttons-container" id="major-publishing-actions"> |
980 | 980 | <?php |
981 | - echo submit_button( __( 'Update Form' ) , 'primary' , '' , false , array( 'onclick' => 'jQuery(this).parent().prev().css({"display":"block","visibility":"inherit"});' ) ); |
|
982 | - $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form['id'] , 'nonce' => wp_create_nonce( 'delete-mailchimp-form-'.$form['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); |
|
983 | - echo '<a href="' . $url . '" class="yikes-delete-mailchimp-form" onclick="return confirm(\'' . __( "Are you sure you want to delete this form? This cannot be undone." , 'yikes-inc-easy-mailchimp-extender' ) . '\');">' . __( "Delete Form" , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
981 | + echo submit_button( __( 'Update Form' ), 'primary', '', false, array( 'onclick' => 'jQuery(this).parent().prev().css({"display":"block","visibility":"inherit"});' ) ); |
|
982 | + $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form[ 'id' ], 'nonce' => wp_create_nonce( 'delete-mailchimp-form-' . $form[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); |
|
983 | + echo '<a href="' . $url . '" class="yikes-delete-mailchimp-form" onclick="return confirm(\'' . __( "Are you sure you want to delete this form? This cannot be undone.", 'yikes-inc-easy-mailchimp-extender' ) . '\');">' . __( "Delete Form", 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
984 | 984 | ?> |
985 | 985 | </span> |
986 | 986 |