| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 |
|
| 4 |
function accua_forms_settings_page_head_scripts() { |
| 5 |
wp_enqueue_style('wp-color-picker'); |
| 6 |
wp_enqueue_script('wp-color-picker'); |
| 7 |
|
| 8 |
// Enqueue settings page JavaScript |
| 9 |
wp_enqueue_script('contact_forms_tabs', plugins_url('assets/js/admin/tabs.js', ACCUA_FORMS_FILE), array('jquery'), ACCUA_FORMS_JS_VERSION, true); |
| 10 |
wp_enqueue_script('accua-forms-settings-page', plugins_url('assets/js/admin/settings-page.js', ACCUA_FORMS_FILE), array('jquery', 'contact_forms_tabs'), ACCUA_FORMS_JS_VERSION, true); |
| 11 |
|
| 12 |
// Theme Helper tab scripts |
| 13 |
wp_enqueue_script( |
| 14 |
'accua-forms-theme-helper', |
| 15 |
plugins_url('assets/js/admin/theme-helper.js', ACCUA_FORMS_FILE), |
| 16 |
array('jquery'), |
| 17 |
ACCUA_FORMS_JS_VERSION, |
| 18 |
true |
| 19 |
); |
| 20 |
wp_localize_script('accua-forms-theme-helper', 'accuaThemeHelper', array( |
| 21 |
'ajaxUrl' => admin_url('admin-ajax.php'), |
| 22 |
'nonce' => wp_create_nonce('accua_theme_helper'), |
| 23 |
'pluginCssUrl' => plugins_url('assets/css/frontend.css', ACCUA_FORMS_FILE), |
| 24 |
'i18n' => array( |
| 25 |
'scanning' => __('Scanning...', 'contact-forms'), |
| 26 |
'noConflicts' => __('No CSS conflicts detected!', 'contact-forms'), |
| 27 |
'conflictsFound' => __('CSS conflicts found:', 'contact-forms'), |
| 28 |
'scanComplete' => __('Scan complete', 'contact-forms'), |
| 29 |
'scanError' => __('Error scanning URL', 'contact-forms'), |
| 30 |
'enterUrl' => __('Enter a URL to scan', 'contact-forms'), |
| 31 |
'fetchingCss' => __('Fetching CSS from URL...', 'contact-forms'), |
| 32 |
), |
| 33 |
'monitoredClasses' => accua_forms_get_monitored_css_classes(), |
| 34 |
'criticalProperties' => array( |
| 35 |
'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', |
| 36 |
'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', |
| 37 |
'display', 'position', 'visibility', 'overflow', |
| 38 |
'width', 'height', 'min-width', 'min-height', 'max-width', 'max-height', |
| 39 |
'flex', 'flex-direction', 'flex-wrap', 'align-items', 'justify-content', |
| 40 |
'border', 'border-width', 'border-style', |
| 41 |
'float', 'clear', 'z-index', 'opacity', |
| 42 |
), |
| 43 |
)); |
| 44 |
|
| 45 |
// Localize script with AJAX URL, nonce, and translations |
| 46 |
wp_localize_script('accua-forms-settings-page', 'accuaFormsSettings', array( |
| 47 |
'ajaxUrl' => admin_url('admin-ajax.php'), |
| 48 |
'nonce' => wp_create_nonce('accua_forms_restore_default'), |
| 49 |
'dangerNonce' => wp_create_nonce('accua_forms_danger_zone'), |
| 50 |
'siteDomain' => wp_parse_url( home_url(), PHP_URL_HOST ), |
| 51 |
'i18n' => array( |
| 52 |
'confirmRestore' => __('Are you sure you want to restore the default value for this message? This will overwrite your current content.', 'contact-forms'), |
| 53 |
'restoring' => __('Restoring...', 'contact-forms'), |
| 54 |
'restored' => __('Restored!', 'contact-forms'), |
| 55 |
'error' => __('Error restoring default', 'contact-forms'), |
| 56 |
'restoreDefault' => __('Restore default', 'contact-forms'), |
| 57 |
'anonymizing' => __('Anonymizing...', 'contact-forms'), |
| 58 |
'loading' => __('Loading...', 'contact-forms'), |
| 59 |
'deleting' => __('Deleting...', 'contact-forms'), |
| 60 |
'noSubmissionsFound' => __('No submissions found matching the specified period.', 'contact-forms'), |
| 61 |
/* translators: %d: total number of submissions that will be anonymized */ |
| 62 |
'previewHeading' => __('The following %d submissions will be anonymized:', 'contact-forms'), |
| 63 |
'formColumn' => __('Form', 'contact-forms'), |
| 64 |
'submissionsColumn' => __('Submissions', 'contact-forms'), |
| 65 |
'totalLabel' => __('Total', 'contact-forms'), |
| 66 |
'confirmAnonymize' => __('Confirm anonymization', 'contact-forms'), |
| 67 |
'cancel' => __('Cancel', 'contact-forms'), |
| 68 |
'confirmDeletePrompt' => sprintf( |
| 69 |
/* translators: %s: site domain */ |
| 70 |
__( 'This will permanently delete ALL Contact Forms data (settings, forms, submissions, uploaded files). This cannot be undone. Type "%s" to confirm:', 'contact-forms' ), |
| 71 |
wp_parse_url( home_url(), PHP_URL_HOST ) |
| 72 |
), |
| 73 |
), |
| 74 |
)); |
| 75 |
} |
| 76 |
|
| 77 |
function accua_forms_settings_page() { |
| 78 |
?> |
| 79 |
<div id="accua_forms_settings_page" class="accua_forms_admin_page wrap"> |
| 80 |
<h1><?php esc_html_e('Contact Forms - Default Settings', 'contact-forms'); ?></h1> |
| 81 |
<?php |
| 82 |
$empty_form_data = array( |
| 83 |
'success_message' => '', |
| 84 |
'error_message' => '', |
| 85 |
'emails_from_name' => '', |
| 86 |
'emails_from' => '', |
| 87 |
'admin_emails_to' => '', |
| 88 |
'emails_bcc' => '', |
| 89 |
'admin_emails_subject' => '', |
| 90 |
'admin_emails_message' => '', |
| 91 |
'confirmation_emails_subject' => '', |
| 92 |
'confirmation_emails_message' => '', |
| 93 |
'layout' => 'sidebyside', |
| 94 |
'style_margin' => '', |
| 95 |
'style_border_color' => '', |
| 96 |
'style_border_width' => '', |
| 97 |
'style_border_radius' => '', |
| 98 |
'style_background_color' => '', |
| 99 |
'style_padding' => '', |
| 100 |
'style_color' => '', |
| 101 |
'style_font_size' => '', |
| 102 |
'style_field_spacing' => '', |
| 103 |
'style_field_border_color' => '', |
| 104 |
'style_field_border_width' => '', |
| 105 |
'style_field_border_radius' => '', |
| 106 |
'style_field_background_color' => '', |
| 107 |
'style_field_padding' => '', |
| 108 |
'style_field_color' => '', |
| 109 |
'style_submit_border_color' => '', |
| 110 |
'style_submit_border_width' => '', |
| 111 |
'style_submit_border_radius' => '', |
| 112 |
'style_submit_background_color' => '', |
| 113 |
'style_submit_padding' => '', |
| 114 |
'style_submit_color' => '', |
| 115 |
'style_submit_font_size' => '', |
| 116 |
); |
| 117 |
|
| 118 |
$empty_file_data = array( |
| 119 |
'valid_extensions' => '', |
| 120 |
'max_size' => '', |
| 121 |
'dest_path' => '', |
| 122 |
); |
| 123 |
|
| 124 |
$empty_captcha_data = array( |
| 125 |
'recaptcha_force_v1' => '', |
| 126 |
'recaptcha_public_key' => '', |
| 127 |
'recaptcha_private_key' => '', |
| 128 |
'recaptcha_v3_public_key' => '', |
| 129 |
'recaptcha_v3_private_key' => '', |
| 130 |
'recaptcha_v3_score_threshold' => '', |
| 131 |
'recaptcha_v3_badge' => '', |
| 132 |
'captcha_spam_action' => '', |
| 133 |
'captcha_spam_action_v2' => '', |
| 134 |
'captcha_hide_title' => '', |
| 135 |
'cap_instance_url' => '', |
| 136 |
'cap_site_key' => '', |
| 137 |
'cap_secret_key' => '', |
| 138 |
); |
| 139 |
|
| 140 |
$empty_analytics_data = array( |
| 141 |
'analytics_track_submit' => false, |
| 142 |
'analytics_track_fields' => false, |
| 143 |
); |
| 144 |
|
| 145 |
$empty_anonymize_ip_data = array( |
| 146 |
'anonymize_ip_bytes' => 0, |
| 147 |
); |
| 148 |
|
| 149 |
$empty_retention_data = array( |
| 150 |
'retention_value' => 0, |
| 151 |
'retention_unit' => 'months', |
| 152 |
'retention_mode' => 'anonymize', |
| 153 |
); |
| 154 |
|
| 155 |
$empty_spam_data = array( |
| 156 |
'email_blocklist' => '', |
| 157 |
); |
| 158 |
|
| 159 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated -- REQUEST_METHOD is always set by server |
| 160 |
if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] && ! empty( $_POST['accua_form_save_form_settings'] ) ) { |
| 161 |
check_admin_referer('accua_form_save_settings', '_nonce_accua_form_save_settings'); |
| 162 |
$post = stripslashes_deep($_POST); |
| 163 |
$post += $empty_form_data; |
| 164 |
$post += $empty_file_data; |
| 165 |
$post += $empty_captcha_data; |
| 166 |
$post += $empty_analytics_data; |
| 167 |
$post += $empty_anonymize_ip_data; |
| 168 |
$post += $empty_retention_data; |
| 169 |
$post += $empty_spam_data; |
| 170 |
$form_data = array(); |
| 171 |
$file_data = array(); |
| 172 |
$captcha_data = array(); |
| 173 |
$analytics_data = array(); |
| 174 |
$anonymize_ip_data = array(); |
| 175 |
$retention_data = array(); |
| 176 |
$spam_data = array(); |
| 177 |
foreach($empty_form_data as $key=>$val){ |
| 178 |
$form_data[$key] = $post[$key]; |
| 179 |
} |
| 180 |
$form_data = accua_forms_filter_settings($form_data); |
| 181 |
|
| 182 |
$file_data['valid_extensions'] = accua_forms_filter_extensions($post['valid_extensions']); |
| 183 |
$file_data['max_size'] = $post['max_size']; |
| 184 |
if (current_user_can('edit_files') || current_user_can('install_plugins')) { |
| 185 |
$file_data['dest_path'] = $post['dest_path']; |
| 186 |
} else { |
| 187 |
$old_file_data = get_option('accua_forms_default_file_field_data',array()); |
| 188 |
$file_data['dest_path'] = isset($old_file_data['dest_path']) ? $old_file_data['dest_path'] : ''; |
| 189 |
} |
| 190 |
|
| 191 |
$captcha_data['recaptcha_force_v1'] = (bool) $post['recaptcha_force_v1']; |
| 192 |
$captcha_data['recaptcha_public_key'] = sanitize_text_field($post['recaptcha_public_key']); |
| 193 |
$captcha_data['recaptcha_private_key'] = sanitize_text_field($post['recaptcha_private_key']); |
| 194 |
$captcha_data['recaptcha_v3_public_key'] = sanitize_text_field($post['recaptcha_v3_public_key']); |
| 195 |
$captcha_data['recaptcha_v3_private_key'] = sanitize_text_field($post['recaptcha_v3_private_key']); |
| 196 |
$captcha_data['recaptcha_v3_score_threshold'] = accua_forms_recaptcha3_clamp_score($post['recaptcha_v3_score_threshold']); |
| 197 |
$recaptcha_v3_badge = sanitize_text_field($post['recaptcha_v3_badge']); |
| 198 |
$captcha_data['recaptcha_v3_badge'] = isset(accua_forms_recaptcha3_badge_options()[$recaptcha_v3_badge]) ? $recaptcha_v3_badge : 'bottomright'; |
| 199 |
$captcha_spam_action = sanitize_text_field($post['captcha_spam_action']); |
| 200 |
$captcha_data['captcha_spam_action'] = isset(accua_forms_captcha_spam_action_options()[$captcha_spam_action]) ? $captcha_spam_action : 'spam'; |
| 201 |
$captcha_spam_action_v2 = sanitize_text_field($post['captcha_spam_action_v2']); |
| 202 |
$captcha_data['captcha_spam_action_v2'] = isset(accua_forms_captcha_spam_action_options()[$captcha_spam_action_v2]) ? $captcha_spam_action_v2 : 'reject'; |
| 203 |
$captcha_data['captcha_hide_title'] = empty($post['captcha_hide_title']) ? 0 : 1; |
| 204 |
$captcha_data['cap_instance_url'] = esc_url_raw(trim($post['cap_instance_url'])); |
| 205 |
$captcha_data['cap_site_key'] = sanitize_text_field($post['cap_site_key']); |
| 206 |
$captcha_data['cap_secret_key'] = sanitize_text_field($post['cap_secret_key']); |
| 207 |
|
| 208 |
foreach($empty_analytics_data as $key=>$val){ |
| 209 |
$analytics_data[$key] = (bool) $post[$key]; |
| 210 |
} |
| 211 |
|
| 212 |
$anonymize_ip_bytes = (int) $post['anonymize_ip_bytes']; |
| 213 |
if ($anonymize_ip_bytes < 0) { |
| 214 |
$anonymize_ip_bytes = 0; |
| 215 |
} elseif ($anonymize_ip_bytes > 4) { |
| 216 |
$anonymize_ip_bytes = 4; |
| 217 |
} |
| 218 |
$anonymize_ip_data['anonymize_ip_bytes'] = $anonymize_ip_bytes; |
| 219 |
|
| 220 |
update_option('accua_forms_default_form_data', $form_data); |
| 221 |
update_option('accua_forms_default_file_field_data', $file_data); |
| 222 |
update_option('accua_forms_default_captcha_field_data', $captcha_data); |
| 223 |
update_option('accua_forms_default_analytics_data', $analytics_data); |
| 224 |
update_option('accua_forms_anonymize_ip_data', $anonymize_ip_data); |
| 225 |
|
| 226 |
// Opt-in to data deletion on uninstall. Only administrators see the Danger |
| 227 |
// Zone that carries the checkbox, so only they can change it; for anybody |
| 228 |
// else the stored value is left exactly as it is instead of being read as |
| 229 |
// an unticked box. |
| 230 |
if ( current_user_can( 'manage_options' ) ) { |
| 231 |
update_option( ACCUA_FORMS_UNINSTALL_OPTION, empty( $post['delete_data_on_uninstall'] ) ? 0 : 1 ); |
| 232 |
} |
| 233 |
|
| 234 |
$retention_data['retention_value'] = max( 0, (int) $post['retention_value'] ); |
| 235 |
$retention_data['retention_unit'] = in_array( $post['retention_unit'], array( 'days', 'months', 'years' ), true ) ? $post['retention_unit'] : 'months'; |
| 236 |
$retention_data['retention_mode'] = in_array( $post['retention_mode'], array( 'anonymize', 'delete' ), true ) ? $post['retention_mode'] : 'anonymize'; |
| 237 |
update_option('accua_forms_retention_data', $retention_data); |
| 238 |
|
| 239 |
// Kept as the text that was typed (see includes/spam-blocklist.php): the |
| 240 |
// textarea round-trips it, comments and order included. |
| 241 |
$spam_data['email_blocklist'] = accua_forms_filter_email_blocklist($post['email_blocklist']); |
| 242 |
update_option('accua_forms_spam_data', $spam_data); |
| 243 |
|
| 244 |
if (!empty($post['delete_previous_ip_values'])) { |
| 245 |
global $wpdb; |
| 246 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Admin-only IP anonymization action, no caching needed |
| 247 |
$wpdb->query("UPDATE `{$wpdb->prefix}accua_forms_submissions` SET afs_ip = ''"); |
| 248 |
} |
| 249 |
} else { |
| 250 |
$form_data = get_option('accua_forms_default_form_data',array()) + $empty_form_data; |
| 251 |
$file_data = get_option('accua_forms_default_file_field_data',array()) + $empty_file_data; |
| 252 |
$captcha_data = get_option('accua_forms_default_captcha_field_data',array()) + $empty_captcha_data; |
| 253 |
$analytics_data = get_option('accua_forms_default_analytics_data',array()) + $empty_analytics_data; |
| 254 |
$anonymize_ip_data = get_option('accua_forms_anonymize_ip_data',array()) + $empty_anonymize_ip_data; |
| 255 |
$retention_data = get_option('accua_forms_retention_data',array()) + $empty_retention_data; |
| 256 |
$spam_data = accua_forms_spam_settings(); |
| 257 |
} |
| 258 |
$delete_on_uninstall = accua_forms_delete_data_on_uninstall(); |
| 259 |
|
| 260 |
if ($captcha_data['recaptcha_force_v1']) { |
| 261 |
$captcha_data = $empty_captcha_data; |
| 262 |
} |
| 263 |
?> |
| 264 |
<form method="post"> |
| 265 |
<?php wp_nonce_field('accua_form_save_settings', '_nonce_accua_form_save_settings'); ?> |
| 266 |
<input type="hidden" name="accua_form_save_form_settings" value="1" /> |
| 267 |
<div id="accua_settings_tabs" class="accua-tabs accua-tabs--primary" data-default-tab="messages"> |
| 268 |
<div class="accua-tabs__tablist" role="tablist" aria-label="<?php esc_attr_e( 'Settings', 'contact-forms' ); ?>"> |
| 269 |
<button class="accua-tabs__tab" role="tab" data-tab="messages"><?php esc_html_e( 'Default Messages', 'contact-forms' ); ?></button> |
| 270 |
<button class="accua-tabs__tab" role="tab" data-tab="integrations"><?php esc_html_e( 'Integrations', 'contact-forms' ); ?></button> |
| 271 |
<button class="accua-tabs__tab" role="tab" data-tab="privacy"><?php esc_html_e( 'Privacy', 'contact-forms' ); ?></button> |
| 272 |
<button class="accua-tabs__tab" role="tab" data-tab="styling"><?php esc_html_e( 'Layout & Styling', 'contact-forms' ); ?></button> |
| 273 |
<button class="accua-tabs__tab" role="tab" data-tab="other"><?php esc_html_e( 'Other settings', 'contact-forms' ); ?></button> |
| 274 |
<button class="accua-tabs__tab" role="tab" data-tab="theme_helper"><?php esc_html_e( 'Theme Helper', 'contact-forms' ); ?></button> |
| 275 |
<?php if ( current_user_can( 'manage_options' ) ) : ?> |
| 276 |
<button class="accua-tabs__tab" role="tab" data-tab="danger_zone"><?php esc_html_e( 'Danger Zone', 'contact-forms' ); ?></button> |
| 277 |
<?php endif; ?> |
| 278 |
<button class="accua-tabs__tab" role="tab" data-tab="tokens"><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></button> |
| 279 |
</div> |
| 280 |
|
| 281 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="messages"> |
| 282 |
<?php |
| 283 |
$email_font_formats = |
| 284 |
'Arial=arial,helvetica,sans-serif;' |
| 285 |
. 'Arial Black=arial black,avant garde,sans-serif;' |
| 286 |
. 'Comic Sans MS=comic sans ms,sans-serif;' |
| 287 |
. 'Courier New=courier new,courier,monospace;' |
| 288 |
. 'Georgia=georgia,palatino,serif;' |
| 289 |
. 'Lucida Sans=lucida sans unicode,lucida grande,sans-serif;' |
| 290 |
. 'Tahoma=tahoma,arial,helvetica,sans-serif;' |
| 291 |
. 'Times New Roman=times new roman,times,serif;' |
| 292 |
. 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' |
| 293 |
. 'Verdana=verdana,geneva,sans-serif;'; |
| 294 |
|
| 295 |
$settings_editor = array( |
| 296 |
'teeny' => true, |
| 297 |
'editor_class' => 'accua_form_value', |
| 298 |
'tinymce' => array( |
| 299 |
'toolbar1' => 'fontselect,|,bold,italic,underline,|,bullist,numlist,|,link,unlink', |
| 300 |
'font_formats' => $email_font_formats, |
| 301 |
'content_style' => 'body { font-family: arial, helvetica, sans-serif; }', |
| 302 |
)); |
| 303 |
?> |
| 304 |
<div class="accua-settings-grid"> |
| 305 |
|
| 306 |
<div class="postbox"> |
| 307 |
<div class="postbox-header"><h2><?php esc_html_e('1. On-screen success message', 'contact-forms'); ?></h2></div> |
| 308 |
<div class="inside"> |
| 309 |
<div id="accua_form_success_message"> |
| 310 |
<?php wp_editor( $form_data['success_message'] , 'success_message' , $settings_editor); ?> |
| 311 |
</div> |
| 312 |
<p class="accua-restore-default-wrapper"> |
| 313 |
<button type="button" class="button-link accua-restore-default-btn" data-message-type="success_message"> |
| 314 |
<?php esc_html_e('Restore default', 'contact-forms'); ?> |
| 315 |
</button> |
| 316 |
</p> |
| 317 |
</div></div> |
| 318 |
|
| 319 |
<div class="postbox"> |
| 320 |
<div class="postbox-header"><h2><?php esc_html_e('2. On-screen error message', 'contact-forms'); ?></h2></div> |
| 321 |
<div class="inside"> |
| 322 |
<div id="accua_form_error_message"> |
| 323 |
<?php wp_editor( $form_data['error_message'] , 'error_message' , $settings_editor); ?> |
| 324 |
</div> |
| 325 |
<p class="accua-restore-default-wrapper"> |
| 326 |
<button type="button" class="button-link accua-restore-default-btn" data-message-type="error_message"> |
| 327 |
<?php esc_html_e('Restore default', 'contact-forms'); ?> |
| 328 |
</button> |
| 329 |
</p> |
| 330 |
</div></div> |
| 331 |
|
| 332 |
<div class="postbox"> |
| 333 |
<div class="postbox-header"><h2><?php esc_html_e('3. Email to notify administrator', 'contact-forms'); ?></h2></div> |
| 334 |
<div class="inside"> |
| 335 |
<table class="form-table" role="presentation"> |
| 336 |
<tr> |
| 337 |
<th scope="row"><label for="accua_settings_admin_emails_to"><?php esc_html_e( 'To', 'contact-forms'); ?></label></th> |
| 338 |
<td id="accua_form_admin_emails_to"><input id="accua_settings_admin_emails_to" name="admin_emails_to" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['admin_emails_to']) ?>" /></td> |
| 339 |
</tr> |
| 340 |
<tr> |
| 341 |
<th scope="row"><label for="accua_settings_emails_bcc"><?php esc_html_e( 'Bcc', 'contact-forms'); ?></label></th> |
| 342 |
<td id="accua_form_emails_bcc"><input id="accua_settings_emails_bcc" name="emails_bcc" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['emails_bcc']) ?>" /></td> |
| 343 |
</tr> |
| 344 |
<tr> |
| 345 |
<th scope="row"><label for="accua_settings_admin_emails_subject"><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th> |
| 346 |
<td id="accua_form_admin_emails_subject"><input id="accua_settings_admin_emails_subject" name="admin_emails_subject" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['admin_emails_subject']) ?>" /></td> |
| 347 |
</tr> |
| 348 |
</table> |
| 349 |
<div id="accua_form_admin_emails_message"> |
| 350 |
<?php wp_editor( $form_data['admin_emails_message'] , 'admin_emails_message' , $settings_editor); ?> |
| 351 |
</div> |
| 352 |
<p class="accua-restore-default-wrapper"> |
| 353 |
<button type="button" class="button-link accua-restore-default-btn" data-message-type="admin_emails"> |
| 354 |
<?php esc_html_e('Restore default', 'contact-forms'); ?> |
| 355 |
</button> |
| 356 |
<span class="description"><?php esc_html_e('(Restores subject and message only)', 'contact-forms'); ?></span> |
| 357 |
</p> |
| 358 |
</div></div> |
| 359 |
|
| 360 |
<div class="postbox"> |
| 361 |
<div class="postbox-header"><h2><?php esc_html_e('4. Email confirmation to the person who completed the form', 'contact-forms'); ?></h2></div> |
| 362 |
<div class="inside"> |
| 363 |
<table class="form-table" role="presentation"> |
| 364 |
<tr> |
| 365 |
<th scope="row"><label for="accua_settings_emails_from_name"><?php esc_html_e( 'From name', 'contact-forms'); ?></label></th> |
| 366 |
<td id="accua_form_emails_from_name"><input id="accua_settings_emails_from_name" class="accua_form_value regular-text" name="emails_from_name" type="text" value="<?php echo esc_attr($form_data['emails_from_name']) ?>" /></td> |
| 367 |
</tr> |
| 368 |
<tr> |
| 369 |
<th scope="row"><label for="accua_settings_emails_from"><?php esc_html_e( 'From email', 'contact-forms'); ?></label></th> |
| 370 |
<td id="accua_form_emails_from"><input id="accua_settings_emails_from" class="accua_form_value regular-text" name="emails_from" type="text" value="<?php echo esc_attr($form_data['emails_from']) ?>" /></td> |
| 371 |
</tr> |
| 372 |
<tr> |
| 373 |
<th scope="row"><label for="accua_settings_confirmation_emails_subject"><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th> |
| 374 |
<td id="accua_form_confirmation_emails_subject"><input id="accua_settings_confirmation_emails_subject" class="accua_form_value regular-text" type="text" name="confirmation_emails_subject" value="<?php echo esc_attr($form_data['confirmation_emails_subject']) ?>" /></td> |
| 375 |
</tr> |
| 376 |
</table> |
| 377 |
<div id="accua_form_confirmation_emails_message"> |
| 378 |
<?php wp_editor( $form_data['confirmation_emails_message'] , 'confirmation_emails_message' , $settings_editor); ?> |
| 379 |
</div> |
| 380 |
<p class="accua-restore-default-wrapper"> |
| 381 |
<button type="button" class="button-link accua-restore-default-btn" data-message-type="confirmation_emails"> |
| 382 |
<?php esc_html_e('Restore default', 'contact-forms'); ?> |
| 383 |
</button> |
| 384 |
<span class="description"><?php esc_html_e('(Restores subject and message only)', 'contact-forms'); ?></span> |
| 385 |
</p> |
| 386 |
</div></div> |
| 387 |
|
| 388 |
</div> |
| 389 |
</div><!-- /panel: messages --> |
| 390 |
|
| 391 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="integrations"> |
| 392 |
<div class="accua-settings-grid"> |
| 393 |
|
| 394 |
<div class="postbox"> |
| 395 |
<div class="postbox-header"><h2><?php esc_html_e( 'File upload default settings', 'contact-forms'); ?></h2></div> |
| 396 |
<div class="inside"> |
| 397 |
<div id="accua_form_valid_extensions"><?php esc_html_e( 'Valid extensions', 'contact-forms'); ?> <br /><textarea name="valid_extensions" class="accua_form_value" style="width:95%"; cols="80" rows="8"><?php echo esc_textarea($file_data['valid_extensions']) ?></textarea> |
| 398 |
<small><?php esc_html_e( 'List of valid extensions, without dot, one per line.', 'contact-forms'); ?></small> |
| 399 |
</div> |
| 400 |
<div id="accua_form_max_size"><?php esc_html_e( 'Maximum file size:', 'contact-forms'); ?> <input name="max_size" class="accua_form_value" type="text" value="<?php echo esc_attr($file_data['max_size']) ?>" /><br /> |
| 401 |
<small><?php esc_html_e( 'You can use suffix K, M or G for kilobyte, megabyte or gigabyte.', 'contact-forms'); ?> |
| 402 |
<?php |
| 403 |
$server_max_size = AccuaForm_Element_File::file_upload_max_size(); |
| 404 |
if ($server_max_size > 0) { |
| 405 |
esc_html_e( 'This value is limited by server upload limits of ', 'contact-forms'); |
| 406 |
echo esc_html( AccuaForm_Element_File::format_size( $server_max_size ) ) . '. '; |
| 407 |
esc_html_e( 'If you need a greater limit you should ask to the server administrator.', 'contact-forms'); |
| 408 |
} |
| 409 |
?> |
| 410 |
</small> |
| 411 |
</div> |
| 412 |
<?php if (current_user_can('edit_files') || current_user_can('install_plugins')) { ?> |
| 413 |
<div id="accua_form_dest_path"><?php esc_html_e( 'Upload path', 'contact-forms');?> : <input name="dest_path" class="accua_form_value" type="text" value="<?php echo esc_attr($file_data['dest_path']) ?>" /> |
| 414 |
<small><?php esc_html_e( 'If it stars with \'/\' an absolute path is used, otherwise a path relative to the WordPress installation directory. Default value is "wp-content/uploads/accua-forms"', 'contact-forms');?>.</small> |
| 415 |
</div> |
| 416 |
<?php } ?> |
| 417 |
</div></div> |
| 418 |
|
| 419 |
<div class="postbox"> |
| 420 |
<div class="postbox-header"><h2><?php esc_html_e( 'reCaptcha settings', 'contact-forms'); ?></h2></div> |
| 421 |
<div class="inside"> |
| 422 |
<h3><?php esc_html_e( 'reCAPTCHA v2 (checkbox)', 'contact-forms');?></h3> |
| 423 |
<p><?php esc_html_e( 'Used by the "Captcha" field: the visitor has to tick the "I\'m not a robot" checkbox.', 'contact-forms');?></p> |
| 424 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML with hardcoded link is intentional ?> |
| 425 |
<p><?php echo strtr(__('Please register this site for reCAPTCHA v2 on %REGISTERURL%, then enter the keys for this site in the following fields', 'contact-forms'), array('%REGISTERURL%' => '<a href="https://www.google.com/recaptcha" target="_blank">google.com/recaptcha</a>'));?></p> |
| 426 |
<div id="accua_form_recaptcha_public_key"><?php esc_html_e('Site key', 'contact-forms');?> : <input name="recaptcha_public_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['recaptcha_public_key']) ?>" /> |
| 427 |
</div> |
| 428 |
<div id="accua_form_recaptcha_private_key"><?php esc_html_e('Secret key', 'contact-forms');?> : <input name="recaptcha_private_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['recaptcha_private_key']) ?>" /> |
| 429 |
</div> |
| 430 |
<h3><?php esc_html_e( 'reCAPTCHA v3 (invisible)', 'contact-forms');?></h3> |
| 431 |
<p><?php esc_html_e( 'Used by the "Captcha (reCAPTCHA v3)" field: no visible challenge, submissions are scored invisibly (the reCAPTCHA badge is shown on the page). Submissions scoring below the minimum score fail the spam check.', 'contact-forms');?></p> |
| 432 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML with hardcoded link is intentional ?> |
| 433 |
<p><?php echo strtr(__('reCAPTCHA v3 needs its own key pair, separate from the v2 one: register this site for reCAPTCHA v3 on %REGISTERURL%, then enter the keys in the following fields', 'contact-forms'), array('%REGISTERURL%' => '<a href="https://www.google.com/recaptcha" target="_blank">google.com/recaptcha</a>'));?></p> |
| 434 |
<div id="accua_form_recaptcha_v3_public_key"><?php esc_html_e('Site key', 'contact-forms');?> : <input name="recaptcha_v3_public_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['recaptcha_v3_public_key']) ?>" /> |
| 435 |
</div> |
| 436 |
<div id="accua_form_recaptcha_v3_private_key"><?php esc_html_e('Secret key', 'contact-forms');?> : <input name="recaptcha_v3_private_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['recaptcha_v3_private_key']) ?>" /> |
| 437 |
</div> |
| 438 |
<div id="accua_form_recaptcha_v3_score_threshold"><?php esc_html_e('Minimum score', 'contact-forms');?> : <input name="recaptcha_v3_score_threshold" class="accua_form_value" type="number" min="0" max="1" step="0.01" value="<?php echo esc_attr(number_format(accua_forms_recaptcha3_default_score_threshold(), 2, '.', '')) ?>" /> |
| 439 |
<small><?php esc_html_e('reCAPTCHA v3 scores every visitor from 0.0 (almost certainly a bot) to 1.0 (almost certainly a person), and submissions scoring below this value fail the spam check. Google suggests 0.5: raise it to be stricter, lower it if legitimate visitors are being caught. Each reCAPTCHA v3 field can override this value, and the score of every submission is recorded so you can see what your forms actually score.', 'contact-forms');?></small> |
| 440 |
</div> |
| 441 |
<div id="accua_form_recaptcha_v3_badge"><?php esc_html_e('Badge position', 'contact-forms');?> : |
| 442 |
<select name="recaptcha_v3_badge" class="accua_form_value"> |
| 443 |
<?php |
| 444 |
$current_badge = accua_forms_recaptcha3_badge(); |
| 445 |
foreach (accua_forms_recaptcha3_badge_options() as $badge_key => $badge_label) { |
| 446 |
echo '<option value="' . esc_attr($badge_key) . '"' . selected($badge_key, $current_badge, false) . '>' . esc_html($badge_label) . '</option>'; |
| 447 |
} |
| 448 |
?> |
| 449 |
</select> |
| 450 |
<small><?php esc_html_e('Where Google\'s floating reCAPTCHA badge is shown. Google allows hiding it only if the reCAPTCHA branding appears elsewhere: choosing "Hidden" makes the field print the required notice text below the form instead.', 'contact-forms');?></small> |
| 451 |
<small><?php esc_html_e('The badge appears once the visitor starts filling the form, because nothing is requested from Google before that. And since this setting travels with the page, a page cache will keep serving the previous badge position until you empty it.', 'contact-forms');?></small> |
| 452 |
</div> |
| 453 |
</div></div> |
| 454 |
|
| 455 |
<div class="postbox"> |
| 456 |
<div class="postbox-header"><h2><?php esc_html_e( 'Captcha defaults', 'contact-forms'); ?></h2></div> |
| 457 |
<div class="inside"> |
| 458 |
<p><?php esc_html_e( 'Defaults for every captcha field (reCAPTCHA v2, reCAPTCHA v3 and Cap). Each field in the form editor can override them.', 'contact-forms');?></p> |
| 459 |
<div id="accua_form_captcha_spam_action_v2"><?php esc_html_e('When the reCAPTCHA v2 check fails', 'contact-forms');?> : |
| 460 |
<select name="captcha_spam_action_v2" class="accua_form_value"> |
| 461 |
<?php |
| 462 |
$current_default_spam_action_v2 = accua_forms_captcha_default_spam_action('captcha'); |
| 463 |
foreach (accua_forms_captcha_spam_action_options() as $spam_action_key => $spam_action_label) { |
| 464 |
echo '<option value="' . esc_attr($spam_action_key) . '"' . selected($spam_action_key, $current_default_spam_action_v2, false) . '>' . esc_html($spam_action_label) . '</option>'; |
| 465 |
} |
| 466 |
?> |
| 467 |
</select> |
| 468 |
<small><?php esc_html_e('reCAPTCHA v2 asks the visitor to tick a checkbox, so a failed check usually means a real person did not solve it, let the challenge expire, or retried with a token already used. Rejecting with a visible error lets them solve it again, which is why it is the default here. The silent options accept the submission instead (normal success message, no notification emails) and mark it as Spam, move it to Trash, or delete it immediately.', 'contact-forms');?></small> |
| 469 |
</div> |
| 470 |
<div id="accua_form_captcha_spam_action"><?php esc_html_e('When the reCAPTCHA v3 check fails', 'contact-forms');?> : |
| 471 |
<select name="captcha_spam_action" class="accua_form_value"> |
| 472 |
<?php |
| 473 |
$current_default_spam_action = accua_forms_captcha_default_spam_action('captcha_v3'); |
| 474 |
foreach (accua_forms_captcha_spam_action_options() as $spam_action_key => $spam_action_label) { |
| 475 |
echo '<option value="' . esc_attr($spam_action_key) . '"' . selected($spam_action_key, $current_default_spam_action, false) . '>' . esc_html($spam_action_label) . '</option>'; |
| 476 |
} |
| 477 |
?> |
| 478 |
</select> |
| 479 |
<small><?php esc_html_e('reCAPTCHA v3 scores visitors invisibly, with nothing for them to solve, so a low score is best absorbed silently: accept the submission (the visitor sees the normal success message and no notification emails are sent) and mark it with the Spam lead status, move it to Trash, or delete it immediately without storing anything, or reject it with a visible error.', 'contact-forms');?></small> |
| 480 |
</div> |
| 481 |
<div id="accua_form_captcha_hide_title"><?php esc_html_e('Hide field title', 'contact-forms');?> : <input name="captcha_hide_title" class="accua_form_value" type="checkbox" value="1" <?php checked(accua_forms_captcha_default_hide_title()) ?> /> |
| 482 |
<small><?php esc_html_e('Do not display the title of captcha fields in the form. The title stays in the markup for screen readers and error messages.', 'contact-forms');?></small> |
| 483 |
</div> |
| 484 |
</div></div> |
| 485 |
|
| 486 |
<div class="postbox"> |
| 487 |
<div class="postbox-header"><h2><?php esc_html_e( 'Cloudflare Turnstile settings', 'contact-forms'); ?></h2></div> |
| 488 |
<div class="inside"> |
| 489 |
<p><?php esc_html_e( 'Used by the "Turnstile" field: the visitor passes a lightweight Cloudflare challenge, usually without any interaction. A modern CAPTCHA alternative that provides bot protection without frustrating user experiences.', 'contact-forms');?></p> |
| 490 |
<?php |
| 491 |
$turnstile_plugin_installed = function_exists('cfturnstile_field_show'); |
| 492 |
if (!$turnstile_plugin_installed) { |
| 493 |
echo '<div class="notice notice-warning inline"><p>'; |
| 494 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML with hardcoded link is intentional |
| 495 |
echo strtr(__('<strong>Required Plugin:</strong> The Turnstile field requires the %PLUGINLINK% plugin to be installed and activated.', 'contact-forms'), array( |
| 496 |
'%PLUGINLINK%' => '<a href="https://it.wordpress.org/plugins/simple-cloudflare-turnstile/" target="_blank">Simple Cloudflare Turnstile</a>' |
| 497 |
)); |
| 498 |
echo '</p></div>'; |
| 499 |
} else { |
| 500 |
$turnstile_key = get_option('cfturnstile_key', ''); |
| 501 |
$turnstile_secretkey = get_option('cfturnstile_secretkey', ''); |
| 502 |
if (empty($turnstile_key) || empty($turnstile_secretkey)) { |
| 503 |
echo '<div class="notice notice-info inline"><p>'; |
| 504 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML with esc_url() link is intentional |
| 505 |
echo strtr(__('The plugin is installed. Please configure your Cloudflare Turnstile keys in %SETTINGSLINK%.', 'contact-forms'), array( |
| 506 |
'%SETTINGSLINK%' => '<a href="' . esc_url( admin_url('options-general.php?page=cfturnstile') ) . '">Settings → Cloudflare Turnstile</a>' |
| 507 |
)); |
| 508 |
echo '</p></div>'; |
| 509 |
} else { |
| 510 |
echo '<div class="notice notice-success inline"><p>'; |
| 511 |
echo '✓ ' . esc_html__( 'Simple Cloudflare Turnstile plugin is installed and configured.', 'contact-forms' ); |
| 512 |
echo '</p></div>'; |
| 513 |
} |
| 514 |
} |
| 515 |
?> |
| 516 |
<p><?php esc_html_e( 'Once the Simple Cloudflare Turnstile plugin is installed and configured, you can add the Turnstile field to any form:', 'contact-forms');?></p> |
| 517 |
<ol style="max-width: 600px;"> |
| 518 |
<li><?php esc_html_e( 'Go to Forms → Edit Form', 'contact-forms');?></li> |
| 519 |
<li><?php esc_html_e( 'Find "Turnstile" in the Fields sidebar', 'contact-forms');?></li> |
| 520 |
<li><?php esc_html_e( 'Drag it into your form (typically before the Submit button)', 'contact-forms');?></li> |
| 521 |
<li><?php esc_html_e( 'Save your form', 'contact-forms');?></li> |
| 522 |
</ol> |
| 523 |
<p><?php esc_html_e( 'The Turnstile field gives you complete control over which forms use bot protection - simply add it to the forms that need it.', 'contact-forms');?></p> |
| 524 |
</div></div> |
| 525 |
|
| 526 |
<div class="postbox"> |
| 527 |
<div class="postbox-header"><h2><?php esc_html_e( 'Cap settings', 'contact-forms'); ?></h2></div> |
| 528 |
<div class="inside"> |
| 529 |
<p><?php esc_html_e( 'Used by the "Captcha (Cap)" field: the visitor ticks a checkbox and the browser solves a small proof-of-work challenge - no puzzles. Cap is an open-source, privacy-first CAPTCHA alternative that runs entirely on your own infrastructure: no data is ever sent to third parties.', 'contact-forms');?></p> |
| 530 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML with hardcoded link is intentional ?> |
| 531 |
<p><?php echo strtr(__('Deploy a Cap Standalone server (see %DOCSURL%), create a key in its dashboard, then enter the server URL and the keys below. The widget script is loaded from your Cap server, so the instance must run with ENABLE_ASSETS_SERVER=true.', 'contact-forms'), array('%DOCSURL%' => '<a href="https://capjs.js.org/guide/standalone/" target="_blank">capjs.js.org</a>'));?></p> |
| 532 |
<div id="accua_form_cap_instance_url"><?php esc_html_e('Cap server URL', 'contact-forms');?> : <input name="cap_instance_url" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['cap_instance_url']) ?>" placeholder="https://cap.example.com" /> |
| 533 |
</div> |
| 534 |
<div id="accua_form_cap_site_key"><?php esc_html_e('Site key', 'contact-forms');?> : <input name="cap_site_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['cap_site_key']) ?>" /> |
| 535 |
</div> |
| 536 |
<div id="accua_form_cap_secret_key"><?php esc_html_e('Secret key', 'contact-forms');?> : <input name="cap_secret_key" class="accua_form_value" type="text" value="<?php echo esc_attr($captcha_data['cap_secret_key']) ?>" /> |
| 537 |
</div> |
| 538 |
</div></div> |
| 539 |
|
| 540 |
<div class="postbox"> |
| 541 |
<div class="postbox-header"><h2><?php esc_html_e( 'Track actions with Google Analytics and/or Matomo', 'contact-forms'); ?></h2></div> |
| 542 |
<div class="inside"> |
| 543 |
<p> |
| 544 |
<input type="checkbox" id="accua_form_analytics_track_submit" name="analytics_track_submit" class="accua_form_value" value="1" <?php if($analytics_data['analytics_track_submit']) { echo 'checked="checked"'; } ?> /> |
| 545 |
<label for="accua_form_analytics_track_submit"><?php esc_html_e('Track submissions', 'contact-forms');?></label> |
| 546 |
</p> |
| 547 |
<p> |
| 548 |
<input type="checkbox" id="accua_form_analytics_track_fields" name="analytics_track_fields" class="accua_form_value" value="1" <?php if($analytics_data['analytics_track_fields']) { echo 'checked="checked"'; } ?> /> |
| 549 |
<label for="accua_form_analytics_track_fields"><?php esc_html_e('Track fields filled in', 'contact-forms');?></label> |
| 550 |
</p> |
| 551 |
</div></div> |
| 552 |
|
| 553 |
</div> |
| 554 |
</div><!-- /panel: integrations --> |
| 555 |
|
| 556 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="privacy"> |
| 557 |
|
| 558 |
<div class="postbox"> |
| 559 |
<div class="postbox-header"><h2><?php esc_html_e( 'IP address tracking', 'contact-forms'); ?></h2></div> |
| 560 |
<div class="inside"> |
| 561 |
<p> |
| 562 |
<?php esc_html_e("Select how many bytes of the visitor's IPs should be masked.", 'contact-forms');?> |
| 563 |
</p> |
| 564 |
<p> |
| 565 |
<input type="radio" name="anonymize_ip_bytes" id="anonymize_ip_bytes_0" value="0" <?php if($anonymize_ip_data['anonymize_ip_bytes'] == 0) { echo 'checked="checked"'; } ?> /> |
| 566 |
<label for="anonymize_ip_bytes_0"><?php esc_html_e('No mask - e.g. 192.168.1.1', 'contact-forms');?></label><br /> |
| 567 |
</p> |
| 568 |
<p> |
| 569 |
<input type="radio" name="anonymize_ip_bytes" id="anonymize_ip_bytes_1" value="1" <?php if($anonymize_ip_data['anonymize_ip_bytes'] == 1) { echo 'checked="checked"'; } ?> /> |
| 570 |
<label for="anonymize_ip_bytes_1"><?php esc_html_e('1 byte - e.g. 192.168.1.xxx', 'contact-forms');?></label><br /> |
| 571 |
</p> |
| 572 |
<p> |
| 573 |
<input type="radio" name="anonymize_ip_bytes" id="anonymize_ip_bytes_2" value="2" <?php if($anonymize_ip_data['anonymize_ip_bytes'] == 2) { echo 'checked="checked"'; } ?> /> |
| 574 |
<label for="anonymize_ip_bytes_2"><?php esc_html_e('2 byte - e.g. 192.168.xxx.xxx', 'contact-forms');?></label><br /> |
| 575 |
</p> |
| 576 |
<p> |
| 577 |
<input type="radio" name="anonymize_ip_bytes" id="anonymize_ip_bytes_3" value="3" <?php if($anonymize_ip_data['anonymize_ip_bytes'] == 3) { echo 'checked="checked"'; } ?> /> |
| 578 |
<label for="anonymize_ip_bytes_3"><?php esc_html_e('3 byte - e.g. 192.xxx.xxx.xxx', 'contact-forms');?></label><br /> |
| 579 |
</p> |
| 580 |
<p> |
| 581 |
<input type="radio" name="anonymize_ip_bytes" id="anonymize_ip_bytes_4" value="4" <?php if($anonymize_ip_data['anonymize_ip_bytes'] == 4) { echo 'checked="checked"'; } ?> /> |
| 582 |
<label for="anonymize_ip_bytes_4"><?php esc_html_e('Fully mask IP address', 'contact-forms');?></label><br /> |
| 583 |
</p> |
| 584 |
<h4><?php esc_html_e( 'Delete IP addresses', 'contact-forms'); ?></h4> |
| 585 |
<p> |
| 586 |
<input type="checkbox" id="delete_previous_ip_values" name="delete_previous_ip_values" class="accua_form_value" value="1" /> |
| 587 |
<label for="delete_previous_ip_values"><?php esc_html_e('Delete all previous IP values', 'contact-forms');?></label><br /> |
| 588 |
</p> |
| 589 |
</div></div> |
| 590 |
|
| 591 |
<div class="postbox"> |
| 592 |
<div class="postbox-header"><h2><?php esc_html_e( 'Data retention', 'contact-forms'); ?></h2></div> |
| 593 |
<div class="inside"> |
| 594 |
<p><?php esc_html_e( 'Automatically anonymize or delete form submissions after a specified period. Set to 0 to keep submissions indefinitely.', 'contact-forms'); ?></p> |
| 595 |
<p> |
| 596 |
<label for="retention_value"><?php esc_html_e( 'Retention period', 'contact-forms'); ?></label> |
| 597 |
<input type="number" id="retention_value" name="retention_value" min="0" step="1" value="<?php echo esc_attr( $retention_data['retention_value'] ); ?>" style="width: 80px;" /> |
| 598 |
<select name="retention_unit" id="retention_unit"> |
| 599 |
<option value="days" <?php selected( $retention_data['retention_unit'], 'days' ); ?>><?php esc_html_e( 'days', 'contact-forms'); ?></option> |
| 600 |
<option value="months" <?php selected( $retention_data['retention_unit'], 'months' ); ?>><?php esc_html_e( 'months', 'contact-forms'); ?></option> |
| 601 |
<option value="years" <?php selected( $retention_data['retention_unit'], 'years' ); ?>><?php esc_html_e( 'years', 'contact-forms'); ?></option> |
| 602 |
</select> |
| 603 |
</p> |
| 604 |
<p> |
| 605 |
<strong><?php esc_html_e( 'When submissions expire:', 'contact-forms'); ?></strong><br /> |
| 606 |
<input type="radio" name="retention_mode" id="retention_mode_anonymize" value="anonymize" <?php checked( $retention_data['retention_mode'], 'anonymize' ); ?> /> |
| 607 |
<label for="retention_mode_anonymize"><?php esc_html_e( 'Anonymize: replace personal data with placeholders, keep submission record for statistics', 'contact-forms'); ?></label><br /> |
| 608 |
<input type="radio" name="retention_mode" id="retention_mode_delete" value="delete" <?php checked( $retention_data['retention_mode'], 'delete' ); ?> /> |
| 609 |
<label for="retention_mode_delete"><?php esc_html_e( 'Delete: permanently remove submission records from the database', 'contact-forms'); ?></label> |
| 610 |
</p> |
| 611 |
<p class="description"><?php esc_html_e( 'Individual forms can override this setting in the form editor.', 'contact-forms'); ?></p> |
| 612 |
<p class="description"><?php |
| 613 |
/* translators: %s: URL to the WordPress Erase Personal Data tool */ |
| 614 |
printf( esc_html__( 'To manually erase data for a specific person, use the WordPress %s tool.', 'contact-forms'), |
| 615 |
'<a href="' . esc_url( admin_url( 'erase-personal-data.php' ) ) . '">' . esc_html__( 'Erase Personal Data', 'contact-forms') . '</a>' |
| 616 |
); |
| 617 |
?></p> |
| 618 |
</div></div> |
| 619 |
|
| 620 |
</div><!-- /panel: privacy --> |
| 621 |
|
| 622 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="styling"> |
| 623 |
<div class="accua-settings-grid"> |
| 624 |
|
| 625 |
<div class="postbox"> |
| 626 |
<div class="postbox-header"><h2><?php esc_html_e( 'Form Container', 'contact-forms'); ?></h2></div> |
| 627 |
<div class="inside"> |
| 628 |
<table class="form-table" role="presentation"> |
| 629 |
<tr> |
| 630 |
<th scope="row"><label for="accua_form_layout_select"><?php esc_html_e( 'Layout', 'contact-forms'); ?></label></th> |
| 631 |
<td> |
| 632 |
<select id="accua_form_layout_select" name="layout" class="accua_form_value"> |
| 633 |
<option value="sidebyside" <?php selected( 'sidebyside', $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'sidebyside' ) ); ?></option> |
| 634 |
<option value="toplabel" <?php selected( 'toplabel', $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'toplabel' ) ); ?></option> |
| 635 |
<option value="inlinelabel" <?php selected( 'inlinelabel', $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'inlinelabel' ) ); ?></option> |
| 636 |
</select> |
| 637 |
<p class="description"><?php esc_html_e( 'With "Labels on the left", labels move above the fields automatically when the form container is narrower than 500px.', 'contact-forms' ); ?></p> |
| 638 |
</td> |
| 639 |
</tr> |
| 640 |
<tr> |
| 641 |
<th scope="row"><label for="accua_style_margin"><?php esc_html_e( 'Margin', 'contact-forms'); ?></label></th> |
| 642 |
<td><input id="accua_style_margin" name="style_margin" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['style_margin']) ?>" /></td> |
| 643 |
</tr> |
| 644 |
<tr> |
| 645 |
<th scope="row"><label for="accua_style_border_color"><?php esc_html_e( 'Border color', 'contact-forms'); ?></label></th> |
| 646 |
<td><input id="accua_style_border_color" name="style_border_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_border_color']) ?>" /></td> |
| 647 |
</tr> |
| 648 |
<tr> |
| 649 |
<th scope="row"><label for="accua_style_border_width"><?php esc_html_e( 'Border width', 'contact-forms'); ?></label></th> |
| 650 |
<td><input id="accua_style_border_width" name="style_border_width" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_border_width']) ?>" /></td> |
| 651 |
</tr> |
| 652 |
<tr> |
| 653 |
<th scope="row"><label for="accua_style_border_radius"><?php esc_html_e( 'Rounded corner radius', 'contact-forms'); ?></label></th> |
| 654 |
<td><input id="accua_style_border_radius" name="style_border_radius" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_border_radius']) ?>" /></td> |
| 655 |
</tr> |
| 656 |
<tr> |
| 657 |
<th scope="row"><label for="accua_style_background_color"><?php esc_html_e( 'Background color', 'contact-forms'); ?></label></th> |
| 658 |
<td><input id="accua_style_background_color" name="style_background_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_background_color']) ?>" /></td> |
| 659 |
</tr> |
| 660 |
<tr> |
| 661 |
<th scope="row"><label for="accua_style_padding"><?php esc_html_e( 'Padding', 'contact-forms'); ?></label></th> |
| 662 |
<td><input id="accua_style_padding" name="style_padding" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['style_padding']) ?>" /></td> |
| 663 |
</tr> |
| 664 |
<tr> |
| 665 |
<th scope="row"><label for="accua_style_color"><?php esc_html_e( 'Text color', 'contact-forms'); ?></label></th> |
| 666 |
<td><input id="accua_style_color" name="style_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_color']) ?>" /></td> |
| 667 |
</tr> |
| 668 |
<tr> |
| 669 |
<th scope="row"><label for="accua_style_font_size"><?php esc_html_e( 'Font size', 'contact-forms'); ?></label></th> |
| 670 |
<td><input id="accua_style_font_size" name="style_font_size" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_font_size']) ?>" /></td> |
| 671 |
</tr> |
| 672 |
</table> |
| 673 |
</div></div> |
| 674 |
|
| 675 |
<div class="postbox"> |
| 676 |
<div class="postbox-header"><h2><?php esc_html_e( 'Fields', 'contact-forms'); ?></h2></div> |
| 677 |
<div class="inside"> |
| 678 |
<table class="form-table" role="presentation"> |
| 679 |
<tr> |
| 680 |
<th scope="row"><label for="accua_style_field_spacing"><?php esc_html_e( 'Spacing', 'contact-forms'); ?></label></th> |
| 681 |
<td><input id="accua_style_field_spacing" name="style_field_spacing" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_field_spacing']) ?>" /></td> |
| 682 |
</tr> |
| 683 |
<tr> |
| 684 |
<th scope="row"><label for="accua_style_field_border_color"><?php esc_html_e( 'Border color', 'contact-forms'); ?></label></th> |
| 685 |
<td><input id="accua_style_field_border_color" name="style_field_border_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_field_border_color']) ?>" /></td> |
| 686 |
</tr> |
| 687 |
<tr> |
| 688 |
<th scope="row"><label for="accua_style_field_border_width"><?php esc_html_e( 'Border width', 'contact-forms'); ?></label></th> |
| 689 |
<td><input id="accua_style_field_border_width" name="style_field_border_width" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_field_border_width']) ?>" /></td> |
| 690 |
</tr> |
| 691 |
<tr> |
| 692 |
<th scope="row"><label for="accua_style_field_border_radius"><?php esc_html_e( 'Rounded corner radius', 'contact-forms'); ?></label></th> |
| 693 |
<td><input id="accua_style_field_border_radius" name="style_field_border_radius" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_field_border_radius']) ?>" /></td> |
| 694 |
</tr> |
| 695 |
<tr> |
| 696 |
<th scope="row"><label for="accua_style_field_background_color"><?php esc_html_e( 'Background color', 'contact-forms'); ?></label></th> |
| 697 |
<td><input id="accua_style_field_background_color" name="style_field_background_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_field_background_color']) ?>" /></td> |
| 698 |
</tr> |
| 699 |
<tr> |
| 700 |
<th scope="row"><label for="accua_style_field_padding"><?php esc_html_e( 'Padding', 'contact-forms'); ?></label></th> |
| 701 |
<td><input id="accua_style_field_padding" name="style_field_padding" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['style_field_padding']) ?>" /></td> |
| 702 |
</tr> |
| 703 |
<tr> |
| 704 |
<th scope="row"><label for="accua_style_field_color"><?php esc_html_e( 'Text color', 'contact-forms'); ?></label></th> |
| 705 |
<td><input id="accua_style_field_color" name="style_field_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_field_color']) ?>" /></td> |
| 706 |
</tr> |
| 707 |
</table> |
| 708 |
</div></div> |
| 709 |
|
| 710 |
<div class="postbox"> |
| 711 |
<div class="postbox-header"><h2><?php esc_html_e( 'Submit Button', 'contact-forms'); ?></h2></div> |
| 712 |
<div class="inside"> |
| 713 |
<table class="form-table" role="presentation"> |
| 714 |
<tr> |
| 715 |
<th scope="row"><label for="accua_style_submit_border_color"><?php esc_html_e( 'Border color', 'contact-forms'); ?></label></th> |
| 716 |
<td><input id="accua_style_submit_border_color" name="style_submit_border_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_submit_border_color']) ?>" /></td> |
| 717 |
</tr> |
| 718 |
<tr> |
| 719 |
<th scope="row"><label for="accua_style_submit_border_width"><?php esc_html_e( 'Border width', 'contact-forms'); ?></label></th> |
| 720 |
<td><input id="accua_style_submit_border_width" name="style_submit_border_width" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_submit_border_width']) ?>" /></td> |
| 721 |
</tr> |
| 722 |
<tr> |
| 723 |
<th scope="row"><label for="accua_style_submit_border_radius"><?php esc_html_e( 'Rounded corner radius', 'contact-forms'); ?></label></th> |
| 724 |
<td><input id="accua_style_submit_border_radius" name="style_submit_border_radius" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_submit_border_radius']) ?>" /></td> |
| 725 |
</tr> |
| 726 |
<tr> |
| 727 |
<th scope="row"><label for="accua_style_submit_background_color"><?php esc_html_e( 'Background color', 'contact-forms'); ?></label></th> |
| 728 |
<td><input id="accua_style_submit_background_color" name="style_submit_background_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_submit_background_color']) ?>" /></td> |
| 729 |
</tr> |
| 730 |
<tr> |
| 731 |
<th scope="row"><label for="accua_style_submit_padding"><?php esc_html_e( 'Padding', 'contact-forms'); ?></label></th> |
| 732 |
<td><input id="accua_style_submit_padding" name="style_submit_padding" class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['style_submit_padding']) ?>" /></td> |
| 733 |
</tr> |
| 734 |
<tr> |
| 735 |
<th scope="row"><label for="accua_style_submit_color"><?php esc_html_e( 'Text color', 'contact-forms'); ?></label></th> |
| 736 |
<td><input id="accua_style_submit_color" name="style_submit_color" class="accua_form_value accua-color-picker" type="text" value="<?php echo esc_attr($form_data['style_submit_color']) ?>" /></td> |
| 737 |
</tr> |
| 738 |
<tr> |
| 739 |
<th scope="row"><label for="accua_style_submit_font_size"><?php esc_html_e( 'Font size', 'contact-forms'); ?></label></th> |
| 740 |
<td><input id="accua_style_submit_font_size" name="style_submit_font_size" class="accua_form_value small-text" type="text" value="<?php echo esc_attr($form_data['style_submit_font_size']) ?>" /></td> |
| 741 |
</tr> |
| 742 |
</table> |
| 743 |
</div></div> |
| 744 |
|
| 745 |
</div> |
| 746 |
</div><!-- /panel: styling --> |
| 747 |
|
| 748 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="other"> |
| 749 |
|
| 750 |
<div class="postbox"> |
| 751 |
<div class="postbox-header"><h2><?php esc_html_e( 'Auto mark as spam', 'contact-forms'); ?></h2></div> |
| 752 |
<div class="inside"> |
| 753 |
<p><?php esc_html_e( 'Submissions carrying one of these email addresses are always treated as spam, on every form, whatever the captcha of that form decided. A captcha can tell how a form was filled in, not who filled it in, so a sender you already know is unwanted gets through it.', 'contact-forms'); ?></p> |
| 754 |
<p> |
| 755 |
<label for="accua_forms_email_blocklist"><strong><?php esc_html_e( 'Blocked email addresses', 'contact-forms'); ?></strong></label><br /> |
| 756 |
<textarea id="accua_forms_email_blocklist" name="email_blocklist" class="widefat code" rows="8" spellcheck="false" aria-describedby="accua_forms_email_blocklist_help"><?php |
| 757 |
echo esc_textarea( $spam_data['email_blocklist'] ); |
| 758 |
?></textarea> |
| 759 |
</p> |
| 760 |
<div id="accua_forms_email_blocklist_help"> |
| 761 |
<p class="description"><?php esc_html_e( 'One entry per line. Leave empty to switch the check off.', 'contact-forms'); ?></p> |
| 762 |
<ul class="description" style="list-style: disc; margin-left: 2em;"> |
| 763 |
<li><code>spammer@example.com</code>: <?php esc_html_e( 'that exact address.', 'contact-forms'); ?></li> |
| 764 |
<li><code>*@spammydomain.net</code>: <?php esc_html_e( 'every address at that domain. Writing just the domain, with or without the @, means the same thing.', 'contact-forms'); ?></li> |
| 765 |
<li><code>*@*.spammydomain.net</code>: <?php esc_html_e( 'its subdomains, which the previous line does not cover.', 'contact-forms'); ?></li> |
| 766 |
<li><code>info*@example.com</code>: <?php |
| 767 |
/* translators: 1: the * wildcard character, 2: the ? wildcard character */ |
| 768 |
printf( esc_html__( 'wildcards work anywhere in the entry: %1$s stands for any number of characters, %2$s for exactly one.', 'contact-forms'), '<code>*</code>', '<code>?</code>' ); |
| 769 |
?></li> |
| 770 |
<li><code># <?php esc_html_e( 'a note about the lines below', 'contact-forms'); ?></code>: <?php esc_html_e( 'a line starting with # is a comment and is kept as you write it.', 'contact-forms'); ?></li> |
| 771 |
</ul> |
| 772 |
<p class="description"><?php esc_html_e( 'Addresses are matched without regard to upper and lower case, in every Email and Autoreply Email field of the form.', 'contact-forms'); ?></p> |
| 773 |
<p class="description"><?php esc_html_e( 'A matching submission is accepted silently: the visitor sees the usual success message, the submission is stored with the Spam status, and no notification or autoreply email is sent. You will find it under Spam in the submissions list, where "Not spam" restores it. Nothing already stored is reclassified: the list applies to submissions received from now on.', 'contact-forms'); ?></p> |
| 774 |
<p class="description"><?php esc_html_e( 'This is also the simplest way to see the spam handling at work: put an address you can send from on the list, submit one of your forms with it, and watch the submission arrive under Spam with no email sent.', 'contact-forms'); ?></p> |
| 775 |
</div> |
| 776 |
</div></div> |
| 777 |
|
| 778 |
</div><!-- /panel: other --> |
| 779 |
|
| 780 |
<?php if ( current_user_can( 'manage_options' ) ) : ?> |
| 781 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="danger_zone"> |
| 782 |
|
| 783 |
<div class="postbox accua-danger-zone"> |
| 784 |
<div class="postbox-header"><h2><?php esc_html_e( 'Anonymize old submissions', 'contact-forms' ); ?></h2></div> |
| 785 |
<div class="inside"> |
| 786 |
<p class="description"><?php esc_html_e( 'Anonymize all submissions older than the specified period, across all forms. This replaces personal data with placeholders and sets IP to 0.0.0.0. This cannot be undone.', 'contact-forms' ); ?></p> |
| 787 |
<p> |
| 788 |
<input type="number" id="accua_danger_anon_value" min="1" step="1" value="12" style="width: 80px;" /> |
| 789 |
<select id="accua_danger_anon_unit" style="vertical-align: baseline;"> |
| 790 |
<option value="days"><?php esc_html_e( 'days', 'contact-forms' ); ?></option> |
| 791 |
<option value="months" selected><?php esc_html_e( 'months', 'contact-forms' ); ?></option> |
| 792 |
<option value="years"><?php esc_html_e( 'years', 'contact-forms' ); ?></option> |
| 793 |
</select> |
| 794 |
<button type="button" id="accua_danger_anon_btn" class="button" style="color: #d63638; border-color: #d63638;"><?php esc_html_e( 'Anonymize submissions', 'contact-forms' ); ?></button> |
| 795 |
</p> |
| 796 |
<div id="accua_danger_anon_result" style="display:none;"></div> |
| 797 |
</div></div> |
| 798 |
|
| 799 |
<div class="postbox accua-danger-zone"> |
| 800 |
<div class="postbox-header"><h2><?php esc_html_e( 'Delete all Contact Forms data', 'contact-forms' ); ?></h2></div> |
| 801 |
<div class="inside"> |
| 802 |
<p class="description"><?php esc_html_e( 'Permanently delete ALL Contact Forms settings, forms, submissions, and uploaded files. The plugin will remain installed but completely reset. Make a full backup before proceeding.', 'contact-forms' ); ?></p> |
| 803 |
<p> |
| 804 |
<button type="button" id="accua_danger_delete_btn" class="button" style="color: #d63638; border-color: #d63638;"><?php esc_html_e( 'Delete all data', 'contact-forms' ); ?></button> |
| 805 |
</p> |
| 806 |
<div id="accua_danger_delete_result" style="display:none;"></div> |
| 807 |
</div></div> |
| 808 |
|
| 809 |
<div class="postbox accua-danger-zone"> |
| 810 |
<div class="postbox-header"><h2><?php esc_html_e( 'When the plugin is deleted', 'contact-forms' ); ?></h2></div> |
| 811 |
<div class="inside"> |
| 812 |
<p class="description"><?php esc_html_e( 'Deleting Contact Forms from the Plugins screen normally leaves your data in the database, so reinstalling the plugin brings your forms and submissions back. Tick this box to have everything deleted instead.', 'contact-forms' ); ?></p> |
| 813 |
<p> |
| 814 |
<label for="accua_delete_data_on_uninstall"> |
| 815 |
<input type="checkbox" id="accua_delete_data_on_uninstall" name="delete_data_on_uninstall" class="accua_form_value" value="1" <?php checked( $delete_on_uninstall ); ?> /> |
| 816 |
<?php esc_html_e( 'Delete all Contact Forms data when the plugin is deleted', 'contact-forms' ); ?> |
| 817 |
</label> |
| 818 |
</p> |
| 819 |
<p class="description"><?php esc_html_e( 'This deletes every form, submission, uploaded file and setting the moment the plugin is deleted. There is no confirmation at that point and no way to undo it. Save the settings to apply your choice.', 'contact-forms' ); ?></p> |
| 820 |
</div></div> |
| 821 |
|
| 822 |
</div><!-- /panel: danger_zone --> |
| 823 |
<?php endif; ?> |
| 824 |
|
| 825 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="tokens"> |
| 826 |
<?php accua_forms_print_tokens(); ?> |
| 827 |
</div><!-- /panel: tokens --> |
| 828 |
|
| 829 |
<div class="accua-tabs__panel" role="tabpanel" data-tab="theme_helper"> |
| 830 |
<?php accua_forms_theme_helper_content(); ?> |
| 831 |
</div><!-- /panel: theme_helper --> |
| 832 |
|
| 833 |
</div><!-- /accua_settings_tabs --> |
| 834 |
|
| 835 |
<?php /* |
| 836 |
<h3><?php _e( 'File upload default settings', 'contact-forms'); ?></h3> |
| 837 |
<p id="accua_form_valid_extensions"><?php _e( 'Valid extensions', 'contact-forms'); ?> <br /><textarea name="valid_extensions" class="accua_form_value" style="width:95%"; cols="80" rows="8"><?php echo htmlspecialchars($file_data['valid_extensions'], ENT_QUOTES) ?></textarea> |
| 838 |
<small><?php _e( 'List of valid extensions, without dot, one per line.', 'contact-forms'); ?></small> |
| 839 |
</p> |
| 840 |
<p id="accua_form_max_size"><?php _e( 'Maximum file size:', 'contact-forms'); ?> <input name="max_size" class="accua_form_value" type="text" value="<?php echo htmlspecialchars($file_data['max_size'], ENT_QUOTES) ?>" /><br /> |
| 841 |
<small><?php _e( 'You can use suffix K, M or G for kilobyte, megabyte or gigabyte.', 'contact-forms'); ?> |
| 842 |
<?php |
| 843 |
$server_max_size = AccuaForm_Element_File::file_upload_max_size(); |
| 844 |
if ($server_max_size > 0) { |
| 845 |
_e( 'This value is limited by server upload limits of ', 'contact-forms'); |
| 846 |
echo AccuaForm_Element_File::format_size($server_max_size).". "; |
| 847 |
_e( 'If you need a greater limit you should ask to the server administrator.', 'contact-forms'); |
| 848 |
} |
| 849 |
?> |
| 850 |
</small></p> |
| 851 |
<p id="accua_form_dest_path"><?php _e( 'Upload path', 'contact-forms');?> : <input name="dest_path" class="accua_form_value" type="text" value="<?php echo htmlspecialchars($file_data['dest_path'], ENT_QUOTES) ?>" /> |
| 852 |
<small><?php _e( 'If it stars with \'/\' an absolute path is used, otherwise a path relative to the WordPress installation directory. Default value is "wp-content/uploads/accua-forms"', 'contact-forms');?>.</small> |
| 853 |
</p> */ ?> |
| 854 |
<p><input class="button button-primary button-large" id="accua_form_save_settings" type="submit" value="Save settings" /></p> |
| 855 |
|
| 856 |
</form> |
| 857 |
|
| 858 |
<span id="accua-forms-version"><?php |
| 859 |
$plugin_data = get_plugin_data( ACCUA_FORMS_FILE ); |
| 860 |
echo esc_html( $plugin_data['Name'] ); ?> - <a href="https://www.cimatti.it/en/wordpress-plugins/contact-forms/"><?php |
| 861 |
esc_html_e('Version', 'contact-forms'); echo ' ' . esc_html( $plugin_data['Version'] ); ?></a></span> |
| 862 |
|
| 863 |
</div> |
| 864 |
|
| 865 |
<?php |
| 866 |
} |
| 867 |
|