PluginProbe
Mailchimp List Subscribe Form / 1.5
Mailchimp List Subscribe Form v1.5
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.5, at views/setup_page.php

445 lines 20.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <div class="wrap">
2
3 <div class="mailchimp-header">
4 <h2><?php esc_html_e('MailChimp List Setup', 'mailchimp_i18n');?> </h2>
5 </div>
6 <?php
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 mailchimpSF_change_list_if_necessary();
13
14 // Display our success/error message(s) if have them
15 if (mailchimpSF_global_msg() != ''){
16 // Message has already been html escaped, so we don't want to 2x escape it here
17 ?>
18 <div id="mc_message" class=""><?php echo mailchimpSF_global_msg(); ?></div>
19 <?php
20 }
21
22 // If we don't have an API Key, do a login form
23 if (!$user || !get_option('mc_api_key')) {
24 ?>
25 <div>
26 <h3 class="mc-h2"><?php esc_html_e('Log In', 'mailchimp_i18n');?></h3>
27 <p class="mc-p" style="width: 40%;line-height: 21px;"><?php echo __('To get started, we’ll need to access your MailChimp account with an <a href="http://kb.mailchimp.com/integrations/api-integrations/about-api-keys">API Key</a>. Paste your MailChimp API key, and click <strong>Connect</strong> to continue.
28 ', 'mailchimp_i18n'); ?></p>
29 <p class="mc-a">
30 <?php
31 echo sprintf(
32 '%1$s <a href="http://www.mailchimp.com/signup/" target="_blank">%2$s</a>',
33 esc_html(__("Don't have a MailChimp account?", 'mailchimp_i18n')),
34 esc_html(__('Try one for Free!', 'mailchimp_i18n'))
35 );
36 ?>
37 </p>
38
39 <div style="width: 900px;">
40 <table class="widefat mc-widefat mc-api">
41 <form method="POST" action="">
42 <tr valign="top">
43 <th scope="row" class="mailchimp-connect"><?php esc_html_e('Connect to MailChimp', 'mailchimp_i18n'); ?></th>
44 <td>
45 <input type="hidden" name="mcsf_action" value="login"/>
46 <input type="password" name="mailchimpSF_api_key" placeholder="API Key">
47 </td>
48 <td>
49 <input type="submit" value="Connnect">
50 </td>
51 </tr>
52 </form>
53 </table>
54 </div>
55 </div>
56
57 <br/>
58 <?php
59 if ($user && $user['username'] != '') {
60 ?>
61 <!--<div class="notes_msg">
62 <strong><?php esc_html_e('Notes', 'mailchimp_i18n'); ?>:</strong>
63 <ul>
64 <li><?php esc_html_e('Changing your settings at MailChimp.com may cause this to stop working.', 'mailchimp_i18n'); ?></li>
65 <li><?php esc_html_e('If you change your login to a different account, the info you have setup below will be erased.', 'mailchimp_i18n'); ?></li>
66 <li><?php esc_html_e('If any of that happens, no biggie - just reconfigure your login and the items below...', 'mailchimp_i18n'); ?></li>
67 </ul>
68 </div>-->
69 <?php
70 }
71 } // End of login form
72
73 // Start logout form
74 else {
75 ?>
76 <table style="min-width:400px;" class="mc-user" cellspacing="0">
77 <tr>
78 <td><h3><?php esc_html_e('Logged in as', 'mailchimp_i18n');?>: <?php echo esc_html($user['username']);
79 ?></h3>
80 </td>
81 <td>
82 <form method="post" action="">
83 <input type="hidden" name="mcsf_action" value="logout"/>
84 <input type="submit" name="Submit" value="<?php esc_attr_e('Logout', 'mailchimp_i18n');?>" class="button" />
85 <?php wp_nonce_field('mc_logout', '_mcsf_nonce_action'); ?>
86 </form>
87 </td>
88 </tr>
89 </table>
90 <?php
91 } // End Logout form
92
93 //Just get out if nothing else matters...
94 $api = mailchimpSF_get_api();
95 if (!$api) { return; }
96
97 if ($api){
98 ?>
99 <h3 class="mc-h2"><?php esc_html_e('Your Lists', 'mailchimp_i18n'); ?></h3>
100
101 <div>
102
103 <p class="mc-p"><?php esc_html_e('Please select the MailChimp list you’d like to connect to your form.', 'mailchimp_i18n'); ?></p>
104 <p class="mc-list-note"><strong><?php esc_html_e('Note:', 'mailchimp_i18n'); ?></strong> <?php esc_html_e('Updating your list will not remove list settings in this plugin, but changing lists will.', 'mailchimp_i18n'); ?></p>
105
106 <form method="post" action="options-general.php?page=mailchimpSF_options">
107 <?php
108 //we *could* support paging, but few users have that many lists (and shouldn't)
109 $lists = $api->get('lists',100);
110 $lists = $lists['lists'];
111
112 if (count($lists) == 0) {
113 ?>
114 <span class='error_msg'>
115 <?php
116 echo sprintf(
117 esc_html(__("Uh-oh, you don't have any lists defined! Please visit %s, login, and setup a list before using this tool!", 'mailchimp_i18n')),
118 "<a href='http://www.mailchimp.com/'>MailChimp</a>"
119 );
120 ?>
121 </span>
122 <?php
123 }
124 else {
125 ?>
126 <table style="min-width:400px" class="mc-list-select" cellspacing="0">
127 <tr class="mc-list-row">
128 <td>
129 <select name="mc_list_id" style="min-width:200px;">
130 <option value=""> &mdash; <?php esc_html_e('Select A List','mailchimp_i18n'); ?> &mdash; </option>
131 <?php
132 foreach ($lists as $list) {
133 $option = get_option('mc_list_id');
134 ?>
135 <option value="<?php echo esc_attr($list['id']); ?>"<?php selected($list['id'], $option); ?>><?php echo esc_html($list['name']); ?></option>
136 <?php
137 }
138 ?>
139 </select>
140 </td>
141 <td>
142 <input type="hidden" name="mcsf_action" value="update_mc_list_id" />
143 <input type="submit" name="Submit" value="<?php esc_attr_e('Update List', 'mailchimp_i18n'); ?>" class="button" />
144 </td>
145 </tr>
146 </table>
147 <?php
148 } //end select list
149 ?>
150 </form>
151 </div>
152
153 <br/>
154
155 <?php
156 }
157 else {
158 //display the selected list...
159 ?>
160
161 <p class="submit">
162 <form method="post" action="options-general.php?page=mailchimpSF_options">
163 <input type="hidden" name="mcsf_action" value="reset_list" />
164 <input type="submit" name="reset_list" value="<?php esc_attr_e('Reset List Options and Select again', 'mailchimp_i18n'); ?>" class="button" />
165 <?php wp_nonce_field('reset_mailchimp_list', '_mcsf_nonce_action'); ?>
166 </form>
167 </p>
168 <h3><?php esc_html_e('Subscribe Form Widget Settings for this List', 'mailchimp_i18n'); ?>:</h3>
169 <h4><?php esc_html_e('Selected MailChimp List', 'mailchimp_i18n'); ?>: <?php echo esc_html(get_option('mc_list_name')); ?></h4>
170 <?php
171 }
172
173 //Just get out if nothing else matters...
174 if (get_option('mc_list_id') == '') return;
175
176
177 // The main Settings form
178 ?>
179
180 <div>
181 <form method="post" action="options-general.php?page=mailchimpSF_options">
182 <div style="width:900px;">
183 <input type="hidden" name="mcsf_action" value="change_form_settings">
184 <?php wp_nonce_field('update_general_form_settings', '_mcsf_nonce_action'); ?>
185
186 <table class="widefat mc-widefat mc-label-options">
187 <tr><th colspan="2">Content Options</th></tr>
188 <tr valign="top">
189 <th scope="row"><?php esc_html_e('Header', 'mailchimp_i18n'); ?></th>
190 <td>
191 <textarea name="mc_header_content" rows="2" cols="70"><?php echo esc_html(get_option('mc_header_content')); ?></textarea><br/>
192 <?php esc_html_e('Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp_i18n'); ?>
193 </td>
194 </tr>
195
196 <tr valign="top">
197 <th scope="row"><?php esc_html_e('Sub-header', 'mailchimp_i18n'); ?></th>
198 <td>
199 <textarea name="mc_subheader_content" rows="2" cols="70"><?php echo esc_html(get_option('mc_subheader_content')); ?></textarea><br/>
200 <?php esc_html_e('Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp_i18n'); ?>.<br/>
201 <?php esc_html_e('This will be displayed under the heading and above the form.', 'mailchimp_i18n'); ?>
202 </td>
203 </tr>
204
205 <tr valign="top" class="last-row">
206 <th scope="row"><?php esc_html_e('Submit Button', 'mailchimp_i18n'); ?></th>
207 <td>
208 <input type="text" name="mc_submit_text" size="70" value="<?php echo esc_attr(get_option('mc_submit_text')); ?>"/>
209 </td>
210 </tr>
211 </table>
212
213 <input type="submit" value="<?php esc_attr_e('Update Subscribe Form Settings', 'mailchimp_i18n'); ?>" class="button mc-submit" /><br/>
214
215 <table class="widefat mc-widefat mc-nuke-styling">
216 <tr><th colspan="2">Remove MailChimp CSS</th></tr>
217 <tr class="mc-internal-heading"><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>
218 </table>
219 <?php if(get_option('mc_nuke_all_styles') == true) {
220 ?>
221 <table class="widefat mc-widefat mc-custom-styling" id="mc-custom-styling" style="display:none">
222 <?php } else {?>
223 <table class="widefat mc-widefat mc-custom-styling" id="mc-custom-styling">
224 <?php } ?>
225 <tr><th colspan="2">Custom Styling</th></tr>
226 <tr class="mc-turned-on"><th><label for="mc_custom_style"><?php esc_html_e('Enabled?', 'mailchimp_i18n'); ?></label></th><td><span class="mc-pre-input"></span><input type="checkbox" name="mc_custom_style" id="mc_custom_style"<?php checked(get_option('mc_custom_style'), 'on'); ?> /><?php esc_html_e('Edit the default MailChimp CSS style.');?></td></tr>
227
228 <tr><th><?php esc_html_e('Border Width (px)', 'mailchimp_i18n'); ?></th><td><span class="mc-pre-input"></span><input type="text" name="mc_form_border_width" size="3" maxlength="3" value="<?php echo esc_attr(get_option('mc_form_border_width')); ?>"/>
229 <em><?php esc_html_e('Set to 0 for no border, do not enter', 'mailchimp_i18n'); ?> px</em>
230 </td></tr>
231 <tr><th><?php esc_html_e('Border Color', 'mailchimp_i18n'); ?></th><td><span class="mc-pre-input">#</span><input type="text" name="mc_form_border_color" size="7" maxlength="6" value="<?php echo esc_attr(get_option('mc_form_border_color')); ?>"/>
232 <em><?php esc_html_e('Do not enter initial', 'mailchimp_i18n'); ?> <strong>#</strong></em>
233 </td></tr>
234 <tr><th><?php esc_html_e('Text Color', 'mailchimp_i18n'); ?></th><td><span class="mc-pre-input">#</span><input type="text" name="mc_form_text_color" size="7" maxlength="6" value="<?php echo esc_attr(get_option('mc_form_text_color')); ?>"/>
235 <em><?php esc_html_e('Do not enter initial', 'mailchimp_i18n'); ?> <strong>#</strong></em>
236 </td></tr>
237 <tr class="last-row"><th><?php esc_html_e('Background Color', 'mailchimp_i18n'); ?></th><td><span class="mc-pre-input">#</span><input type="text" name="mc_form_background" size="7" maxlength="6" value="<?php echo esc_attr(get_option('mc_form_background')); ?>"/>
238 <em><?php esc_html_e('Do not enter initial', 'mailchimp_i18n'); ?> <strong>#</strong></em>
239 </td></tr>
240 </table>
241
242 <input type="submit" value="<?php esc_attr_e('Update Subscribe Form Settings', 'mailchimp_i18n'); ?>" class="button mc-submit" /><br/>
243
244
245 <table class="widefat mc-widefat">
246 <tr><th colspan="2">List Options</th></tr>
247 <tr valign="top">
248 <th scope="row"><?php esc_html_e('MonkeyRewards', 'mailchimp_i18n'); ?>?</th>
249 <td><input name="mc_rewards" type="checkbox"<?php if (get_option('mc_rewards')=='on' || get_option('mc_rewards')=='' ) { echo ' checked="checked"'; } ?> id="mc_rewards" class="code" />
250 <em><label for="mc_rewards"><?php echo __('We’ll add a "powered by MailChimp" link to your form that will help you earn <a href="http://kb.mailchimp.com/accounts/account-setup/monkeyrewards-credits" target="_blank">MonkeyRewards</a>. You can turn it off at any time.', 'mailchimp_i18n'); ?></label></em>
251 </td>
252 </tr>
253
254 <tr valign="top">
255 <th scope="row"><?php esc_html_e('Use JavaScript Support?', 'mailchimp_i18n'); ?></th>
256 <td><input name="mc_use_javascript" type="checkbox" <?php checked(get_option('mc_use_javascript'), 'on'); ?> id="mc_use_javascript" class="code" />
257 <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_i18n'); ?></label></em>
258 </td>
259 </tr>
260
261 <tr valign="top">
262 <th scope="row"><?php esc_html_e('Use JavaScript Datepicker?', 'mailchimp_i18n'); ?></th>
263 <td><input name="mc_use_datepicker" type="checkbox" <?php checked(get_option('mc_use_datepicker'), 'on'); ?> id="mc_use_datepicker" class="code" />
264 <em><label for="mc_use_datepicker"><?php esc_html_e('We’ll use the jQuery UI Datepicker for dates.', 'mailchimp_i18n'); ?></label></em>
265 </td>
266 </tr>
267
268 <tr valign="top">
269 <th scope="row"><?php esc_html_e('Use Double Opt-In (Recommended)?', 'mailchimp_i18n'); ?></th>
270 <td><input name="mc_double_optin" type="checkbox" <?php checked(get_option('mc_double_optin'), true); ?> id="mc_double_optin" class="code" />
271 <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_i18n'); ?></label></em>
272 </td>
273 </tr>
274
275 <tr valign="top" class="last-row">
276 <th scope="row"><?php esc_html_e('Include Unsubscribe link?', 'mailchimp_i18n'); ?></th>
277 <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" />
278 <em><label for="mc_use_unsub_link"><?php esc_html_e('We’ll automatically add a link to your list’s unsubscribe form.', 'mailchimp_i18n'); ?></label></em>
279 </td>
280 </tr>
281 </table>
282
283 </div>
284
285 <div style="width:900px;">
286
287 <input type="submit" value="<?php esc_attr_e('Update Subscribe Form Settings', 'mailchimp_i18n'); ?>" class="button mc-submit" /><br/>
288
289 <table class='widefat mc-widefat'>
290 <tr>
291 <th colspan="4">
292 <?php esc_html_e('Merge Fields Included', 'mailchimp_i18n'); ?>
293
294 <?php
295 $mv = get_option('mc_merge_vars');
296
297 if (count($mv) == 0 || !is_array($mv)){
298 ?>
299 <em><?php esc_html_e('No Merge Fields found.', 'mailchimp_i18n'); ?></em>
300 <?php
301 } else {
302 ?>
303 </th>
304 </tr>
305 <tr valign="top">
306 <th><?php esc_html_e('Name', 'mailchimp_i18n');?></th>
307 <th><?php esc_html_e('Tag', 'mailchimp_i18n');?></th>
308 <th><?php esc_html_e('Required?', 'mailchimp_i18n');?></th>
309 <th><?php esc_html_e('Include?', 'mailchimp_i18n');?></th>
310 </tr>
311 <?php
312 foreach($mv as $var){
313 ?>
314 <tr valign="top">
315 <td><?php echo esc_html($var['name']); ?></td>
316 <td><?php echo esc_html($var['tag']); ?></td>
317 <td><?php echo esc_html(($var['required'] == 1) ? 'Y' : 'N'); ?></td>
318 <td>
319 <?php
320 if (!$var['required']){
321 $opt = 'mc_mv_'.$var['tag'];
322 ?>
323 <input name="<?php echo esc_attr($opt); ?>" type="checkbox" id="<?php echo esc_attr($opt); ?>" class="code"<?php checked(get_option($opt), 'on'); ?> />
324 <?php
325 } else {
326 ?>
327 &nbsp;&mdash;&nbsp;
328 <?php
329 }
330 ?>
331 </td>
332 </tr>
333 <?php
334 }
335 ?>
336 </table>
337 <input type="submit" value="<?php esc_attr_e('Update Subscribe Form Settings', 'mailchimp_i18n'); ?>" class="button mc-submit" /><br/>
338 </div>
339
340 <?php
341 // Interest Groups Table
342 $igs = get_option('mc_interest_groups');
343 if (is_array($igs) && !isset($igs['id'])) { ?>
344 <h3 class="mc-h3"><?php esc_html_e('Group Settings', 'mailchimp_i18n'); ?></h3> <?php
345 // Determines whether or not to continue processing. Only false if there was an error.
346 $continue = true;
347 foreach ($igs as $ig) {
348 if ($continue) {
349 if (!is_array($ig) || empty($ig) || $ig == 'N' ) {
350 ?>
351 <em><?php esc_html_e('No Interest Groups Setup for this List', 'mailchimp_i18n'); ?></em>
352 <?php
353 $continue = false;
354 }
355 else {
356 ?>
357 <table class='mc-widefat mc-blue' 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_i18n'); ?></label>
364 </th>
365 <th>
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 </th>
368 </tr>
369 <tr valign="top">
370 <th><?php esc_html_e('Input Type', 'mailchimp_i18n'); ?></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_i18n'); ?></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 <div style="width: 900px; margin-top: 35px;">
396 <table class="widefat mc-widefat mc-yellow">
397 <tr><th colspan="2">CSS Cheat Sheet</th></tr>
398 <tr valign="top">
399 <th scope="row">.widget_mailchimpsf_widget </th>
400 <td>This targets the entire widget container.</td>
401 </tr>
402 <tr valign="top">
403 <th scope="row">.widget-title</th>
404 <td>This styles the title of your MailChimp widget. <i>Modifying this class will affect your other widget titles.</i></td>
405 </tr>
406 <tr valign="top">
407 <th scope="row">#mc_signup</th>
408 <td>This targets the entirity of the widget beneath the widget title.</td>
409 </tr>
410 <tr valign="top">
411 <th scope="row">#mc_subheader</th>
412 <td>This styles the subheader text.</td>
413 </tr>
414 <tr valign="top">
415 <th scope="row">.mc_form_inside</th>
416 <td>The guts and main container for the all of the form elements (the entirety of the widget minus the header and the sub header).</td>
417 </tr>
418 <tr valign="top">
419 <th scope="row">.mc_header</th>
420 <td>This targets the label above the input fields.</td>
421 </tr>
422 <tr valign="top">
423 <th scope="row">.mc_input</th>
424 <td>This attaches to the input fields.</td>
425 </tr>
426 <tr valign="top">
427 <th scope="row">.mc_header_address</th>
428 <td>This is the label above an address group.</td>
429 </tr>
430 <tr valign="top">
431 <th scope="row">.mc_radio_label</th>
432 <td>These are the labels associated with radio buttons.</td>
433 </tr>
434 <tr valign="top">
435 <th scope="row">#mc-indicates-required</th>
436 <td>This targets the “Indicates Required Field” text.</td>
437 </tr>
438 <tr valign="top">
439 <th scope="row">#mc_signup_submit</th>
440 <td>Use this to style the submit button.</td>
441 </tr>
442 </table>
443 </div>
444
445 </form>