# contact-forms/2.2.32/admin/form-editor.php

Contact Forms by Cimatti, version 2.2.32. 973 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/2.2.32/code/admin/form-editor.php
- Raw: https://pluginprobe.com/plugins/contact-forms/2.2.32/raw/admin/form-editor.php
- Modified: 2026-07-13T10:04:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/2.2.32/code/admin/form-editor.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) exit;

require_once __DIR__ . '/list-page.php';

function accua_forms_edit_page_head_scripts() {
  wp_enqueue_style('wp-color-picker');
  wp_enqueue_script('wp-color-picker', '', array(), ACCUA_FORMS_JS_VERSION, true );

  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 );
  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 );
}

/**
 * Enqueue deactivation modal script on the Plugins page.
 */

function accua_forms_edit_page_head() {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Detection only, actual action processing in _accua_forms_form_edit_action() has nonce check
if (isset($_POST['accua-form-edit-action']) || (!isset($_GET['fid']))) {
  _accua_forms_form_edit_action();
  accua_forms_list_page_table(true);
}

?>
    <style type="text/css">
      .container > div {
        padding: 0px;
        margin-bottom: 6px;
      }
      .widget-liquid-right .widget, #wp_inactive_widgets .widget, .widget-liquid-right .sidebar-description, .widget-placeholder {
        width: 95%;
      }
    </style>
<?php
}

add_action( 'wp_ajax_accua-form-fields-order' , 'accua_forms_form_fields_order');

