integration-settings.php
14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php defined('ABSPATH') or exit;
/** @var MC4WP_Integration $integration */
/** @var array $opts */
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<p class="mc4wp-breadcrumbs">
<span class="prefix"><?php echo esc_html__('You are here: ', 'mailchimp-for-wp'); ?></span>
<a href="<?php echo esc_url(admin_url('admin.php?page=mailchimp-for-wp')); ?>">Mailchimp for WordPress</a> ›
<a href="<?php echo esc_url(admin_url('admin.php?page=mailchimp-for-wp-integrations')); ?>"><?php echo esc_html__('Integrations', 'mailchimp-for-wp'); ?></a> ›
<span class="current-crumb"><strong><?php echo esc_html($integration->name); ?></strong></span>
</p>
<div class="mc4wp-row">
<div class="main-content mc4wp-col">
<h1 class="mc4wp-page-title">
<?php printf(esc_html__('%s integration', 'mailchimp-for-wp'), esc_html($integration->name)); ?>
</h1>
<h2 style="display: none;"></h2>
<?php settings_errors(); ?>
<div id="notice-additional-fields" class="notice notice-warning" style="display: none;">
<p><?php echo esc_html__('The selected Mailchimp audience requires custom fields, which may prevent this integration from working.', 'mailchimp-for-wp'); ?></p>
<p><?php echo sprintf(wp_kses(__('Please ensure you <a href="%1$s">configure the plugin to send all required fields</a> or <a href="%2$s">log into your Mailchimp account</a> and make sure only the email & name fields are marked as required fields for the selected audiences.', 'mailchimp-for-wp'), array( 'a' => array( 'href' => array() ) )), 'https://www.mc4wp.com/kb/send-additional-fields-from-integrations/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=integrations-page', 'https://admin.mailchimp.com/lists/'); ?></p>
</div>
<p>
<?php echo esc_html($integration->description); ?>
</p>
<form method="post" action="<?php echo admin_url('options.php'); ?>">
<?php settings_fields('mc4wp_integrations_settings'); ?>
<?php
/**
* Runs just before integration settings are outputted in admin.
*
* @since 3.0
*
* @param MC4WP_Integration $integration
* @param array $opts
* @ignore
*/
do_action('mc4wp_admin_before_integration_settings', $integration, $opts);
/**
* @ignore
*/
do_action('mc4wp_admin_before_' . $integration->slug . '_integration_settings', $integration, $opts);
?>
<table class="form-table">
<?php
if ($integration->has_ui_element('enabled')) {
?>
<tbody>
<tr valign="top">
<th scope="row"><?php echo esc_html__('Enabled?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap integration-toggles-wrap">
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][enabled]" value="1" <?php checked($opts['enabled'], 1); ?> /> <?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?></label>
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][enabled]" value="0" <?php checked($opts['enabled'], 0); ?> /> <?php echo esc_html__('No', 'mailchimp-for-wp'); ?></label>
<p class="description"><?php echo sprintf(esc_html__('Enable the %s integration? This will add a sign-up checkbox to the form.', 'mailchimp-for-wp'), $integration->name); ?></p>
</td>
</tr>
</tbody>
<?php
}
?>
<?php
$config = array(
'element' => 'mc4wp_integrations[' . $integration->slug . '][enabled]',
'value' => '1',
'hide' => false,
);
?>
<tbody class="integration-toggled-settings" data-showif="<?php echo esc_attr(json_encode($config)); ?>">
<?php
if ($integration->has_ui_element('implicit')) {
?>
<tr valign="top">
<th scope="row"><?php echo esc_html__('Implicit?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][implicit]" value="1" <?php checked($opts['implicit'], 1); ?> /> <?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?></label>
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][implicit]" value="0" <?php checked($opts['implicit'], 0); ?> /> <?php echo esc_html__('No', 'mailchimp-for-wp'); ?> <?php echo '<em>', esc_html__('(recommended)', 'mailchimp-for-wp'), '</em>'; ?>
</label>
<p class="description">
<?php
echo esc_html__('Select "yes" if you want to subscribe people without asking them explicitly.', 'mailchimp-for-wp');
echo '<br />';
echo sprintf(
wp_kses(
__('<strong>Warning: </strong> enabling this may affect your <a href="%s">GDPR compliance</a>.', 'mailchimp-for-wp'),
array(
'a' => array( 'href' => array() ),
'strong' => array(),
)
),
'https://www.mc4wp.com/kb/gdpr-compliance/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=integrations-page'
);
?>
</p>
</td>
</tr>
<?php
}
?>
<?php
if ($integration->has_ui_element('lists')) {
?>
<?php // hidden input to make sure a value is sent to the server when no checkboxes were selected ?>
<input type="hidden" name="mc4wp_integrations[<?php echo $integration->slug; ?>][lists][]" value="" />
<tr valign="top">
<th scope="row"><?php echo esc_html__('Mailchimp audiences', 'mailchimp-for-wp'); ?></th>
<?php
if (! empty($lists)) {
echo '<td>';
echo '<ul style="margin-bottom: 20px; max-height: 300px; overflow-y: auto;">';
foreach ($lists as $list) {
$checked = checked(in_array($list->id, $opts['lists'], true), true, false);
$value = esc_attr($list->id);
echo '<li><label>';
echo "<input type=\"checkbox\" name=\"mc4wp_integrations[{$integration->slug}][lists][]\" value=\"{$value}\" class=\"mc4wp-list-input\" {$checked}> ";
echo esc_html($list->name);
echo '</label></li>';
}
echo '</ul>';
echo '<p class="description">';
echo esc_html__('Select the audiences to which people who check the checkbox should be subscribed.', 'mailchimp-for-wp');
echo '</p>';
echo '</td>';
} else {
echo '<td>', sprintf(wp_kses(__('No audiences found, <a href="%s">are you connected to Mailchimp</a>?', 'mailchimp-for-wp'), array( 'a' => array( 'href' => array() ) )), esc_url(admin_url('admin.php?page=mailchimp-for-wp'))), '</td>';
}
?>
</tr>
<?php
} // end if UI has lists
?>
<?php
if ($integration->has_ui_element('label')) {
$config = array(
'element' => 'mc4wp_integrations[' . $integration->slug . '][implicit]',
'value' => 0,
);
?>
<tr valign="top" data-showif="<?php echo esc_attr(json_encode($config)); ?>">
<th scope="row"><label for="mc4wp_checkbox_label"><?php echo esc_html__('Checkbox label text', 'mailchimp-for-wp'); ?></label></th>
<td>
<input type="text" class="widefat" id="mc4wp_checkbox_label" name="mc4wp_integrations[<?php echo $integration->slug; ?>][label]" value="<?php echo esc_attr($opts['label']); ?>" required />
<p class="description"><?php printf(esc_html__('HTML tags like %s are allowed in the label text.', 'mailchimp-for-wp'), '<code>' . esc_html('<strong><em><a>') . '</code>'); ?></p>
</td>
</tr>
<?php
} // end if UI label
?>
<?php
if ($integration->has_ui_element('precheck')) {
$config = array(
'element' => 'mc4wp_integrations[' . $integration->slug . '][implicit]',
'value' => 0,
);
?>
<tr valign="top" data-showif="<?php echo esc_attr(json_encode($config)); ?>">
<th scope="row"><?php echo esc_html__('Pre-check the checkbox?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][precheck]" value="1" <?php checked($opts['precheck'], 1); ?> /> <?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?></label>
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][precheck]" value="0" <?php checked($opts['precheck'], 0); ?> /> <?php echo esc_html__('No', 'mailchimp-for-wp'); ?> <?php echo '<em>' . __('(recommended)', 'mailchimp-for-wp') . '</em>'; ?></label>
<p class="description">
<?php
echo esc_html__('Select "yes" if the checkbox should be pre-checked.', 'mailchimp-for-wp');
echo '<br />';
echo sprintf(
wp_kses(
__('<strong>Warning: </strong> enabling this may affect your <a href="%s">GDPR compliance</a>.', 'mailchimp-for-wp'),
array(
'a' => array( 'href' => array() ),
'strong' => array(),
)
),
'https://www.mc4wp.com/kb/gdpr-compliance/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=integrations-page'
);
?>
</p>
</td>
<?php
} // end if UI precheck
?>
<?php
if ($integration->has_ui_element('css')) {
$config = array(
'element' => 'mc4wp_integrations[' . $integration->slug . '][implicit]',
'value' => 0,
);
?>
<tr valign="top" data-showif="<?php echo esc_attr(json_encode($config)); ?>">
<th scope="row"><?php echo esc_html__('Load some default CSS?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][css]" value="1" <?php checked($opts['css'], 1); ?> />‏ <?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?></label>
<label><input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][css]" value="0" <?php checked($opts['css'], 0); ?> />‏ <?php echo esc_html__('No', 'mailchimp-for-wp'); ?></label>
<p class="description"><?php echo esc_html__('Select "yes" if the checkbox appears in a weird place.', 'mailchimp-for-wp'); ?></p>
</td>
</tr>
<?php
} // end if UI css
?>
<?php
if ($integration->has_ui_element('double_optin')) {
?>
<tr valign="top">
<th scope="row"><?php echo esc_html__('Double opt-in?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label>
<input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][double_optin]" value="1" <?php checked($opts['double_optin'], 1); ?> />‏
<?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?>
</label>
<label>
<input type="radio" id="mc4wp_checkbox_double_optin_0" name="mc4wp_integrations[<?php echo $integration->slug; ?>][double_optin]" value="0" <?php checked($opts['double_optin'], 0); ?> />‏
<?php echo esc_html__('No', 'mailchimp-for-wp'); ?>
</label>
<p class="description">
<?php echo esc_html__('Select "yes" if you want people to confirm their email address before being subscribed (recommended)', 'mailchimp-for-wp'); ?>
</p>
</td>
</tr>
<?php
} // end if UI double_optin
?>
<?php
if ($integration->has_ui_element('update_existing')) {
?>
<tr valign="top">
<th scope="row"><?php echo esc_html__('Update existing subscribers?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label>
<input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][update_existing]" value="1" <?php checked($opts['update_existing'], 1); ?> />‏
<?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?>
</label>
<label>
<input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][update_existing]" value="0" <?php checked($opts['update_existing'], 0); ?> />‏
<?php echo esc_html__('No', 'mailchimp-for-wp'); ?>
</label>
<p class="description"><?php echo esc_html__('Select "yes" if you want to update existing subscribers with the data that is sent.', 'mailchimp-for-wp'); ?></p>
</td>
</tr>
<?php
} // end if UI update_existing
?>
<?php
if ($integration->has_ui_element('replace_interests')) {
$config = array(
'element' => 'mc4wp_integrations[' . $integration->slug . '][update_existing]',
'value' => 1,
);
?>
<tr valign="top" data-showif="<?php echo esc_attr(json_encode($config)); ?>">
<th scope="row"><?php echo esc_html__('Replace interest groups?', 'mailchimp-for-wp'); ?></th>
<td class="nowrap">
<label>
<input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][replace_interests]" value="1" <?php checked($opts['replace_interests'], 1); ?> />‏
<?php echo esc_html__('Yes', 'mailchimp-for-wp'); ?>
</label>
<label>
<input type="radio" name="mc4wp_integrations[<?php echo $integration->slug; ?>][replace_interests]" value="0" <?php checked($opts['replace_interests'], 0); ?> />‏
<?php echo esc_html__('No', 'mailchimp-for-wp'); ?>
</label>
<p class="description">
<?php echo esc_html__('Select "no" if you want to add the selected interests to any previously selected interests when updating a subscriber.', 'mailchimp-for-wp'); ?>
<?php echo sprintf('<a href="%s" target="_blank">' . esc_html__('What does this do?', 'mailchimp-for-wp') . '</a>', 'https://www.mc4wp.com/kb/what-does-replace-groupings-mean/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=integrations-page'); ?>
</p>
</td>
</tr>
<?php
} // end if UI replace_interests
?>
</tbody>
</table>
<?php
/**
* Runs right after integration settings are outputted (before the submit button).
*
* @param MC4WP_Integration $integration
* @param array $opts
* @ignore
*/
do_action('mc4wp_admin_after_integration_settings', $integration, $opts);
/**
* @ignore
*/
do_action('mc4wp_admin_after_' . $integration->slug . '_integration_settings', $integration, $opts);
?>
<?php
if (count($integration->get_ui_elements()) > 0) {
submit_button();
}
?>
</form>
</div>
<div class="mc4wp-sidebar mc4wp-col">
<?php require MC4WP_PLUGIN_DIR . '/includes/views/parts/admin-sidebar.php'; ?>
</div>
</div>
</div>