PluginProbe
Mailchimp List Subscribe Form / 1.6.0
Mailchimp List Subscribe Form v1.6.0
1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 All 55 releases
mailchimp / views / setup_page.php

setup_page.php in Mailchimp List Subscribe Form 1.6.0, at views/setup_page.php

457 lines 18.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * View file for the setup page.
4 *
5 * @package Mailchimp
6 */
7
8 $user = get_option( 'mc_user' );
9 /* TODO MC SOPRESTO USER INFO */
10
11 // If we have an API Key, see if we need to change the lists and its options
12 mailchimp_sf_change_list_if_necessary();
13
14 $is_list_selected = false;
15 ?>
16 <div class="wrap">
17 <hr class="wp-header-end" />
18 <?php
19 // Display our success/error message(s) if have them
20 if ( mailchimp_sf_global_msg() !== '' ) {
21 ?>
22 <div id="mc-message" class=""><?php echo wp_kses_post( mailchimp_sf_global_msg() ); ?></div>
23 <?php
24 }
25 ?>
26 <table class="mc-user" cellspacing="0">
27 <tr>
28 <td><h3><?php esc_html_e( 'Logged in as', 'mailchimp' ); ?>: <?php echo esc_html( $user['username'] ); ?></h3>
29 </td>
30 <td>
31 <form method="post" action="">
32 <input type="hidden" name="mcsf_action" value="logout"/>
33 <input type="submit" name="Submit" value="<?php esc_attr_e( 'Logout', 'mailchimp' ); ?>" class="button button-secondary mailchimp-sf-button small" />
34 <?php wp_nonce_field( 'mc_logout', '_mcsf_nonce_action' ); ?>
35 </form>
36 </td>
37 </tr>
38 </table>
39 <?php
40 // Just get out if nothing else matters...
41 $api = mailchimp_sf_get_api();
42 if ( ! $api ) {
43 return;
44 }
45 ?>
46 <h3 class="mc-h2"><?php esc_html_e( 'Your Lists', 'mailchimp' ); ?></h3>
47
48 <div>
49 <p class="mc-p"><?php esc_html_e( 'Please select the Mailchimp list you\'d like to connect to your form.', 'mailchimp' ); ?></p>
50 <p class="mc-list-note"><strong><?php esc_html_e( 'Note:', 'mailchimp' ); ?></strong> <?php esc_html_e( 'Updating your list will not remove list settings in this plugin, but changing lists will.', 'mailchimp' ); ?></p>
51
52 <form method="post" action="<?php echo esc_url( add_query_arg( array( 'page' => 'mailchimp_sf_options' ), admin_url( 'admin.php' ) ) ); ?>">
53 <?php
54 // we *could* support paging, but few users have that many lists (and shouldn't)
55 $lists = $api->get( 'lists', 100, array( 'fields' => 'lists.id,lists.name,lists.email_type_option' ) );
56 if ( is_wp_error( $lists ) ) {
57 ?>
58 <div class="error_msg">
59 <?php
60 printf(
61 /* translators: %s: error message */
62 esc_html__( 'Uh-oh, we couldn\'t get your lists from Mailchimp! Error: %s', 'mailchimp' ),
63 esc_html( $lists->get_error_message() )
64 );
65 ?>
66 </div>
67 <?php
68 } elseif ( isset( $lists['lists'] ) && count( $lists['lists'] ) === 0 ) {
69 ?>
70 <div class="error_msg">
71 <?php
72 printf(
73 /* translators: %s: link to Mailchimp */
74 esc_html__( 'Uh-oh, you don\'t have any lists defined! Please visit %s, login, and setup a list before using this tool!', 'mailchimp' ),
75 "<a href='http://www.mailchimp.com/'>Mailchimp</a>"
76 );
77 ?>
78 </div>
79 <?php
80 } else {
81 $lists = $lists['lists'];
82 $option = get_option( 'mc_list_id' );
83 $list_ids = array_map(
84 function ( $ele ) {
85 return $ele['id'];
86 },
87 $lists
88 );
89 $is_list_selected = in_array( $option, $list_ids, true );
90 ?>
91 <table class="mc-list-select" cellspacing="0">
92 <tr class="mc-list-row">
93 <td>
94 <label class="screen-reader-text" for="mc_list_id"><?php esc_html_e( 'Select a list', 'mailchimp' ); ?></label>
95 <select id="mc_list_id" name="mc_list_id" style="min-width:200px;">
96 <option value=""> &mdash; <?php esc_html_e( 'Select A List', 'mailchimp' ); ?> &mdash; </option>
97 <?php
98 foreach ( $lists as $list ) {
99 ?>
100 <option value="<?php echo esc_attr( $list['id'] ); ?>"<?php selected( $list['id'], $option ); ?>><?php echo esc_html( $list['name'] ); ?></option>
101 <?php
102 }
103 ?>
104 </select>
105 </td>
106 <td>
107 <input type="hidden" name="mcsf_action" value="update_mc_list_id" />
108 <input type="submit" name="Submit" value="<?php esc_attr_e( 'Update List', 'mailchimp' ); ?>" class="button mailchimp-sf-button small" />
109 </td>
110 </tr>
111 </table>
112 <?php
113 } //end select list
114 ?>
115 </form>
116 </div>
117
118 <br/>
119
120 <?php
121 // Just get out if nothing else matters...
122 if ( ! $is_list_selected ) {
123 return;
124 }
125
126 // The main Settings form
127 ?>
128 <div>
129 <form method="post" action="<?php echo esc_url( add_query_arg( array( 'page' => 'mailchimp_sf_options' ), admin_url( 'admin.php' ) ) ); ?>">
130 <div class="mc-section">
131 <input type="hidden" name="mcsf_action" value="change_form_settings">
132 <?php wp_nonce_field( 'update_general_form_settings', '_mcsf_nonce_action' ); ?>
133
134 <table class="widefat mc-widefat mc-label-options">
135 <tr><th colspan="2"><?php esc_html_e( 'Content Options', 'mailchimp' ); ?></th></tr>
136 <tr valign="top">
137 <th scope="row">
138 <label for="mc_header_content"><?php esc_html_e( 'Header', 'mailchimp' ); ?></label>
139 </th>
140 <td>
141 <textarea class="widefat" id="mc_header_content" name="mc_header_content" rows="2"><?php echo wp_kses_post( get_option( 'mc_header_content' ) ); ?></textarea><br/>
142 <?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?>
143 </td>
144 </tr>
145
146 <tr valign="top">
147 <th scope="row">
148 <label for="mc_subheader_content"><?php esc_html_e( 'Sub-header', 'mailchimp' ); ?></label>
149 </th>
150 <td>
151 <textarea class="widefat" id="mc_subheader_content" name="mc_subheader_content" rows="2"><?php echo wp_kses_post( get_option( 'mc_subheader_content' ) ); ?></textarea><br/>
152 <?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?><br/>
153 <?php esc_html_e( 'This will be displayed under the heading and above the form.', 'mailchimp' ); ?>
154 </td>
155 </tr>
156
157 <tr valign="top" class="last-row">
158 <th scope="row">
159 <label for="mc_submit_text"><?php esc_html_e( 'Submit Button', 'mailchimp' ); ?></label>
160 </th>
161 <td>
162 <input class="widefat" type="text" id="mc_submit_text" name="mc_submit_text" size="70" value="<?php echo esc_attr( get_option( 'mc_submit_text' ) ); ?>"/>
163 </td>
164 </tr>
165 </table>
166 <input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/>
167
168
169 <table class="widefat mc-widefat mc-nuke-styling">
170 <tr><th colspan="2"><?php esc_html_e( 'Remove Mailchimp CSS', 'mailchimp' ); ?></th></tr>
171 <tr><th><label for="mc_nuke_all_styles"><?php esc_html_e( 'Remove CSS' ); ?></label></th><td><span class="mc-pre-input"></span><input type="checkbox" name="mc_nuke_all_styles" id="mc_nuke_all_styles" <?php checked( get_option( 'mc_nuke_all_styles' ), true ); ?> onclick="showMe('mc-custom-styling')"/><?php esc_html_e( 'This will disable all Mailchimp CSS, so it\'s recommended for WordPress experts only.' ); ?></td></tr>
172 </table>
173
174 <table class="widefat mc-widefat mc-custom-styling" id="mc-custom-styling" style="<?php echo esc_attr( ( get_option( 'mc_nuke_all_styles' ) === '1' ? 'display:none;' : '' ) ); ?>">
175 <tr>
176 <th colspan="2"><?php esc_html_e( 'Custom Styling', 'mailchimp' ); ?></th>
177 </tr>
178 <tr>
179 <th>
180 <label for="mc_custom_style"><?php esc_html_e( 'Enabled?', 'mailchimp' ); ?></label>
181 </th>
182 <td>
183 <span class="mc-pre-input"></span>
184 <input type="checkbox" name="mc_custom_style" id="mc_custom_style"<?php checked( get_option( 'mc_custom_style' ), 'on' ); ?> />
185 <em><?php esc_html_e( 'Edit the default Mailchimp CSS style.' ); ?></em>
186 </td>
187 </tr>
188 <tr>
189 <th>
190 <label for="mc_form_border_width"><?php esc_html_e( 'Border Width (px)', 'mailchimp' ); ?></label>
191 </th>
192 <td>
193 <input type="text" id="mc_form_border_width" name="mc_form_border_width" size="3" maxlength="3" value="<?php echo esc_attr( get_option( 'mc_form_border_width' ) ); ?>"/>
194 <em><?php esc_html_e( 'Set to 0 for no border, do not enter', 'mailchimp' ); ?> px</em>
195 </td>
196 </tr>
197 <tr>
198 <th>
199 <label for="mc_form_border_color"><?php esc_html_e( 'Border Color', 'mailchimp' ); ?></label>
200 </th>
201 <td>
202 <span class="mc-pre-input">#</span>
203 <input type="text" id="mc_form_border_color" name="mc_form_border_color" size="7" maxlength="6" value="<?php echo esc_attr( get_option( 'mc_form_border_color' ) ); ?>"/>
204 <em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em>
205 </td>
206 </tr>
207 <tr>
208 <th>
209 <label for="mc_form_text_color"><?php esc_html_e( 'Text Color', 'mailchimp' ); ?></label>
210 </th>
211 <td>
212 <span class="mc-pre-input">#</span>
213 <input type="text" id="mc_form_text_color" name="mc_form_text_color" size="7" maxlength="6" value="<?php echo esc_attr( get_option( 'mc_form_text_color' ) ); ?>"/>
214 <em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em>
215 </td>
216 </tr>
217 <tr class="last-row">
218 <th>
219 <label for="mc_form_background"><?php esc_html_e( 'Background Color', 'mailchimp' ); ?></label>
220 </th>
221 <td>
222 <span class="mc-pre-input">#</span>
223 <input type="text" id="mc_form_background" name="mc_form_background" size="7" maxlength="6" value="<?php echo esc_attr( get_option( 'mc_form_background' ) ); ?>"/>
224 <em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em>
225 </td>
226 </tr>
227 </table>
228 <input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/>
229
230 <table class="widefat mc-widefat">
231 <tr><th colspan="2"><?php esc_html_e( 'List Options', 'mailchimp' ); ?></th></tr>
232
233 <tr valign="top">
234 <th scope="row"><?php esc_html_e( 'Use JavaScript Support?', 'mailchimp' ); ?></th>
235 <td><input name="mc_use_javascript" type="checkbox" <?php checked( get_option( 'mc_use_javascript' ), 'on' ); ?> id="mc_use_javascript" class="code" />
236 <em><label for="mc_use_javascript"><?php esc_html_e( 'This plugin uses JavaScript submission, and it should degrade gracefully for users not using JavaScript. It is optional, and you can turn it off at any time.', 'mailchimp' ); ?></label></em>
237 </td>
238 </tr>
239
240 <tr valign="top">
241 <th scope="row"><?php esc_html_e( 'Use JavaScript Datepicker?', 'mailchimp' ); ?></th>
242 <td><input name="mc_use_datepicker" type="checkbox" <?php checked( get_option( 'mc_use_datepicker' ), 'on' ); ?> id="mc_use_datepicker" class="code" />
243 <em><label for="mc_use_datepicker"><?php esc_html_e( 'We\'ll use the jQuery UI Datepicker for dates.', 'mailchimp' ); ?></label></em>
244 </td>
245 </tr>
246
247 <tr valign="top">
248 <th scope="row"><?php esc_html_e( 'Use Double Opt-In (Recommended)?', 'mailchimp' ); ?></th>
249 <td><input name="mc_double_optin" type="checkbox" <?php checked( get_option( 'mc_double_optin' ), true ); ?> id="mc_double_optin" class="code" />
250 <em><label for="mc_double_optin"><?php esc_html_e( 'Before new your subscribers are added via the plugin, they\'ll need to confirm their email address.', 'mailchimp' ); ?></label></em>
251 </td>
252 </tr>
253 <tr valign="top">
254 <th scope="row"><?php esc_html_e( 'Update existing subscribers?', 'mailchimp' ); ?></th>
255 <td><input name="mc_update_existing" type="checkbox" <?php checked( get_option( 'mc_update_existing' ), true ); ?> id="mc_update_existing" class="code" />
256 <em><label for="mc_update_existing"><?php esc_html_e( 'If an existing subscriber fills out this form, we will update their information with what\'s provided.', 'mailchimp' ); ?></label></em>
257 </td>
258 </tr>
259
260 <tr valign="top" class="last-row">
261 <th scope="row"><?php esc_html_e( 'Include Unsubscribe link?', 'mailchimp' ); ?></th>
262 <td><input name="mc_use_unsub_link" type="checkbox"<?php checked( get_option( 'mc_use_unsub_link' ), 'on' ); ?> id="mc_use_unsub_link" class="code" />
263 <em><label for="mc_use_unsub_link"><?php esc_html_e( 'We\'ll automatically add a link to your list\'s unsubscribe form.', 'mailchimp' ); ?></label></em>
264 </td>
265 </tr>
266 </table>
267 <input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/>
268 </div>
269
270 <?php
271 $mv = get_option( 'mc_merge_vars' );
272
273 if ( ! is_array( $mv ) || count( $mv ) === 0 ) {
274 ?>
275 <div class="mc-section">
276 <table class='widefat mc-widefat'>
277 <tr><th><?php esc_html_e( 'Merge Fields Included', 'mailchimp' ); ?></th></tr>
278 <tr><td><em><?php esc_html_e( 'No Merge Fields found.', 'mailchimp' ); ?></em></td></tr>
279 </table>
280 </div>
281 <?php
282 } else {
283 ?>
284 <div class="mc-section">
285 <table class='widefat mc-widefat'>
286 <tr>
287 <th colspan="4">
288 <?php esc_html_e( 'Merge Fields Included', 'mailchimp' ); ?>
289 </th>
290 </tr>
291 <tr valign="top">
292 <th><?php esc_html_e( 'Name', 'mailchimp' ); ?></th>
293 <th><?php esc_html_e( 'Tag', 'mailchimp' ); ?></th>
294 <th><?php esc_html_e( 'Required?', 'mailchimp' ); ?></th>
295 <th><?php esc_html_e( 'Include?', 'mailchimp' ); ?></th>
296 </tr>
297 <?php
298 foreach ( $mv as $mv_var ) {
299 ?>
300 <tr valign="top">
301 <td><?php echo esc_html( $mv_var['name'] ); ?></td>
302 <td><?php echo esc_html( $mv_var['tag'] ); ?></td>
303 <td><?php echo esc_html( ( 1 === $mv_var['required'] ) ? 'Y' : 'N' ); ?></td>
304 <td>
305 <?php
306 if ( ! $mv_var['required'] ) {
307 $opt = 'mc_mv_' . $mv_var['tag'];
308 ?>
309 <label class="screen-reader-text" for="<?php echo esc_attr( $opt ); ?>">
310 <?php
311 echo esc_html(
312 sprintf(
313 /* translators: %s: name of field */
314 __( 'Include merge field %s?', 'mailchimp' ),
315 $mv_var['name']
316 )
317 );
318 ?>
319 </label>
320 <input name="<?php echo esc_attr( $opt ); ?>" type="checkbox" id="<?php echo esc_attr( $opt ); ?>" class="code"<?php checked( get_option( $opt ), 'on' ); ?> />
321 <?php
322 } else {
323 ?>
324 &nbsp;&mdash;&nbsp;
325 <?php
326 }
327 ?>
328 </td>
329 </tr>
330 <?php
331 }
332 ?>
333 </table>
334 <input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/>
335 </div>
336
337 <?php
338 // Interest Groups Table
339 $igs = get_option( 'mc_interest_groups' );
340 if ( is_array( $igs ) && ! isset( $igs['id'] ) ) {
341 ?>
342 <div class="mc-section">
343 <h3 class="mc-h3"><?php esc_html_e( 'Group Settings', 'mailchimp' ); ?></h3>
344 </div>
345 <?php
346 // Determines whether or not to continue processing. Only false if there was an error.
347 $continue = true;
348 foreach ( $igs as $ig ) {
349 if ( $continue ) {
350 if ( ! is_array( $ig ) || empty( $ig ) || 'N' === $ig ) {
351 ?>
352 <em><?php esc_html_e( 'No Interest Groups Setup for this List', 'mailchimp' ); ?></em>
353 <?php
354 $continue = false;
355 } else {
356 ?>
357 <table class='mc-widefat' width="450px" cellspacing="0">
358 <tr valign="top">
359 <th colspan="2"><?php echo esc_html( $ig['title'] ); ?></th>
360 </tr>
361 <tr valign="top">
362 <th>
363 <label for="<?php echo esc_attr( 'mc_show_interest_groups_' . $ig['id'] ); ?>"><?php esc_html_e( 'Show?', 'mailchimp' ); ?></label>
364 </th>
365 <td>
366 <input name="<?php echo esc_attr( 'mc_show_interest_groups_' . $ig['id'] ); ?>" id="<?php echo esc_attr( 'mc_show_interest_groups_' . $ig['id'] ); ?>" type="checkbox" class="code"<?php checked( 'on', get_option( 'mc_show_interest_groups_' . $ig['id'] ) ); ?> />
367 </td>
368 </tr>
369 <tr valign="top">
370 <th><?php esc_html_e( 'Input Type', 'mailchimp' ); ?></th>
371 <td><?php echo esc_html( $ig['type'] ); ?></td>
372 </tr>
373 <tr valign="top" class="last-row">
374 <th><?php esc_html_e( 'Options', 'mailchimp' ); ?></th>
375 <td>
376 <ul>
377 <?php
378 foreach ( $ig['groups'] as $interest ) {
379 ?>
380 <li><?php echo esc_html( $interest['name'] ); ?></li>
381 <?php
382 }
383 ?>
384 </ul>
385 </td>
386 </tr>
387 </table>
388 <?php
389 }
390 }
391 }
392 }
393 }
394 ?>
395
396 <div class="mc-section" style="margin-top: 35px;">
397 <table class="widefat mc-widefat">
398 <tr><th colspan="2"><?php esc_html_e( 'CSS Cheat Sheet', 'mailchimp' ); ?></th></tr>
399 <tr valign="top">
400 <th scope="row">.widget_mailchimpsf_widget </th>
401 <td><?php esc_html_e( 'This targets the entire widget container.', 'mailchimp' ); ?></td>
402 </tr>
403 <tr valign="top">
404 <th scope="row">.widget-title</th>
405 <td>
406 <?php
407 echo wp_kses(
408 __( 'This styles the title of your Mailchimp widget. <i>Modifying this class will affect your other widget titles.</i>', 'mailchimp' ),
409 [
410 'i' => [],
411 ]
412 );
413 ?>
414 </td>
415 </tr>
416 <tr valign="top">
417 <th scope="row">#mc_signup</th>
418 <td><?php esc_html_e( 'This targets the entirity of the widget beneath the widget title.', 'mailchimp' ); ?></td>
419 </tr>
420 <tr valign="top">
421 <th scope="row">#mc_subheader</th>
422 <td><?php esc_html_e( 'This styles the subheader text.', 'mailchimp' ); ?></td>
423 </tr>
424 <tr valign="top">
425 <th scope="row">.mc_form_inside</th>
426 <td><?php esc_html_e( 'The guts and main container for the all of the form elements (the entirety of the widget minus the header and the sub header).', 'mailchimp' ); ?></td>
427 </tr>
428 <tr valign="top">
429 <th scope="row">.mc_header</th>
430 <td><?php esc_html_e( 'This targets the label above the input fields.', 'mailchimp' ); ?></td>
431 </tr>
432 <tr valign="top">
433 <th scope="row">.mc_input</th>
434 <td><?php esc_html_e( 'This attaches to the input fields.', 'mailchimp' ); ?></td>
435 </tr>
436 <tr valign="top">
437 <th scope="row">.mc_header_address</th>
438 <td><?php esc_html_e( 'This is the label above an address group.', 'mailchimp' ); ?></td>
439 </tr>
440 <tr valign="top">
441 <th scope="row">.mc_radio_label</th>
442 <td><?php esc_html_e( 'These are the labels associated with radio buttons.', 'mailchimp' ); ?></td>
443 </tr>
444 <tr valign="top">
445 <th scope="row">#mc-indicates-required</th>
446 <td><?php esc_html_e( 'This targets the “Indicates Required Field” text.', 'mailchimp' ); ?></td>
447 </tr>
448 <tr valign="top">
449 <th scope="row">#mc_signup_submit</th>
450 <td><?php esc_html_e( 'Use this to style the submit button.', 'mailchimp' ); ?></td>
451 </tr>
452 </table>
453 </div>
454 </form>
455 </div>
456 </div>
457