function accua_forms_add_page($message='') {
  $forms_data = get_option('accua_forms_saved_forms', array());
  $trash_data = get_option('accua_forms_trash_forms', array());
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form ID, parent function accua_forms_list_page() checks nonce
  if (!empty($_GET['fid'])) {
    // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form ID
    $fid = absint(wp_unslash($_GET['fid']));
  } else {
    if ($message === '') {
      $fid = 1 + ((int) get_option('accua_forms_lastid', 0));
      while (isset($forms_data[$fid]) || isset($trash_data[$fid])) {
        $fid++;
      }
      update_option('accua_forms_lastid', $fid);
      $message = _accua_forms_test_clonefrom($fid);
      if ($message === '') {
        return accua_forms_edit_page($fid);
      }
    } else {
      $fid = '';
    }
  }
  if (!empty($_GET['clonefrom'])) {
    check_admin_referer('clone_posts');
    $clonefrom = sanitize_text_field( wp_unslash( $_GET['clonefrom'] ) );
  } else {
    $clonefrom = '';
  }
?>

<div id="accua_forms_add_page" class="accua_forms_admin_page wrap">
<h1><?php esc_html_e( 'Create a form', 'contact-forms'); ?></h1>
<?php if ($message !== '') {
  echo "<div style='border:1px solid; padding: 10px;'>".esc_html($message)."</div>";
} ?>
<form action="admin.php" method="GET">
<?php wp_nonce_field('edit_posts', '_wpnonce', false, true) ?>
<input type="hidden" name="page" value="accua_forms_list" />
<p>Form id: <input type="text" name="fid" value="<?php echo esc_attr($fid); ?>" /></p>
<?php
  if ($forms_data) {
    echo '<p><select name="clonefrom">
            <option value="">'.esc_html__( 'Empty form', 'contact-forms').'</option>
            <optgroup label="'.esc_attr__( 'Clone form:', 'contact-forms').'">';
    foreach ($forms_data as $i => $formdata) {
      $sel = ( $i === $clonefrom ) ? ' selected="selected"' : '';
      $i_esc = esc_attr($i);
      if (isset($formdata['title']) && ('' !== trim($formdata['title']))) {
        $formtitle = esc_html($formdata['title']);
      } else {
        $formtitle = $i_esc;
      }
      // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $sel is a static string, other vars pre-escaped
      echo '<option value="' . esc_attr( $i_esc ) . '"' . $sel . '>' . esc_html( $formtitle ) . "</option>\n";
    }
    echo '</optgroup></select></p>';
  }
?>
<p><input type="submit" value="<?php esc_attr_e( 'Create', 'contact-forms'); ?>" /></p>
</form>
</div>
<?php
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Internal helper function, underscore prefix indicates private
function _accua_forms_test_clonefrom($fid){
  $error = '';
  if (isset($_GET['clonefrom'])&&$_GET['clonefrom']!=='') {
    // Verify nonce for clone operation to prevent CSRF attacks
    // Check for both possible nonce actions depending on the entry point
    $nonce_valid = false;
    if (isset($_GET['_wpnonce'])) {
      $nonce = sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) );
      // First try clone_posts nonce (from accua_forms_add page)
      if (wp_verify_nonce($nonce, 'clone_posts')) {
        $nonce_valid = true;
      }
      // Then try edit_posts nonce (from accua_forms_list page)
      elseif (wp_verify_nonce($nonce, 'edit_posts')) {
        $nonce_valid = true;
      }
    }
    
    if (!$nonce_valid) {
      wp_die(esc_html__('Security check failed. Please try again.', 'contact-forms'), esc_html__('Security Error', 'contact-forms'), array('response' => 403));
    }
    
    $clonefrom = sanitize_text_field( wp_unslash( $_GET['clonefrom'] ) );
    $forms_data = get_option('accua_forms_saved_forms', array());
    if (isset($forms_data[$fid])){
      $error .= '<p>' . esc_html__( 'Form already exists', 'contact-forms') . '</p>';
    } elseif (empty($forms_data[$clonefrom])) {
      $error .= '<p>' . esc_html__( 'Source form doesn\'t exists.', 'contact-forms') . '</p>';
    } else {
      $forms_data[$fid] = $forms_data[$clonefrom];
      if (!isset($forms_data[$fid]['title'])) {
        $forms_data[$fid]['title'] = $clonefrom ." ".__( 'clone', 'contact-forms');
      } else {
        $forms_data[$fid]['title'] .= " ". __( 'clone', 'contact-forms');
      }
      update_option('accua_forms_saved_forms', $forms_data);
    }
  }
  return $error;
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Internal helper function, underscore prefix indicates private
function _accua_forms_form_edit_action() {
  static $message = null;
  if ($message === null) {
    $message = '';
    if (isset($_POST['accua-form-edit-action'])){
      $post = stripslashes_deep($_POST);
      switch ($post['accua-form-edit-action']) {
        case 'delete':
          $fid = $post['form-id'];
          check_admin_referer('contact-forms-delete_'.$fid);
          $forms_data = get_option('accua_forms_saved_forms', array());
          unset($forms_data[$fid]);
          update_option('accua_forms_saved_forms', $forms_data);
          $fid = esc_html($fid);
          // translators: %s is the form ID being deleted
          $message .= sprintf( __( 'Form "%s" deleted','contact-forms' ), $fid );
        break;
      }
    }
  }
  return $message;
}

function accua_forms_validate_form_id($fid) {
  $error = '';
  if (!preg_match('/^[a-z0-9_-]+$/i', $fid)) {
    $error .= "<p>".__( 'Only letters, numbers, hyphens, and underscores allowed in form identifier', 'contact-forms')."</p>";
  }
  if (substr($fid,0,2) == '__') {
    $error .= "<p>".__( 'The identifier cannot start with two underscores (__)', 'contact-forms')."</p>";
  }
  if (strlen($fid) > 70) {
    $error .= "<p>".__( 'The identifier cannot be longer than 70 characters', 'contact-forms')."</p>";
  }
  return $error;
}

function accua_forms_list_page() {
  $message = '';
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verified below
  if (isset($_POST['accua-form-edit-action'])){
    $message = _accua_forms_form_edit_action();
  } elseif (isset($_GET['fid'])) {
    check_admin_referer('edit_posts');
    $fid = sanitize_text_field(wp_unslash($_GET['fid']));
    $error = accua_forms_validate_form_id($fid);
    // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified above
    if ($error === '' && (isset($_GET['clonefrom']) && $_GET['clonefrom'] !== '')) {
      $error .= _accua_forms_test_clonefrom($fid);
    }
    if ($error === '') {
      return accua_forms_edit_page($fid);
    } else {
      return accua_forms_add_page($error);
    }
  }
?>
<div id="accua_forms_list_page" class="accua_forms_admin_page wrap">
<?php if ($message !== '') {
  echo "<div style='border:1px solid; padding: 10px;'>".esc_html($message)."</div>";
} ?>
<h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms', 'contact-forms'); ?></h1>
<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>
<hr class="wp-header-end">
<p><?php esc_html_e( 'Use the shortcode or block to include forms in posts, pages or other content types.', 'contact-forms'); ?></p>
<?php
accua_forms_list_page_table();
?>
</div>
<?php
}

