PluginProbe
Contact Forms by Cimatti / 2.2.32
Contact Forms by Cimatti v2.2.32
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 2.2.32, at admin/form-editor.php

973 lines 62.7 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', 'jquery-ui-dialog'), 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 = $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 $error = '';
172 if (!preg_match('/^[a-z0-9_-]+$/i', $fid)) {
173 $error .= "<p>".__( 'Only letters, numbers, hyphens, and underscores allowed in form identifier', 'contact-forms')."</p>";
174 }
175 if (substr($fid,0,2) == '__') {
176 $error .= "<p>".__( 'The identifier cannot start with two underscores (__)', 'contact-forms')."</p>";
177 }
178 if (strlen($fid) > 70) {
179 $error .= "<p>".__( 'The identifier cannot be longer than 70 characters', 'contact-forms')."</p>";
180 }
181 return $error;
182 }
183
184 function accua_forms_list_page() {
185 $message = '';
186 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verified below
187 if (isset($_POST['accua-form-edit-action'])){
188 $message = _accua_forms_form_edit_action();
189 } elseif (isset($_GET['fid'])) {
190 check_admin_referer('edit_posts');
191 $fid = sanitize_text_field(wp_unslash($_GET['fid']));
192 $error = accua_forms_validate_form_id($fid);
193 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified above
194 if ($error === '' && (isset($_GET['clonefrom']) && $_GET['clonefrom'] !== '')) {
195 $error .= _accua_forms_test_clonefrom($fid);
196 }
197 if ($error === '') {
198 return accua_forms_edit_page($fid);
199 } else {
200 return accua_forms_add_page($error);
201 }
202 }
203 ?>
204 <div id="accua_forms_list_page" class="accua_forms_admin_page wrap">
205 <?php if ($message !== '') {
206 echo "<div style='border:1px solid; padding: 10px;'>".esc_html($message)."</div>";
207 } ?>
208 <h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms', 'contact-forms'); ?></h1>
209 <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>
210 <hr class="wp-header-end">
211 <p><?php esc_html_e( 'Use the shortcode or block to include forms in posts, pages or other content types.', 'contact-forms'); ?></p>
212 <?php
213 accua_forms_list_page_table();
214 ?>
215 </div>
216 <?php
217 }
218
219 function accua_forms_edit_page($fid) {
220 global $wpdb;
221
222 // Initialize draft for this form (creates from published data if no draft exists)
223 _accua_forms_init_draft($fid);
224
225 wp_enqueue_script('contact_forms_tabs', plugins_url('assets/js/admin/tabs.js', ACCUA_FORMS_FILE ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION, true );
226 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 );
227
228 $avail_fields = get_option('accua_forms_avail_fields', array());
229 $default_form_data = get_option('accua_forms_default_form_data', array()) + accua_forms_get_default_form_data();
230
231 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form restore flag, parent function checks nonce
232 $form_data = _accua_forms_get_form_data($fid, true, !empty($_GET['restore']));
233 $form_overrided_data = $form_data['_overrided'];
234
235 // Check if any field currently in the form is a custom submit button
236 $has_custom_submit = false;
237 foreach ( $form_data['fields'] as $field ) {
238 $ref = $field['ref'] ?? '';
239 if ( ! empty( $avail_fields[ $ref ] ) && ( $avail_fields[ $ref ]['type'] ?? '' ) === 'submit' ) {
240 $has_custom_submit = true;
241 break;
242 }
243 }
244 $default_submit_hidden = $has_custom_submit ? 'style="display:none"' : '';
245
246 $fid_esc = esc_attr($fid);
247
248 $adminurl = admin_url();
249
250 global $wp_version;
251 if (version_compare($wp_version, '4') >= 0) {
252 ?>
253 <style>
254 #widgets-right .accua-form-widget-scroll-wrapper .widget.ui-draggable {
255 height: auto !important;
256 }
257 #accua-default-submit-widget .widget-top {
258 cursor: default;
259 background: #dcdcde;
260 }
261 #accua-default-submit-widget .widget-inside .widget-content {
262 font-size: 14px;
263 line-height: 1.6;
264 padding: 4px 10px 10px;
265 color: #3c434a;
266 }
267 </style>
268 <?php
269 }
270
271 ?>
272 <div id="accua_forms_edit_page" class="accua_forms_admin_page wrap">
273 <h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms - Edit Form', 'contact-forms' ); ?></h1>
274 <?php
275 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table, lightweight count query
276 $submission_count = (int) $wpdb->get_var( $wpdb->prepare(
277 "SELECT COUNT(*) FROM `{$wpdb->prefix}accua_forms_submissions` WHERE afs_form_id = %s AND afs_status >= 0",
278 $fid
279 ) );
280 $submissions_url = admin_url( 'admin.php?page=accua_forms_submissions_list&fid=' . urlencode( $fid ) );
281 printf(
282 '<a class="page-title-action" href="%s">%s (%s)</a>',
283 esc_url( $submissions_url ),
284 esc_html__( 'Submissions', 'contact-forms' ),
285 esc_html( number_format_i18n( $submission_count ) )
286 );
287 ?>
288 <hr class="wp-header-end">
289 <?php wp_nonce_field('edit_form', '_nonce_edit_form'); ?>
290 <div id="titlediv">
291 <div id="titlewrap">
292 <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' ); ?>">
293 </div>
294 </div>
295 <div id="accua_tabs" class="accua-tabs accua-tabs--primary" data-default-tab="fields">
296 <div class="accua-tabs__header">
297 <div class="accua-tabs__tablist" role="tablist" aria-label="<?php esc_attr_e( 'Form editor', 'contact-forms' ); ?>">
298 <button class="accua-tabs__tab" role="tab" data-tab="fields"><?php esc_html_e( 'Fields', 'contact-forms' ); ?></button>
299 <button class="accua-tabs__tab" role="tab" data-tab="customise"><?php esc_html_e( 'Appearance and General', 'contact-forms' ); ?></button>
300 <button class="accua-tabs__tab" role="tab" data-tab="messages"><?php esc_html_e( 'Messages', 'contact-forms' ); ?></button>
301 <button class="accua-tabs__tab" role="tab" data-tab="retention"><?php esc_html_e( 'Data Retention', 'contact-forms' ); ?></button>
302 <button class="accua-tabs__tab" role="tab" data-tab="google_ads">Google Ads</button>
303 <button class="accua-tabs__tab" role="tab" data-tab="tokens"><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></button>
304 </div>
305 <div id="accua_tabs_actions" class="accua_tabs_actions">
306 <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'))); ?>);">
307 <input type="hidden" name="accua-form-edit-action" value="delete" />
308 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
309 <input type="hidden" name="form-id" value="<?php echo $fid_esc; ?>" />
310 <input type="submit" value="<?php esc_attr_e( 'Delete this form', 'contact-forms' ); ?>" />
311 <?php wp_nonce_field( 'contact-forms-delete_'.$fid ); ?>
312 </form>
313 <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')); ?>" />
314 <span class="accua_form_save_settings_status"></span>
315 </div>
316 </div>
317 <div id="accua_tab_fields" class="accua-tabs__panel" role="tabpanel" data-tab="fields">
318 <!-- Begin available fields -->
319 <div class="widget-liquid-left">
320 <h2><?php esc_html_e( 'Available Fields', 'contact-forms' ); ?></h2>
321 <input type="text" id="accua-fields-filter" class="accua-fields-filter" placeholder="<?php esc_attr_e( 'Filter fields…', 'contact-forms' ); ?>" autocomplete="off" />
322 <div id="widgets-left">
323 <div id="available-widgets" class="widgets-holder-wrap">
324 <div class="accua-form-widget-scroll-wrapper">
325 <div class="widget-holder">
326 <div id="widget-list">
327 <!-- begin fields list -->
328
329 <?php
330
331 //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
332 $form_fields_html = '';
333 foreach ($form_data['fields'] as $field) {
334 if (empty($avail_fields[$field['ref']])) {
335 $ref = array();
336 if (!empty($field['ref'])) {
337 if ($field['ref'] == '__fieldset-begin') {
338 $ref = array(
339 'id' => '__fieldset-begin',
340 'name' => __('Fieldset begin', 'contact-forms'),
341 'type' => 'fieldset-begin',
342 'description' => '',
343 );
344 } elseif ($field['ref'] == '__fieldset-end') {
345 $ref = array(
346 'id' => '__fieldset-end',
347 'name' => __('Fieldset end', 'contact-forms'),
348 'type' => 'fieldset-end',
349 'description' => '',
350 );
351 }
352 }
353 } else {
354 $ref = $avail_fields[$field['ref']];
355 if ( ! isset( $ref['id'] ) ) { $ref['id'] = $field['ref']; }
356 if ( ! isset( $ref['name'] ) ) { $ref['name'] = $ref['label'] ?? $field['ref']; }
357 }
358
359 $form_fields_html .= accua_forms_field_text_settings_form($fid, $ref, $field);
360 }
361
362
363 foreach ($avail_fields as $avail_field_key => $avail_field) {
364 if ( ! isset( $avail_field['id'] ) ) { $avail_field['id'] = $avail_field_key; }
365 if ( ! isset( $avail_field['name'] ) ) { $avail_field['name'] = $avail_field['label'] ?? $avail_field_key; }
366 $hidden = (empty($form_data['fields'][$avail_field['id']])) ? false : 'hidden';
367 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
368 echo accua_forms_field_text_settings_form($fid, $avail_field, $hidden);
369 }
370 // Custom HTML field
371 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
372 echo accua_forms_field_text_settings_form($fid);
373 // Fieldset begin
374 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
375 echo accua_forms_field_text_settings_form($fid, array(
376 'id' => '__fieldset-begin',
377 'name' => __( 'Fieldset begin', 'contact-forms'),
378 'type' => 'fieldset-begin',
379 'description' => __('You can use this field multiple times.', 'contact-forms'),
380 'default_value' => '',
381 'allowed_values' => '',
382 ));
383 // Fieldset end
384 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
385 echo accua_forms_field_text_settings_form($fid, array(
386 'id' => '__fieldset-end',
387 'name' => __( 'Fieldset end', 'contact-forms'),
388 'type' => 'fieldset-end',
389 'description' => __('You can use this field multiple times.', 'contact-forms'),
390 'default_value' => '',
391 'allowed_values' => '',
392 ));
393 ?>
394
395 <!-- end fields list -->
396 </div>
397
398 <br class='clear' />
399 </div>
400 </div>
401 <br class="clear" />
402 </div>
403
404 </div>
405 </div>
406 <!-- End available fields -->
407
408 <div class="widget-liquid-right">
409 <div id="widgets-right">
410 <h2><?php esc_html_e( 'Drop fields here', 'contact-forms' ); ?></h2>
411 <div class="widgets-holder-wrap dashed">
412 <div class="accua-form-widget-scroll-wrapper">
413 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
414 <div class="widgets-sortables ui-sortable" id="cimatti-accua-fields-form-area-<?php echo $fid_esc ?>">
415 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $form_fields_html is built from pre-escaped heredoc templates ?>
416 <?php echo $form_fields_html; ?>
417 <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"' ?>>
418 <div class="widget-top">
419 <div class="widget-title-action">
420 <a href="#" class="widget-action hide-if-no-js" aria-expanded="false"></a>
421 </div>
422 <div class="widget-title"><h4><?php esc_html_e( 'Default Submit button', 'contact-forms' ); ?><span class="in-widget-title"></span></h4></div>
423 </div>
424 <div class="widget-inside">
425 <div class="widget-content">
426 <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>
427 </div>
428 </div>
429 </div>
430 </div>
431 </div>
432 </div>
433 </div>
434 </div>
435 </div><!-- /panel: fields -->
436 <div id="accua_tab_customise" class="accua-tabs__panel" role="tabpanel" data-tab="customise">
437 <div class="accua-customise-columns">
438 <div class="accua-style-column">
439 <h2><?php esc_html_e( 'General', 'contact-forms' ); ?></h2>
440 <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>
441
442 <p id="accua_form_layout"><?php esc_html_e( 'Labels', 'contact-forms' ); ?> <select name="layout" class="accua_form_value">
443 <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>
444 <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>
445 <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>
446 <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>
447 </select></p>
448 <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>
449
450 <h2><?php esc_html_e( 'Form Container', 'contact-forms' ); ?></h2>
451
452 <div class="accua-style-row" id="accua_form_style_margin">
453 <div class="accua-style-toggle">
454 <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" ';} ?>/>
455 </div>
456 <div class="accua-style-content">
457 <label class="accua-style-label" for="accua_form_style_margin_check">margin</label>
458 <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']); ?>" />
459 <span class="accua-style-help"><?php esc_html_e( 'Outer spacing around the form', 'contact-forms' ); ?></span>
460 </div>
461 </div>
462
463 <div class="accua-style-row" id="accua_form_style_padding">
464 <div class="accua-style-toggle">
465 <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" ';} ?>/>
466 </div>
467 <div class="accua-style-content">
468 <label class="accua-style-label" for="accua_form_style_padding_check">padding</label>
469 <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']); ?>" />
470 <span class="accua-style-help"><?php esc_html_e( 'Inner spacing inside the form', 'contact-forms' ); ?></span>
471 </div>
472 </div>
473
474 <div class="accua-style-row" id="accua_form_style_background_color">
475 <div class="accua-style-toggle">
476 <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" ';} ?>/>
477 </div>
478 <div class="accua-style-content">
479 <label class="accua-style-label" for="accua_form_style_background_color_check">background-color</label>
480 <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']); ?>" />
481 <span class="accua-style-help"><?php esc_html_e( 'Form background fill', 'contact-forms' ); ?></span>
482 </div>
483 </div>
484
485 <div class="accua-style-row" id="accua_form_style_border_color">
486 <div class="accua-style-toggle">
487 <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" ';} ?>/>
488 </div>
489 <div class="accua-style-content">
490 <label class="accua-style-label" for="accua_form_style_border_color_check">border-color</label>
491 <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']); ?>" />
492 <span class="accua-style-help"><?php esc_html_e( 'Form border color', 'contact-forms' ); ?></span>
493 </div>
494 </div>
495
496 <div class="accua-style-row" id="accua_form_style_border_width">
497 <div class="accua-style-toggle">
498 <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" ';} ?>/>
499 </div>
500 <div class="accua-style-content">
501 <label class="accua-style-label" for="accua_form_style_border_width_check">border-width</label>
502 <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']); ?>" />
503 <span class="accua-style-help"><?php esc_html_e( 'Form border thickness', 'contact-forms' ); ?></span>
504 </div>
505 </div>
506
507 <div class="accua-style-row" id="accua_form_style_border_radius">
508 <div class="accua-style-toggle">
509 <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" ';} ?>/>
510 </div>
511 <div class="accua-style-content">
512 <label class="accua-style-label" for="accua_form_style_border_radius_check">border-radius</label>
513 <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']); ?>" />
514 <span class="accua-style-help"><?php esc_html_e( 'Rounded corners', 'contact-forms' ); ?></span>
515 </div>
516 </div>
517
518 <div class="accua-style-row" id="accua_form_style_color">
519 <div class="accua-style-toggle">
520 <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" ';} ?>/>
521 </div>
522 <div class="accua-style-content">
523 <label class="accua-style-label" for="accua_form_style_color_check">color</label>
524 <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']); ?>" />
525 <span class="accua-style-help"><?php esc_html_e( 'Form text color', 'contact-forms' ); ?></span>
526 </div>
527 </div>
528
529 <div class="accua-style-row" id="accua_form_style_font_size">
530 <div class="accua-style-toggle">
531 <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" ';} ?>/>
532 </div>
533 <div class="accua-style-content">
534 <label class="accua-style-label" for="accua_form_style_font_size_check">font-size</label>
535 <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']); ?>" />
536 <span class="accua-style-help"><?php esc_html_e( 'Base text size', 'contact-forms' ); ?></span>
537 </div>
538 </div>
539
540 </div>
541 <div class="accua-style-column">
542
543 <h2><?php esc_html_e( 'Input Fields', 'contact-forms' ); ?></h2>
544
545 <div class="accua-style-row" id="accua_form_style_field_spacing">
546 <div class="accua-style-toggle">
547 <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" ';} ?>/>
548 </div>
549 <div class="accua-style-content">
550 <label class="accua-style-label" for="accua_form_style_field_spacing_check">margin-bottom</label>
551 <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']); ?>" />
552 <span class="accua-style-help"><?php esc_html_e( 'Space between fields', 'contact-forms' ); ?></span>
553 </div>
554 </div>
555
556 <div class="accua-style-row" id="accua_form_style_field_padding">
557 <div class="accua-style-toggle">
558 <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" ';} ?>/>
559 </div>
560 <div class="accua-style-content">
561 <label class="accua-style-label" for="accua_form_style_field_padding_check">padding</label>
562 <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']); ?>" />
563 <span class="accua-style-help"><?php esc_html_e( 'Inner spacing in inputs', 'contact-forms' ); ?></span>
564 </div>
565 </div>
566
567 <div class="accua-style-row" id="accua_form_style_field_background_color">
568 <div class="accua-style-toggle">
569 <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" ';} ?>/>
570 </div>
571 <div class="accua-style-content">
572 <label class="accua-style-label" for="accua_form_style_field_background_color_check">background-color</label>
573 <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']); ?>" />
574 <span class="accua-style-help"><?php esc_html_e( 'Input field fill color', 'contact-forms' ); ?></span>
575 </div>
576 </div>
577
578 <div class="accua-style-row" id="accua_form_style_field_border_color">
579 <div class="accua-style-toggle">
580 <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" ';} ?>/>
581 </div>
582 <div class="accua-style-content">
583 <label class="accua-style-label" for="accua_form_style_field_border_color_check">border-color</label>
584 <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']); ?>" />
585 <span class="accua-style-help"><?php esc_html_e( 'Input border color', 'contact-forms' ); ?></span>
586 </div>
587 </div>
588
589 <div class="accua-style-row" id="accua_form_style_field_border_width">
590 <div class="accua-style-toggle">
591 <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" ';} ?>/>
592 </div>
593 <div class="accua-style-content">
594 <label class="accua-style-label" for="accua_form_style_field_border_width_check">border-width</label>
595 <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']); ?>" />
596 <span class="accua-style-help"><?php esc_html_e( 'Input border thickness', 'contact-forms' ); ?></span>
597 </div>
598 </div>
599
600 <div class="accua-style-row" id="accua_form_style_field_border_radius">
601 <div class="accua-style-toggle">
602 <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" ';} ?>/>
603 </div>
604 <div class="accua-style-content">
605 <label class="accua-style-label" for="accua_form_style_field_border_radius_check">border-radius</label>
606 <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']); ?>" />
607 <span class="accua-style-help"><?php esc_html_e( 'Input rounded corners', 'contact-forms' ); ?></span>
608 </div>
609 </div>
610
611 <div class="accua-style-row" id="accua_form_style_field_color">
612 <div class="accua-style-toggle">
613 <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" ';} ?>/>
614 </div>
615 <div class="accua-style-content">
616 <label class="accua-style-label" for="accua_form_style_field_color_check">color</label>
617 <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']); ?>" />
618 <span class="accua-style-help"><?php esc_html_e( 'Input text color', 'contact-forms' ); ?></span>
619 </div>
620 </div>
621
622 <h2><?php esc_html_e( 'Submit Button', 'contact-forms' ); ?></h2>
623
624 <div class="accua-style-row" id="accua_form_style_submit_padding">
625 <div class="accua-style-toggle">
626 <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" ';} ?>/>
627 </div>
628 <div class="accua-style-content">
629 <label class="accua-style-label" for="accua_form_style_submit_padding_check">padding</label>
630 <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']); ?>" />
631 <span class="accua-style-help"><?php esc_html_e( 'Button inner spacing', 'contact-forms' ); ?></span>
632 </div>
633 </div>
634
635 <div class="accua-style-row" id="accua_form_style_submit_background_color">
636 <div class="accua-style-toggle">
637 <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" ';} ?>/>
638 </div>
639 <div class="accua-style-content">
640 <label class="accua-style-label" for="accua_form_style_submit_background_color_check">background-color</label>
641 <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']); ?>" />
642 <span class="accua-style-help"><?php esc_html_e( 'Button fill color', 'contact-forms' ); ?></span>
643 </div>
644 </div>
645
646 <div class="accua-style-row" id="accua_form_style_submit_color">
647 <div class="accua-style-toggle">
648 <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" ';} ?>/>
649 </div>
650 <div class="accua-style-content">
651 <label class="accua-style-label" for="accua_form_style_submit_color_check">color</label>
652 <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']); ?>" />
653 <span class="accua-style-help"><?php esc_html_e( 'Button text color', 'contact-forms' ); ?></span>
654 </div>
655 </div>
656
657 <div class="accua-style-row" id="accua_form_style_submit_font_size">
658 <div class="accua-style-toggle">
659 <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" ';} ?>/>
660 </div>
661 <div class="accua-style-content">
662 <label class="accua-style-label" for="accua_form_style_submit_font_size_check">font-size</label>
663 <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']); ?>" />
664 <span class="accua-style-help"><?php esc_html_e( 'Button text size', 'contact-forms' ); ?></span>
665 </div>
666 </div>
667
668 <div class="accua-style-row" id="accua_form_style_submit_border_color">
669 <div class="accua-style-toggle">
670 <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" ';} ?>/>
671 </div>
672 <div class="accua-style-content">
673 <label class="accua-style-label" for="accua_form_style_submit_border_color_check">border-color</label>
674 <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']); ?>" />
675 <span class="accua-style-help"><?php esc_html_e( 'Button border color', 'contact-forms' ); ?></span>
676 </div>
677 </div>
678
679 <div class="accua-style-row" id="accua_form_style_submit_border_width">
680 <div class="accua-style-toggle">
681 <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" ';} ?>/>
682 </div>
683 <div class="accua-style-content">
684 <label class="accua-style-label" for="accua_form_style_submit_border_width_check">border-width</label>
685 <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']); ?>" />
686 <span class="accua-style-help"><?php esc_html_e( 'Button border thickness', 'contact-forms' ); ?></span>
687 </div>
688 </div>
689
690 <div class="accua-style-row" id="accua_form_style_submit_border_radius">
691 <div class="accua-style-toggle">
692 <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" ';} ?>/>
693 </div>
694 <div class="accua-style-content">
695 <label class="accua-style-label" for="accua_form_style_submit_border_radius_check">border-radius</label>
696 <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']); ?>" />
697 <span class="accua-style-help"><?php esc_html_e( 'Button rounded corners', 'contact-forms' ); ?></span>
698 </div>
699 </div>
700
701 </div>
702 </div>
703 </div><!-- /panel: customise -->
704 <div id="accua_tab_google_ads" class="accua-tabs__panel" role="tabpanel" data-tab="google_ads">
705 <div class="postbox">
706 <div class="postbox-header"><h2>Google Ads Conversion Tracking</h2></div>
707 <div class="inside">
708 <table class="form-table" role="presentation">
709 <tr>
710 <th scope="row"><label for="gads_conversion_code_input"><?php esc_html_e( 'GADS Conversion Code', 'contact-forms' ); ?></label></th>
711 <td>
712 <input type="text"
713 id="gads_conversion_code_input"
714 name="gads_conversion_tracking_code"
715 class="accua_form_value regular-text"
716 value="<?php echo esc_attr($form_data['gads_conversion_tracking_code'] ?? ''); ?>"
717 pattern="AW-\d+/[a-zA-Z0-9]+"
718 title="(es: AW-123456789/aaBBccDD)"
719 />
720 <span id="gads_code_validation_message" class="validation-message" style="display:none; color:#d63638;"></span>
721 <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>
722 </td>
723 </tr>
724 </table>
725 </div>
726 </div>
727 </div><!-- /panel: google_ads -->
728
729 <div id="accua_form_preview_pane" class="accua-form-preview-pane">
730 <h2><?php esc_html_e( 'Preview', 'contact-forms' ); ?></h2>
731 <div id="accua_form_preview_area_wrapper">
732 <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>
733 </div>
734 </div>
735
736 <div id="accua_tab_messages" class="accua-tabs__panel" role="tabpanel" data-tab="messages">
737 <?php
738 $email_font_formats =
739 'Arial=arial,helvetica,sans-serif;'
740 . 'Arial Black=arial black,avant garde,sans-serif;'
741 . 'Comic Sans MS=comic sans ms,sans-serif;'
742 . 'Courier New=courier new,courier,monospace;'
743 . 'Georgia=georgia,palatino,serif;'
744 . 'Lucida Sans=lucida sans unicode,lucida grande,sans-serif;'
745 . 'Tahoma=tahoma,arial,helvetica,sans-serif;'
746 . 'Times New Roman=times new roman,times,serif;'
747 . 'Trebuchet MS=trebuchet ms,geneva,sans-serif;'
748 . 'Verdana=verdana,geneva,sans-serif;';
749
750 $settings_editor = array(
751 'teeny' => true,
752 'editor_class' => 'accua_form_value',
753 'tinymce' => array(
754 'toolbar1' => 'fontselect,|,bold,italic,underline,|,bullist,numlist,|,link,unlink',
755 'font_formats' => $email_font_formats,
756 'content_style' => 'body { font-family: arial, helvetica, sans-serif; }',
757 ));
758 ?>
759 <div class="accua-settings-grid">
760 <div class="postbox">
761 <div class="postbox-header"><h2><?php esc_html_e('1. On-screen success message', 'contact-forms'); ?></h2></div>
762 <div class="inside">
763 <div id="accua_form_success_message">
764 <fieldset class="accua-radio-group">
765 <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>
766 <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>
767 <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>
768 </fieldset>
769 <div class="defalut_message">
770 <?php esc_html_e( 'Default Success message', 'contact-forms' ); ?>
771 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['success_message'] ) ); ?></div>
772 </div>
773 <?php wp_editor( $form_data['success_message'] , 'accua_form_success_message_textarea' , $settings_editor); ?>
774 </div>
775 </div>
776 </div>
777
778 <div class="postbox">
779 <div class="postbox-header"><h2><?php esc_html_e('2. On-screen error message', 'contact-forms'); ?></h2></div>
780 <div class="inside">
781 <div id="accua_form_error_message">
782 <fieldset class="accua-radio-group">
783 <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>
784 <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>
785 <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>
786 </fieldset>
787 <div class="defalut_message">
788 <?php esc_html_e( 'Default error message', 'contact-forms' ); ?> <br />
789 <div class="defalut_content_message" ><?php echo wp_kses_post( wpautop( $default_form_data['error_message'] ) ); ?></div>
790 </div>
791 <?php wp_editor( $form_data['error_message'] , 'accua_form_error_message_textarea' , $settings_editor); ?>
792 </div>
793 </div>
794 </div>
795
796 <div class="postbox">
797 <div class="postbox-header"><h2><?php esc_html_e('3. Email to notify administrator', 'contact-forms'); ?></h2></div>
798 <div class="inside">
799 <table class="form-table" role="presentation">
800 <tr>
801 <th scope="row"><label><?php esc_html_e( 'To', 'contact-forms' ); ?></label></th>
802 <td id="accua_form_admin_emails_to">
803 <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'; ?> />
804 <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>
805 <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>
806 </td>
807 </tr>
808 <tr>
809 <th scope="row"><label><?php esc_html_e( 'Bcc', 'contact-forms' ); ?></label></th>
810 <td id="accua_form_emails_bcc">
811 <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'; ?> />
812 <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>
813 <?php if ( ! empty( $default_form_data['emails_bcc'] ) ) { ?>
814 <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>
815 <?php } ?>
816 </td>
817 </tr>
818 <tr>
819 <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
820 <td id="accua_form_admin_emails_subject">
821 <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'; ?> />
822 <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>
823 <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>
824 </td>
825 </tr>
826 </table>
827
828 <div id="accua_form_admin_emails_message">
829 <fieldset class="accua-radio-group">
830 <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>
831 <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>
832 <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>
833 </fieldset>
834 <div class="defalut_message">
835 <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
836 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['admin_emails_message'] ) ); ?></div>
837 </div>
838 <?php wp_editor( $form_data['admin_emails_message'] , 'accua_form_admin_emails_message_textarea' , $settings_editor); ?>
839 </div>
840
841 </div>
842 </div>
843
844 <div class="postbox">
845 <div class="postbox-header"><h2><?php esc_html_e('4. Email confirmation to the person who completed the form', 'contact-forms'); ?></h2></div>
846 <div class="inside">
847 <table class="form-table" role="presentation">
848 <tr>
849 <th scope="row"><label><?php esc_html_e( 'From name', 'contact-forms'); ?></label></th>
850 <td id="accua_form_emails_from_name">
851 <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'; ?> />
852 <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>
853 <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>
854 </td>
855 </tr>
856 <tr>
857 <th scope="row"><label><?php esc_html_e( 'From email', 'contact-forms'); ?></label></th>
858 <td id="accua_form_emails_from">
859 <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'; ?> />
860 <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>
861 <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>
862 </td>
863 </tr>
864 <tr>
865 <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
866 <td id="accua_form_confirmation_emails_subject">
867 <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'; ?> />
868 <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>
869 <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>
870 </td>
871 </tr>
872 </table>
873
874 <div id="accua_form_confirmation_emails_message">
875 <fieldset class="accua-radio-group">
876 <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>
877 <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>
878 <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>
879 </fieldset>
880 <div class="defalut_message">
881 <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
882 <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['confirmation_emails_message'] ) ); ?></div>
883 </div>
884 <?php wp_editor( $form_data['confirmation_emails_message'] , 'accua_form_confirmation_emails_message_textarea' , $settings_editor); ?>
885 </div>
886 </div>
887 </div>
888 </div><!-- /.accua-settings-grid -->
889 </div><!-- /panel: messages -->
890
891 <div id="accua_tab_tokens" class="accua-tabs__panel" role="tabpanel" data-tab="tokens">
892 <div class="postbox">
893 <div class="postbox-header"><h2><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></h2></div>
894 <div class="inside">
895 <?php accua_forms_print_tokens(); ?>
896 </div>
897 </div>
898 </div>
899
900 <div id="accua_tab_retention" class="accua-tabs__panel" role="tabpanel" data-tab="retention">
901 <?php
902 $global_retention = get_option( 'accua_forms_retention_data', array() );
903 $global_retention = wp_parse_args( $global_retention, array( 'retention_value' => 0, 'retention_unit' => 'months', 'retention_mode' => 'anonymize' ) );
904 $global_val = (int) $global_retention['retention_value'];
905 $global_unit = $global_retention['retention_unit'];
906 $global_mode = $global_retention['retention_mode'];
907 $unit_labels = array( 'days' => __( 'days', 'contact-forms' ), 'months' => __( 'months', 'contact-forms' ), 'years' => __( 'years', 'contact-forms' ) );
908 $mode_labels = array( 'anonymize' => __( 'Anonymize', 'contact-forms' ), 'delete' => __( 'Delete permanently', 'contact-forms' ) );
909 if ( $global_val > 0 ) {
910 $global_summary = sprintf( '%d %s — %s', $global_val, $unit_labels[ $global_unit ] ?? $global_unit, $mode_labels[ $global_mode ] ?? $global_mode );
911 } else {
912 $global_summary = __( 'Keep indefinitely', 'contact-forms' );
913 }
914 ?>
915 <div class="postbox">
916 <div class="postbox-header"><h2><?php esc_html_e('Data Retention', 'contact-forms'); ?></h2></div>
917 <div class="inside">
918 <table class="form-table" role="presentation">
919 <tr>
920 <th scope="row"><?php esc_html_e( 'Override', 'contact-forms'); ?></th>
921 <td>
922 <input type="checkbox" name="submission_retention_override" id="accua_form_retention_override" value="1" <?php checked( ! empty( $form_data['submission_retention_override'] ) ); ?> />
923 <label for="accua_form_retention_override"><?php esc_html_e( 'Override default data retention', 'contact-forms'); ?></label>
924 <p class="description"><?php
925 printf(
926 /* translators: %s: current global retention summary, e.g. "12 months — Anonymize" or "Keep indefinitely" */
927 esc_html__( 'Global default: %s', 'contact-forms' ),
928 '<strong>' . esc_html( $global_summary ) . '</strong>'
929 );
930 ?></p>
931 </td>
932 </tr>
933 </table>
934 <div id="accua_form_retention_fields" style="<?php echo empty( $form_data['submission_retention_override'] ) ? 'display:none;' : ''; ?>">
935 <table class="form-table" role="presentation">
936 <tr>
937 <th scope="row"><label for="submission_retention_value"><?php esc_html_e( 'Retention period', 'contact-forms'); ?></label></th>
938 <td>
939 <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;" />
940 <select name="submission_retention_unit" id="submission_retention_unit">
941 <option value="days" <?php selected( $form_data['submission_retention_unit'], 'days' ); ?>><?php esc_html_e( 'days', 'contact-forms'); ?></option>
942 <option value="months" <?php selected( $form_data['submission_retention_unit'], 'months' ); ?>><?php esc_html_e( 'months', 'contact-forms'); ?></option>
943 <option value="years" <?php selected( $form_data['submission_retention_unit'], 'years' ); ?>><?php esc_html_e( 'years', 'contact-forms'); ?></option>
944 </select>
945 <span class="description"><?php esc_html_e( '(0 = keep indefinitely)', 'contact-forms'); ?></span>
946 </td>
947 </tr>
948 <tr>
949 <th scope="row"><?php esc_html_e( 'When submissions expire', 'contact-forms'); ?></th>
950 <td>
951 <fieldset>
952 <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_anonymize" value="anonymize" <?php checked( $form_data['submission_retention_mode'], 'anonymize' ); ?> />
953 <?php esc_html_e( 'Anonymize — replace personal data with placeholders, keep submission record for statistics', 'contact-forms'); ?></label><br />
954 <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_delete" value="delete" <?php checked( $form_data['submission_retention_mode'], 'delete' ); ?> />
955 <?php esc_html_e( 'Delete — permanently remove submission records from the database', 'contact-forms'); ?></label>
956 </fieldset>
957 </td>
958 </tr>
959 </table>
960 </div>
961 </div></div>
962
963 </div><!-- /panel: retention -->
964
965 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
966 <input type="hidden" id="accua_form_save_settings_id" value="<?php echo $fid_esc; ?>" />
967
968 </div><!-- /#accua_tabs -->
969
970 <?php
971 }
972
973