static function field_settings_callback()
    {
        //		echo "This is the field settings section";
        $field_type_array = array('text' => __('text', 'si-contact-form'), 'textarea' => __('textarea', 'si-contact-form'), 'checkbox' => __('checkbox', 'si-contact-form'), 'checkbox-multiple' => __('checkbox-multiple', 'si-contact-form'), 'radio' => __('radio', 'si-contact-form'), 'select' => __('select', 'si-contact-form'), 'select-multiple' => __('select-multiple', 'si-contact-form'), 'attachment' => __('attachment', 'si-contact-form'), 'date' => __('date', 'si-contact-form'), 'time' => __('time', 'si-contact-form'), 'email' => __('email', 'si-contact-form'), 'url' => __('url', 'si-contact-form'), 'hidden' => __('hidden', 'si-contact-form'), 'password' => __('password', 'si-contact-form'), 'fieldset' => __('fieldset(box-open)', 'si-contact-form'), 'fieldset-close' => __('fieldset(box-close)', 'si-contact-form'));
        $select_type_fields = array('checkbox-multiple', 'select', 'select-multiple', 'radio');
        // Display the field options
        ?>
		<div class="clear"></div>
		<fieldset class="fscf_settings_group fscf_field_settings">
        <div>
        <?php 
        if (empty(self::$new_field_added)) {
            ?>
        <div class="fscf_right" style="padding:7px;"><input type="button" class="button-primary" name="new_field" value="<?php 
            esc_attr_e('Add New Field', 'si-contact-form');
            ?>
" onclick="fscf_add_field('<?php 
            esc_attr_e('Add Field', 'si-contact-form');
            ?>
');" /></div>
        <?php 
        }
        ?>
        <p class="submit">
		<input id="submit2" class="button-primary" type="submit" value="<?php 
        esc_attr_e('Save Changes', 'si-contact-form');
        ?>
" onclick="document.pressed=this.value" name="submit" />
		</p>
        </div>
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_extra_fields_tip');">
		<strong><?php 
        _e('View instructions for fields', 'si-contact-form');
        ?>
</strong></a>
		<div class="fscf_tip" id="si_contact_extra_fields_tip"><br />

        <strong><?php 
        _e('Instructions for how to use Fields:', 'si-contact-form');
        ?>
</strong>
		<blockquote><ul>
			<li><?php 
        _e('Below are the settings for individual form fields.  Click on the "Show Details" button to the right of the field name to see the details for that field. ', 'si-contact-form');
        ?>
</li>
			<li><?php 
        _e('You can change the order in which the fields appear on the form.  Simply click on a field somewhere outside any of the text boxes and drag it into the position you desire.  When you click Save Changes, the new field order will be saved.', 'si-contact-form');
        ?>
</li>
			<li><?php 
        _e('You can also add extra fields of your own design for phone number, company name, etc. ', 'si-contact-form');
        ?>
			<?php 
        _e("To create an extra field, just click on the 'Add New Field' button on the right. Then choose the settings, including whether you want the field to be required or not. There is a checkbox to temporarily disable a field. If you don't need it any more, you can permanently delete a field with the Delete Field button.", 'si-contact-form');
        ?>
</li>
			<li><?php 
        _e('Field Labels must be unique.  The Labels on the default standard fields (Name, Email, Subject, Message) cannot be changed here, but you can change the label that displays on the form on the Labels tab.', 'si-contact-form');
        ?>
</li>
			</ul></blockquote>

            <p><strong><?php 
        _e('Field types:', 'si-contact-form');
        ?>
</strong></p>
			<blockquote>

            <p><strong><?php 
        _e('Text and Textarea fields:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The text field is for single line text entry. The textarea field is for multiple line text entry.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Checkbox field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('This is a single checkbox.  The field name is displayed next to the checkbox.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Checkbox-multiple, Radio, Select, and Select-multiple fields:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('These allow the user to select from a list of options.', 'si-contact-form');
        ?>
			<?php 
        _e('The options are entered in the "Select options" box, one per line.  You can also set the default selection with "Default option."', 'si-contact-form');
        ?>
			<?php 
        _e('You can use select-multiple and checkbox-multiple to allow the user to select more than one option from the list.', 'si-contact-form');
        ?>
			<?php 
        _e('By default, radio and checkboxes are displayed vertically, one per line. To make them display horizontally, check the "Inline" box.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Attachment field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The attachment field is used to allow users to attach a file upload to the form. The attachment is sent with your email, then deleted from the server after the email is sent. You can add multiple attachment fields.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Date field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The date field shows a calendar pop-up to allow the user to select a date. This ensures that a date entry is in a standard format every time.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Time field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The time field is used to allow a time entry field with hours, minutes, and AM/PM. The time field ensures that a time entry is in a standard format.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Email field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The email field is used to allow an email address entry field. The email field ensures that a email entry is in a valid email format.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('URL field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The URL field is used to allow a URL entry field. The URL field ensures that a URL entry is in a valid URL format.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Hidden field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The hidden field is used if you need to pass a hidden value from the form to the email message. The hidden field does not show on the page. You must set the field name and default value.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Password field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The password field is used for a text field where what is entered shows up as dots on the screen. The email you receive will have the entered value fully visible.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        _e('Fieldset:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        _e('The fieldset(box-open) is used to draw a box around related form elements. The field name is used for a title (legend) for the group.', 'si-contact-form');
        ?>
			<br />

            <?php 
        _e('The fieldset(box-close) is used to close a box around related form elements. A label is not required for this type. If you do not close a fieldset box, it will close automatically when you add another fieldset box.', 'si-contact-form');
        ?>
</p>
			</blockquote>

			<p><strong><?php 
        echo __('Field Properties:', 'si-contact-form');
        ?>
</strong></p>
			<blockquote>

            <p><i><?php 
        echo __('Some of these field properties apply only to certain field types.  Properties irrelevant for the selected field type will be ignored.', 'si-contact-form');
        ?>
			</i></p>

            <p><strong><?php 
        echo __('Tag:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('The field Tag is used to identify the field for email settings, shortcodes, and query variables.  Field tags must be unique.  If you leave the Tag entry blank, one will be generated for you based on the field name.  If you change a field name, you might want to change the tag to match.  Or just delete the tag, and a new one will be generated for you.', 'si-contact-form');
        ?>
</p>

			<p><strong><?php 
        echo __('Default:', 'si-contact-form');
        ?>
</strong><br />
            <?php 
        echo __('Use to pre-fill a value for the field. For select and radio fields, enter the number of the option to pre-select (1 = first item, etc.).  For select-multiple and checkbox-multiple, enter the list item number(s) to pre-select separated by commas.  For a checkbox, enter "1" to pre-check the box.', 'si-contact-form');
        ?>
            <?php 
        echo ' ';
        echo __('For a date field, you can enter any date in the configured format. Or to show today\'s date as default, just put the word today in brackets. example: [today].', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Default as placeholder:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Check this setting if you want the default text to be a placeholder inside the form field. The placeholder is a short hint that is displayed in the input field before the user enters a value. Works with the following input types only: name, email, subject, message, text, textarea, url, and password. This setting is sometimes used along with the "Hide label" setting.', 'si-contact-form');
        ?>
            <?php 
        echo ' <br /><br />';
        echo __('When using "Default as placeholder" setting with "Enable double email entry" setting enabled. The "Default" setting should be in this example format: "Email==Re-enter Email". Separate words with == separators.', 'si-contact-form');
        ?>
            <?php 
        echo ' <br /><br />';
        echo __('When using "Default as placeholder" setting with "First Name, Last Name" setting enabled. The "Default" setting should be in this example format: "First Name==Last Name". Separate words with == separators.', 'si-contact-form');
        ?>
            <?php 
        echo ' <br /><br />';
        echo __('When using "Default as placeholder" setting with "First Name, Middle Name, Last Name" setting enabled. The "Default" setting should be in this example format: "First Name==Middle Name==Last Name". Separate words with == separators.', 'si-contact-form');
        ?>
            </p>

            <p><strong><?php 
        echo __('Hide label:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Check this setting if you want to hide the field label on the form. This is sometimes used along with the "Default as placeholder" setting.', 'si-contact-form');
        ?>
</p>


			<p><strong><?php 
        echo __('Select options:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('List of options for select, select-multiple, radio, and checkbox-multiple field types.  Type the options, one per line. This entry is required for these field types.', 'si-contact-form');
        ?>
            <?php 
        echo ' ';
        echo __('The first option of a select field type can be in brackets to indicate that it must be selected, example: [Please select].', 'si-contact-form');
        ?>
            <?php 
        echo ' ';
        echo __('If you add options as a key==value set (use == to separate) the value will show on the form and the key will show in the email.', 'si-contact-form');
        ?>
            </p>

			<p><strong><?php 
        echo __('Inline:', 'si-contact-form');
        ?>
</strong><br />
            <?php 
        echo __('If checked, checkboxes and radio buttons appear horizontally on one line instead of vertically one per line.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Max length:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use to limit the number of allowed characters for a text field. The limit will be checked when the form is posted. Can be used for text, textarea, and password field types.', 'si-contact-form');
        ?>
			<?php 
        echo __(' This will not change the size of the field on the form.  To change that, use the size attribute (see below), or your add a width attribute to the "Input text fields" setting on the Styles tab.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Required field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Check this setting if you want the field to be required when the form is posted. Can be used for any field type.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Disable field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Check this setting if you do not want the field to appear on the form. Can be used for any field type.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Attributes:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use to insert input field attributes. Example: To make a text field readonly, set to: readonly="readonly"  To set the size of a field to 15 characters, use size=15. Can be used for any field type.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Validation regex:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use a regular expression to validate if form input is in a specific format. Example: If you want numbers in a text field type but do not allow text, use this regex: /^\\d+$/ Can be used for text, textarea, date and password field types.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Regex fail message:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use to customize a message to alert the user when the form fails to validate a regex after post. Example: Please only enter numbers. For use with validation regex only.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Label CSS/Input CSS:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use to style individual form fields with CSS. CSS class names or inline style code are both acceptable. Note: If you do not need to style fields individually, you should use the CSS settings on the Styles tab instead.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('HTML before/after field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Use the HTML before/after field to print some HTML before or after a field on the form. This is for the form display only, not email. HTML is allowed.', 'si-contact-form');
        ?>
</p>

            <p><strong><?php 
        echo __('Follow previous field:', 'si-contact-form');
        ?>
</strong><br />
			<?php 
        echo __('Check this setting if you want this field to show on the form following the previous field on the same line. For example, you could put state, and zip on one line. This feature seems to be limited to two fields, and it is only compatible with the "labels on top" style on a wide theme.', 'si-contact-form');
        ?>
</p>
		</blockquote>
		</div>
		<div class="clear"></div>

		<?php 
        // none of the field slugs can be the same as a post type rewrite_slug
        // or you will get "page not found" when posting the form with that field filled in
        self::get_post_types_slugs();
        $slug_list = array();
        foreach (self::$form_options['fields'] as $key => $field) {
            $slug_list[] = $field['slug'];
        }
        $bad_slug_list = array();
        foreach (self::$post_types_slugs as $key => $slug) {
            if (in_array(strtolower($slug), $slug_list)) {
                echo '<div id="message" class="error">';
                echo sprintf(__('Warning: one of your field tags conflicts with the post type redirect tag "%s". To automatically correct this, click the <b>Save Changes</b> button.', 'si-contact-form'), $slug);
                echo "</div>\n";
                $bad_slug_list[] = $slug;
            }
        }
        // fill in any missing defaults
        $field_opt_defaults = array('hide_label' => 'false', 'placeholder' => 'false');
        $placeholder_error = 0;
        $name_format_error = 0;
        $email_format_error = 0;
        $dup_field_error = 0;
        $field_names = array();
        $fields_count = count(self::$form_options['fields']);
        foreach (self::$form_options['fields'] as $key => $field) {
            $field_opt_name = self::$form_option_name . '[fields][' . $key . ']';
            // fill in any missing field options defaults
            foreach ($field_opt_defaults as $dfkey => $dfval) {
                if (!isset($field[$dfkey]) || empty($field[$dfkey])) {
                    $field[$dfkey] = $dfval;
                }
            }
            ?>

			<fieldset class="fscf_field" id="field-<?php 
            echo $key + 1;
            ?>
">

			<legend><b><?php 
            $label_changed = 0;
            // are there label overrides for standard field names? standard field labels can be renamed on the labels tab
            if (FSCF_NAME_FIELD == $field['standard']) {
                if (self::$form_options['title_name'] != '') {
                    $label_changed = 1;
                    echo self::$form_options['title_name'];
                } else {
                    echo esc_html($field['label']);
                }
            } else {
                if (FSCF_EMAIL_FIELD == $field['standard']) {
                    if (self::$form_options['title_email'] != '') {
                        $label_changed = 1;
                        echo self::$form_options['title_email'];
                    } else {
                        //echo esc_html($field['label']);
                        echo 'Email:';
                        // correction for old forms where it was Email Address:
                        $field['label'] = 'Email:';
                    }
                } else {
                    if (FSCF_SUBJECT_FIELD == $field['standard']) {
                        if (self::$form_options['title_subj'] != '') {
                            $label_changed = 1;
                            echo self::$form_options['title_subj'];
                        } else {
                            echo esc_html($field['label']);
                        }
                    } else {
                        if (FSCF_MESSAGE_FIELD == $field['standard']) {
                            if (self::$form_options['title_mess'] != '') {
                                $label_changed = 1;
                                echo self::$form_options['title_mess'];
                            } else {
                                echo esc_html($field['label']);
                            }
                        } else {
                            echo esc_html($field['label']);
                        }
                    }
                }
            }
            ?>
</b> <?php 
            if ('0' != $field['standard']) {
                if ($label_changed) {
                    _e('(standard field name was changed on the Labels tab)', 'si-contact-form');
                } else {
                    _e('(standard field)', 'si-contact-form');
                }
            }
            ?>
</legend>

			<input name="<?php 
            echo $field_opt_name . '[standard]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_standard';
            ?>
" type="hidden" 
				   value="<?php 
            echo esc_attr($field['standard']);
            ?>
" />
			<input name="<?php 
            echo $field_opt_name . '[delete]';
            ?>
" id="delete-<?php 
            echo +$key + 1;
            ?>
" type="hidden"
				   value="false" />
			<?php 
            // special notices
            // new field added message
            if (!empty(self::$new_field_added) && $fields_count == $key + 1) {
                // A new field was added, show a message
                echo '<div class="fsc-notice">' . self::$new_field_added . '</div>' . "\n";
                self::$new_field_key = $key + 1;
            }
            if (in_array(strtolower($field['slug']), $bad_slug_list)) {
                echo '<div class="fsc-error">' . sprintf(__('Warning: one of your field tags conflicts with the post type redirect tag "%s". To automatically correct this, click the <b>Save Changes</b> button.', 'si-contact-form'), $field['slug']) . '</div>' . "\n";
            }
            // warn if placeholder is missing the Default text
            if ($field['placeholder'] == 'true' && $field['default'] == '') {
                if (!$placeholder_error) {
                    echo '<div class="updated">';
                    echo __('Caution: "Default as placeholder" setting requires "Default" setting to be filled in. Correct this on the Fields tab and click <b>Save Changes</b>', 'si-contact-form');
                    echo "</div>\n";
                }
                echo '<div class="fsc-notice">' . __('Caution: "Default as placeholder" setting requires "Default" setting to be filled in. Correct this in the field details and click <b>Save Changes</b>', 'si-contact-form') . '</div>' . "\n";
                $placeholder_error = 1;
            }
            // warn if name default not in proper format
            if (FSCF_NAME_FIELD == $field['standard']) {
                $name_format_array = array('name' => __('Name', 'si-contact-form'), 'first_last' => __('First Name, Last Name', 'si-contact-form'), 'first_middle_i_last' => __('First Name, Middle Initial, Last Name', 'si-contact-form'), 'first_middle_last' => __('First Name, Middle Name, Last Name', 'si-contact-form'));
                if ($field['default'] != '' && self::$form_options['name_format'] == 'first_last') {
                    if (!preg_match('/^(.*)(==)(.*)$/', $field['default'], $matches)) {
                        $name_format_error = 'First Name==Last Name';
                    }
                } else {
                    if ($field['default'] != '' && self::$form_options['name_format'] == 'first_middle_last') {
                        if (!preg_match('/^(.*)(==)(.*)(==)(.*)$/', $field['default'], $matches)) {
                            $name_format_error = 'First Name==Middle Name==Last Name';
                        }
                    } else {
                        if ($field['default'] != '' && self::$form_options['name_format'] == 'first_middle_i_last') {
                            if (!preg_match('/^(.*)(==)(.*)(==)(.*)$/', $field['default'], $matches)) {
                                $name_format_error = 'First Name==Middle Initial==Last Name';
                            }
                        }
                    }
                }
                if ($name_format_error) {
                    $this_name_format = $name_format_array[self::$form_options['name_format']];
                    echo '<div class="updated">';
                    echo sprintf(__('Caution: Name field format "%s" requires the "Default" setting to be in this example format: %s. Separate words with == separators, or empty the "Default" setting. Correct this on the Fields tab and click <b>Save Changes</b>', 'si-contact-form'), $this_name_format, $name_format_error);
                    echo "</div>\n";
                    echo '<div class="fsc-notice">' . sprintf(__('Caution: Name field format "%s" requires the "Default" setting to be in this example format: %s. Separate words with == separators, or empty the "Default" setting. Correct this in the field details and click <b>Save Changes</b>', 'si-contact-form'), $this_name_format, $name_format_error) . '</div>' . "\n";
                }
            }
            // warn if double email default not in proper format
            if (FSCF_EMAIL_FIELD == $field['standard'] && 'true' == self::$form_options['double_email'] && $field['default'] != '') {
                if (!preg_match('/^(.*)(==)(.*)$/', $field['default'], $matches)) {
                    echo '<div class="updated">';
                    echo __('Caution: When "Enable double email entry" setting is enabled, the "Default" setting should be in this example format: Email==Re-enter Email. Separate words with == separators, or empty the "Default" setting. Correct this on the Fields tab and click <b>Save Changes</b>', 'si-contact-form');
                    echo "</div>\n";
                    echo '<div class="fsc-notice">' . __('Caution: "When Enable double email entry" setting is enabled, the "Default" setting should be in this example format: Email==Re-enter Email. Separate words with == separators, or empty the "Default" setting. Correct this in the field details and click <b>Save Changes</b>', 'si-contact-form') . '</div>' . "\n";
                }
            }
            // Make sure field names are unique
            if (in_array($field['label'], $field_names)) {
                // We have a duplicate field label, display an error message
                if (!$dup_field_error) {
                    echo '<div class="updated">';
                    echo __('Caution: Duplicate field label. Now you must change the field label on the Fields tab and click <b>Save Changes</b>', 'si-contact-form');
                    echo "</div>\n";
                }
                echo '<div class="fsc-notice">' . __('Caution: Duplicate field label. Change the field label and click <b>Save Changes</b>', 'si-contact-form') . '</div>' . "\n";
                $dup_field_error = 1;
            }
            $field_names[] = $field['label'];
            $k = +$key + 1;
            ?>
			<label for="fs_contact_field<?php 
            echo +$key + 1;
            ?>
_label"><?php 
            _e('Label:', 'si-contact-form');
            ?>
</label>
			<input name="<?php 
            echo $field_opt_name . '[label]';
            ?>
" id="fs_contact_field<?php 
            echo +$key + 1;
            ?>
_label" type="text"
				   value="<?php 
            echo esc_attr($field['label']);
            ?>
" size="70"
				   <?php 
            if ($field['standard'] > 0) {
                echo ' readonly="readonly"';
            }
            ?>
/>

			<label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_type';
            ?>
"><?php 
            echo __('Field type:', 'si-contact-form');
            ?>
</label>
			<?php 
            // Disable field type select for name and message
            ?>
			<select id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_type';
            ?>
"
				<?php 
            if (FSCF_NAME_FIELD == $field['standard'] || FSCF_MESSAGE_FIELD == $field['standard']) {
                echo ' disabled="disabled">';
            } else {
                echo ' name="' . $field_opt_name . '[type]">';
            }
            $selected = '';
            // Limit options for the Email and Subject fields
            if (FSCF_EMAIL_FIELD == $field['standard']) {
                // Only allow 'text' and 'email' type options
                if ($field['type'] == 'text') {
                    $selected = ' selected="selected"';
                }
                echo '<option value="text"' . $selected . '>' . esc_html(__('text', 'si-contact-form')) . '</option>' . "\n";
                $selected = '';
                if ($field['type'] == 'email') {
                    $selected = ' selected="selected"';
                }
                echo '<option value="email"' . $selected . '>' . esc_html(__('email', 'si-contact-form')) . '</option>' . "\n";
            } else {
                if (FSCF_SUBJECT_FIELD == $field['standard']) {
                    if ($field['type'] == 'text') {
                        $selected = ' selected="selected"';
                    }
                    echo '<option value="text"' . $selected . '>' . esc_html(__('text', 'si-contact-form')) . '</option>' . "\n";
                    $selected = '';
                    if ($field['type'] == 'select') {
                        $selected = ' selected="selected"';
                    }
                    echo '<option value="select"' . $selected . '>' . esc_html(__('select', 'si-contact-form')) . '</option>' . "\n";
                } else {
                    foreach ($field_type_array as $k => $v) {
                        if ($field['type'] == "{$k}") {
                            $selected = ' selected="selected"';
                        }
                        echo '<option value="' . esc_attr($k) . '"' . $selected . '>' . esc_html($v) . '</option>' . "\n";
                        $selected = '';
                    }
                }
            }
            ?>
			</select>
			<?php 
            if (FSCF_NAME_FIELD == $field['standard'] || FSCF_MESSAGE_FIELD == $field['standard']) {
                // Provide type field for disabled select lists
                ?>
				<input type="hidden" name="<?php 
                echo $field_opt_name . '[type]';
                ?>
" value="<?php 
                echo $field["type"];
                ?>
" />
			<?php 
            }
            ?>
			&nbsp;&nbsp;
			<input name="fscf_show_fields" type="button" id="button<?php 
            echo $key;
            ?>
" value="Show Details" class="button" onclick="toggleVisibilitybutton('<?php 
            echo $key;
            ?>
')" />
			<?php 
            if ("true" == $field['disable']) {
                echo '&nbsp;&nbsp<span class="fscf_warning_text">' . __('DISABLED', 'si-contact-form') . '</span>';
            }
            ?>
<br />
			<div id="field<?php 
            echo $key;
            ?>
" class="fscf_field_details">
            <?php 
            if ('0' != $field['standard']) {
                _e('Standard field labels can be changed on the Labels tab.', 'si-contact-form');
                echo '<br />';
            }
            if (FSCF_NAME_FIELD == $field['standard']) {
                // Add special fields for the Name field
                ?>
				<label for="fs_contact_name_format"><?php 
                _e('Name field format:', 'si-contact-form');
                ?>
</label>
				<select id="fs_contact_name_format" name="<?php 
                echo self::$form_option_name;
                ?>
[name_format]">
				<?php 
                $selected = '';
                foreach ($name_format_array as $k => $v) {
                    if (self::$form_options['name_format'] == "{$k}") {
                        $selected = ' selected="selected"';
                    }
                    echo '<option value="' . esc_attr($k) . '"' . $selected . '>' . esc_html($v) . '</option>' . "\n";
                    $selected = '';
                }
                ?>
				</select>
				<a style="cursor:pointer;" title="<?php 
                esc_attr_e('Click for Help!', 'si-contact-form');
                ?>
" onclick="toggleVisibility('si_contact_name_format_tip');"><?php 
                _e('help', 'si-contact-form');
                ?>
</a>
				<div class="fscf_tip" id="si_contact_name_format_tip">
				<?php 
                _e('Select how the name field is formatted on the form.', 'si-contact-form');
                ?>
				</div>&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="<?php 
                echo self::$form_option_name;
                ?>
[auto_fill_enable]" id="fs_contact_auto_fill_enable" type="checkbox" <?php 
                if (self::$form_options['auto_fill_enable'] == 'true') {
                    echo 'checked="checked"';
                }
                ?>
 value="true" />
				<label for="fs_contact_auto_fill_enable"><?php 
                _e('Enable auto form fill', 'si-contact-form');
                ?>
.</label>
				<a style="cursor:pointer;" title="<?php 
                esc_attr_e('Click for Help!', 'si-contact-form');
                ?>
" onclick="toggleVisibility('si_contact_auto_fill_enable_tip');"><?php 
                _e('help', 'si-contact-form');
                ?>
</a>
				<div class="fscf_tip" id="si_contact_auto_fill_enable_tip">
					<?php 
                _e('Auto form fill email address and name (username) on the contact form for logged in users who are not administrators.', 'si-contact-form');
                ?>
				</div>
				<br />
			<?php 
            }
            ?>

		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_slug';
            ?>
"><?php 
            echo __('Tag', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[slug]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_slug';
            ?>
" type="text"
				  value="<?php 
            echo esc_attr($field['slug']);
            ?>
" <?php 
            if ($field['standard'] != '0') {
                echo ' readonly';
            }
            ?>
 size="45" />	
		   
		   &nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[req]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_req';
            ?>
" type="checkbox" 
			   <?php 
            if ($field['req'] == 'true' || FSCF_EMAIL_FIELD == $field['standard'] && self::$form_options['double_email'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_req';
            ?>
"><?php 
            _e('Required field', 'si-contact-form');
            ?>
</label>&nbsp;&nbsp;

		   &nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[disable]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_disable';
            ?>
" type="checkbox" 
			   <?php 
            if ($field['disable'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_disable';
            ?>
"><?php 
            _e('Disable field', 'si-contact-form');
            ?>
</label>

			&nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[follow]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_follow';
            ?>
" type="checkbox"
			   <?php 
            if ($field['follow'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
			<label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_follow';
            ?>
"><?php 
            _e('Follow previous field', 'si-contact-form');
            ?>
</label><br />

		   <strong><?php 
            echo __('Field modifiers', 'si-contact-form');
            ?>
:</strong>&nbsp;&nbsp;
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_default';
            ?>
"><?php 
            echo __('Default', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[default]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_default';
            ?>
" type="text"
				  value="<?php 
            echo esc_attr($field['default']);
            ?>
" size="45" />

           &nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[hide_label]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_hide_label';
            ?>
" type="checkbox"
			   <?php 
            if ($field['hide_label'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
			<label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_hide_label';
            ?>
"><?php 
            _e('Hide label', 'si-contact-form');
            ?>
</label>

           &nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[placeholder]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_placeholder';
            ?>
" type="checkbox"
			   <?php 
            if ($field['placeholder'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
			<label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_placeholder';
            ?>
"><?php 
            _e('Default as placeholder', 'si-contact-form');
            ?>
</label>


		   <div class="fscf-clear"></div>
			<div class="fscf_left">
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_options';
            ?>
"><?php 
            echo __('Select options', 'si-contact-form');
            if (in_array($field['type'], $select_type_fields)) {
                echo ' (Required)';
            }
            ?>
:</label><br />
		   <textarea rows="6" cols="40" name="<?php 
            echo $field_opt_name . '[options]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_options';
            ?>
"><?php 
            echo esc_textarea(trim($field['options']));
            ?>
</textarea></div>
		   &nbsp;&nbsp;&nbsp;<input name="<?php 
            echo $field_opt_name . '[inline]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_inline';
            ?>
" type="checkbox"
			   <?php 
            if ($field['inline'] == 'true') {
                echo 'checked="checked"';
            }
            ?>
 value="true" />
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_inline';
            ?>
"><?php 
            _e('Inline', 'si-contact-form');
            ?>
</label>&nbsp;&nbsp;&nbsp;

		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_max_len';
            ?>
"><?php 
            echo __('Max length', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[max_len]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_max_len';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['max_len']);
            ?>
" size="2" />
		   
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_attributes';
            ?>
"><?php 
            echo __('Attributes', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[attributes]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_attributes';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['attributes']);
            ?>
" size="20" />

		   <br /><label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_regex';
            ?>
"><?php 
            echo __('Validation regex', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[regex]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_regex';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['regex']);
            ?>
" size="20" /><br />

		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_regex_error';
            ?>
"><?php 
            echo __('Regex fail message', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[regex_error]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_regex_error';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['regex_error']);
            ?>
" size="35" /><br />

		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_label_css';
            ?>
"><?php 
            echo __('Label CSS', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[label_css]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_label_css';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['label_css']);
            ?>
" size="53" />

		   <br /><label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_input_css';
            ?>
"><?php 
            echo __('Input CSS', 'si-contact-form');
            ?>
:</label>
		   <input name="<?php 
            echo $field_opt_name . '[input_css]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_input_css';
            ?>
" type="text" 
				  value="<?php 
            echo esc_attr($field['input_css']);
            ?>
" size="53" /><br />

           <?php 
            do_action('fs_contact_fields_extra_modifiers', $field_opt_name, $field, $key);
            ?>

		   <div class="clear"></div>
		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_notes';
            ?>
"><?php 
            _e('HTML before form field:', 'si-contact-form');
            ?>
</label><br />
		   <textarea rows="2" cols="40" name="<?php 
            echo $field_opt_name . '[notes]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_notes';
            ?>
"><?php 
            echo esc_textarea($field['notes']);
            ?>
</textarea><br />

		   <label for="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_notes_after';
            ?>
"><?php 
            _e('HTML after form field:', 'si-contact-form');
            ?>
</label><br />
		   <textarea rows="2" cols="40" name="<?php 
            echo $field_opt_name . '[notes_after]';
            ?>
" id="<?php 
            echo 'fs_contact_field' . +$key + 1 . '_notes_after';
            ?>
"><?php 
            echo esc_textarea($field['notes_after']);
            ?>
</textarea><br />

       <p class="submit">
		<input id="submit2" class="button-primary" type="submit" value="<?php 
            esc_attr_e('Save Changes', 'si-contact-form');
            ?>
" onclick="document.pressed=this.value" name="submit" />
        <?php 
            if ('0' == $field['standard'] && empty(self::$new_field_added)) {
                ?>
				<input type="button" class="button-primary" name="<?php 
                echo 'delte field-' . $key;
                ?>
"
				   value="<?php 
                esc_attr_e('Delete Field', 'si-contact-form');
                ?>
" onclick="fscf_delete_field('<?php 
                echo $key + 1;
                ?>
')" />
		<?php 
            }
            echo '</p>';
            if (FSCF_EMAIL_FIELD == $field['standard']) {
                // Add extra field to the email field
                ?>
				<br /><input name="<?php 
                echo self::$form_option_name;
                ?>
[double_email]" id="fs_contact_double_email" type="checkbox" <?php 
                if (self::$form_options['double_email'] == 'true') {
                    echo 'checked="checked"';
                }
                ?>
 value="true" />
				<label for="fs_contact_double_email"><?php 
                _e('Enable double email entry required on the form.', 'si-contact-form');
                ?>
</label>
				<a style="cursor:pointer;" title="<?php 
                esc_attr_e('Click for Help!', 'si-contact-form');
                ?>
" onclick="toggleVisibility('si_contact_double_email_tip');"><?php 
                _e('help', 'si-contact-form');
                ?>
</a>
				<div class="fscf_tip" id="si_contact_double_email_tip">
				<?php 
                _e('Requires users to enter email address in two fields to help reduce mistakes. Note: "Required field" will also be set.', 'si-contact-form');
                ?>
				</div>
				<br />
				<?php 
            }
            ?>
			</div>
			</fieldset>
			<?php 
        }
        // end foreach
        // Settings affecting all fields
        ?>
        <div>
        <?php 
        if (empty(self::$new_field_added)) {
            ?>
		<div class="fscf_right" style="padding:7px;"><input type="button" class="button-primary" name="new_field" value="<?php 
            esc_attr_e('Add New Field', 'si-contact-form');
            ?>
" onclick="fscf_add_field('<?php 
            esc_attr_e('Add Field', 'si-contact-form');
            ?>
');" /></div>
        <?php 
        }
        ?>
        <p class="submit">
		<input id="submit2" class="button-primary" type="submit" value="<?php 
        esc_attr_e('Save Changes', 'si-contact-form');
        ?>
" onclick="document.pressed=this.value" name="submit" />
		</p>
        </div>

		<?php 
        self::display_ads();
        ?>

		<p><strong>General Field Settings</strong></p>
		<label for="fs_contact_date_format"><?php 
        _e('Date field - Date format:', 'si-contact-form');
        ?>
</label>
		<select id="fs_contact_date_format" name="<?php 
        echo self::$form_option_name;
        ?>
[date_format]">
			<?php 
        $selected = '';
        $cal_date_array = array('mm/dd/yyyy' => __('mm/dd/yyyy', 'si-contact-form'), 'dd/mm/yyyy' => __('dd/mm/yyyy', 'si-contact-form'), 'mm-dd-yyyy' => __('mm-dd-yyyy', 'si-contact-form'), 'dd-mm-yyyy' => __('dd-mm-yyyy', 'si-contact-form'), 'mm.dd.yyyy' => __('mm.dd.yyyy', 'si-contact-form'), 'dd.mm.yyyy' => __('dd.mm.yyyy', 'si-contact-form'), 'yyyy/mm/dd' => __('yyyy/mm/dd', 'si-contact-form'), 'yyyy-mm-dd' => __('yyyy-mm-dd', 'si-contact-form'), 'yyyy.mm.dd' => __('yyyy.mm.dd', 'si-contact-form'));
        foreach ($cal_date_array as $k => $v) {
            if (self::$form_options['date_format'] == "{$k}") {
                $selected = ' selected="selected"';
            }
            echo '<option value="' . esc_attr($k) . '"' . $selected . '>' . esc_html($v) . '</option>' . "\n";
            $selected = '';
        }
        ?>
		</select>
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_date_format_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_date_format_tip">
		<?php 
        _e('Use to set the date format for the date field.', 'si-contact-form');
        ?>
		</div>
		<br />

		<label for="fs_contact_cal_start_day"><?php 
        _e('Date field - Calendar Start Day of the Week', 'si-contact-form');
        ?>
:</label>
		<input name="<?php 
        echo self::$form_option_name;
        ?>
[cal_start_day]" id="fs_contact_cal_start_day" type="text" value="<?php 
        echo absint(self::$form_options['cal_start_day']);
        ?>
" size="3" />
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_cal_start_day_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_cal_start_day_tip">
		<?php 
        _e('Use to set the day the week the date field calendar will start on: 0(Sun) to 6(Sat).', 'si-contact-form');
        ?>
		</div>
		<br />

		<label for="fs_contact_time_format"><?php 
        _e('Time field - Time format:', 'si-contact-form');
        ?>
</label>
		<select id="fs_contact_time_format" name="<?php 
        echo self::$form_option_name;
        ?>
[time_format]">
			<?php 
        $selected = '';
        $time_format_array = array('12' => __('12 Hour', 'si-contact-form'), '24' => __('24 Hour', 'si-contact-form'));
        foreach ($time_format_array as $k => $v) {
            if (self::$form_options['time_format'] == "{$k}") {
                $selected = ' selected="selected"';
            }
            echo '<option value="' . esc_attr($k) . '"' . $selected . '>' . esc_html($v) . '</option>' . "\n";
            $selected = '';
        }
        ?>
		</select>
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_time_format_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_time_format_tip">
		<?php 
        _e('Use to set the time format for the time field.', 'si-contact-form');
        ?>
		</div>
		<br />


		<label for="fs_contact_attach_types"><?php 
        _e('Attached files acceptable types', 'si-contact-form');
        ?>
:</label>
		<input name="<?php 
        echo self::$form_option_name;
        ?>
[attach_types]" id="fs_contact_attach_types" type="text" value="<?php 
        echo esc_attr(self::$form_options['attach_types']);
        ?>
" size="60" />
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_attach_types_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_attach_types_tip">
		<?php 
        _e('Set the acceptable file types for the file attachment feature. Any file type not on this list will be rejected.', 'si-contact-form');
        ?>
		<?php 
        _e('Separate each file type with a comma character. example:', 'si-contact-form');
        ?>
		doc,docx,pdf,txt,gif,jpg,jpeg,png
		</div>
		<br />

		<label for="fs_contact_attach_size"><?php 
        _e('Attached files maximum size allowed', 'si-contact-form');
        ?>
:</label>
		<input name="<?php 
        echo self::$form_option_name;
        ?>
[attach_size]" id="fs_contact_attach_size" type="text" value="<?php 
        echo esc_attr(self::$form_options['attach_size']);
        ?>
" size="30" />
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_attach_size_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_attach_size_tip">
			<?php 
        _e('Set the acceptable maximum file size for the file attachment feature.', 'si-contact-form');
        ?>
<br />
			<?php 
        _e('example: 1mb equals one Megabyte, 1kb equals one Kilobyte', 'si-contact-form');
        $max_upload = (int) ini_get('upload_max_filesize');
        $max_post = (int) ini_get('post_max_size');
        $memory_limit = (int) ini_get('memory_limit');
        $upload_mb = min($max_upload, $max_post, $memory_limit);
        ?>
<br />
		<?php 
        _e('Note: Maximum size is limited to available server resources and various PHP settings. Very few servers will accept more than 2mb. Sizes under 1mb will usually have best results. examples:', 'si-contact-form');
        ?>
		500kb, 800kb, 1mb, 1.5mb, 2mb
		<?php 
        _e('Note: If you set the value higher than your server can handle, users will have problems uploading big files. The form can time out and may not even show an error.', 'si-contact-form');
        ?>
			<b><?php 
        _e('Your server will not allow uploading files larger than than:', 'si-contact-form');
        echo " {$upload_mb}";
        ?>
mb</b>
		</div>
		<br />

		<input name="<?php 
        echo self::$form_option_name;
        ?>
[textarea_html_allow]" id="fs_contact_textarea_html_allow" type="checkbox" <?php 
        if (self::$form_options['textarea_html_allow'] == 'true') {
            echo 'checked="checked"';
        }
        ?>
 value="true" />
		<label for="fs_contact_textarea_html_allow"><?php 
        _e('Enable users to send HTML code in the textarea extra field types.', 'si-contact-form');
        ?>
</label>
		<a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_textarea_html_allow_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
		<div class="fscf_tip" id="si_contact_textarea_html_allow_tip">
		<?php 
        _e('This setting is disabled by default for better security. Enable only if you want users to be able to send HTML code in the textarea extra field types. HTML code allowed will be filtered and limited to a few safe tags only.', 'si-contact-form');
        ?>
		</div>
		<br />

	   <input name="<?php 
        echo self::$form_option_name;
        ?>
[preserve_space_enable]" id="fs_contact_preserve_space_enable" type="checkbox" <?php 
        if (self::$form_options['preserve_space_enable'] == 'true') {
            echo 'checked="checked"';
        }
        ?>
 value="true" />
	   <label for="fs_contact_preserve_space_enable"><?php 
        _e('Preserve Message field spaces.', 'si-contact-form');
        ?>
</label>
	   <a style="cursor:pointer;" title="<?php 
        esc_attr_e('Click for Help!', 'si-contact-form');
        ?>
" onclick="toggleVisibility('si_contact_preserve_space_enable_tip');"><?php 
        _e('help', 'si-contact-form');
        ?>
</a>
	   <div class="fscf_tip" id="si_contact_preserve_space_enable_tip">
	   <?php 
        _e('Normally the textarea fields will have all extra white space removed. Enabling this setting will allow all the textarea field white space to be preserved.', 'si-contact-form');
        ?>
	   </div>
	   <br />		
		
		</fieldset>

		<?php 
    }