function accua_forms_edit_page($fid) {
  global $wpdb;

  // Initialize draft for this form (creates from published data if no draft exists)
  _accua_forms_init_draft($fid);
  
  wp_enqueue_script('contact_forms_tabs', plugins_url('assets/js/admin/tabs.js', ACCUA_FORMS_FILE ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION, true );
  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 );

  $avail_fields = get_option('accua_forms_avail_fields', array());
  $default_form_data = get_option('accua_forms_default_form_data', array()) + accua_forms_get_default_form_data();

  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only form restore flag, parent function checks nonce
  $form_data = _accua_forms_get_form_data($fid, true, !empty($_GET['restore']));
  $form_overrided_data = $form_data['_overrided'];

  // Check if any field currently in the form is a custom submit button
  $has_custom_submit = false;
  foreach ( $form_data['fields'] as $field ) {
    $ref = $field['ref'] ?? '';
    if ( ! empty( $avail_fields[ $ref ] ) && ( $avail_fields[ $ref ]['type'] ?? '' ) === 'submit' ) {
      $has_custom_submit = true;
      break;
    }
  }
  $default_submit_hidden = $has_custom_submit ? 'style="display:none"' : '';

  $fid_esc = esc_attr($fid);

  $adminurl = admin_url();

  global $wp_version;
  if (version_compare($wp_version, '4') >= 0) {
?>
<style>
#widgets-right .accua-form-widget-scroll-wrapper .widget.ui-draggable {
        height: auto !important;
}
#accua-default-submit-widget .widget-top {
        cursor: default;
        background: #dcdcde;
}
#accua-default-submit-widget .widget-inside .widget-content {
        font-size: 14px;
        line-height: 1.6;
        padding: 4px 10px 10px;
        color: #3c434a;
}
</style>
<?php
  }

?>
<div id="accua_forms_edit_page" class="accua_forms_admin_page wrap">
<h1 class="wp-heading-inline"><?php esc_html_e( 'Contact Forms - Edit Form', 'contact-forms' ); ?></h1>
<?php
  // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table, lightweight count query
  $submission_count = (int) $wpdb->get_var( $wpdb->prepare(
    "SELECT COUNT(*) FROM `{$wpdb->prefix}accua_forms_submissions` WHERE afs_form_id = %s AND afs_status >= 0",
    $fid
  ) );
  $submissions_url = admin_url( 'admin.php?page=accua_forms_submissions_list&fid=' . urlencode( $fid ) );
  printf(
    '<a class="page-title-action" href="%s">%s (%s)</a>',
    esc_url( $submissions_url ),
    esc_html__( 'Submissions', 'contact-forms' ),
    esc_html( number_format_i18n( $submission_count ) )
  );
?>
<hr class="wp-header-end">
<?php wp_nonce_field('edit_form', '_nonce_edit_form'); ?>
<div id="titlediv">
  <div id="titlewrap">
    <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' ); ?>">
  </div>
