| 1 |
<?php |
| 2 |
/** |
| 3 |
* View file for the setup page. |
| 4 |
* |
| 5 |
* @package Mailchimp |
| 6 |
*/ |
| 7 |
|
| 8 |
?> |
| 9 |
<div> |
| 10 |
<form method="post" action="<?php echo esc_url( add_query_arg( array( 'page' => 'mailchimp_sf_options' ), admin_url( 'admin.php' ) ) ); ?>"> |
| 11 |
<div class="mc-section"> |
| 12 |
<input type="hidden" name="mcsf_action" value="change_form_settings"> |
| 13 |
<?php wp_nonce_field( 'update_general_form_settings', '_mcsf_nonce_action' ); ?> |
| 14 |
|
| 15 |
<table class="widefat mc-widefat mc-label-options"> |
| 16 |
<tr><th colspan="2"><?php esc_html_e( 'Content Options', 'mailchimp' ); ?></th></tr> |
| 17 |
<tr valign="top"> |
| 18 |
<th scope="row"> |
| 19 |
<label for="mc_header_content"><?php esc_html_e( 'Header', 'mailchimp' ); ?></label> |
| 20 |
</th> |
| 21 |
<td> |
| 22 |
<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/> |
| 23 |
<?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?> |
| 24 |
</td> |
| 25 |
</tr> |
| 26 |
|
| 27 |
<tr valign="top"> |
| 28 |
<th scope="row"> |
| 29 |
<label for="mc_subheader_content"><?php esc_html_e( 'Sub-header', 'mailchimp' ); ?></label> |
| 30 |
</th> |
| 31 |
<td> |
| 32 |
<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/> |
| 33 |
<?php esc_html_e( 'Add your own text, HTML markup (including image links), or keep it blank.', 'mailchimp' ); ?><br/> |
| 34 |
<?php esc_html_e( 'This will be displayed under the heading and above the form.', 'mailchimp' ); ?> |
| 35 |
</td> |
| 36 |
</tr> |
| 37 |
|
| 38 |
<tr valign="top" class="last-row"> |
| 39 |
<th scope="row"> |
| 40 |
<label for="mc_submit_text"><?php esc_html_e( 'Submit Button', 'mailchimp' ); ?></label> |
| 41 |
</th> |
| 42 |
<td> |
| 43 |
<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' ) ); ?>"/> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
</table> |
| 47 |
<input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/> |
| 48 |
|
| 49 |
<?php |
| 50 |
if ( get_option( 'mc_nuke_all_styles' ) === '1' ) { |
| 51 |
?> |
| 52 |
<table class="widefat mc-widefat mc-nuke-styling"> |
| 53 |
<tr><th colspan="2"><?php esc_html_e( 'Remove Mailchimp CSS', 'mailchimp' ); ?></th></tr> |
| 54 |
<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> |
| 55 |
</table> |
| 56 |
<?php |
| 57 |
} |
| 58 |
|
| 59 |
if ( 'on' === get_option( 'mc_custom_style' ) ) { |
| 60 |
?> |
| 61 |
<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;' : '' ) ); ?>"> |
| 62 |
<tr> |
| 63 |
<th colspan="2"><?php esc_html_e( 'Custom Styling', 'mailchimp' ); ?></th> |
| 64 |
</tr> |
| 65 |
<tr> |
| 66 |
<th> |
| 67 |
<label for="mc_custom_style"><?php esc_html_e( 'Enabled?', 'mailchimp' ); ?></label> |
| 68 |
</th> |
| 69 |
<td> |
| 70 |
<span class="mc-pre-input"></span> |
| 71 |
<input type="checkbox" name="mc_custom_style" id="mc_custom_style"<?php checked( get_option( 'mc_custom_style' ), 'on' ); ?> /> |
| 72 |
<em><?php esc_html_e( 'Edit the default Mailchimp CSS style.' ); ?></em> |
| 73 |
</td> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<th> |
| 77 |
<label for="mc_form_border_width"><?php esc_html_e( 'Border Width (px)', 'mailchimp' ); ?></label> |
| 78 |
</th> |
| 79 |
<td> |
| 80 |
<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' ) ); ?>"/> |
| 81 |
<em><?php esc_html_e( 'Set to 0 for no border, do not enter', 'mailchimp' ); ?> px</em> |
| 82 |
</td> |
| 83 |
</tr> |
| 84 |
<tr> |
| 85 |
<th> |
| 86 |
<label for="mc_form_border_color"><?php esc_html_e( 'Border Color', 'mailchimp' ); ?></label> |
| 87 |
</th> |
| 88 |
<td> |
| 89 |
<span class="mc-pre-input">#</span> |
| 90 |
<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' ) ); ?>"/> |
| 91 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 92 |
</td> |
| 93 |
</tr> |
| 94 |
<tr> |
| 95 |
<th> |
| 96 |
<label for="mc_form_text_color"><?php esc_html_e( 'Text Color', 'mailchimp' ); ?></label> |
| 97 |
</th> |
| 98 |
<td> |
| 99 |
<span class="mc-pre-input">#</span> |
| 100 |
<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' ) ); ?>"/> |
| 101 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
<tr class="last-row"> |
| 105 |
<th> |
| 106 |
<label for="mc_form_background"><?php esc_html_e( 'Background Color', 'mailchimp' ); ?></label> |
| 107 |
</th> |
| 108 |
<td> |
| 109 |
<span class="mc-pre-input">#</span> |
| 110 |
<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' ) ); ?>"/> |
| 111 |
<em><?php esc_html_e( 'Do not enter initial', 'mailchimp' ); ?> <strong>#</strong></em> |
| 112 |
</td> |
| 113 |
</tr> |
| 114 |
</table> |
| 115 |
<input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/> |
| 116 |
<?php |
| 117 |
} |
| 118 |
?> |
| 119 |
|
| 120 |
<table class="widefat mc-widefat"> |
| 121 |
<tr><th colspan="2"><?php esc_html_e( 'List Options', 'mailchimp' ); ?></th></tr> |
| 122 |
|
| 123 |
<tr valign="top"> |
| 124 |
<th scope="row"><?php esc_html_e( 'Use Double Opt-In (Recommended)?', 'mailchimp' ); ?></th> |
| 125 |
<td><input name="mc_double_optin" type="checkbox" <?php checked( get_option( 'mc_double_optin' ), true ); ?> id="mc_double_optin" class="code" /> |
| 126 |
<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> |
| 127 |
</td> |
| 128 |
</tr> |
| 129 |
<tr valign="top"> |
| 130 |
<th scope="row"><?php esc_html_e( 'Update existing subscribers?', 'mailchimp' ); ?></th> |
| 131 |
<td><input name="mc_update_existing" type="checkbox" <?php checked( get_option( 'mc_update_existing' ), true ); ?> id="mc_update_existing" class="code" /> |
| 132 |
<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> |
| 133 |
</td> |
| 134 |
</tr> |
| 135 |
|
| 136 |
<tr valign="top" class="last-row"> |
| 137 |
<th scope="row"><?php esc_html_e( 'Include Unsubscribe link?', 'mailchimp' ); ?></th> |
| 138 |
<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" /> |
| 139 |
<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> |
| 140 |
</td> |
| 141 |
</tr> |
| 142 |
<tr valign="top"> |
| 143 |
<td colspan="2"> |
| 144 |
<?php |
| 145 |
echo wp_kses( |
| 146 |
sprintf( |
| 147 |
/* translators: %s: link to Mailchimp */ |
| 148 |
__( '<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' ), |
| 149 |
'https://mailchimp.com/help/change-or-update-the-return-to-our-website-button/' |
| 150 |
), |
| 151 |
[ |
| 152 |
'a' => [ |
| 153 |
'href' => [], |
| 154 |
'target' => [], |
| 155 |
'rel' => [], |
| 156 |
], |
| 157 |
'strong' => [], |
| 158 |
] |
| 159 |
) |
| 160 |
?> |
| 161 |
</td> |
| 162 |
</tr> |
| 163 |
</table> |
| 164 |
<input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/> |
| 165 |
</div> |
| 166 |
|
| 167 |
<?php |
| 168 |
$mv = get_option( 'mc_merge_vars' ); |
| 169 |
|
| 170 |
if ( ! is_array( $mv ) || count( $mv ) === 0 ) { |
| 171 |
?> |
| 172 |
<div class="mc-section"> |
| 173 |
<table class='widefat mc-widefat'> |
| 174 |
<tr><th><?php esc_html_e( 'Merge Fields Included', 'mailchimp' ); ?></th></tr> |
| 175 |
<tr><td><em><?php esc_html_e( 'No Merge Fields found.', 'mailchimp' ); ?></em></td></tr> |
| 176 |
</table> |
| 177 |
</div> |
| 178 |
<?php |
| 179 |
} else { |
| 180 |
?> |
| 181 |
<div class="mc-section"> |
| 182 |
<table class='widefat mc-widefat'> |
| 183 |
<tr> |
| 184 |
<th colspan="4"> |
| 185 |
<?php esc_html_e( 'Merge Fields Included', 'mailchimp' ); ?> |
| 186 |
</th> |
| 187 |
</tr> |
| 188 |
<tr valign="top"> |
| 189 |
<th><?php esc_html_e( 'Name', 'mailchimp' ); ?></th> |
| 190 |
<th><?php esc_html_e( 'Tag', 'mailchimp' ); ?></th> |
| 191 |
<th><?php esc_html_e( 'Required?', 'mailchimp' ); ?></th> |
| 192 |
<th><?php esc_html_e( 'Include?', 'mailchimp' ); ?></th> |
| 193 |
</tr> |
| 194 |
<?php |
| 195 |
foreach ( $mv as $mv_var ) { |
| 196 |
?> |
| 197 |
<tr valign="top"> |
| 198 |
<td><?php echo esc_html( $mv_var['name'] ); ?></td> |
| 199 |
<td><?php echo esc_html( $mv_var['tag'] ); ?></td> |
| 200 |
<td><?php echo esc_html( ( 1 === intval( $mv_var['required'] ) ) ? 'Y' : 'N' ); ?></td> |
| 201 |
<td> |
| 202 |
<?php |
| 203 |
if ( ! $mv_var['required'] ) { |
| 204 |
$opt = 'mc_mv_' . $mv_var['tag']; |
| 205 |
?> |
| 206 |
<label class="screen-reader-text" for="<?php echo esc_attr( $opt ); ?>"> |
| 207 |
<?php |
| 208 |
echo esc_html( |
| 209 |
sprintf( |
| 210 |
/* translators: %s: name of field */ |
| 211 |
__( 'Include merge field %s?', 'mailchimp' ), |
| 212 |
$mv_var['name'] |
| 213 |
) |
| 214 |
); |
| 215 |
?> |
| 216 |
</label> |
| 217 |
<input name="<?php echo esc_attr( $opt ); ?>" type="checkbox" id="<?php echo esc_attr( $opt ); ?>" class="code"<?php checked( get_option( $opt ), 'on' ); ?> /> |
| 218 |
<?php |
| 219 |
} else { |
| 220 |
?> |
| 221 |
— |
| 222 |
<?php |
| 223 |
} |
| 224 |
?> |
| 225 |
</td> |
| 226 |
</tr> |
| 227 |
<?php |
| 228 |
} |
| 229 |
?> |
| 230 |
</table> |
| 231 |
<input type="submit" value="<?php esc_attr_e( 'Update Subscribe Form Settings', 'mailchimp' ); ?>" class="button mailchimp-sf-button small mc-submit" /><br/> |
| 232 |
</div> |
| 233 |
|
| 234 |
<?php |
| 235 |
// Interest Groups Table |
| 236 |
$igs = get_option( 'mc_interest_groups' ); |
| 237 |
if ( is_array( $igs ) && ! empty( $igs ) ) { |
| 238 |
?> |
| 239 |
<div class="mc-section"> |
| 240 |
<h3 class="mc-h3"><?php esc_html_e( 'Group Settings', 'mailchimp' ); ?></h3> |
| 241 |
</div> |
| 242 |
<?php |
| 243 |
// Determines whether or not to continue processing. Only false if there was an error. |
| 244 |
$continue = true; |
| 245 |
foreach ( $igs as $ig ) { |
| 246 |
if ( $continue ) { |
| 247 |
if ( ! is_array( $ig ) || empty( $ig ) || 'N' === $ig ) { |
| 248 |
?> |
| 249 |
<em><?php esc_html_e( 'No Interest Groups Setup for this List', 'mailchimp' ); ?></em> |
| 250 |
<?php |
| 251 |
$continue = false; |
| 252 |
} else { |
| 253 |
?> |
| 254 |
<table class='mc-widefat' width="450px" cellspacing="0"> |
| 255 |
<tr valign="top"> |
| 256 |
<th colspan="2"><?php echo esc_html( $ig['title'] ); ?></th> |
| 257 |
</tr> |
| 258 |
<tr valign="top"> |
| 259 |
<th> |
| 260 |
<label for="<?php echo esc_attr( 'mc_show_interest_groups_' . $ig['id'] ); ?>"><?php esc_html_e( 'Show?', 'mailchimp' ); ?></label> |
| 261 |
</th> |
| 262 |
<td> |
| 263 |
<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'] ) ); ?> /> |
| 264 |
</td> |
| 265 |
</tr> |
| 266 |
<tr valign="top"> |
| 267 |
<th><?php esc_html_e( 'Input Type', 'mailchimp' ); ?></th> |
| 268 |
<td><?php echo esc_html( $ig['type'] ); ?></td> |
| 269 |
</tr> |
| 270 |
<tr valign="top" class="last-row"> |
| 271 |
<th><?php esc_html_e( 'Options', 'mailchimp' ); ?></th> |
| 272 |
<td> |
| 273 |
<ul> |
| 274 |
<?php |
| 275 |
foreach ( $ig['groups'] as $interest ) { |
| 276 |
?> |
| 277 |
<li><?php echo esc_html( $interest['name'] ); ?></li> |
| 278 |
<?php |
| 279 |
} |
| 280 |
?> |
| 281 |
</ul> |
| 282 |
</td> |
| 283 |
</tr> |
| 284 |
</table> |
| 285 |
<?php |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
} |
| 290 |
} |
| 291 |
?> |
| 292 |
</form> |
| 293 |
</div> |
| 294 |
|