PluginProbe
Contact Forms by Cimatti / trunk
Contact Forms by Cimatti vtrunk
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / admin / form-editor.php

form-editor.php in Contact Forms by Cimatti trunk, at admin/form-editor.php

978 lines 63.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 require_once __DIR__ . '/list-page.php';
5
6 function accua_forms_edit_page_head_scripts() {
7 wp_enqueue_style('wp-color-picker');
8 wp_enqueue_script('wp-color-picker', '', array(), ACCUA_FORMS_JS_VERSION, true );
9
10 wp_enqueue_script( 'accua-form-fields', plugins_url( 'assets/js/admin/form-fields.js' , ACCUA_FORMS_FILE ), array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), ACCUA_FORMS_JS_VERSION, true );
11 wp_enqueue_script( 'accua-form-settings', plugins_url('assets/js/admin/form-settings.js', ACCUA_FORMS_FILE), array('jquery', 'wp-color-picker', 'jquery-ui-resizable'), ACCUA_FORMS_JS_VERSION, true );
12 }
13
14 /**
15 * Enqueue deactivation modal script on the Plugins page.
16 */
17
18 function accua_forms_edit_page_head() {
19 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Detection only, actual action processing in _accua_forms_form_edit_action() has nonce check
20 if (isset($_POST['accua-form-edit-action']) || (!isset($_GET['fid']))) {
21 _accua_forms_form_edit_action();
22 accua_forms_list_page_table(true);
23 }
24
25 ?>
26 <style type="text/css">
27 .container > div {
28 padding: 0px;
29 margin-bottom: 6px;
30 }
31 .widget-liquid-right .widget, #wp_inactive_widgets .widget, .widget-liquid-right .sidebar-description, .widget-placeholder {
32 width: 95%;
33 }
34 </style>
35 <?php
36 }
37
38 add_action( 'wp_ajax_accua-form-fields-order' , 'accua_forms_form_fields_order');
39
40 function accua_forms_add_page($message='') {
41 $forms_data = get_option('accua_forms_saved_forms', array());
42 $trash_data = get_option('accua_forms_trash_forms', array());
43 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form ID, parent function accua_forms_list_page() checks nonce
44 if (!empty($_GET['fid'])) {
45 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form ID
46 $fid = absint(wp_unslash($_GET['fid']));
47 } else {
48 if ($message === '') {
49 $fid = 1 + ((int) get_option('accua_forms_lastid', 0));
50 while (isset($forms_data[$fid]) || isset($trash_data[$fid])) {
51 $fid++;
52 }
53 update_option('accua_forms_lastid', $fid);
54 $message = _accua_forms_test_clonefrom($fid);
55 if ($message === '') {
56 return accua_forms_edit_page($fid);
57 }
58 } else {
59 $fid = '';
60 }
61 }
62 if (!empty($_GET['clonefrom'])) {
63 check_admin_referer('clone_posts');
64 $clonefrom = sanitize_text_field( wp_unslash( $_GET['clonefrom'] ) );
65 } else {
66 $clonefrom = '';
67 }
68 ?>
69
70 <div id="accua_forms_add_page" class="accua_forms_admin_page wrap">
71 <h1><?php esc_html_e( 'Create a form', 'contact-forms'); ?></h1>
72 <?php if ($message !== '') {
73 echo "<div style='border:1px solid; padding: 10px;'>".esc_html($message)."</div>";
74 } ?>
75 <form action="admin.php" method="GET">
76 <?php wp_nonce_field('edit_posts', '_wpnonce', false, true) ?>
77 <input type="hidden" name="page" value="accua_forms_list" />
78 <p>Form id: <input type="text" name="fid" value="<?php echo esc_attr($fid); ?>" /></p>
79 <?php
80 if ($forms_data) {
81 echo '<p><select name="clonefrom">
82 <option value="">'.esc_html__( 'Empty form', 'contact-forms').'</option>
83 <optgroup label="'.esc_attr__( 'Clone form:', 'contact-forms').'">';
84 foreach ($forms_data as $i => $formdata) {
85 $sel = ( $i === $clonefrom ) ? ' selected="selected"' : '';
86 $i_esc = esc_attr($i);
87 if (isset($formdata['title']) && ('' !== trim($formdata['title']))) {
88 $formtitle = esc_html($formdata['title']);
89 } else {
90 $formtitle = $i_esc;
91 }
92 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $sel is a static string, other vars pre-escaped
93 echo '<option value="' . esc_attr( $i_esc ) . '"' . $sel . '>' . esc_html( $formtitle ) . "</option>\n";
94 }
95 echo '</optgroup></select></p>';
96 }
97 ?>
98 <p><input type="submit" value="<?php esc_attr_e( 'Create', 'contact-forms'); ?>" /></p>
99 </form>
100 </div>
101 <?php
102 }
103
104 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Internal helper function, underscore prefix indicates private
105 function _accua_forms_test_clonefrom($fid){
106 $error = '';
107 if (isset($_GET['clonefrom'])&&$_GET['clonefrom']!=='') {
108 // Verify nonce for clone operation to prevent CSRF attacks
109 // Check for both possible nonce actions depending on the entry point
110 $nonce_valid = false;
111 if (isset($_GET['_wpnonce'])) {
112 $nonce = sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) );
113 // First try clone_posts nonce (from accua_forms_add page)
114 if (wp_verify_nonce($nonce, 'clone_posts')) {
115 $nonce_valid = true;
116 }
117 // Then try edit_posts nonce (from accua_forms_list page)
118 elseif (wp_verify_nonce($nonce, 'edit_posts')) {
119 $nonce_valid = true;
120 }
121 }
122
123 if (!$nonce_valid) {
124 wp_die(esc_html__('Security check failed. Please try again.', 'contact-forms'), esc_html__('Security Error', 'contact-forms'), array('response' => 403));
125 }
126
127 $clonefrom = sanitize_text_field( wp_unslash( $_GET['clonefrom'] ) );
128 $forms_data = get_option('accua_forms_saved_forms', array());
129 if (isset($forms_data[$fid])){
130 $error .= '<p>' . esc_html__( 'Form already exists', 'contact-forms') . '</p>';
131 } elseif (empty($forms_data[$clonefrom])) {
132 $error .= '<p>' . esc_html__( 'Source form doesn\'t exists.', 'contact-forms') . '</p>';
133 } else {
134 $forms_data[$fid] = $forms_data[$clonefrom];
135 if (!isset($forms_data[$fid]['title'])) {
136 $forms_data[$fid]['title'] = $clonefrom ." ".__( 'clone', 'contact-forms');
137 } else {
138 $forms_data[$fid]['title'] .= " ". __( 'clone', 'contact-forms');
139 }
140 update_option('accua_forms_saved_forms', $forms_data);
141 }
142 }
143 return $error;
144 }
145
146 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Internal helper function, underscore prefix indicates private
147 function _accua_forms_form_edit_action() {
148 static $message = null;
149 if ($message === null) {
150 $message = '';
151 if (isset($_POST['accua-form-edit-action'])){
152 $post = stripslashes_deep($_POST);
153 switch ($post['accua-form-edit-action']) {
154 case 'delete':
155 $fid = isset($post['form-id']) ? $post['form-id'] : '';
156 check_admin_referer('contact-forms-delete_'.$fid);
157 $forms_data = get_option('accua_forms_saved_forms', array());
158 unset($forms_data[$fid]);
159 update_option('accua_forms_saved_forms', $forms_data);
160 $fid = esc_html($fid);
161 // translators: %s is the form ID being deleted
162 $message .= sprintf( __( 'Form "%s" deleted','contact-forms' ), $fid );
163 break;
164 }
165 }
166 }
167 return $message;
168 }
169
170 function accua_forms_validate_form_id($fid) {
171 // Cast before the string checks below: a request that omits form-id
172 // reaches here with null, and preg_match()/substr()/strlen() have
173 // deprecated null arguments since PHP 8.1. An empty id fails the
174 // pattern check anyway, which is the answer the callers want.
175 $fid = (string) $fid;
176 $error = '';
177 if (!preg_match('/^[a-z0-9_-]+$/i', $fid)) {
178 $error .= "<p>".__( 'Only letters, numbers, hyphens, and underscores allowed in form identifier', 'contact-forms')."</p>";
179 }
180 if (substr($fid,0,2) == '__') {
181 $error .= "<p>".__( 'The identifier cannot start with two underscores (__)', 'contact-forms')."</p>";
182 }
183 if (strlen($fid) > 70) {
184 $error .= "<p>".__( 'The identifier cannot be longer than 70 characters', 'contact-forms')."</p>";
185 }
186 return $error;
187 }
188
189 function accua_forms_list_page() {
190 $message = '';
191 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verified below
192 if (isset($_POST['accua-form-edit-action'])){
193 $message = _accua_forms_form_edit_action();
194 } elseif (isset($_GET['fid'])) {
195 check_admin_referer('edit_posts');
196 $fid = sanitize_text_field(wp_unslash($_GET['fid']));
197 $error = accua_forms_validate_form_id($fid);
198 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified above
199 if ($error === '' && (isset($_GET['clonefrom']) && $_GET['clonefrom'] !== '')) {
200 $error .= _accua_forms_test_clonefrom($fid);
201 }
202 if ($error === '') {
203 return accua_forms_edit_page($fid);
204 } else {
205 return accua_forms_add_page($error);
206 }
207 }
208 ?>
209 <div id="accua_forms_list_page" class="accua_forms_admin_page wrap">
210 <?php if ($message !== '') {
211 echo "<div style='border:1px solid; padding: 10px;'>".esc_html($message)."</div>";
212 } ?>
213 <h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms', 'contact-forms'); ?></h1>
214 <a class="page-title-action" href="<?php echo esc_url( get_admin_url() ); ?>admin.php?page=accua_forms_add"><?php esc_html_e('Add New','contact-forms'); ?></a>
215 <hr class="wp-header-end">
216 <p><?php esc_html_e( 'Use the shortcode or block to include forms in posts, pages or other content types.', 'contact-forms'); ?></p>
217 <?php
218 accua_forms_list_page_table();
219 ?>
220 </div>
221 <?php
222 }
223
224 function accua_forms_edit_page($fid) {
225 global $wpdb;
226
227 // Initialize draft for this form (creates from published data if no draft exists)
228 _accua_forms_init_draft($fid);
229
230 wp_enqueue_script('contact_forms_tabs', plugins_url('assets/js/admin/tabs.js', ACCUA_FORMS_FILE ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION, true );
231 wp_enqueue_script('accua_verify_gads_conversion_code', plugins_url('assets/js/admin/verify-gads-conversion.js', ACCUA_FORMS_FILE ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION, true );
232
233 $avail_fields = get_option('accua_forms_avail_fields', array());
234 $default_form_data = get_option('accua_forms_default_form_data', array()) + accua_forms_get_default_form_data();
235
236 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form restore flag, parent function checks nonce
237 $form_data = _accua_forms_get_form_data($fid, true, !empty($_GET['restore']));
238 $form_overrided_data = $form_data['_overrided'];
239
240 // Check if any field currently in the form is a custom submit button
241 $has_custom_submit = false;
242 foreach ( $form_data['fields'] as $field ) {
243 $ref = $field['ref'] ?? '';
244 if ( ! empty( $avail_fields[ $ref ] ) && ( $avail_fields[ $ref ]['type'] ?? '' ) === 'submit' ) {
245 $has_custom_submit = true;
246 break;
247 }
248 }
249 $default_submit_hidden = $has_custom_submit ? 'style="display:none"' : '';
250
251 $fid_esc = esc_attr($fid);
252
253 $adminurl = admin_url();
254
255 global $wp_version;
256 if (version_compare($wp_version, '4') >= 0) {
257 ?>
258 <style>
259 #widgets-right .accua-form-widget-scroll-wrapper .widget.ui-draggable {
260 height: auto !important;
261 }
262 #accua-default-submit-widget .widget-top {
263 cursor: default;
264 background: #dcdcde;
265 }
266 #accua-default-submit-widget .widget-inside .widget-content {
267 font-size: 14px;
268 line-height: 1.6;
269 padding: 4px 10px 10px;
270 color: #3c434a;
271 }
272 </style>
273 <?php
274 }
275
276 ?>
277 <div id="accua_forms_edit_page" class="accua_forms_admin_page wrap">
278 <h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms - Edit Form', 'contact-forms' ); ?></h1>
279 <?php
280 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table, lightweight count query
281 $submission_count = (int) $wpdb->get_var( $wpdb->prepare(
282 "SELECT COUNT(*) FROM `{$wpdb->prefix}accua_forms_submissions` WHERE afs_form_id = %s AND afs_status >= 0",
283 $fid
284 ) );
285 $submissions_url = admin_url( 'admin.php?page=accua_forms_submissions_list&fid=' . urlencode( $fid ) );
286 printf(
287 '<a class="page-title-action" href="%s">%s (%s)</a>',
288 esc_url( $submissions_url ),
289 esc_html__( 'Submissions', 'contact-forms' ),
290 esc_html( number_format_i18n( $submission_count ) )
291 );
292 ?>
293 <hr class="wp-header-end">
294 <?php wp_nonce_field('edit_form', '_nonce_edit_form'); ?>
295 <div id="titlediv">
296 <div id="titlewrap">
297 <input id="title" type="text" autocomplete="off" value="<?php echo esc_attr($form_data['title']) ?>" size="30" name="post_title" placeholder="<?php esc_attr_e( 'Enter title here', 'contact-forms' ); ?>">
298 </div>
299 </div>
300 <div id="accua_tabs" class="accua-tabs accua-tabs--primary" data-default-tab="fields">
301 <div class="accua-tabs__header">
302 <div class="accua-tabs__tablist" role="tablist" aria-label="<?php esc_attr_e( 'Form editor', 'contact-forms' ); ?>">
303 <button class="accua-tabs__tab" role="tab" data-tab="fields"><?php esc_html_e( 'Fields', 'contact-forms' ); ?></button>
304 <button class="accua-tabs__tab" role="tab" data-tab="customise"><?php esc_html_e( 'Appearance and General', 'contact-forms' ); ?></button>
305 <button class="accua-tabs__tab" role="tab" data-tab="messages"><?php esc_html_e( 'Messages', 'contact-forms' ); ?></button>
306 <button class="accua-tabs__tab" role="tab" data-tab="retention"><?php esc_html_e( 'Data Retention', 'contact-forms' ); ?></button>
307 <button class="accua-tabs__tab" role="tab" data-tab="google_ads">Google Ads</button>
308 <button class="accua-tabs__tab" role="tab" data-tab="tokens"><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></button>
309 </div>
310 <div id="accua_tabs_actions" class="accua_tabs_actions">
311 <form id="delete_form" action="admin.php?page=accua_forms_list" method="POST" onsubmit="return confirm(<?php print esc_attr(_accua_forms_json_encode(__('Do you really want to delete this form?', 'contact-forms'))); ?>);">
312 <input type="hidden" name="accua-form-edit-action" value="delete" />
313 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
314 <input type="hidden" name="form-id" value="<?php echo $fid_esc; ?>" />
315 <input type="submit" value="<?php esc_attr_e( 'Delete this form', 'contact-forms' ); ?>" />
316 <?php wp_nonce_field( 'contact-forms-delete_'.$fid ); ?>
317 </form>
318 <input class="button button-primary button-large accua_form_save_settings_button" id="accua_form_save_settings_top" type="button" value="<?php echo esc_attr(__( 'Save', 'contact-forms')); ?>" />
319 </div>
320 </div>
321 <div id="accua_tab_fields" class="accua-tabs__panel" role="tabpanel" data-tab="fields">
322 <!-- Begin available fields -->
323 <div class="widget-liquid-left">
324 <h2><?php esc_html_e( 'Available Fields', 'contact-forms' ); ?></h2>
325 <input type="text" id="accua-fields-filter" class="accua-fields-filter" placeholder="<?php esc_attr_e( 'Filter fields…', 'contact-forms' ); ?>" autocomplete="off" />
326 <div id="widgets-left">
327 <div id="available-widgets" class="widgets-holder-wrap">
328 <div class="accua-form-widget-scroll-wrapper">
329 <div class="widget-holder">
330 <div id="widget-list">
331 <!-- begin fields list -->
332
333 <?php
334
335 //This block must be executed before the output of available fields so accua_forms_field_text_settings_form() can initialize $html_multi_number for further html and fieldset fields
336 $form_fields_html = '';
337 foreach ($form_data['fields'] as $field) {
338 if (empty($avail_fields[$field['ref']])) {
339 $ref = array();
340 if (!empty($field['ref'])) {
341 if ($field['ref'] == '__fieldset-begin') {
342 $ref = array(
343 'id' => '__fieldset-begin',
344 'name' => __('Fieldset begin', 'contact-forms'),
345 'type' => 'fieldset-begin',
346 'description' => '',
347 );
348 } elseif ($field['ref'] == '__fieldset-end') {
349 $ref = array(
350 'id' => '__fieldset-end',
351 'name' => __('Fieldset end', 'contact-forms'),
352 'type' => 'fieldset-end',
353 'description' => '',
354 );
355 }
356 }
357 } else {
358 $ref = $avail_fields[$field['ref']];
359 if ( ! isset( $ref['id'] ) ) { $ref['id'] = $field['ref']; }
360 if ( ! isset( $ref['name'] ) ) { $ref['name'] = $ref['label'] ?? $field['ref']; }
361 }
362
363 $form_fields_html .= accua_forms_field_text_settings_form($fid, $ref, $field);
364 }
365
366
367 foreach ($avail_fields as $avail_field_key => $avail_field) {
368 if ( ! isset( $avail_field['id'] ) ) { $avail_field['id'] = $avail_field_key; }
369 if ( ! isset( $avail_field['name'] ) ) { $avail_field['name'] = $avail_field['label'] ?? $avail_field_key; }
370 $hidden = (empty($form_data['fields'][$avail_field['id']])) ? false : 'hidden';
371 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
372 echo accua_forms_field_text_settings_form($fid, $avail_field, $hidden);
373 }
374 // Custom HTML field
375 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
376 echo accua_forms_field_text_settings_form($fid);
377 // Fieldset begin
378 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
379 echo accua_forms_field_text_settings_form($fid, array(
380 'id' => '__fieldset-begin',
381 'name' => __( 'Fieldset begin', 'contact-forms'),
382 'type' => 'fieldset-begin',
383 'description' => __('You can use this field multiple times.', 'contact-forms'),
384 'default_value' => '',
385 'allowed_values' => '',
386 ));
387 // Fieldset end
388 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
389 echo accua_forms_field_text_settings_form($fid, array(
390 'id' => '__fieldset-end',
391 'name' => __( 'Fieldset end', 'contact-forms'),
392 'type' => 'fieldset-end',
393 'description' => __('You can use this field multiple times.', 'contact-forms'),
394 'default_value' => '',
395 'allowed_values' => '',
396 ));
397 ?>
398
399 <!-- end fields list -->
400 </div>
401
402 <br class='clear' />
403 </div>
404 </div>
405 <br class="clear" />
406 </div>
407
408 </div>
409 <p class="accua-fields-create-link"><a href="<?php echo esc_url( admin_url( 'admin.php?page=accua_forms_fields' ) ); ?>"><?php esc_html_e( 'Create new field', 'contact-forms' ); ?></a></p>
410 </div>
411 <!-- End available fields -->
412
413 <div class="widget-liquid-right">
414 <div id="widgets-right">
415 <h2><?php esc_html_e( 'Drop fields here', 'contact-forms' ); ?></h2>
416 <div class="widgets-holder-wrap dashed">
417 <div class="accua-form-widget-scroll-wrapper">
418 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
419 <div class="widgets-sortables ui-sortable" id="cimatti-accua-fields-form-area-<?php echo $fid_esc ?>">
420 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $form_fields_html is built from pre-escaped heredoc templates ?>
421 <?php echo $form_fields_html; ?>
422 <div class="widget accua-static-widget" id="accua-default-submit-widget" <?php echo $default_submit_hidden; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- value is '' or literal 'style="display:none"' ?>>
423 <div class="widget-top">
424 <div class="widget-title-action">
425 <a href="#" class="widget-action hide-if-no-js" aria-expanded="false"></a>
426 </div>
427 <div class="widget-title"><h4><?php esc_html_e( 'Default Submit button', 'contact-forms' ); ?><span class="in-widget-title"></span></h4></div>
428 </div>
429 <div class="widget-inside">
430 <div class="widget-content">
431 <p><?php esc_html_e( 'To personalize the submit button, create a custom button in the Fields section, then drag and drop it into your form. The default submit button will be automatically replaced.', 'contact-forms' ); ?></p>
432 </div>
433 </div>
434 </div>
435 </div>
436 </div>
437 </div>
438 </div>
439 </div>
440 </div><!-- /panel: fields -->
441 <div id="accua_tab_customise" class="accua-tabs__panel" role="tabpanel" data-tab="customise">
442 <div class="accua-customise-columns">
443 <div class="accua-style-column">
444 <h2><?php esc_html_e( 'General', 'contact-forms' ); ?></h2>
445 <p id="accua_form_use_ajax"><input id="accua_form_use_ajax_check" class="accua_form_value" type="checkbox" value="1" <?php if (!empty($form_data['use_ajax'])) {echo 'checked="checked" ';} ?>/><label for="accua_form_use_ajax_check"><?php esc_html_e( 'Do not reload the page on form submission', 'contact-forms' ); ?></label></p>
446
447 <p id="accua_form_layout"><?php esc_html_e( 'Labels', 'contact-forms' ); ?> <select name="layout" class="accua_form_value">
448 <option value="" <?php selected( ! isset( $form_overrided_data['layout'] ) ); ?>><?php printf( /* translators: %s: current default layout label */ esc_html__( 'default (%s)', 'contact-forms' ), esc_html( accua_forms_get_layout_label( $default_form_data['layout'] ) ) ); ?></option>
449 <option value="sidebyside" <?php selected( isset( $form_overrided_data['layout'] ) && 'sidebyside' === $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'sidebyside' ) ); ?></option>
450 <option value="toplabel" <?php selected( isset( $form_overrided_data['layout'] ) && 'toplabel' === $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'toplabel' ) ); ?></option>
451 <option value="inlinelabel" <?php selected( isset( $form_overrided_data['layout'] ) && 'inlinelabel' === $form_data['layout'] ); ?>><?php echo esc_html( accua_forms_get_layout_label( 'inlinelabel' ) ); ?></option>
452 </select></p>
453 <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>
454
455 <h2><?php esc_html_e( 'Form Container', 'contact-forms' ); ?></h2>
456
457 <div class="accua-style-row" id="accua_form_style_margin">
458 <div class="accua-style-toggle">
459 <input name="accua_form_style_margin" id="accua_form_style_margin_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_margin'])) {echo 'checked="checked" ';} ?>/>
460 </div>
461 <div class="accua-style-content">
462 <label class="accua-style-label" for="accua_form_style_margin_check">margin</label>
463 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_margin']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_margin']); ?>" />
464 <span class="accua-style-help"><?php esc_html_e( 'Outer spacing around the form', 'contact-forms' ); ?></span>
465 </div>
466 </div>
467
468 <div class="accua-style-row" id="accua_form_style_padding">
469 <div class="accua-style-toggle">
470 <input name="accua_form_style_padding" id="accua_form_style_padding_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_padding'])) {echo 'checked="checked" ';} ?>/>
471 </div>
472 <div class="accua-style-content">
473 <label class="accua-style-label" for="accua_form_style_padding_check">padding</label>
474 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_padding']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_padding']); ?>" />
475 <span class="accua-style-help"><?php esc_html_e( 'Inner spacing inside the form', 'contact-forms' ); ?></span>
476 </div>
477 </div>
478
479 <div class="accua-style-row" id="accua_form_style_background_color">
480 <div class="accua-style-toggle">
481 <input name="accua_form_style_background_color" id="accua_form_style_background_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_background_color'])) {echo 'checked="checked" ';} ?>/>
482 </div>
483 <div class="accua-style-content">
484 <label class="accua-style-label" for="accua_form_style_background_color_check">background-color</label>
485 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_background_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_background_color']); ?>" />
486 <span class="accua-style-help"><?php esc_html_e( 'Form background fill', 'contact-forms' ); ?></span>
487 </div>
488 </div>
489
490 <div class="accua-style-row" id="accua_form_style_border_color">
491 <div class="accua-style-toggle">
492 <input name="accua_form_style_border_color" id="accua_form_style_border_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_border_color'])) {echo 'checked="checked" ';} ?>/>
493 </div>
494 <div class="accua-style-content">
495 <label class="accua-style-label" for="accua_form_style_border_color_check">border-color</label>
496 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_border_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_border_color']); ?>" />
497 <span class="accua-style-help"><?php esc_html_e( 'Form border color', 'contact-forms' ); ?></span>
498 </div>
499 </div>
500
501 <div class="accua-style-row" id="accua_form_style_border_width">
502 <div class="accua-style-toggle">
503 <input name="accua_form_style_border_width" id="accua_form_style_border_width_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_border_width'])) {echo 'checked="checked" ';} ?>/>
504 </div>
505 <div class="accua-style-content">
506 <label class="accua-style-label" for="accua_form_style_border_width_check">border-width</label>
507 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_border_width']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_border_width']); ?>" />
508 <span class="accua-style-help"><?php esc_html_e( 'Form border thickness', 'contact-forms' ); ?></span>
509 </div>
510 </div>
511
512 <div class="accua-style-row" id="accua_form_style_border_radius">
513 <div class="accua-style-toggle">
514 <input name="accua_form_style_border_radius" id="accua_form_style_border_radius_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_border_radius'])) {echo 'checked="checked" ';} ?>/>
515 </div>
516 <div class="accua-style-content">
517 <label class="accua-style-label" for="accua_form_style_border_radius_check">border-radius</label>
518 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_border_radius']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_border_radius']); ?>" />
519 <span class="accua-style-help"><?php esc_html_e( 'Rounded corners', 'contact-forms' ); ?></span>
520 </div>
521 </div>
522
523 <div class="accua-style-row" id="accua_form_style_color">
524 <div class="accua-style-toggle">
525 <input name="accua_form_style_color" id="accua_form_style_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_color'])) {echo 'checked="checked" ';} ?>/>
526 </div>
527 <div class="accua-style-content">
528 <label class="accua-style-label" for="accua_form_style_color_check">color</label>
529 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_color']); ?>" />
530 <span class="accua-style-help"><?php esc_html_e( 'Form text color', 'contact-forms' ); ?></span>
531 </div>
532 </div>
533
534 <div class="accua-style-row" id="accua_form_style_font_size">
535 <div class="accua-style-toggle">
536 <input name="accua_form_style_font_size" id="accua_form_style_font_size_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_font_size'])) {echo 'checked="checked" ';} ?>/>
537 </div>
538 <div class="accua-style-content">
539 <label class="accua-style-label" for="accua_form_style_font_size_check">font-size</label>
540 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_font_size']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_font_size']); ?>" />
541 <span class="accua-style-help"><?php esc_html_e( 'Base text size', 'contact-forms' ); ?></span>
542 </div>
543 </div>
544
545 </div>
546 <div class="accua-style-column">
547
548 <h2><?php esc_html_e( 'Input Fields', 'contact-forms' ); ?></h2>
549
550 <div class="accua-style-row" id="accua_form_style_field_spacing">
551 <div class="accua-style-toggle">
552 <input name="accua_form_style_field_spacing" id="accua_form_style_field_spacing_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_spacing'])) {echo 'checked="checked" ';} ?>/>
553 </div>
554 <div class="accua-style-content">
555 <label class="accua-style-label" for="accua_form_style_field_spacing_check">margin-bottom</label>
556 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_spacing']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_spacing']); ?>" />
557 <span class="accua-style-help"><?php esc_html_e( 'Space between fields', 'contact-forms' ); ?></span>
558 </div>
559 </div>
560
561 <div class="accua-style-row" id="accua_form_style_field_padding">
562 <div class="accua-style-toggle">
563 <input name="accua_form_style_field_padding" id="accua_form_style_field_padding_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_padding'])) {echo 'checked="checked" ';} ?>/>
564 </div>
565 <div class="accua-style-content">
566 <label class="accua-style-label" for="accua_form_style_field_padding_check">padding</label>
567 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_padding']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_padding']); ?>" />
568 <span class="accua-style-help"><?php esc_html_e( 'Inner spacing in inputs', 'contact-forms' ); ?></span>
569 </div>
570 </div>
571
572 <div class="accua-style-row" id="accua_form_style_field_background_color">
573 <div class="accua-style-toggle">
574 <input name="accua_form_style_field_background_color" id="accua_form_style_field_background_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_background_color'])) {echo 'checked="checked" ';} ?>/>
575 </div>
576 <div class="accua-style-content">
577 <label class="accua-style-label" for="accua_form_style_field_background_color_check">background-color</label>
578 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_background_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_background_color']); ?>" />
579 <span class="accua-style-help"><?php esc_html_e( 'Input field fill color', 'contact-forms' ); ?></span>
580 </div>
581 </div>
582
583 <div class="accua-style-row" id="accua_form_style_field_border_color">
584 <div class="accua-style-toggle">
585 <input name="accua_form_style_field_border_color" id="accua_form_style_field_border_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_border_color'])) {echo 'checked="checked" ';} ?>/>
586 </div>
587 <div class="accua-style-content">
588 <label class="accua-style-label" for="accua_form_style_field_border_color_check">border-color</label>
589 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_border_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_border_color']); ?>" />
590 <span class="accua-style-help"><?php esc_html_e( 'Input border color', 'contact-forms' ); ?></span>
591 </div>
592 </div>
593
594 <div class="accua-style-row" id="accua_form_style_field_border_width">
595 <div class="accua-style-toggle">
596 <input name="accua_form_style_field_border_width" id="accua_form_style_field_border_width_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_border_width'])) {echo 'checked="checked" ';} ?>/>
597 </div>
598 <div class="accua-style-content">
599 <label class="accua-style-label" for="accua_form_style_field_border_width_check">border-width</label>
600 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_border_width']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_border_width']); ?>" />
601 <span class="accua-style-help"><?php esc_html_e( 'Input border thickness', 'contact-forms' ); ?></span>
602 </div>
603 </div>
604
605 <div class="accua-style-row" id="accua_form_style_field_border_radius">
606 <div class="accua-style-toggle">
607 <input name="accua_form_style_field_border_radius" id="accua_form_style_field_border_radius_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_border_radius'])) {echo 'checked="checked" ';} ?>/>
608 </div>
609 <div class="accua-style-content">
610 <label class="accua-style-label" for="accua_form_style_field_border_radius_check">border-radius</label>
611 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_border_radius']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_border_radius']); ?>" />
612 <span class="accua-style-help"><?php esc_html_e( 'Input rounded corners', 'contact-forms' ); ?></span>
613 </div>
614 </div>
615
616 <div class="accua-style-row" id="accua_form_style_field_color">
617 <div class="accua-style-toggle">
618 <input name="accua_form_style_field_color" id="accua_form_style_field_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_field_color'])) {echo 'checked="checked" ';} ?>/>
619 </div>
620 <div class="accua-style-content">
621 <label class="accua-style-label" for="accua_form_style_field_color_check">color</label>
622 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_field_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_field_color']); ?>" />
623 <span class="accua-style-help"><?php esc_html_e( 'Input text color', 'contact-forms' ); ?></span>
624 </div>
625 </div>
626
627 <h2><?php esc_html_e( 'Submit Button', 'contact-forms' ); ?></h2>
628
629 <div class="accua-style-row" id="accua_form_style_submit_padding">
630 <div class="accua-style-toggle">
631 <input name="accua_form_style_submit_padding" id="accua_form_style_submit_padding_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_padding'])) {echo 'checked="checked" ';} ?>/>
632 </div>
633 <div class="accua-style-content">
634 <label class="accua-style-label" for="accua_form_style_submit_padding_check">padding</label>
635 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_padding']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_padding']); ?>" />
636 <span class="accua-style-help"><?php esc_html_e( 'Button inner spacing', 'contact-forms' ); ?></span>
637 </div>
638 </div>
639
640 <div class="accua-style-row" id="accua_form_style_submit_background_color">
641 <div class="accua-style-toggle">
642 <input name="accua_form_style_submit_background_color" id="accua_form_style_submit_background_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_background_color'])) {echo 'checked="checked" ';} ?>/>
643 </div>
644 <div class="accua-style-content">
645 <label class="accua-style-label" for="accua_form_style_submit_background_color_check">background-color</label>
646 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_background_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_background_color']); ?>" />
647 <span class="accua-style-help"><?php esc_html_e( 'Button fill color', 'contact-forms' ); ?></span>
648 </div>
649 </div>
650
651 <div class="accua-style-row" id="accua_form_style_submit_color">
652 <div class="accua-style-toggle">
653 <input name="accua_form_style_submit_color" id="accua_form_style_submit_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_color'])) {echo 'checked="checked" ';} ?>/>
654 </div>
655 <div class="accua-style-content">
656 <label class="accua-style-label" for="accua_form_style_submit_color_check">color</label>
657 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_color']); ?>" />
658 <span class="accua-style-help"><?php esc_html_e( 'Button text color', 'contact-forms' ); ?></span>
659 </div>
660 </div>
661
662 <div class="accua-style-row" id="accua_form_style_submit_font_size">
663 <div class="accua-style-toggle">
664 <input name="accua_form_style_submit_font_size" id="accua_form_style_submit_font_size_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_font_size'])) {echo 'checked="checked" ';} ?>/>
665 </div>
666 <div class="accua-style-content">
667 <label class="accua-style-label" for="accua_form_style_submit_font_size_check">font-size</label>
668 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_font_size']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_font_size']); ?>" />
669 <span class="accua-style-help"><?php esc_html_e( 'Button text size', 'contact-forms' ); ?></span>
670 </div>
671 </div>
672
673 <div class="accua-style-row" id="accua_form_style_submit_border_color">
674 <div class="accua-style-toggle">
675 <input name="accua_form_style_submit_border_color" id="accua_form_style_submit_border_color_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_border_color'])) {echo 'checked="checked" ';} ?>/>
676 </div>
677 <div class="accua-style-content">
678 <label class="accua-style-label" for="accua_form_style_submit_border_color_check">border-color</label>
679 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_border_color']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_border_color']); ?>" />
680 <span class="accua-style-help"><?php esc_html_e( 'Button border color', 'contact-forms' ); ?></span>
681 </div>
682 </div>
683
684 <div class="accua-style-row" id="accua_form_style_submit_border_width">
685 <div class="accua-style-toggle">
686 <input name="accua_form_style_submit_border_width" id="accua_form_style_submit_border_width_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_border_width'])) {echo 'checked="checked" ';} ?>/>
687 </div>
688 <div class="accua-style-content">
689 <label class="accua-style-label" for="accua_form_style_submit_border_width_check">border-width</label>
690 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_border_width']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_border_width']); ?>" />
691 <span class="accua-style-help"><?php esc_html_e( 'Button border thickness', 'contact-forms' ); ?></span>
692 </div>
693 </div>
694
695 <div class="accua-style-row" id="accua_form_style_submit_border_radius">
696 <div class="accua-style-toggle">
697 <input name="accua_form_style_submit_border_radius" id="accua_form_style_submit_border_radius_check" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['style_submit_border_radius'])) {echo 'checked="checked" ';} ?>/>
698 </div>
699 <div class="accua-style-content">
700 <label class="accua-style-label" for="accua_form_style_submit_border_radius_check">border-radius</label>
701 <input class="accua_form_value" type="text" value="<?php echo esc_attr($form_data['style_submit_border_radius']) ?>" placeholder="<?php echo esc_attr($default_form_data['style_submit_border_radius']); ?>" />
702 <span class="accua-style-help"><?php esc_html_e( 'Button rounded corners', 'contact-forms' ); ?></span>
703 </div>
704 </div>
705
706 </div>
707 </div>
708 </div><!-- /panel: customise -->
709 <div id="accua_tab_google_ads" class="accua-tabs__panel" role="tabpanel" data-tab="google_ads">
710 <div class="postbox">
711 <div class="postbox-header"><h2>Google Ads Conversion Tracking</h2></div>
712 <div class="inside">
713 <table class="form-table" role="presentation">
714 <tr>
715 <th scope="row"><label for="gads_conversion_code_input"><?php esc_html_e( 'GADS Conversion Code', 'contact-forms' ); ?></label></th>
716 <td>
717 <input type="text"
718 id="gads_conversion_code_input"
719 name="gads_conversion_tracking_code"
720 class="accua_form_value regular-text"
721 value="<?php echo esc_attr($form_data['gads_conversion_tracking_code'] ?? ''); ?>"
722 pattern="AW-\d+/[a-zA-Z0-9]+"
723 title="(es: AW-123456789/aaBBccDD)"
724 />
725 <span id="gads_code_validation_message" class="validation-message" style="display:none; color:#d63638;"></span>
726 <p class="description"><?php esc_html_e( 'If you want to use Google Ads Conversion Tracking Code, please enter it here.', 'contact-forms' ); ?> (es: AW-123456789/aaBBccDD)</p>
727 </td>
728 </tr>
729 </table>
730 </div>
731 </div>
732 </div><!-- /panel: google_ads -->
733
734 <div id="accua_form_preview_pane" class="accua-form-preview-pane">
735 <h2><?php esc_html_e( 'Preview', 'contact-forms' ); ?></h2>
736 <div id="accua_form_preview_area_wrapper">
737 <iframe id="accua_form_preview_area" src="admin-ajax.php?action=accua_forms_preview&fid=<?php echo esc_attr($fid);?>&_wpnonce=<?php echo esc_attr( wp_create_nonce('accua_forms_preview') ); ?>" frameborder="0" scrolling="no"></iframe>
738 </div>
739 </div>
740
741 <div id="accua_tab_messages" class="accua-tabs__panel" role="tabpanel" data-tab="messages">
742 <?php
743 $email_font_formats =
744 'Arial=arial,helvetica,sans-serif;'
745 . 'Arial Black=arial black,avant garde,sans-serif;'
746 . 'Comic Sans MS=comic sans ms,sans-serif;'
747 . 'Courier New=courier new,courier,monospace;'
748 . 'Georgia=georgia,palatino,serif;'
749 . 'Lucida Sans=lucida sans unicode,lucida grande,sans-serif;'
750 . 'Tahoma=tahoma,arial,helvetica,sans-serif;'
751 . 'Times New Roman=times new roman,times,serif;'
752 . 'Trebuchet MS=trebuchet ms,geneva,sans-serif;'
753 . 'Verdana=verdana,geneva,sans-serif;';
754
755 $settings_editor = array(
756 'teeny' => true,
757 'editor_class' => 'accua_form_value',
758 'tinymce' => array(
759 'toolbar1' => 'fontselect,|,bold,italic,underline,|,bullist,numlist,|,link,unlink',
760 'font_formats' => $email_font_formats,
761 'content_style' => 'body { font-family: arial, helvetica, sans-serif; }',
762 ));
763 ?>
764 <div class="accua-settings-grid">
765 <div class="postbox">
766 <div class="postbox-header"><h2><?php esc_html_e('1. On-screen success message', 'contact-forms'); ?></h2></div>
767 <div class="inside">
768 <div id="accua_form_success_message">
769 <fieldset class="accua-radio-group">
770 <label><input class="accua_form_check_override" name="accua_form_success_message" type="radio" value="0" <?php if (!isset($form_overrided_data['success_message'])) {echo ' checked ';} ?>> <?php esc_html_e( 'Use the default message', 'contact-forms' ); ?></label>
771 <label><input class="accua_form_check_override" name="accua_form_success_message" type="radio" value="1" <?php if (isset($form_overrided_data['success_message']) && !isset($form_overrided_data['success_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
772 <label><input class="accua_form_check_override" name="accua_form_success_message" type="radio" value="-1" <?php if (isset($form_overrided_data['success_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Don\'t show any messages', 'contact-forms' ); ?></label>
773 </fieldset>
774 <div class="defalut_message">
775 <?php esc_html_e( 'Default Success message', 'contact-forms' ); ?>
776 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['success_message'] ) ); ?></div>
777 </div>
778 <?php wp_editor( $form_data['success_message'] , 'accua_form_success_message_textarea' , $settings_editor); ?>
779 </div>
780 </div>
781 </div>
782
783 <div class="postbox">
784 <div class="postbox-header"><h2><?php esc_html_e('2. On-screen error message', 'contact-forms'); ?></h2></div>
785 <div class="inside">
786 <div id="accua_form_error_message">
787 <fieldset class="accua-radio-group">
788 <label><input class="accua_form_check_override" name="accua_form_error_message" type="radio" value="0" <?php if (!isset($form_overrided_data['error_message'])) {echo ' checked ';} ?>> <?php esc_html_e( 'Use the default message', 'contact-forms' ); ?></label>
789 <label><input class="accua_form_check_override" name="accua_form_error_message" type="radio" value="1" <?php if (isset($form_overrided_data['error_message']) && !isset($form_overrided_data['error_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
790 <label><input class="accua_form_check_override" name="accua_form_error_message" type="radio" value="-1" <?php if (isset($form_overrided_data['error_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Don\'t show any messages', 'contact-forms' ); ?></label>
791 </fieldset>
792 <div class="defalut_message">
793 <?php esc_html_e( 'Default error message', 'contact-forms' ); ?> <br />
794 <div class="defalut_content_message" ><?php echo wp_kses_post( wpautop( $default_form_data['error_message'] ) ); ?></div>
795 </div>
796 <?php wp_editor( $form_data['error_message'] , 'accua_form_error_message_textarea' , $settings_editor); ?>
797 </div>
798 </div>
799 </div>
800
801 <div class="postbox">
802 <div class="postbox-header"><h2><?php esc_html_e('3. Email to notify administrator', 'contact-forms'); ?></h2></div>
803 <div class="inside">
804 <table class="form-table" role="presentation">
805 <tr>
806 <th scope="row"><label><?php esc_html_e( 'To', 'contact-forms' ); ?></label></th>
807 <td id="accua_form_admin_emails_to">
808 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['admin_emails_to']) ?>" <?php if (!isset($form_overrided_data['admin_emails_to'])) echo 'disabled'; ?> />
809 <label><input name="accua_form_admin_emails_to" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['admin_emails_to'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
810 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['admin_emails_to']) . '</code>' ); ?></p>
811 </td>
812 </tr>
813 <tr>
814 <th scope="row"><label><?php esc_html_e( 'Bcc', 'contact-forms' ); ?></label></th>
815 <td id="accua_form_emails_bcc">
816 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['emails_bcc']) ?>" <?php if (!isset($form_overrided_data['emails_bcc'])) echo 'disabled'; ?> />
817 <label><input name="accua_form_emails_bcc" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['emails_bcc'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
818 <?php if ( ! empty( $default_form_data['emails_bcc'] ) ) { ?>
819 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['emails_bcc']) . '</code>' ); ?></p>
820 <?php } ?>
821 </td>
822 </tr>
823 <tr>
824 <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
825 <td id="accua_form_admin_emails_subject">
826 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['admin_emails_subject']) ?>" <?php if (!isset($form_overrided_data['admin_emails_subject'])) echo 'disabled'; ?> />
827 <label><input name="accua_form_admin_emails_subject" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['admin_emails_subject'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
828 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['admin_emails_subject']) . '</code>' ); ?></p>
829 </td>
830 </tr>
831 </table>
832
833 <div id="accua_form_admin_emails_message">
834 <fieldset class="accua-radio-group">
835 <label><input class="accua_form_check_override" name="accua_form_admin_emails_message" type="radio" value="0" <?php if (!isset($form_overrided_data['admin_emails_message'])) {echo ' checked ';} ?>> <?php esc_html_e( 'Use the default message', 'contact-forms' ); ?></label>
836 <label><input class="accua_form_check_override" name="accua_form_admin_emails_message" type="radio" value="1" <?php if (isset($form_overrided_data['admin_emails_message']) && !isset($form_overrided_data['admin_emails_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
837 <label><input class="accua_form_check_override" name="accua_form_admin_emails_message" type="radio" value="-1" <?php if (isset($form_overrided_data['admin_emails_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Don\'t show any messages', 'contact-forms' ); ?></label>
838 </fieldset>
839 <div class="defalut_message">
840 <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
841 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['admin_emails_message'] ) ); ?></div>
842 </div>
843 <?php wp_editor( $form_data['admin_emails_message'] , 'accua_form_admin_emails_message_textarea' , $settings_editor); ?>
844 </div>
845
846 </div>
847 </div>
848
849 <div class="postbox">
850 <div class="postbox-header"><h2><?php esc_html_e('4. Email confirmation to the person who completed the form', 'contact-forms'); ?></h2></div>
851 <div class="inside">
852 <table class="form-table" role="presentation">
853 <tr>
854 <th scope="row"><label><?php esc_html_e( 'From name', 'contact-forms'); ?></label></th>
855 <td id="accua_form_emails_from_name">
856 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['emails_from_name']) ?>" <?php if (!isset($form_overrided_data['emails_from_name'])) echo 'disabled'; ?> />
857 <label><input name="accua_form_emails_from_name" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['emails_from_name'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
858 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['emails_from_name']) . '</code>' ); ?></p>
859 </td>
860 </tr>
861 <tr>
862 <th scope="row"><label><?php esc_html_e( 'From email', 'contact-forms'); ?></label></th>
863 <td id="accua_form_emails_from">
864 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['emails_from']) ?>" <?php if (!isset($form_overrided_data['emails_from'])) echo 'disabled'; ?> />
865 <label><input name="accua_form_emails_from" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['emails_from'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
866 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['emails_from']) . '</code>' ); ?></p>
867 </td>
868 </tr>
869 <tr>
870 <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
871 <td id="accua_form_confirmation_emails_subject">
872 <input class="accua_form_value regular-text" type="text" value="<?php echo esc_attr($form_data['confirmation_emails_subject']) ?>" <?php if (!isset($form_overrided_data['confirmation_emails_subject'])) echo 'disabled'; ?> />
873 <label><input name="accua_form_confirmation_emails_subject" class="accua_form_check_override" type="checkbox" value="1" <?php if (isset($form_overrided_data['confirmation_emails_subject'])) {echo 'checked="checked" ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
874 <p class="description"><?php /* translators: %s: default value */ printf( esc_html__( 'Default: %s', 'contact-forms' ), '<code>' . esc_html($default_form_data['confirmation_emails_subject']) . '</code>' ); ?></p>
875 </td>
876 </tr>
877 </table>
878
879 <div id="accua_form_confirmation_emails_message">
880 <fieldset class="accua-radio-group">
881 <label><input class="accua_form_check_override" name="accua_form_confirmation_emails_message" type="radio" value="0" <?php if (!isset($form_overrided_data['confirmation_emails_message'])) {echo ' checked ';} ?>> <?php esc_html_e( 'Use the default message', 'contact-forms' ); ?></label>
882 <label><input class="accua_form_check_override" name="accua_form_confirmation_emails_message" type="radio" value="1" <?php if (isset($form_overrided_data['confirmation_emails_message']) && !isset($form_overrided_data['confirmation_emails_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Customize', 'contact-forms' ); ?></label>
883 <label><input class="accua_form_check_override" name="accua_form_confirmation_emails_message" type="radio" value="-1" <?php if (isset($form_overrided_data['confirmation_emails_message_no_message'])) {echo ' checked ';} ?>/> <?php esc_html_e( 'Don\'t show any messages', 'contact-forms' ); ?></label>
884 </fieldset>
885 <div class="defalut_message">
886 <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
887 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['confirmation_emails_message'] ) ); ?></div>
888 </div>
889 <?php wp_editor( $form_data['confirmation_emails_message'] , 'accua_form_confirmation_emails_message_textarea' , $settings_editor); ?>
890 </div>
891 </div>
892 </div>
893 </div><!-- /.accua-settings-grid -->
894 </div><!-- /panel: messages -->
895
896 <div id="accua_tab_tokens" class="accua-tabs__panel" role="tabpanel" data-tab="tokens">
897 <div class="postbox">
898 <div class="postbox-header"><h2><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></h2></div>
899 <div class="inside">
900 <?php accua_forms_print_tokens(); ?>
901 </div>
902 </div>
903 </div>
904
905 <div id="accua_tab_retention" class="accua-tabs__panel" role="tabpanel" data-tab="retention">
906 <?php
907 $global_retention = get_option( 'accua_forms_retention_data', array() );
908 $global_retention = wp_parse_args( $global_retention, array( 'retention_value' => 0, 'retention_unit' => 'months', 'retention_mode' => 'anonymize' ) );
909 $global_val = (int) $global_retention['retention_value'];
910 $global_unit = $global_retention['retention_unit'];
911 $global_mode = $global_retention['retention_mode'];
912 $unit_labels = array( 'days' => __( 'days', 'contact-forms' ), 'months' => __( 'months', 'contact-forms' ), 'years' => __( 'years', 'contact-forms' ) );
913 $mode_labels = array( 'anonymize' => __( 'Anonymize', 'contact-forms' ), 'delete' => __( 'Delete permanently', 'contact-forms' ) );
914 if ( $global_val > 0 ) {
915 $global_summary = sprintf( '%d %s: %s', $global_val, $unit_labels[ $global_unit ] ?? $global_unit, $mode_labels[ $global_mode ] ?? $global_mode );
916 } else {
917 $global_summary = __( 'Keep indefinitely', 'contact-forms' );
918 }
919 ?>
920 <div class="postbox">
921 <div class="postbox-header"><h2><?php esc_html_e('Data Retention', 'contact-forms'); ?></h2></div>
922 <div class="inside">
923 <table class="form-table" role="presentation">
924 <tr>
925 <th scope="row"><?php esc_html_e( 'Override', 'contact-forms'); ?></th>
926 <td>
927 <input type="checkbox" name="submission_retention_override" id="accua_form_retention_override" value="1" <?php checked( ! empty( $form_data['submission_retention_override'] ) ); ?> />
928 <label for="accua_form_retention_override"><?php esc_html_e( 'Override default data retention', 'contact-forms'); ?></label>
929 <p class="description"><?php
930 printf(
931 /* translators: %s: current global retention summary, e.g. "12 months: Anonymize" or "Keep indefinitely" */
932 esc_html__( 'Global default: %s', 'contact-forms' ),
933 '<strong>' . esc_html( $global_summary ) . '</strong>'
934 );
935 ?></p>
936 </td>
937 </tr>
938 </table>
939 <div id="accua_form_retention_fields" style="<?php echo empty( $form_data['submission_retention_override'] ) ? 'display:none;' : ''; ?>">
940 <table class="form-table" role="presentation">
941 <tr>
942 <th scope="row"><label for="submission_retention_value"><?php esc_html_e( 'Retention period', 'contact-forms'); ?></label></th>
943 <td>
944 <input type="number" id="submission_retention_value" name="submission_retention_value" min="0" step="1" value="<?php echo esc_attr( $form_data['submission_retention_value'] ); ?>" style="width: 80px;" />
945 <select name="submission_retention_unit" id="submission_retention_unit">
946 <option value="days" <?php selected( $form_data['submission_retention_unit'], 'days' ); ?>><?php esc_html_e( 'days', 'contact-forms'); ?></option>
947 <option value="months" <?php selected( $form_data['submission_retention_unit'], 'months' ); ?>><?php esc_html_e( 'months', 'contact-forms'); ?></option>
948 <option value="years" <?php selected( $form_data['submission_retention_unit'], 'years' ); ?>><?php esc_html_e( 'years', 'contact-forms'); ?></option>
949 </select>
950 <span class="description"><?php esc_html_e( '(0 = keep indefinitely)', 'contact-forms'); ?></span>
951 </td>
952 </tr>
953 <tr>
954 <th scope="row"><?php esc_html_e( 'When submissions expire', 'contact-forms'); ?></th>
955 <td>
956 <fieldset>
957 <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_anonymize" value="anonymize" <?php checked( $form_data['submission_retention_mode'], 'anonymize' ); ?> />
958 <?php esc_html_e( 'Anonymize: replace personal data with placeholders, keep submission record for statistics', 'contact-forms'); ?></label><br />
959 <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_delete" value="delete" <?php checked( $form_data['submission_retention_mode'], 'delete' ); ?> />
960 <?php esc_html_e( 'Delete: permanently remove submission records from the database', 'contact-forms'); ?></label>
961 </fieldset>
962 </td>
963 </tr>
964 </table>
965 </div>
966 </div></div>
967
968 </div><!-- /panel: retention -->
969
970 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
971 <input type="hidden" id="accua_form_save_settings_id" value="<?php echo $fid_esc; ?>" />
972
973 </div><!-- /#accua_tabs -->
974
975 <?php
976 }
977
978