</div>
    <div id="accua_tabs" class="accua-tabs accua-tabs--primary" data-default-tab="fields">
      <div class="accua-tabs__header">
        <div class="accua-tabs__tablist" role="tablist" aria-label="<?php esc_attr_e( 'Form editor', 'contact-forms' ); ?>">
          <button class="accua-tabs__tab" role="tab" data-tab="fields"><?php esc_html_e( 'Fields', 'contact-forms' ); ?></button>
          <button class="accua-tabs__tab" role="tab" data-tab="customise"><?php esc_html_e( 'Appearance and General', 'contact-forms' ); ?></button>
          <button class="accua-tabs__tab" role="tab" data-tab="messages"><?php esc_html_e( 'Messages', 'contact-forms' ); ?></button>
          <button class="accua-tabs__tab" role="tab" data-tab="retention"><?php esc_html_e( 'Data Retention', 'contact-forms' ); ?></button>
          <button class="accua-tabs__tab" role="tab" data-tab="google_ads">Google Ads</button>
          <button class="accua-tabs__tab" role="tab" data-tab="tokens"><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></button>
        </div>
        <div id="accua_tabs_actions" class="accua_tabs_actions">
          <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'))); ?>);">
            <input type="hidden" name="accua-form-edit-action" value="delete" />
            <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
            <input type="hidden" name="form-id" value="<?php echo $fid_esc; ?>" />
            <input type="submit" value="<?php esc_attr_e( 'Delete this form', 'contact-forms' ); ?>" />
            <?php wp_nonce_field( 'contact-forms-delete_'.$fid ); ?>
          </form>
          <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')); ?>" />
          <span class="accua_form_save_settings_status"></span>
        </div>
      </div>
    <div id="accua_tab_fields" class="accua-tabs__panel" role="tabpanel" data-tab="fields">
					<!-- Begin available fields -->
						<div class="widget-liquid-left">
							<h2><?php esc_html_e( 'Available Fields', 'contact-forms' ); ?></h2>
							<input type="text" id="accua-fields-filter" class="accua-fields-filter" placeholder="<?php esc_attr_e( 'Filter fields…', 'contact-forms' ); ?>" autocomplete="off" />
						    <div id="widgets-left">
						      <div id="available-widgets" class="widgets-holder-wrap">
						        <div class="accua-form-widget-scroll-wrapper">
						        <div class="widget-holder">
						        <div id="widget-list">
						        <!-- begin fields list -->

						        <?php

						          //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
						          $form_fields_html = '';
                                  foreach ($form_data['fields'] as $field) {
                                    if (empty($avail_fields[$field['ref']])) {
                                      $ref = array();
                                      if (!empty($field['ref'])) {
                                        if ($field['ref'] == '__fieldset-begin') {
                                          $ref = array(
                                              'id' => '__fieldset-begin',
                                              'name' => __('Fieldset begin', 'contact-forms'),
                                              'type' => 'fieldset-begin',
                                              'description' => '',
                                          );
                                        } elseif ($field['ref'] == '__fieldset-end') {
                                          $ref = array(
                                              'id' => '__fieldset-end',
                                              'name' => __('Fieldset end', 'contact-forms'),
                                              'type' => 'fieldset-end',
                                              'description' => '',
                                          );
                                        }
                                      }
                                    } else {
                                      $ref = $avail_fields[$field['ref']];
                                      if ( ! isset( $ref['id'] ) ) { $ref['id'] = $field['ref']; }
                                      if ( ! isset( $ref['name'] ) ) { $ref['name'] = $ref['label'] ?? $field['ref']; }
                                    }

                                    $form_fields_html .= accua_forms_field_text_settings_form($fid, $ref, $field);
                                  }


						          foreach ($avail_fields as $avail_field_key => $avail_field) {
						            if ( ! isset( $avail_field['id'] ) ) { $avail_field['id'] = $avail_field_key; }
						            if ( ! isset( $avail_field['name'] ) ) { $avail_field['name'] = $avail_field['label'] ?? $avail_field_key; }
						            $hidden = (empty($form_data['fields'][$avail_field['id']])) ? false : 'hidden';
						            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
						            echo accua_forms_field_text_settings_form($fid, $avail_field, $hidden);
						          }
						          // Custom HTML field
						          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
						          echo accua_forms_field_text_settings_form($fid);
						          // Fieldset begin
						          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
						          echo accua_forms_field_text_settings_form($fid, array(
						              'id' => '__fieldset-begin',
						              'name' => __( 'Fieldset begin', 'contact-forms'),
						              'type' => 'fieldset-begin',
						              'description' => __('You can use this field multiple times.', 'contact-forms'),
						              'default_value' => '',
						              'allowed_values' => '',
						          ));
						          // Fieldset end
						          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is pre-escaped in heredoc templates
						          echo accua_forms_field_text_settings_form($fid, array(
						            'id' => '__fieldset-end',
						            'name' => __( 'Fieldset end', 'contact-forms'),
						            'type' => 'fieldset-end',
						            'description' => __('You can use this field multiple times.', 'contact-forms'),
						            'default_value' => '',
						            'allowed_values' => '',
						          ));
						        ?>

						        <!-- end fields list -->
						        </div>

						        <br class='clear' />
						        </div>
						        </div>
						        <br class="clear" />
						      </div>

						    </div>
						</div>
					<!-- End available fields -->

				      <div class="widget-liquid-right">
				        <div id="widgets-right">
				          <h2><?php esc_html_e( 'Drop fields here', 'contact-forms' ); ?></h2>
				          <div class="widgets-holder-wrap dashed">
				            <div class="accua-form-widget-scroll-wrapper">
				            <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
				            <div class="widgets-sortables ui-sortable" id="cimatti-accua-fields-form-area-<?php echo $fid_esc ?>">
				                <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $form_fields_html is built from pre-escaped heredoc templates ?>
				                <?php echo $form_fields_html; ?>
				                <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"' ?>>
				                  <div class="widget-top">
				                    <div class="widget-title-action">
				                      <a href="#" class="widget-action hide-if-no-js" aria-expanded="false"></a>
				                    </div>
				                    <div class="widget-title"><h4><?php esc_html_e( 'Default Submit button', 'contact-forms' ); ?><span class="in-widget-title"></span></h4></div>
				                  </div>
				                  <div class="widget-inside">
				                    <div class="widget-content">
				                      <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>
				                    </div>
				                  </div>
				                </div>
				            </div>
				            </div>
				          </div>
				        </div>
				      </div>
    </div><!-- /panel: fields -->
    <div id="accua_tab_customise" class="accua-tabs__panel" role="tabpanel" data-tab="customise">
        <div class="accua-customise-columns">
				  <div class="accua-style-column">
				    <h2><?php esc_html_e( 'General', 'contact-forms' ); ?></h2>
				    <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>

					<p id="accua_form_layout"><?php esc_html_e( 'Labels', 'contact-forms' ); ?> <select name="layout" class="accua_form_value">
					  <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>
					  <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>
					  <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>
					  <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>
					</select></p>
					<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>

					<h2><?php esc_html_e( 'Form Container', 'contact-forms' ); ?></h2>

					<div class="accua-style-row" id="accua_form_style_margin">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_margin_check">margin</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Outer spacing around the form', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_padding">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_padding_check">padding</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Inner spacing inside the form', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_background_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_background_color_check">background-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Form background fill', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_border_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_border_color_check">border-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Form border color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_border_width">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_border_width_check">border-width</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Form border thickness', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_border_radius">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_border_radius_check">border-radius</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Rounded corners', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_color_check">color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Form text color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_font_size">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_font_size_check">font-size</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Base text size', 'contact-forms' ); ?></span>
					  </div>
					</div>

				  </div>
				  <div class="accua-style-column">

					<h2><?php esc_html_e( 'Input Fields', 'contact-forms' ); ?></h2>

					<div class="accua-style-row" id="accua_form_style_field_spacing">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_spacing_check">margin-bottom</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Space between fields', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_padding">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_padding_check">padding</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Inner spacing in inputs', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_background_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_background_color_check">background-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Input field fill color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_border_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_border_color_check">border-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Input border color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_border_width">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_border_width_check">border-width</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Input border thickness', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_border_radius">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_border_radius_check">border-radius</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Input rounded corners', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_field_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_field_color_check">color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Input text color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<h2><?php esc_html_e( 'Submit Button', 'contact-forms' ); ?></h2>

					<div class="accua-style-row" id="accua_form_style_submit_padding">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_padding_check">padding</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button inner spacing', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_background_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_background_color_check">background-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button fill color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_color_check">color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button text color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_font_size">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_font_size_check">font-size</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button text size', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_border_color">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_border_color_check">border-color</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button border color', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_border_width">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_border_width_check">border-width</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button border thickness', 'contact-forms' ); ?></span>
					  </div>
					</div>

					<div class="accua-style-row" id="accua_form_style_submit_border_radius">
					  <div class="accua-style-toggle">
					    <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" ';} ?>/>
					  </div>
					  <div class="accua-style-content">
					    <label class="accua-style-label" for="accua_form_style_submit_border_radius_check">border-radius</label>
					    <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']); ?>" />
					    <span class="accua-style-help"><?php esc_html_e( 'Button rounded corners', 'contact-forms' ); ?></span>
					  </div>
					</div>

				  </div>
        </div>
    </div><!-- /panel: customise -->
    <div id="accua_tab_google_ads" class="accua-tabs__panel" role="tabpanel" data-tab="google_ads">
      <div class="postbox">
        <div class="postbox-header"><h2>Google Ads Conversion Tracking</h2></div>
        <div class="inside">
          <table class="form-table" role="presentation">
            <tr>
              <th scope="row"><label for="gads_conversion_code_input"><?php esc_html_e( 'GADS Conversion Code', 'contact-forms' ); ?></label></th>
              <td>
                <input type="text"
                  id="gads_conversion_code_input"
                  name="gads_conversion_tracking_code"
                  class="accua_form_value regular-text"
                  value="<?php echo esc_attr($form_data['gads_conversion_tracking_code'] ?? ''); ?>"
                  pattern="AW-\d+/[a-zA-Z0-9]+"
                  title="(es: AW-123456789/aaBBccDD)"
                />
                <span id="gads_code_validation_message" class="validation-message" style="display:none; color:#d63638;"></span>
                <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>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div><!-- /panel: google_ads -->

    <div id="accua_form_preview_pane" class="accua-form-preview-pane">
	        <h2><?php esc_html_e( 'Preview', 'contact-forms' ); ?></h2>
	        <div id="accua_form_preview_area_wrapper">
	        <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>
	        </div>
    </div>

 <div id="accua_tab_messages" class="accua-tabs__panel" role="tabpanel" data-tab="messages">
 <?php
  $email_font_formats =
    'Arial=arial,helvetica,sans-serif;'
    . 'Arial Black=arial black,avant garde,sans-serif;'
    . 'Comic Sans MS=comic sans ms,sans-serif;'
    . 'Courier New=courier new,courier,monospace;'
    . 'Georgia=georgia,palatino,serif;'
    . 'Lucida Sans=lucida sans unicode,lucida grande,sans-serif;'
    . 'Tahoma=tahoma,arial,helvetica,sans-serif;'
    . 'Times New Roman=times new roman,times,serif;'
    . 'Trebuchet MS=trebuchet ms,geneva,sans-serif;'
    . 'Verdana=verdana,geneva,sans-serif;';

  $settings_editor = array(
    'teeny' => true,
    'editor_class' => 'accua_form_value',
    'tinymce' => array(
        'toolbar1' => 'fontselect,|,bold,italic,underline,|,bullist,numlist,|,link,unlink',
        'font_formats' => $email_font_formats,
        'content_style' => 'body { font-family: arial, helvetica, sans-serif; }',
    ));
  ?>
   <div class="accua-settings-grid">
   <div class="postbox">
        <div class="postbox-header"><h2><?php esc_html_e('1. On-screen success message', 'contact-forms'); ?></h2></div>
        <div class="inside">
          <div id="accua_form_success_message">
            <fieldset class="accua-radio-group">
            <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>
            <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>
            <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>
            </fieldset>
            <div class="defalut_message">
              <?php esc_html_e( 'Default Success message', 'contact-forms' ); ?>
              <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['success_message'] ) ); ?></div>
            </div>
            <?php  wp_editor( $form_data['success_message'] , 'accua_form_success_message_textarea' , $settings_editor);   ?>
          </div>
        </div>
   </div>

   <div class="postbox">
        <div class="postbox-header"><h2><?php esc_html_e('2. On-screen error message', 'contact-forms'); ?></h2></div>
        <div class="inside">
          <div id="accua_form_error_message">
          <fieldset class="accua-radio-group">
          <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>
          <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>
          <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>
          </fieldset>
          <div class="defalut_message">
            <?php esc_html_e( 'Default error message', 'contact-forms' ); ?> <br />
            <div  class="defalut_content_message" ><?php echo wp_kses_post( wpautop( $default_form_data['error_message'] ) ); ?></div>
          </div>
          <?php  wp_editor( $form_data['error_message'] , 'accua_form_error_message_textarea' , $settings_editor); ?>
          </div>
        </div>
   </div>

   <div class="postbox">
        <div class="postbox-header"><h2><?php esc_html_e('3. Email to notify administrator', 'contact-forms'); ?></h2></div>
        <div class="inside">
          <table class="form-table" role="presentation">
            <tr>
              <th scope="row"><label><?php esc_html_e( 'To', 'contact-forms' ); ?></label></th>
              <td id="accua_form_admin_emails_to">
                <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'; ?> />
                <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>
                <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>
              </td>
            </tr>
            <tr>
              <th scope="row"><label><?php esc_html_e( 'Bcc', 'contact-forms' ); ?></label></th>
              <td id="accua_form_emails_bcc">
                <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'; ?> />
                <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>
                <?php if ( ! empty( $default_form_data['emails_bcc'] ) ) { ?>
                <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>
                <?php } ?>
              </td>
            </tr>
            <tr>
              <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
              <td id="accua_form_admin_emails_subject">
                <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'; ?> />
                <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>
                <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>
              </td>
            </tr>
          </table>

          <div id="accua_form_admin_emails_message">
            <fieldset class="accua-radio-group">
            <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>
            <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>
            <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>
            </fieldset>
            <div class="defalut_message">
              <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
              <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['admin_emails_message'] ) ); ?></div>
            </div>
            <?php  wp_editor( $form_data['admin_emails_message'] , 'accua_form_admin_emails_message_textarea' , $settings_editor);   ?>
          </div>

      </div>
   </div>

   <div class="postbox">
        <div class="postbox-header"><h2><?php esc_html_e('4. Email confirmation to the person who completed the form', 'contact-forms'); ?></h2></div>
        <div class="inside">
          <table class="form-table" role="presentation">
            <tr>
              <th scope="row"><label><?php esc_html_e( 'From name', 'contact-forms'); ?></label></th>
              <td id="accua_form_emails_from_name">
                <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'; ?> />
                <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>
                <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>
              </td>
            </tr>
            <tr>
              <th scope="row"><label><?php esc_html_e( 'From email', 'contact-forms'); ?></label></th>
              <td id="accua_form_emails_from">
                <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'; ?> />
                <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>
                <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>
              </td>
            </tr>
            <tr>
              <th scope="row"><label><?php esc_html_e( 'Subject', 'contact-forms'); ?></label></th>
              <td id="accua_form_confirmation_emails_subject">
                <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'; ?> />
                <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>
                <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>
              </td>
            </tr>
          </table>

           <div id="accua_form_confirmation_emails_message">
            <fieldset class="accua-radio-group">
            <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>
            <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>
            <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>
            </fieldset>
            <div class="defalut_message">
              <?php esc_html_e( 'Default message', 'contact-forms' ); ?>
              <div class="defalut_content_message"><?php echo wp_kses_post( wpautop( $default_form_data['confirmation_emails_message'] ) ); ?></div>
            </div>
            <?php  wp_editor( $form_data['confirmation_emails_message'] , 'accua_form_confirmation_emails_message_textarea' , $settings_editor);   ?>
          </div>
        </div>
   </div>
   </div><!-- /.accua-settings-grid -->
 </div><!-- /panel: messages -->

 <div id="accua_tab_tokens" class="accua-tabs__panel" role="tabpanel" data-tab="tokens">
   <div class="postbox">
     <div class="postbox-header"><h2><?php esc_html_e( 'Tokens', 'contact-forms' ); ?></h2></div>
     <div class="inside">
       <?php accua_forms_print_tokens(); ?>
     </div>
   </div>
