| 1 |
<?php |
| 2 |
/** |
| 3 |
* View file for the setup page. |
| 4 |
* |
| 5 |
* @package Mailchimp |
| 6 |
*/ |
| 7 |
|
| 8 |
?> |
| 9 |
<div class="mailchimp-sf-main-setings-wrapper"> |
| 10 |
<div class="mailchimp-sf-main-settings"> |
| 11 |
<form method="post" action="<?php echo esc_url( add_query_arg( array( 'page' => 'mailchimp_sf_options' ), admin_url( 'admin.php' ) ) ); ?>" id="mailchimp-sf-settings-form"> |
| 12 |
<div class="mailchimp-sf-section"> |
| 13 |
<input type="hidden" name="mcsf_action" value="change_form_settings"> |
| 14 |
<?php wp_nonce_field( 'update_general_form_settings', '_mcsf_nonce_action' ); ?> |
| 15 |
|
| 16 |
<table class="widefat mailchimp-sf-settings-table"> |
| 17 |
<thead> |
| 18 |
<tr> |
| 19 |
<th colspan="2"> |
| 20 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Form copy', 'mailchimp' ); ?></h2> |
| 21 |
</th> |
| 22 |
</tr> |
| 23 |
</thead> |
| 24 |
<tbody> |
| 25 |
<tr valign="top"> |
| 26 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 27 |
<label for="mc_header_content"><?php esc_html_e( 'Header', 'mailchimp' ); ?></label> |
| 28 |
</th> |
| 29 |
<td> |
| 30 |
<textarea class="widefat" id="mc_header_content" name="mc_header_content" rows="2"><?php echo wp_kses_post( get_option( 'mc_header_content' ) ); ?></textarea> |
| 31 |
<p class="description"> |
| 32 |
<?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?> |
| 33 |
</p> |
| 34 |
|
| 35 |
</td> |
| 36 |
</tr> |
| 37 |
|
| 38 |
<tr valign="top"> |
| 39 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 40 |
<label for="mc_subheader_content"><?php esc_html_e( 'Sub-header', 'mailchimp' ); ?></label> |
| 41 |
</th> |
| 42 |
<td> |
| 43 |
<textarea class="widefat" id="mc_subheader_content" name="mc_subheader_content" rows="2"><?php echo esc_textarea( get_option( 'mc_subheader_content' ) ); ?></textarea> |
| 44 |
<p class="description"> |
| 45 |
<?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?><br/> |
| 46 |
<?php esc_html_e( 'This will be displayed under the heading and above the form.', 'mailchimp' ); ?> |
| 47 |
</p> |
| 48 |
</td> |
| 49 |
</tr> |
| 50 |
|
| 51 |
<tr valign="top" class="last-row"> |
| 52 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 53 |
<label for="mc_submit_text"><?php esc_html_e( 'Submit Button', 'mailchimp' ); ?></label> |
| 54 |
</th> |
| 55 |
<td> |
| 56 |
<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' ) ); ?>"/> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
</tbody> |
| 60 |
</table> |
| 61 |
|
| 62 |
<div class="mailchimp-sf-section-footer"> |
| 63 |
<input type="submit" value="<?php esc_attr_e( 'Save Changes', 'mailchimp' ); ?>" class="mailchimp-sf-button mailchimp-sf-button-submit btn-primary" style="display: none;"/> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
|
| 67 |
<?php |
| 68 |
$mv = get_option( 'mc_merge_vars' ); |
| 69 |
if ( ! is_array( $mv ) || count( $mv ) === 0 ) { |
| 70 |
?> |
| 71 |
<div class="mailchimp-sf-section"> |
| 72 |
<table class="widefat mailchimp-sf-settings-table"> |
| 73 |
<thead> |
| 74 |
<tr> |
| 75 |
<th> |
| 76 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Audience fields', 'mailchimp' ); ?></h2> |
| 77 |
</th> |
| 78 |
</tr> |
| 79 |
</thead> |
| 80 |
<tbody> |
| 81 |
<tr> |
| 82 |
<td><em><?php esc_html_e( 'No Merge Fields found.', 'mailchimp' ); ?></em></td> |
| 83 |
</tr> |
| 84 |
</tbody> |
| 85 |
</table> |
| 86 |
</div> |
| 87 |
<?php |
| 88 |
} else { |
| 89 |
?> |
| 90 |
<div class="mailchimp-sf-section"> |
| 91 |
<table class="widefat mailchimp-sf-settings-table fixed"> |
| 92 |
<thead> |
| 93 |
<tr> |
| 94 |
<th colspan="4"> |
| 95 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Audience fields', 'mailchimp' ); ?></h2> |
| 96 |
</th> |
| 97 |
</tr> |
| 98 |
</thead> |
| 99 |
<tbody> |
| 100 |
<tr valign="top"> |
| 101 |
<th><?php esc_html_e( 'Name', 'mailchimp' ); ?></th> |
| 102 |
<th><?php esc_html_e( 'Tag', 'mailchimp' ); ?></th> |
| 103 |
<th><?php esc_html_e( 'Required?', 'mailchimp' ); ?></th> |
| 104 |
<th><?php esc_html_e( 'Include?', 'mailchimp' ); ?></th> |
| 105 |
</tr> |
| 106 |
<?php |
| 107 |
foreach ( $mv as $mv_var ) { |
| 108 |
?> |
| 109 |
<tr valign="top"> |
| 110 |
<td><?php echo esc_html( $mv_var['name'] ); ?></td> |
| 111 |
<td><?php echo esc_html( $mv_var['tag'] ); ?></td> |
| 112 |
<td><?php echo esc_html( ( 1 === intval( $mv_var['required'] ) ) ? 'Y' : 'N' ); ?></td> |
| 113 |
<td> |
| 114 |
<?php |
| 115 |
$opt = 'mc_mv_' . $mv_var['tag']; |
| 116 |
$checked = 'on' === get_option( $opt ) || (bool) $mv_var['required']; |
| 117 |
?> |
| 118 |
<label class="screen-reader-text" for="<?php echo esc_attr( $opt ); ?>"> |
| 119 |
<?php |
| 120 |
echo esc_html( |
| 121 |
sprintf( |
| 122 |
/* translators: %s: name of field */ |
| 123 |
__( 'Include merge field %s?', 'mailchimp' ), |
| 124 |
$mv_var['name'] |
| 125 |
) |
| 126 |
); |
| 127 |
?> |
| 128 |
</label> |
| 129 |
<input name="<?php echo esc_attr( $opt ); ?>" type="checkbox" id="<?php echo esc_attr( $opt ); ?>" class="mailchimp-sf-checkbox"<?php checked( $checked ); ?> <?php disabled( $mv_var['required'] ); ?> data-tag="<?php echo esc_attr( $mv_var['tag'] ); ?>"/> |
| 130 |
</td> |
| 131 |
</tr> |
| 132 |
<?php |
| 133 |
} |
| 134 |
?> |
| 135 |
</tbody> |
| 136 |
</table> |
| 137 |
|
| 138 |
<div class="mailchimp-sf-section-footer"> |
| 139 |
<input type="submit" value="<?php esc_attr_e( 'Save Changes', 'mailchimp' ); ?>" class="mailchimp-sf-button mailchimp-sf-button-submit btn-primary" style="display: none;"/> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
|
| 143 |
<?php |
| 144 |
// Interest Groups Table |
| 145 |
$igs = get_option( 'mc_interest_groups' ); |
| 146 |
if ( is_array( $igs ) && ! empty( $igs ) ) { |
| 147 |
?> |
| 148 |
<div class="mailchimp-sf-section"> |
| 149 |
<table class="widefat mailchimp-sf-settings-table fixed"> |
| 150 |
<thead> |
| 151 |
<tr> |
| 152 |
<th colspan="4"> |
| 153 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Group settings', 'mailchimp' ); ?></h2> |
| 154 |
</th> |
| 155 |
</tr> |
| 156 |
</thead> |
| 157 |
<tbody> |
| 158 |
<tr valign="top"> |
| 159 |
<th><?php esc_html_e( 'Name', 'mailchimp' ); ?></th> |
| 160 |
<th><?php esc_html_e( 'Input Type', 'mailchimp' ); ?></th> |
| 161 |
<th><?php esc_html_e( 'Options', 'mailchimp' ); ?></th> |
| 162 |
<th><?php esc_html_e( 'Show?', 'mailchimp' ); ?></th> |
| 163 |
</tr> |
| 164 |
<?php |
| 165 |
// Determines whether or not to continue processing. Only false if there was an error. |
| 166 |
$continue = true; |
| 167 |
foreach ( $igs as $ig ) { |
| 168 |
if ( $continue ) { |
| 169 |
if ( ! is_array( $ig ) || empty( $ig ) || 'N' === $ig ) { |
| 170 |
?> |
| 171 |
<em><?php esc_html_e( 'No Interest Groups Setup for this List', 'mailchimp' ); ?></em> |
| 172 |
<?php |
| 173 |
$continue = false; |
| 174 |
} else { |
| 175 |
?> |
| 176 |
<tr valign="top"> |
| 177 |
<td><strong><?php echo esc_html( $ig['title'] ); ?></strong></td> |
| 178 |
<td><?php echo esc_html( $ig['type'] ); ?></td> |
| 179 |
<td> |
| 180 |
<ul> |
| 181 |
<?php |
| 182 |
foreach ( $ig['groups'] as $interest ) { |
| 183 |
?> |
| 184 |
<li><?php echo esc_html( $interest['name'] ); ?></li> |
| 185 |
<?php |
| 186 |
} |
| 187 |
?> |
| 188 |
</ul> |
| 189 |
</td> |
| 190 |
<td> |
| 191 |
<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="mailchimp-sf-checkbox"<?php checked( 'on', get_option( 'mc_show_interest_groups_' . $ig['id'] ) ); ?> data-group-id="<?php echo esc_attr( $ig['id'] ); ?>"/> |
| 192 |
</td> |
| 193 |
</tr> |
| 194 |
<?php |
| 195 |
} |
| 196 |
} |
| 197 |
} |
| 198 |
?> |
| 199 |
</tbody> |
| 200 |
</table> |
| 201 |
|
| 202 |
<div class="mailchimp-sf-section-footer"> |
| 203 |
<input type="submit" value="<?php esc_attr_e( 'Save Changes', 'mailchimp' ); ?>" class="mailchimp-sf-button mailchimp-sf-button-submit btn-primary" style="display: none;"/> |
| 204 |
</div> |
| 205 |
</div> |
| 206 |
<?php |
| 207 |
} |
| 208 |
} |
| 209 |
?> |
| 210 |
|
| 211 |
<div class="mailchimp-sf-section"> |
| 212 |
<?php |
| 213 |
if ( get_option( 'mc_nuke_all_styles' ) === '1' ) { |
| 214 |
?> |
| 215 |
<table class="widefat mailchimp-sf-settings-table"> |
| 216 |
<thead> |
| 217 |
<tr> |
| 218 |
<th colspan="2"> |
| 219 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Remove Mailchimp CSS', 'mailchimp' ); ?></h2> |
| 220 |
</th> |
| 221 |
</tr> |
| 222 |
</thead> |
| 223 |
<tbody> |
| 224 |
<tr> |
| 225 |
<th class="mailchimp-sf-option-header"> |
| 226 |
<label for="mc_nuke_all_styles"> |
| 227 |
<?php esc_html_e( 'Remove CSS', 'mailchimp' ); ?> |
| 228 |
</label> |
| 229 |
</th> |
| 230 |
<td> |
| 231 |
<span class="mc-pre-input"></span> |
| 232 |
<div class="input-checkbox-wrapper"> |
| 233 |
<div class="input-checkbox-wrapper-inner"> |
| 234 |
<input type="checkbox" name="mc_nuke_all_styles" id="mc_nuke_all_styles" class="mailchimp-sf-checkbox" <?php checked( get_option( 'mc_nuke_all_styles' ), true ); ?> onclick="showMe('mc-custom-styling')"/> |
| 235 |
</div> |
| 236 |
<label for="mc_nuke_all_styles"> |
| 237 |
<?php esc_html_e( 'This will disable all Mailchimp CSS, so it\'s recommended for WordPress experts only.', 'mailchimp' ); ?> |
| 238 |
</label> |
| 239 |
</div> |
| 240 |
</td> |
| 241 |
</tr> |
| 242 |
</tbody> |
| 243 |
</table> |
| 244 |
<?php |
| 245 |
} |
| 246 |
|
| 247 |
if ( 'on' === get_option( 'mc_custom_style' ) ) { |
| 248 |
?> |
| 249 |
<table class="widefat mailchimp-sf-settings-table mc-custom-styling" style="<?php echo esc_attr( ( get_option( 'mc_nuke_all_styles' ) === '1' ? 'display:none;' : '' ) ); ?>" id="mc-custom-styling"> |
| 250 |
<thead> |
| 251 |
<tr> |
| 252 |
<th colspan="2"> |
| 253 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Custom Styling', 'mailchimp' ); ?></h2> |
| 254 |
</th> |
| 255 |
</tr> |
| 256 |
</thead> |
| 257 |
<tbody> |
| 258 |
<tr> |
| 259 |
<th class="mailchimp-sf-option-header"> |
| 260 |
<label for="mc_custom_style"><?php esc_html_e( 'Enabled?', 'mailchimp' ); ?></label> |
| 261 |
</th> |
| 262 |
<td> |
| 263 |
<div class="input-checkbox-wrapper"> |
| 264 |
<div class="input-checkbox-wrapper-inner"> |
| 265 |
<input type="checkbox" name="mc_custom_style" id="mc_custom_style" class="mailchimp-sf-checkbox"<?php checked( get_option( 'mc_custom_style' ), 'on' ); ?> /> |
| 266 |
</div> |
| 267 |
<label for="mc_custom_style"> |
| 268 |
<?php esc_html_e( 'Edit the default Mailchimp CSS style.', 'mailchimp' ); ?> |
| 269 |
</label> |
| 270 |
</div> |
| 271 |
</td> |
| 272 |
</tr> |
| 273 |
<tr> |
| 274 |
<th class="mailchimp-sf-option-header"> |
| 275 |
<label for="mc_form_border_width"><?php esc_html_e( 'Border Width (px)', 'mailchimp' ); ?></label> |
| 276 |
</th> |
| 277 |
<td> |
| 278 |
<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' ) ); ?>"/> |
| 279 |
<p class="description"> |
| 280 |
<em><?php esc_html_e( 'Set to 0 for no border, do not enter', 'mailchimp' ); ?> px</em> |
| 281 |
</p> |
| 282 |
</td> |
| 283 |
</tr> |
| 284 |
<tr> |
| 285 |
<th class="mailchimp-sf-option-header"> |
| 286 |
<label for="mc_form_border_color"><?php esc_html_e( 'Border Color', 'mailchimp' ); ?></label> |
| 287 |
</th> |
| 288 |
<td> |
| 289 |
<span class="mc-pre-input">#</span> |
| 290 |
<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' ) ); ?>"/> |
| 291 |
<p class="description"> |
| 292 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 293 |
</p> |
| 294 |
</td> |
| 295 |
</tr> |
| 296 |
<tr> |
| 297 |
<th class="mailchimp-sf-option-header"> |
| 298 |
<label for="mc_form_text_color"><?php esc_html_e( 'Text Color', 'mailchimp' ); ?></label> |
| 299 |
</th> |
| 300 |
<td> |
| 301 |
<span class="mc-pre-input">#</span> |
| 302 |
<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' ) ); ?>"/> |
| 303 |
<p class="description"> |
| 304 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 305 |
</p> |
| 306 |
</td> |
| 307 |
</tr> |
| 308 |
<tr class="last-row"> |
| 309 |
<th class="mailchimp-sf-option-header"> |
| 310 |
<label for="mc_form_background"><?php esc_html_e( 'Background Color', 'mailchimp' ); ?></label> |
| 311 |
</th> |
| 312 |
<td> |
| 313 |
<span class="mc-pre-input">#</span> |
| 314 |
<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' ) ); ?>"/> |
| 315 |
<p class="description"> |
| 316 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 317 |
</p> |
| 318 |
</td> |
| 319 |
</tr> |
| 320 |
</tbody> |
| 321 |
</table> |
| 322 |
<?php |
| 323 |
} |
| 324 |
?> |
| 325 |
|
| 326 |
<table class="widefat mailchimp-sf-settings-table mailchimp-sf-list-settings"> |
| 327 |
<thead> |
| 328 |
<tr> |
| 329 |
<th colspan="2"> |
| 330 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'List settings', 'mailchimp' ); ?></h2> |
| 331 |
</th> |
| 332 |
</tr> |
| 333 |
</thead> |
| 334 |
<tbody> |
| 335 |
<tr valign="top"> |
| 336 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 337 |
<?php esc_html_e( 'Use Double Opt-In (Recommended)?', 'mailchimp' ); ?> |
| 338 |
</th> |
| 339 |
<td> |
| 340 |
<div class="input-checkbox-wrapper"> |
| 341 |
<div class="input-checkbox-wrapper-inner"> |
| 342 |
<input name="mc_double_optin" type="checkbox" <?php checked( get_option( 'mc_double_optin' ), true ); ?> id="mc_double_optin" class="mailchimp-sf-checkbox" /> |
| 343 |
</div> |
| 344 |
<label for="mc_double_optin"> |
| 345 |
<?php esc_html_e( 'Before new your subscribers are added via the plugin, they\'ll need to confirm their email address.', 'mailchimp' ); ?> |
| 346 |
</label> |
| 347 |
</div> |
| 348 |
</td> |
| 349 |
</tr> |
| 350 |
<tr valign="top"> |
| 351 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 352 |
<?php esc_html_e( 'Update existing subscribers?', 'mailchimp' ); ?> |
| 353 |
</th> |
| 354 |
<td> |
| 355 |
<div class="input-checkbox-wrapper"> |
| 356 |
<div class="input-checkbox-wrapper-inner"> |
| 357 |
<input name="mc_update_existing" type="checkbox" <?php checked( get_option( 'mc_update_existing' ), true ); ?> id="mc_update_existing" class="mailchimp-sf-checkbox" /> |
| 358 |
</div> |
| 359 |
<label for="mc_update_existing"> |
| 360 |
<?php esc_html_e( 'If an existing subscriber fills out this form, we will update their information with what\'s provided.', 'mailchimp' ); ?> |
| 361 |
</label> |
| 362 |
</div> |
| 363 |
</td> |
| 364 |
</tr> |
| 365 |
|
| 366 |
<tr valign="top" class="last-row"> |
| 367 |
<th scope="row" class="mailchimp-sf-option-header"> |
| 368 |
<?php esc_html_e( 'Include Unsubscribe link?', 'mailchimp' ); ?> |
| 369 |
</th> |
| 370 |
<td> |
| 371 |
<div class="input-checkbox-wrapper"> |
| 372 |
<div class="input-checkbox-wrapper-inner"> |
| 373 |
<input name="mc_use_unsub_link" type="checkbox"<?php checked( get_option( 'mc_use_unsub_link' ), 'on' ); ?> id="mc_use_unsub_link" class="mailchimp-sf-checkbox" /> |
| 374 |
</div> |
| 375 |
<label for="mc_use_unsub_link"> |
| 376 |
<?php esc_html_e( 'We\'ll automatically add a link to your list\'s unsubscribe form.', 'mailchimp' ); ?> |
| 377 |
</label> |
| 378 |
</div> |
| 379 |
</td> |
| 380 |
</tr> |
| 381 |
<tr valign="top"> |
| 382 |
<td colspan="2" class="mailchimp-sf-note"> |
| 383 |
<?php |
| 384 |
echo wp_kses( |
| 385 |
sprintf( |
| 386 |
/* translators: %s: link to Mailchimp */ |
| 387 |
__( '<strong>Note:</strong> If you haven\'t already, please <a href="%s" target="_blank" rel="noopener noreferrer">add</a> your website URL to your Mailchimp Audience account settings so users can properly return to your site after subscribing.', 'mailchimp' ), |
| 388 |
'https://mailchimp.com/help/change-or-update-the-return-to-our-website-button/' |
| 389 |
), |
| 390 |
[ |
| 391 |
'a' => [ |
| 392 |
'href' => [], |
| 393 |
'target' => [], |
| 394 |
'rel' => [], |
| 395 |
], |
| 396 |
'strong' => [], |
| 397 |
] |
| 398 |
) |
| 399 |
?> |
| 400 |
</td> |
| 401 |
</tr> |
| 402 |
</tbody> |
| 403 |
</table> |
| 404 |
<div class="mailchimp-sf-section-footer"> |
| 405 |
<input type="submit" value="<?php esc_attr_e( 'Save Changes', 'mailchimp' ); ?>" class="mailchimp-sf-button mailchimp-sf-button-submit btn-primary" style="display: none;"/> |
| 406 |
</div> |
| 407 |
</div> |
| 408 |
</form> |
| 409 |
</div> |
| 410 |
<div class="mailchimp-sf-settings-form-previewer"> |
| 411 |
<div class="mailchimp-sf-settings-form-previewer-content"> |
| 412 |
<table class="widefat mailchimp-sf-settings-table"> |
| 413 |
<thead> |
| 414 |
<tr> |
| 415 |
<th> |
| 416 |
<h2 class="mailchimp-sf-settings-table-title"><?php esc_html_e( 'Form preview', 'mailchimp' ); ?></h2> |
| 417 |
</th> |
| 418 |
</tr> |
| 419 |
</thead> |
| 420 |
<tbody> |
| 421 |
<tr> |
| 422 |
<td class="mailchimp-sf-form-preview-content"> |
| 423 |
<div class="mailchimp-sf-form-preview"> |
| 424 |
<?php |
| 425 |
mailchimp_sf_load_resources(); |
| 426 |
mailchimp_sf_signup_form(); |
| 427 |
?> |
| 428 |
</div> |
| 429 |
</td> |
| 430 |
</tr> |
| 431 |
</tbody> |
| 432 |
</table> |
| 433 |
</div> |
| 434 |
</div> |
| 435 |
</div> |
| 436 |
|