</div>

<div id="accua_tab_retention" class="accua-tabs__panel" role="tabpanel" data-tab="retention">
<?php
  $global_retention = get_option( 'accua_forms_retention_data', array() );
  $global_retention = wp_parse_args( $global_retention, array( 'retention_value' => 0, 'retention_unit' => 'months', 'retention_mode' => 'anonymize' ) );
  $global_val  = (int) $global_retention['retention_value'];
  $global_unit = $global_retention['retention_unit'];
  $global_mode = $global_retention['retention_mode'];
  $unit_labels = array( 'days' => __( 'days', 'contact-forms' ), 'months' => __( 'months', 'contact-forms' ), 'years' => __( 'years', 'contact-forms' ) );
  $mode_labels = array( 'anonymize' => __( 'Anonymize', 'contact-forms' ), 'delete' => __( 'Delete permanently', 'contact-forms' ) );
  if ( $global_val > 0 ) {
    $global_summary = sprintf( '%d %s — %s', $global_val, $unit_labels[ $global_unit ] ?? $global_unit, $mode_labels[ $global_mode ] ?? $global_mode );
  } else {
    $global_summary = __( 'Keep indefinitely', 'contact-forms' );
  }
?>
   <div class="postbox">
   <div class="postbox-header"><h2><?php esc_html_e('Data Retention', 'contact-forms'); ?></h2></div>
   <div class="inside">
          <table class="form-table" role="presentation">
            <tr>
              <th scope="row"><?php esc_html_e( 'Override', 'contact-forms'); ?></th>
              <td>
                <input type="checkbox" name="submission_retention_override" id="accua_form_retention_override" value="1" <?php checked( ! empty( $form_data['submission_retention_override'] ) ); ?> />
                <label for="accua_form_retention_override"><?php esc_html_e( 'Override default data retention', 'contact-forms'); ?></label>
                <p class="description"><?php
                  printf(
                    /* translators: %s: current global retention summary, e.g. "12 months — Anonymize" or "Keep indefinitely" */
                    esc_html__( 'Global default: %s', 'contact-forms' ),
                    '<strong>' . esc_html( $global_summary ) . '</strong>'
                  );
                ?></p>
              </td>
            </tr>
          </table>
          <div id="accua_form_retention_fields" style="<?php echo empty( $form_data['submission_retention_override'] ) ? 'display:none;' : ''; ?>">
            <table class="form-table" role="presentation">
              <tr>
                <th scope="row"><label for="submission_retention_value"><?php esc_html_e( 'Retention period', 'contact-forms'); ?></label></th>
                <td>
                  <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;" />
                  <select name="submission_retention_unit" id="submission_retention_unit">
                    <option value="days" <?php selected( $form_data['submission_retention_unit'], 'days' ); ?>><?php esc_html_e( 'days', 'contact-forms'); ?></option>
                    <option value="months" <?php selected( $form_data['submission_retention_unit'], 'months' ); ?>><?php esc_html_e( 'months', 'contact-forms'); ?></option>
                    <option value="years" <?php selected( $form_data['submission_retention_unit'], 'years' ); ?>><?php esc_html_e( 'years', 'contact-forms'); ?></option>
                  </select>
                  <span class="description"><?php esc_html_e( '(0 = keep indefinitely)', 'contact-forms'); ?></span>
                </td>
              </tr>
              <tr>
                <th scope="row"><?php esc_html_e( 'When submissions expire', 'contact-forms'); ?></th>
                <td>
                  <fieldset>
                    <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_anonymize" value="anonymize" <?php checked( $form_data['submission_retention_mode'], 'anonymize' ); ?> />
                    <?php esc_html_e( 'Anonymize — replace personal data with placeholders, keep submission record for statistics', 'contact-forms'); ?></label><br />
                    <label><input type="radio" name="submission_retention_mode" id="submission_retention_mode_delete" value="delete" <?php checked( $form_data['submission_retention_mode'], 'delete' ); ?> />
                    <?php esc_html_e( 'Delete — permanently remove submission records from the database', 'contact-forms'); ?></label>
                  </fieldset>
                </td>
              </tr>
            </table>
          </div>
   </div></div>

</div><!-- /panel: retention -->

<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $fid_esc is pre-escaped with esc_attr() ?>
<input type="hidden" id="accua_form_save_settings_id" value="<?php echo $fid_esc; ?>" />

</div><!-- /#accua_tabs -->

<?php
}


```
