class-evf-builder-fields.php
2 weeks ago
class-evf-builder-integrations.php
2 weeks ago
class-evf-builder-page.php
2 months ago
class-evf-builder-payments.php
2 weeks ago
class-evf-builder-settings.php
3 months ago
class-evf-builder-settings.php
1079 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * EverestForms Builder Settings |
| 5 | * |
| 6 | * @package EverestForms\Admin |
| 7 | * @since 1.2.0 |
| 8 | */ |
| 9 | |
| 10 | use EverestForms\Helpers\FormHelper; |
| 11 | |
| 12 | defined( 'ABSPATH' ) || exit; |
| 13 | |
| 14 | if ( class_exists( 'EVF_Builder_Settings', false ) ) { |
| 15 | return new EVF_Builder_Settings(); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * EVF_Builder_Settings class. |
| 20 | */ |
| 21 | class EVF_Builder_Settings extends EVF_Builder_Page { |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * Constructor. |
| 26 | */ |
| 27 | public function __construct() { |
| 28 | $this->id = 'settings'; |
| 29 | $this->label = esc_html__( 'Settings', 'everest-forms' ); |
| 30 | $this->sidebar = true; |
| 31 | |
| 32 | add_action( 'everest_forms_settings_connections_email', array( $this, 'output_connections_list' ) ); |
| 33 | |
| 34 | add_filter( 'everest_forms_builder_settings_section', array( $this, 'add_custom_css_js_section' ), 11, 2 ); |
| 35 | add_action( 'everest_forms_settings_panel_content', array( $this, 'add_custom_css_js_settings' ), 111, 1 ); |
| 36 | |
| 37 | parent::__construct(); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Outputs the builder sidebar. |
| 42 | */ |
| 43 | public function output_sidebar() { |
| 44 | $sections = apply_filters( |
| 45 | 'everest_forms_builder_settings_section', |
| 46 | array( |
| 47 | 'general' => esc_html__( 'General', 'everest-forms' ), |
| 48 | 'email' => esc_html__( 'Email', 'everest-forms' ), |
| 49 | 'confirmation' => esc_html__( 'Confirmation', 'everest-forms' ), |
| 50 | 'security' => esc_html__( 'Anti-Spam and Security', 'everest-forms' ), |
| 51 | ), |
| 52 | $this->form_data |
| 53 | ); |
| 54 | |
| 55 | if ( ! empty( $sections ) ) { |
| 56 | foreach ( $sections as $slug => $section ) { |
| 57 | $this->add_sidebar_tab( $section, $slug ); |
| 58 | do_action( 'everest_forms_settings_connections_' . $slug, $section ); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Get form data |
| 65 | * |
| 66 | * @return array form data. |
| 67 | */ |
| 68 | private function form_data() { |
| 69 | $form_data = array(); |
| 70 | |
| 71 | if ( ! empty( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
| 72 | $form_data = evf()->form->get( absint( $_GET['form_id'] ), array( 'content_only' => true ) ); // phpcs:ignore WordPress.Security.NonceVerification |
| 73 | } |
| 74 | |
| 75 | return $form_data; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Outputs the connection lists on sidebar. |
| 80 | */ |
| 81 | public function output_connections_list() { |
| 82 | $form_data = $this->form_data(); |
| 83 | $email = isset( $form_data['settings']['email'] ) ? $form_data['settings']['email'] : array(); |
| 84 | |
| 85 | if ( empty( $email ) ) { |
| 86 | $email['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 87 | } |
| 88 | |
| 89 | ?> |
| 90 | <div class="everest-forms-active-email"> |
| 91 | <button class="everest-forms-btn everest-forms-btn-primary everest-forms-email-add" data-form_id=" |
| 92 | <?php |
| 93 | echo isset( $_GET['form_id'] ) ? absint( sanitize_text_field( wp_unslash( $_GET['form_id'] ) ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification |
| 94 | ?> |
| 95 | " data-source="email" data-type="<?php echo esc_attr( 'connection' ); ?>"> |
| 96 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> |
| 97 | <path d="M12 21.95c-.6 0-1-.4-1-1v-8H3.1c-.6 0-1-.4-1-1s.4-1 1-1H11v-7.9c0-.6.4-1 1-1s1 .4 1 1v7.9h7.9c.6 0 1 .4 1 1s-.4 1-1 1H13v8c0 .6-.4 1-1 1Z" /> |
| 98 | </svg> |
| 99 | <?php printf( esc_html__( 'Add New Email', 'everest-forms' ) ); ?> |
| 100 | </button> |
| 101 | <ul class="everest-forms-active-email-connections-list"> |
| 102 | <?php if ( ! empty( $email ) ) { ?> |
| 103 | <h4><?php echo esc_html__( 'Email Notifications', 'everest-forms' ); ?> </h4> |
| 104 | <?php |
| 105 | } |
| 106 | if ( ! empty( $email ) ) { |
| 107 | foreach ( $email as $connection_id => $connection_data ) { |
| 108 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 109 | $connection_name = ! empty( $connection_data['connection_name'] ) ? $connection_data['connection_name'] : ''; |
| 110 | if ( 'connection_1' !== $connection_id ) { |
| 111 | $remove_class = 'everest-forms-email-remove'; |
| 112 | $duplicate_class = 'everest-forms-duplicate-email'; |
| 113 | $preview_class = 'everest-forms-email-preview'; |
| 114 | } else { |
| 115 | $remove_class = 'everest-forms-email-default-remove'; |
| 116 | $duplicate_class = 'everest-forms-email-default-duplicate'; |
| 117 | $preview_class = 'everest-forms-email-preview'; |
| 118 | } |
| 119 | if ( isset( $email['enable_email_notification'] ) && '0' === $email['enable_email_notification'] ) { |
| 120 | $email_status = isset( $email['enable_email_notification'] ) ? $email['enable_email_notification'] : '1'; |
| 121 | } else { |
| 122 | $email_status = isset( $email[ $connection_id ]['enable_email_notification'] ) ? $email[ $connection_id ]['enable_email_notification'] : '1'; |
| 123 | } |
| 124 | ?> |
| 125 | <li class="connection-list" data-connection-id="<?php echo esc_attr( $connection_id ); ?>"> |
| 126 | <a class="user-nickname" href="#"><?php echo esc_html( $connection_name ); ?></a> |
| 127 | <div class="evf-email-side-section"> |
| 128 | <div class="evf-toggle-section"> |
| 129 | <span class="everest-forms-toggle-form"> |
| 130 | <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat"> |
| 131 | <input type="checkbox" class="evf-email-toggle" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="1" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" <?php echo checked( '1', $email_status, false ); ?>> |
| 132 | <span class="slider round"></span> |
| 133 | </span> |
| 134 | </div> |
| 135 | <span class="evf-vertical-divider"></span> |
| 136 | <a href="#"> |
| 137 | <span class="<?php echo esc_attr( $remove_class ); ?>"> |
| 138 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> |
| 139 | <path fill-rule="evenodd" d="M9.293 3.293A1 1 0 0 1 10 3h4a1 1 0 0 1 1 1v1H9V4a1 1 0 0 1 .293-.707ZM7 5V4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h4a1 1 0 1 1 0 2h-1v13a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7H3a1 1 0 1 1 0-2h4Zm1 2h10v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7h2Zm2 3a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0v-6a1 1 0 0 1 1-1Zm5 7v-6a1 1 0 1 0-2 0v6a1 1 0 1 0 2 0Z" clip-rule="evenodd" /> |
| 140 | </svg> |
| 141 | </span> |
| 142 | </a> |
| 143 | <span class="evf-vertical-divider"></span> |
| 144 | <?php |
| 145 | $preview_url = esc_url( |
| 146 | add_query_arg( |
| 147 | array( |
| 148 | 'evf_email_preview' => $connection_id, |
| 149 | 'form_id' => isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0, |
| 150 | ), |
| 151 | home_url() |
| 152 | ) |
| 153 | ); |
| 154 | ?> |
| 155 | <a class="<?php echo esc_attr( $preview_class ); ?>" target="__blank" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" href="<?php echo esc_url( $preview_url ); ?>"> |
| 156 | <span class="<?php echo esc_attr( $preview_class ); ?>"> |
| 157 | <svg xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/1999/svg" |
| 158 | viewBox="0 0 442.04 442.04" xml:space="preserve"> |
| 159 | <g id="SVGRepo_bgCarrier" stroke-width="0"></g> |
| 160 | <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g> |
| 161 | <g id="SVGRepo_iconCarrier"> |
| 162 | <g> |
| 163 | <g> |
| 164 | <path d="M221.02,341.304c-49.708,0-103.206-19.44-154.71-56.22C27.808,257.59,4.044,230.351,3.051,229.203 c-4.068-4.697-4.068-11.669,0-16.367c0.993-1.146,24.756-28.387,63.259-55.881c51.505-36.777,105.003-56.219,154.71-56.219 c49.708,0,103.207,19.441,154.71,56.219c38.502,27.494,62.266,54.734,63.259,55.881c4.068,4.697,4.068,11.669,0,16.367 c-0.993,1.146-24.756,28.387-63.259,55.881C324.227,321.863,270.729,341.304,221.02,341.304z M29.638,221.021 c9.61,9.799,27.747,27.03,51.694,44.071c32.83,23.361,83.714,51.212,139.688,51.212s106.859-27.851,139.688-51.212 c23.944-17.038,42.082-34.271,51.694-44.071c-9.609-9.799-27.747-27.03-51.694-44.071 c-32.829-23.362-83.714-51.212-139.688-51.212s-106.858,27.85-139.688,51.212C57.388,193.988,39.25,211.219,29.638,221.021z"></path> |
| 165 | </g> |
| 166 | <g> |
| 167 | <path d="M221.02,298.521c-42.734,0-77.5-34.767-77.5-77.5c0-42.733,34.766-77.5,77.5-77.5c18.794,0,36.924,6.814,51.048,19.188 c5.193,4.549,5.715,12.446,1.166,17.639c-4.549,5.193-12.447,5.714-17.639,1.166c-9.564-8.379-21.844-12.993-34.576-12.993 c-28.949,0-52.5,23.552-52.5,52.5s23.551,52.5,52.5,52.5c28.95,0,52.5-23.552,52.5-52.5c0-6.903,5.597-12.5,12.5-12.5 s12.5,5.597,12.5,12.5C298.521,263.754,263.754,298.521,221.02,298.521z"></path> |
| 168 | </g> |
| 169 | <g> |
| 170 | <path d="M221.02,246.021c-13.785,0-25-11.215-25-25s11.215-25,25-25c13.786,0,25,11.215,25,25S234.806,246.021,221.02,246.021z"></path> |
| 171 | </g> |
| 172 | </g> |
| 173 | </g> |
| 174 | </svg> |
| 175 | </span> |
| 176 | </a> |
| 177 | <span class="evf-vertical-divider"></span> |
| 178 | <a href="#" class="everest-forms-email-duplicate"> |
| 179 | <span class="<?php echo esc_attr( $duplicate_class ); ?>"> |
| 180 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 25"> |
| 181 | <path fill-rule="evenodd" d="M3.033 3.533c.257-.257.605-.4.968-.4h9A1.368 1.368 0 0 1 14.369 4.5v1a.632.632 0 0 0 1.263 0v-1a2.632 2.632 0 0 0-2.631-2.632H4A2.632 2.632 0 0 0 1.368 4.5v9A2.631 2.631 0 0 0 4 16.131h1a.632.632 0 0 0 0-1.263H4A1.368 1.368 0 0 1 2.631 13.5v-9c0-.363.144-.711.401-.968Zm6.598 7.968A1.37 1.37 0 0 1 11 10.132h9c.756 0 1.368.613 1.368 1.369v9c0 .755-.612 1.368-1.368 1.368h-9A1.368 1.368 0 0 1 9.63 20.5v-9ZM11 8.869A2.632 2.632 0 0 0 8.368 11.5v9A2.632 2.632 0 0 0 11 23.131h9a2.632 2.632 0 0 0 2.63-2.631v-9A2.632 2.632 0 0 0 20 8.87h-9Z" clip-rule="evenodd"></path> |
| 182 | </svg> |
| 183 | </span> |
| 184 | </a> |
| 185 | </div> |
| 186 | </li> |
| 187 | <?php |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | ?> |
| 192 | </ul> |
| 193 | </div> |
| 194 | <?php |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Outputs the builder content. |
| 199 | */ |
| 200 | public function output_content() { |
| 201 | $settings = isset( $this->form_data['settings'] ) ? $this->form_data['settings'] : array(); |
| 202 | |
| 203 | // --------------------------------------------------------------------// |
| 204 | // General |
| 205 | // --------------------------------------------------------------------// |
| 206 | echo '<div class="evf-content-section evf-content-general-settings">'; |
| 207 | echo '<div class="evf-content-section-title">'; |
| 208 | esc_html_e( 'General', 'everest-forms' ); |
| 209 | echo '</div>'; |
| 210 | everest_forms_panel_field( |
| 211 | 'text', |
| 212 | 'settings', |
| 213 | 'form_title', |
| 214 | $this->form_data, |
| 215 | esc_html__( 'Form Name', 'everest-forms' ), |
| 216 | array( |
| 217 | 'default' => isset( $this->form->post_title ) ? $this->form->post_title : '', |
| 218 | 'tooltip' => esc_html__( 'Give a name to this form', 'everest-forms' ), |
| 219 | ) |
| 220 | ); |
| 221 | everest_forms_panel_field( |
| 222 | 'textarea', |
| 223 | 'settings', |
| 224 | 'form_description', |
| 225 | $this->form_data, |
| 226 | esc_html__( 'Form description', 'everest-forms' ), |
| 227 | array( |
| 228 | 'input_class' => 'short', |
| 229 | 'default' => isset( $this->form->form_description ) ? $this->form->form_description : '', |
| 230 | 'tooltip' => sprintf( esc_html__( 'Give the description to this form', 'everest-forms' ) ), |
| 231 | ) |
| 232 | ); |
| 233 | |
| 234 | $this->form_data['settings']['form_tags'] = FormHelper::get_form_tags( $this->form_data['id'], 'slug' ); |
| 235 | |
| 236 | everest_forms_panel_field( |
| 237 | 'select', |
| 238 | 'settings', |
| 239 | 'form_tags', |
| 240 | $this->form_data, |
| 241 | esc_html__( 'Tags', 'everest-forms' ), |
| 242 | array( |
| 243 | 'default' => '', |
| 244 | 'tooltip' => esc_html__( 'Please choose a tags from the list, or type in a new tag if you\'d like to add one.', 'everest-forms' ), |
| 245 | 'options' => FormHelper::get_all_form_tags(), |
| 246 | 'input_class' => 'form-tags-select2', |
| 247 | 'multiple' => true, |
| 248 | 'placeholder' => esc_html__( 'Select or type tags', 'everest-forms' ), |
| 249 | ) |
| 250 | ); |
| 251 | |
| 252 | everest_forms_panel_field( |
| 253 | 'textarea', |
| 254 | 'settings', |
| 255 | 'form_disable_message', |
| 256 | $this->form_data, |
| 257 | esc_html__( 'Form disabled message', 'everest-forms' ), |
| 258 | array( |
| 259 | 'input_class' => 'short', |
| 260 | 'default' => isset( $this->form->form_disable_message ) ? $this->form->form_disable_message : __( 'This form is disabled.', 'everest-forms' ), |
| 261 | 'tooltip' => sprintf( esc_html__( 'Message that shows up if the form is disabled.', 'everest-forms' ) ), |
| 262 | ) |
| 263 | ); |
| 264 | |
| 265 | everest_forms_panel_field( |
| 266 | 'select', |
| 267 | 'settings', |
| 268 | 'layout_class', |
| 269 | $this->form_data, |
| 270 | esc_html__( 'Layout Design', 'everest-forms' ), |
| 271 | array( |
| 272 | 'default' => '0', |
| 273 | 'tooltip' => esc_html__( 'Choose design template for the Form', 'everest-forms' ), |
| 274 | 'options' => array( |
| 275 | 'default' => esc_html__( 'Default', 'everest-forms' ), |
| 276 | 'layout-two' => esc_html__( 'Classic Layout', 'everest-forms' ), |
| 277 | ), |
| 278 | ) |
| 279 | ); |
| 280 | everest_forms_panel_field( |
| 281 | 'text', |
| 282 | 'settings', |
| 283 | 'form_class', |
| 284 | $this->form_data, |
| 285 | esc_html__( 'Form Class', 'everest-forms' ), |
| 286 | array( |
| 287 | 'default' => isset( $this->form->form_class ) ? $this->form->form_class : '', |
| 288 | /* translators: %1$s - general settings docs url */ |
| 289 | 'tooltip' => sprintf( esc_html__( 'Enter CSS class names for the form wrapper. Multiple class names should be separated with spaces. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#7-toc-title' ) ), |
| 290 | ) |
| 291 | ); |
| 292 | |
| 293 | do_action( 'everest_forms_field_required_indicators', $this->form_data, $settings ); |
| 294 | |
| 295 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submit Button', 'everest-forms' ) . '</h4>'; |
| 296 | everest_forms_panel_field( |
| 297 | 'text', |
| 298 | 'settings', |
| 299 | 'submit_button_text', |
| 300 | $this->form_data, |
| 301 | esc_html__( 'Submit button text', 'everest-forms' ), |
| 302 | array( |
| 303 | 'default' => isset( $settings['submit_button_text'] ) ? $settings['submit_button_text'] : __( 'Submit', 'everest-forms' ), |
| 304 | 'tooltip' => esc_html__( 'Enter desired text for submit button.', 'everest-forms' ), |
| 305 | ) |
| 306 | ); |
| 307 | everest_forms_panel_field( |
| 308 | 'text', |
| 309 | 'settings', |
| 310 | 'submit_button_processing_text', |
| 311 | $this->form_data, |
| 312 | __( 'Submit button processing text', 'everest-forms' ), |
| 313 | array( |
| 314 | 'default' => isset( $settings['submit_button_processing_text'] ) ? $settings['submit_button_processing_text'] : __( 'Processing…', 'everest-forms' ), |
| 315 | 'tooltip' => esc_html__( 'Enter the submit button text that you would like the button to display while the form submission is processing.', 'everest-forms' ), |
| 316 | ) |
| 317 | ); |
| 318 | everest_forms_panel_field( |
| 319 | 'text', |
| 320 | 'settings', |
| 321 | 'submit_button_class', |
| 322 | $this->form_data, |
| 323 | esc_html__( 'Submit button class', 'everest-forms' ), |
| 324 | array( |
| 325 | 'default' => isset( $settings['submit_button_class'] ) ? $settings['submit_button_class'] : '', |
| 326 | 'tooltip' => esc_html__( 'Enter CSS class names for submit button. Multiple class names should be separated with spaces.', 'everest-forms' ), |
| 327 | ) |
| 328 | ); |
| 329 | do_action( 'everest_forms_inline_submit_settings', $this, 'submit', 'connection_1' ); |
| 330 | echo '</div>'; |
| 331 | do_action( 'everest_forms_inline_integrations_settings', $this->form_data, $settings ); |
| 332 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Advanced', 'everest-forms' ) . '</h4>'; |
| 333 | everest_forms_panel_field( |
| 334 | 'toggle', |
| 335 | 'settings', |
| 336 | 'ajax_form_submission', |
| 337 | $this->form_data, |
| 338 | esc_html__( 'Enable Ajax Form Submission', 'everest-forms' ), |
| 339 | array( |
| 340 | 'default' => isset( $settings['ajax_form_submission'] ) ? $settings['ajax_form_submission'] : 0, |
| 341 | 'tooltip' => esc_html__( 'Enables form submission without reloading the page.', 'everest-forms' ), |
| 342 | ) |
| 343 | ); |
| 344 | everest_forms_panel_field( |
| 345 | 'toggle', |
| 346 | 'settings', |
| 347 | 'disabled_entries', |
| 348 | $this->form_data, |
| 349 | esc_html__( 'Disable storing entry information', 'everest-forms' ), |
| 350 | array( |
| 351 | 'default' => isset( $settings['disabled_entries'] ) ? $settings['disabled_entries'] : 0, |
| 352 | /* translators: %1$s - general settings docs url */ |
| 353 | 'tooltip' => sprintf( esc_html__( 'Disable storing form entries. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#13-toc-title' ) ), |
| 354 | ) |
| 355 | ); |
| 356 | do_action( 'everest_forms_inline_advance_settings', $this ); |
| 357 | echo '</div>'; |
| 358 | |
| 359 | do_action( 'everest_forms_inline_general_settings', $this ); |
| 360 | |
| 361 | echo '</div>'; |
| 362 | |
| 363 | // --------------------------------------------------------------------// |
| 364 | |
| 365 | // --------------------------------------------------------------------// |
| 366 | $form_name = isset( $settings['form_title'] ) ? ' - ' . $settings['form_title'] : ''; |
| 367 | if ( ! isset( $settings['email']['connection_1'] ) ) { |
| 368 | $settings['email']['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 369 | $settings['email']['connection_1']['evf_to_email'] = isset( $settings['email']['evf_to_email'] ) ? $settings['email']['evf_to_email'] : '{admin_email}'; |
| 370 | $settings['email']['connection_1']['evf_from_name'] = isset( $settings['email']['evf_from_name'] ) ? $settings['email']['evf_from_name'] : get_bloginfo( 'name', 'display' ); |
| 371 | $settings['email']['connection_1']['evf_from_email'] = isset( $settings['email']['evf_from_email'] ) ? $settings['email']['evf_from_email'] : '{admin_email}'; |
| 372 | $settings['email']['connection_1']['evf_reply_to'] = isset( $settings['email']['evf_reply_to'] ) ? $settings['email']['evf_reply_to'] : ''; |
| 373 | /* translators: %s: Form Name */ |
| 374 | $settings['email']['connection_1']['evf_email_subject'] = isset( $settings['email']['evf_email_subject'] ) ? $settings['email']['evf_email_subject'] : sprintf( esc_html__( 'New Form Entry %s', 'everest-forms' ), $form_name ); |
| 375 | $settings['email']['connection_1']['evf_email_message'] = isset( $settings['email']['evf_email_message'] ) ? $settings['email']['evf_email_message'] : '{all_fields}'; |
| 376 | |
| 377 | $email_settings = array( 'attach_pdf_to_admin_email', 'show_header_in_attachment_pdf_file', 'conditional_logic_status', 'conditional_option', 'conditionals' ); |
| 378 | foreach ( $email_settings as $email_setting ) { |
| 379 | $settings['email']['connection_1'][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 380 | } |
| 381 | |
| 382 | // Backward compatibility. |
| 383 | $unique_connection_id = sprintf( 'connection_%s', uniqid() ); |
| 384 | if ( isset( $settings['email']['evf_send_confirmation_email'] ) && '1' === $settings['email']['evf_send_confirmation_email'] ) { |
| 385 | $settings['email'][ $unique_connection_id ] = array( 'connection_name' => esc_html__( 'User Notification', 'everest-forms' ) ); |
| 386 | |
| 387 | foreach ( $email_settings as $email_setting ) { |
| 388 | $settings['email'][ $unique_connection_id ][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | echo "<div class = 'evf-email-settings-wrapper'>"; |
| 394 | |
| 395 | foreach ( $settings['email'] as $connection_id => $connection ) : |
| 396 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 397 | // Backward Compatibility. |
| 398 | if ( isset( $settings['email']['enable_email_notification'] ) && '0' === $settings['email']['enable_email_notification'] ) { |
| 399 | $email_status = isset( $settings['email']['enable_email_notification'] ) ? $settings['email']['enable_email_notification'] : '1'; |
| 400 | } else { |
| 401 | $email_status = isset( $settings['email'][ $connection_id ]['enable_email_notification'] ) ? $settings['email'][ $connection_id ]['enable_email_notification'] : '1'; |
| 402 | } |
| 403 | $hidden_class = '1' !== $email_status ? 'everest-forms-hidden' : ''; |
| 404 | $hidden_enable_setting_class = '1' === $email_status ? 'everest-forms-hidden' : ''; |
| 405 | $toggler_hide_class = isset( $toggler_hide_class ) ? 'style=display:none;' : ''; |
| 406 | echo '<div class="evf-content-section evf-content-email-settings" ' . esc_attr( $toggler_hide_class ) . '>'; |
| 407 | echo '<div class="evf-content-section-title" ' . esc_attr( $toggler_hide_class ) . '>'; |
| 408 | echo '<div class="evf-title">' . esc_html__( 'Email', 'everest-forms' ) . '</div>'; |
| 409 | ?> |
| 410 | <div class="evf-enable-email-toggle <?php echo esc_attr( $hidden_enable_setting_class ); ?>"><img src="<?php echo esc_url( plugin_dir_url( EVF_PLUGIN_FILE ) . 'assets/images/enable-email-toggle.png' ); ?>" alt="<?php esc_attr_e( 'Click me to enable email settings', 'everest-forms' ); ?>"></div> |
| 411 | <div class="evf-toggle-section"> |
| 412 | <label class="evf-toggle-switch"> |
| 413 | <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat"> |
| 414 | <input type="checkbox" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="1" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" <?php echo checked( '1', $email_status, false ); ?>> |
| 415 | <span class="evf-toggle-switch-wrap"></span> |
| 416 | <span class="evf-toggle-switch-control"></span> |
| 417 | </label> |
| 418 | </div> |
| 419 | </div> |
| 420 | <?php |
| 421 | |
| 422 | echo '<div class="evf-content-email-settings-inner ' . esc_attr( $hidden_class ) . '" data-connection_id=' . esc_attr( $connection_id ) . '>'; |
| 423 | |
| 424 | everest_forms_panel_field( |
| 425 | 'text', |
| 426 | 'email', |
| 427 | 'connection_name', |
| 428 | $this->form_data, |
| 429 | '', |
| 430 | array( |
| 431 | 'default' => isset( $settings['email'][ $connection_id ]['connection_name'] ) ? $settings['email'][ $connection_id ]['connection_name'] : __( 'Admin Notification', 'everest-forms' ), |
| 432 | 'class' => 'everest-forms-email-name', |
| 433 | 'parent' => 'settings', |
| 434 | 'subsection' => $connection_id, |
| 435 | ) |
| 436 | ); |
| 437 | |
| 438 | everest_forms_panel_field( |
| 439 | 'text', |
| 440 | 'email', |
| 441 | 'evf_to_email', |
| 442 | $this->form_data, |
| 443 | esc_html__( 'To Address', 'everest-forms' ), |
| 444 | array( |
| 445 | 'default' => isset( $settings['email'][ $connection_id ]['evf_to_email'] ) ? $settings['email'][ $connection_id ]['evf_to_email'] : '{admin_email}', |
| 446 | /* translators: %1$s - general settings docs url */ |
| 447 | 'tooltip' => sprintf( esc_html__( 'Enter the recipient\'s email address (comma separated) to receive form entry notifications. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#1-toc-title' ) ), |
| 448 | 'smarttags' => array( |
| 449 | 'type' => 'fields', |
| 450 | 'form_fields' => 'email', |
| 451 | ), |
| 452 | 'parent' => 'settings', |
| 453 | 'subsection' => $connection_id, |
| 454 | ) |
| 455 | ); |
| 456 | if ( 'yes' === get_option( 'everest_forms_enable_email_copies' ) ) { |
| 457 | everest_forms_panel_field( |
| 458 | 'text', |
| 459 | 'email', |
| 460 | 'evf_carboncopy', |
| 461 | $this->form_data, |
| 462 | esc_html__( 'Cc Address', 'everest-forms' ), |
| 463 | array( |
| 464 | 'default' => isset( $settings['email'][ $connection_id ]['evf_carboncopy'] ) ? $settings['email'][ $connection_id ]['evf_carboncopy'] : '', |
| 465 | 'tooltip' => esc_html__( 'Enter Cc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 466 | 'smarttags' => array( |
| 467 | 'type' => 'fields', |
| 468 | 'form_fields' => 'email', |
| 469 | ), |
| 470 | 'parent' => 'settings', |
| 471 | 'subsection' => $connection_id, |
| 472 | ) |
| 473 | ); |
| 474 | everest_forms_panel_field( |
| 475 | 'text', |
| 476 | 'email', |
| 477 | 'evf_blindcarboncopy', |
| 478 | $this->form_data, |
| 479 | esc_html__( 'Bcc Address', 'everest-forms' ), |
| 480 | array( |
| 481 | 'default' => isset( $settings['email'][ $connection_id ]['evf_blindcarboncopy'] ) ? $settings['email'][ $connection_id ]['evf_blindcarboncopy'] : '', |
| 482 | 'tooltip' => esc_html__( 'Enter Bcc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 483 | 'smarttags' => array( |
| 484 | 'type' => 'fields', |
| 485 | 'form_fields' => 'email', |
| 486 | ), |
| 487 | 'parent' => 'settings', |
| 488 | 'subsection' => $connection_id, |
| 489 | ) |
| 490 | ); |
| 491 | } |
| 492 | everest_forms_panel_field( |
| 493 | 'text', |
| 494 | 'email', |
| 495 | 'evf_from_name', |
| 496 | $this->form_data, |
| 497 | esc_html__( 'From Name', 'everest-forms' ), |
| 498 | array( |
| 499 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_name'] ) ? $settings['email'][ $connection_id ]['evf_from_name'] : get_bloginfo( 'name', 'display' ), |
| 500 | /* translators: %1$s - general settings docs url */ |
| 501 | 'tooltip' => sprintf( esc_html__( 'Enter the From Name to be displayed in Email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#2-toc-title' ) ), |
| 502 | 'smarttags' => array( |
| 503 | 'type' => 'all', |
| 504 | 'form_fields' => 'all', |
| 505 | ), |
| 506 | 'parent' => 'settings', |
| 507 | 'subsection' => $connection_id, |
| 508 | ) |
| 509 | ); |
| 510 | everest_forms_panel_field( |
| 511 | 'text', |
| 512 | 'email', |
| 513 | 'evf_from_email', |
| 514 | $this->form_data, |
| 515 | esc_html__( 'From Address', 'everest-forms' ), |
| 516 | array( |
| 517 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_email'] ) ? $settings['email'][ $connection_id ]['evf_from_email'] : '{admin_email}', |
| 518 | /* translators: %1$s - general settings docs url */ |
| 519 | 'tooltip' => sprintf( esc_html__( 'Enter the Email address from which you want to send Email. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#3-toc-title' ) ), |
| 520 | 'smarttags' => array( |
| 521 | 'type' => 'fields', |
| 522 | 'form_fields' => 'email', |
| 523 | ), |
| 524 | 'parent' => 'settings', |
| 525 | 'subsection' => $connection_id, |
| 526 | ) |
| 527 | ); |
| 528 | everest_forms_panel_field( |
| 529 | 'text', |
| 530 | 'email', |
| 531 | 'evf_reply_to', |
| 532 | $this->form_data, |
| 533 | esc_html__( 'Reply To', 'everest-forms' ), |
| 534 | array( |
| 535 | 'default' => isset( $settings['email'][ $connection_id ]['evf_reply_to'] ) ? $settings['email'][ $connection_id ]['evf_reply_to'] : '', |
| 536 | /* translators: %1$s - general settings docs url */ |
| 537 | 'tooltip' => sprintf( esc_html__( 'Enter the reply to email address where you want the email to be received when this email is replied. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#4-toc-title' ) ), |
| 538 | 'smarttags' => array( |
| 539 | 'type' => 'fields', |
| 540 | 'form_fields' => 'email', |
| 541 | ), |
| 542 | 'parent' => 'settings', |
| 543 | 'subsection' => $connection_id, |
| 544 | ) |
| 545 | ); |
| 546 | everest_forms_panel_field( |
| 547 | 'text', |
| 548 | 'email', |
| 549 | 'evf_email_subject', |
| 550 | $this->form_data, |
| 551 | esc_html__( 'Email Subject', 'everest-forms' ), |
| 552 | array( |
| 553 | /* translators: %s: Form Name */ |
| 554 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_subject'] ) ? $settings['email'][ $connection_id ]['evf_email_subject'] : sprintf( esc_html__( 'New Form Entry %s', 'everest-forms' ), $form_name ), |
| 555 | /* translators: %1$s - General Settings docs url */ |
| 556 | 'tooltip' => sprintf( esc_html__( 'Enter the subject of the email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#5-toc-title' ) ), |
| 557 | 'smarttags' => array( |
| 558 | 'type' => 'all', |
| 559 | 'form_fields' => 'all', |
| 560 | ), |
| 561 | 'parent' => 'settings', |
| 562 | 'subsection' => $connection_id, |
| 563 | ) |
| 564 | ); |
| 565 | // --------------------------------------------------------------------// |
| 566 | // Everest Forms AI Setting Section Start |
| 567 | // --------------------------------------------------------------------// |
| 568 | $everest_forms_ai_api_key = get_option( 'everest_forms_ai_api_key' ); |
| 569 | if ( ! empty( $everest_forms_ai_api_key ) ) { |
| 570 | everest_forms_panel_field( |
| 571 | 'toggle', |
| 572 | 'email', |
| 573 | 'enable_ai_email_prompt', |
| 574 | $this->form_data, |
| 575 | esc_html__( 'Enable Email Prompt', 'everest-forms' ), |
| 576 | array( |
| 577 | 'default' => ! empty( $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ) ? $settings['email'][ $connection_id ]['enable_ai_email_prompt'] : '0', |
| 578 | 'class' => 'everest-forms-enable-email-prompt', |
| 579 | /* translators: %1$s - email message prompt doc url*/ |
| 580 | 'tooltip' => sprintf( esc_html__( 'Check this option to enable the email message prompt. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/ai/#6-toc-title' ) ), |
| 581 | 'parent' => 'settings', |
| 582 | 'subsection' => $connection_id, |
| 583 | ) |
| 584 | ); |
| 585 | everest_forms_panel_field( |
| 586 | 'textarea', |
| 587 | 'email', |
| 588 | 'evf_email_message_prompt', |
| 589 | $this->form_data, |
| 590 | esc_html__( 'Email Message Prompt', 'everest-forms' ), |
| 591 | array( |
| 592 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_message_prompt'] ) ? $settings['email'][ $connection_id ]['evf_email_message_prompt'] : '', |
| 593 | 'class' => isset( $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ) && '1' === $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ? 'evf-email-message-prompt' : 'evf-email-message-prompt everest-forms-hidden', |
| 594 | /* translators: %1$s - general settings docs url */ |
| 595 | 'tooltip' => sprintf( esc_html__( 'Enter the email message prompt. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/ai/#6-toc-title' ) ), |
| 596 | 'smarttags' => array( |
| 597 | 'type' => 'all', |
| 598 | 'form_fields' => 'all', |
| 599 | ), |
| 600 | 'parent' => 'settings', |
| 601 | 'subsection' => $connection_id, |
| 602 | ) |
| 603 | ); |
| 604 | } |
| 605 | // --------------------------------------------------------------------// |
| 606 | // Everest Forms AI Setting Section End |
| 607 | // --------------------------------------------------------------------// |
| 608 | everest_forms_panel_field( |
| 609 | 'tinymce', |
| 610 | 'email', |
| 611 | 'evf_email_message', |
| 612 | $this->form_data, |
| 613 | esc_html__( 'Email Message', 'everest-forms' ), |
| 614 | array( |
| 615 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_message'] ) ? evf_string_translation( $this->form_data['id'], 'evf_email_message', $settings['email'][ $connection_id ]['evf_email_message'] ) : __( '{all_fields}', 'everest-forms' ), |
| 616 | /* translators: %1$s - general settings docs url */ |
| 617 | 'tooltip' => sprintf( esc_html__( 'Enter the message of the email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#6-toc-title' ) ), |
| 618 | 'smarttags' => array( |
| 619 | 'type' => 'all', |
| 620 | 'form_fields' => 'all', |
| 621 | ), |
| 622 | 'parent' => 'settings', |
| 623 | 'subsection' => $connection_id, |
| 624 | /* translators: %s - all fields smart tag. */ |
| 625 | 'after' => empty( $everest_forms_ai_api_key ) ? '<p class="desc">' . sprintf( esc_html__( 'To display all form fields, use the %s Smart Tag.', 'everest-forms' ), '<code>{all_fields}</code>' ) . '</p>' : '<p class="desc">' . sprintf( esc_html__( 'To display all form fields, use the %1$s Smart Tag. Use %2$s Smart Tag for AI-generated emails', 'everest-forms' ), '<code>{all_fields}</code>', '<code>{ai_email_response}</code>' ) . '</p>', |
| 626 | ) |
| 627 | ); |
| 628 | |
| 629 | do_action( 'everest_forms_inline_email_settings', $this, $connection_id ); |
| 630 | |
| 631 | echo '</div></div>'; |
| 632 | } |
| 633 | |
| 634 | endforeach; |
| 635 | |
| 636 | echo '</div>'; |
| 637 | |
| 638 | // --------------------------------------------------------------------// |
| 639 | // Preview Confirmation |
| 640 | // --------------------------------------------------------------------// |
| 641 | /** |
| 642 | * For backward compatibility. |
| 643 | * |
| 644 | * @since 3.4.0 |
| 645 | */ |
| 646 | $this->form_data = evf_form_confirmation_backward_compatibility( $this->form_data ); |
| 647 | |
| 648 | echo '<div class="evf-content-section evf-content-confirmation-settings">'; |
| 649 | echo '<h3 class="evf-content-section-title">'; |
| 650 | esc_html_e( 'Form Confirmation', 'everest-forms' ); |
| 651 | echo '</h3>'; |
| 652 | echo '<div class="evf-confirmation-wrap everest-forms-border-container">'; |
| 653 | echo '<h4 class="evf-content-section-title">'; |
| 654 | esc_html_e( 'Confirmation Settings', 'everest-forms' ); |
| 655 | echo '</h4>'; |
| 656 | |
| 657 | $confirmation_type = isset( $this->form_data['settings']['redirect_to'] ) ? $this->form_data['settings']['redirect_to'] : 'same'; |
| 658 | $confirmation_type = '0' === (string) $confirmation_type ? 'same' : $confirmation_type; |
| 659 | |
| 660 | ?> |
| 661 | <div id="everest-forms-panel-field-settings-redirect_to-wrap" class="everest-forms-panel-field evf-builder-radio everest-forms-panel-field-radio"> |
| 662 | <label for="everest-forms-panel-field-settings-redirect_to"><?php echo __( 'Confirmation Type', 'everest-forms' ); ?> |
| 663 | <i title="<?php echo __( 'Choose the confirmation type', 'everest-forms' ); ?>" class="dashicons dashicons-editor-help everest-forms-help-tooltip"></i> |
| 664 | </label> |
| 665 | <div class="radio-list"> |
| 666 | <label for="everest-forms-panel-field-settings-redirect_to-1" class="inline"><input type="radio" id="everest-forms-panel-field-settings-redirect_to-1" name="settings[redirect_to]" value="same" class="widefat confirmation-redirect-to" <?php echo checked( 'same', $confirmation_type, false ); ?>><?php echo __( 'Same Page', 'everest-forms' ); ?></label> |
| 667 | <label for="everest-forms-panel-field-settings-redirect_to-2" class="inline"><input type="radio" id="everest-forms-panel-field-settings-redirect_to-2" name="settings[redirect_to]" value="custom_page" class="widefat confirmation-redirect-to" <?php echo checked( 'custom_page', $confirmation_type, false ); ?>><?php echo __( 'Redirect to Custom Page', 'everest-forms' ); ?></label><label for="everest-forms-panel-field-settings-redirect_to-3" class="inline"><input type="radio" id="everest-forms-panel-field-settings-redirect_to-3" name="settings[redirect_to]" value="external_url" class="widefat confirmation-redirect-to" <?php echo checked( 'external_url', $confirmation_type, false ); ?>><?php echo __( 'Redirect to External URL', 'everest-forms' ); ?></label> |
| 668 | </div> |
| 669 | </div> |
| 670 | <?php |
| 671 | everest_forms_panel_field( |
| 672 | 'select', |
| 673 | 'settings', |
| 674 | 'custom_page', |
| 675 | $this->form_data, |
| 676 | esc_html__( 'Custom Page', 'everest-forms' ), |
| 677 | array( |
| 678 | 'class' => 'custom-page-setting', |
| 679 | 'default' => '0', |
| 680 | 'options' => $this->get_all_pages(), |
| 681 | ) |
| 682 | ); |
| 683 | |
| 684 | everest_forms_panel_field( |
| 685 | 'text', |
| 686 | 'settings', |
| 687 | 'external_url', |
| 688 | $this->form_data, |
| 689 | esc_html__( 'External URL', 'everest-forms' ), |
| 690 | array( |
| 691 | 'class' => 'external-page-setting', |
| 692 | 'default' => isset( $this->form->external_url ) ? $this->form->external_url : '', |
| 693 | ) |
| 694 | ); |
| 695 | everest_forms_panel_field( |
| 696 | 'toggle', |
| 697 | 'settings', |
| 698 | 'enable_redirect_in_new_tab', |
| 699 | $this->form_data, |
| 700 | esc_html__( ' Open in new tab', 'everest-forms' ), |
| 701 | array( |
| 702 | 'class' => 'external-page-setting', |
| 703 | 'tooltip' => esc_html__( 'Enable to open the url in the new tab.', 'everest-forms' ), |
| 704 | 'default' => '0', |
| 705 | ) |
| 706 | ); |
| 707 | everest_forms_panel_field( |
| 708 | 'toggle', |
| 709 | 'settings', |
| 710 | 'enable_redirect_query_string', |
| 711 | $this->form_data, |
| 712 | esc_html__( ' Append Query String', 'everest-forms' ), |
| 713 | array( |
| 714 | 'class' => 'custom-and-external-page-setting', |
| 715 | 'input_class' => 'append-query-string-input', |
| 716 | 'tooltip' => esc_html__( 'Enable to add the query string in the url.', 'everest-forms' ), |
| 717 | 'default' => '0', |
| 718 | ) |
| 719 | ); |
| 720 | |
| 721 | everest_forms_panel_field( |
| 722 | 'text', |
| 723 | 'settings', |
| 724 | 'query_string', |
| 725 | $this->form_data, |
| 726 | esc_html__( 'Query String', 'everest-forms' ), |
| 727 | array( |
| 728 | 'default' => isset( $settings['query_string'] ) ? $settings['query_string'] : '', |
| 729 | 'class' => 'custom-and-external-page-setting query-string-wrap', |
| 730 | 'smarttags' => array( |
| 731 | 'type' => 'all', |
| 732 | 'form_fields' => 'all', |
| 733 | ), |
| 734 | 'after' => '<p class="desc">' . sprintf( esc_html__( 'Example: firstname= {field_id="name_ys0GeZISRs-1"}&email={field_id="email_LbH5NxasXM-2"}', 'everest-forms' ) ) . '</p>', |
| 735 | ) |
| 736 | ); |
| 737 | |
| 738 | everest_forms_panel_field( |
| 739 | 'textarea', |
| 740 | 'settings', |
| 741 | 'successful_form_submission_message', |
| 742 | $this->form_data, |
| 743 | esc_html__( 'Success Message', 'everest-forms' ), |
| 744 | array( |
| 745 | 'class' => 'same-page-setting', |
| 746 | 'input_class' => 'short', |
| 747 | 'default' => isset( $this->form->successful_form_submission_message ) ? $this->form->successful_form_submission_message : __( 'Thanks for contacting us! We will be in touch with you shortly', 'everest-forms' ), |
| 748 | /* translators: %1$s - general settings docs url */ |
| 749 | 'tooltip' => sprintf( esc_html__( 'Success message that shows up after submitting form. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#4-toc-title' ) ), |
| 750 | ) |
| 751 | ); |
| 752 | |
| 753 | everest_forms_panel_field( |
| 754 | 'toggle', |
| 755 | 'settings', |
| 756 | 'submission_message_scroll', |
| 757 | $this->form_data, |
| 758 | __( 'Auto scroll to Submission Message', 'everest-forms' ), |
| 759 | array( |
| 760 | 'class' => 'same-page-setting', |
| 761 | 'default' => '1', |
| 762 | ) |
| 763 | ); |
| 764 | $form_state_type = isset( $this->form_data['settings']['form_state_type'] ) ? $this->form_data['settings']['form_state_type'] : 'hide'; |
| 765 | ?> |
| 766 | <div id="everest-forms-panel-field-settings-form_state_type-wrap" class="everest-forms-panel-field same-page-setting evf-builder-radio everest-forms-panel-field-radio" style=""> |
| 767 | <label for="everest-forms-panel-field-settings-form_state_type"><?php echo __( 'After Submission Form Behavior', 'everest-forms' ); ?> <i title="<?php echo __( 'Choose the submission form behavior.', 'everest-forms' ); ?>" class="dashicons dashicons-editor-help everest-forms-help-tooltip tooltipstered"></i></label> |
| 768 | <div class="radio-list"> |
| 769 | <label for="everest-forms-panel-field-settings-form_state_type-1" class="inline"><input type="radio" id="everest-forms-panel-field-settings-form_state_type-1" name="settings[form_state_type]" value="reset" class="widefat form-state-type" <?php echo checked( 'reset', $form_state_type, false ); ?>> <?php echo __( 'Reset Form', 'everest-forms' ); ?></label> |
| 770 | <label for="everest-forms-panel-field-settings-form_state_type-2" class="inline"><input type="radio" id="everest-forms-panel-field-settings-form_state_type-2" name="settings[form_state_type]" value="hide" class="widefat form-state-type" <?php echo checked( 'hide', $form_state_type, false ); ?>><?php echo __( 'Hide Form', 'everest-forms' ); ?></label> |
| 771 | </div> |
| 772 | </div> |
| 773 | <?php |
| 774 | |
| 775 | everest_forms_panel_field( |
| 776 | 'toggle', |
| 777 | 'settings', |
| 778 | 'preview_confirmation', |
| 779 | $this->form_data, |
| 780 | esc_html__( 'Show User Submitted Form Summary After Submission', 'everest-forms' ), |
| 781 | array( |
| 782 | 'class' => 'same-page-setting preview-confirmation-toggle-wrapper', |
| 783 | 'input_class' => 'everest-preview-confirmation', |
| 784 | ) |
| 785 | ); |
| 786 | |
| 787 | everest_forms_panel_field( |
| 788 | 'select', |
| 789 | 'settings', |
| 790 | 'preview_confirmation_select', |
| 791 | $this->form_data, |
| 792 | esc_html__( 'Preview type', 'everest-forms' ), |
| 793 | array( |
| 794 | 'class' => 'same-page-setting preview-confirm-select-wrapper', |
| 795 | 'default' => 'basic', |
| 796 | 'tooltip' => esc_html__( 'Choose preview style type.', 'everest-forms' ), |
| 797 | 'options' => array( |
| 798 | 'basic' => esc_html__( 'Basic', 'everest-forms' ), |
| 799 | 'table' => esc_html__( 'Table', 'everest-forms' ), |
| 800 | 'compact' => esc_html__( 'Compact', 'everest-forms' ), |
| 801 | ), |
| 802 | ) |
| 803 | ); |
| 804 | |
| 805 | // message display type based on the form state type. |
| 806 | $option = array( |
| 807 | 'hide' => esc_html__( 'Shown Message in Place of Form', 'everest-forms' ), |
| 808 | 'popup' => esc_html__( 'As Popup', 'everest-forms' ), |
| 809 | ); |
| 810 | |
| 811 | $is_preview = isset( $this->form_data['settings']['preview_confirmation'] ) ? $this->form_data['settings']['preview_confirmation'] : false; |
| 812 | |
| 813 | if ( $is_preview ) { |
| 814 | $option = array( |
| 815 | 'top' => esc_html__( 'Above Form Summary', 'everest-forms' ), |
| 816 | 'bottom' => esc_html( 'Below Form Summary', 'everest-forms' ), |
| 817 | 'popup' => esc_html__( 'As Popup', 'everest-forms' ), |
| 818 | ); |
| 819 | } |
| 820 | |
| 821 | everest_forms_panel_field( |
| 822 | 'select', |
| 823 | 'settings', |
| 824 | 'message_display_location_of_hide', |
| 825 | $this->form_data, |
| 826 | esc_html__( 'Display Message', 'everest-forms' ), |
| 827 | array( |
| 828 | 'class' => 'same-page-setting form-state-hide', |
| 829 | 'input_class' => 'message-display-location-of-hide', |
| 830 | 'default' => 'hide', |
| 831 | /* translators: %1$s - general settings docs url */ |
| 832 | 'tooltip' => sprintf( esc_html__( 'Choose where to display success message. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/confirmations/' ) ), |
| 833 | 'options' => $option, |
| 834 | ) |
| 835 | ); |
| 836 | |
| 837 | everest_forms_panel_field( |
| 838 | 'select', |
| 839 | 'settings', |
| 840 | 'message_display_location_of_reset', |
| 841 | $this->form_data, |
| 842 | esc_html__( 'Display Message', 'everest-forms' ), |
| 843 | array( |
| 844 | 'class' => 'same-page-setting form-state-reset', |
| 845 | 'default' => 'hide', |
| 846 | /* translators: %1$s - general settings docs url */ |
| 847 | 'tooltip' => sprintf( esc_html__( 'Choose where to display success message. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/confirmations/' ) ), |
| 848 | 'options' => array( |
| 849 | 'top' => esc_html__( 'Above the form', 'everest-forms' ), |
| 850 | 'bottom' => esc_html__( 'Below the form', 'everest-forms' ), |
| 851 | 'popup' => esc_html__( 'As Popup', 'everest-forms' ), |
| 852 | ), |
| 853 | ) |
| 854 | ); |
| 855 | |
| 856 | echo '</div>'; |
| 857 | do_action( 'everest_forms_submission_redirection_settings', $this, 'submission_redirection' ); |
| 858 | |
| 859 | echo '</div>'; |
| 860 | |
| 861 | // --------------------------------------------------------------------// |
| 862 | // Spam Protection and Security |
| 863 | // --------------------------------------------------------------------// |
| 864 | echo '<div class="evf-content-section evf-content-security-settings">'; |
| 865 | echo '<div class="evf-content-section-title">'; |
| 866 | esc_html_e( 'Anti-Spam and Security', 'everest-forms' ); |
| 867 | echo '</div>'; |
| 868 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Honeypot', 'everest-forms' ) . '</h4>'; |
| 869 | everest_forms_panel_field( |
| 870 | 'toggle', |
| 871 | 'settings', |
| 872 | 'honeypot', |
| 873 | $this->form_data, |
| 874 | esc_html__( 'Enable anti-spam honeypot', 'everest-forms' ), |
| 875 | array( |
| 876 | 'default' => '1', |
| 877 | ) |
| 878 | ); |
| 879 | do_action( 'everest_forms_inline_honeypot_settings', $this, 'honeypot', 'connection_1' ); |
| 880 | echo '</div>'; |
| 881 | |
| 882 | /** |
| 883 | * CleanTalks anti-spam protection. |
| 884 | */ |
| 885 | do_action( 'everest_forms_inline_cleantalk_settings', $this, 'cleantalk', 'connection_1' ); |
| 886 | |
| 887 | /** |
| 888 | * Akismet anit-spam protection. |
| 889 | * |
| 890 | * @since 2.0.4 |
| 891 | */ |
| 892 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Akismet', 'everest-forms' ) . '</h4>'; |
| 893 | everest_forms_panel_field( |
| 894 | 'toggle', |
| 895 | 'settings', |
| 896 | 'akismet', |
| 897 | $this->form_data, |
| 898 | esc_html__( 'Enable Akismet anti-spam protection', 'everest-forms' ), |
| 899 | array( |
| 900 | 'default' => '0', |
| 901 | ) |
| 902 | ); |
| 903 | |
| 904 | /** |
| 905 | * Warning message if the installtion, activation and configuration are not proper. |
| 906 | */ |
| 907 | if ( ! file_exists( WP_PLUGIN_DIR . '/akismet/akismet.php' ) ) { |
| 908 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been installed.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 909 | } elseif ( ! is_plugin_active( 'akismet/akismet.php' ) ) { |
| 910 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been activated.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 911 | } elseif ( ! evf_is_akismet_configured() ) { |
| 912 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been properly configured.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 913 | } |
| 914 | echo '<div class="everest-forms-border-container everest-forms-akismet-protection-type">'; |
| 915 | everest_forms_panel_field( |
| 916 | 'select', |
| 917 | 'settings', |
| 918 | 'akismet_protection_type', |
| 919 | $this->form_data, |
| 920 | esc_html__( 'Protection type', 'everest-forms' ), |
| 921 | array( |
| 922 | 'default' => 'validation_failed', |
| 923 | 'tooltip' => esc_html__( "Please select the protection type. Choosing 'Mark as Spam' allows the submission but marks the entry as spam, while selecting 'Reject Submission' will prevent the form submission.", 'everest-forms' ), |
| 924 | 'options' => array( |
| 925 | 'validation_failed' => esc_html__( 'Reject Submission', 'everest-forms' ), |
| 926 | 'mark_as_spam' => esc_html__( 'Mark as Spam', 'everest-forms' ), |
| 927 | ), |
| 928 | ) |
| 929 | ); |
| 930 | do_action( 'everest_forms_inline_akismet_settings', $this, 'akismet', 'connection_1' ); |
| 931 | |
| 932 | do_action( 'everest_forms_inline_akismet_protection_type_settings', $this, 'akismet_protection_type', 'connection_1' ); |
| 933 | echo '</div>'; |
| 934 | echo '</div>'; |
| 935 | do_action( 'everest_forms_inline_security_settings', $this ); |
| 936 | |
| 937 | /** |
| 938 | * Minimum time for form submission. |
| 939 | * |
| 940 | * @since 3.0.1 |
| 941 | */ |
| 942 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Waiting time for form submission', 'everest-forms' ) . '</h4>'; |
| 943 | everest_forms_panel_field( |
| 944 | 'toggle', |
| 945 | 'settings', |
| 946 | 'form_submission_min_waiting_time', |
| 947 | $this->form_data, |
| 948 | esc_html__( 'Enable minimum waiting time for form submission', 'everest-forms' ), |
| 949 | array( |
| 950 | 'default' => '0', |
| 951 | 'tooltip' => esc_html__( 'Prevents the form submission before the specified time', 'everest-forms' ), |
| 952 | ) |
| 953 | ); |
| 954 | |
| 955 | echo '<div class="everest-forms-border-container everest-forms-form-submission-minimum-waiting-time">'; |
| 956 | everest_forms_panel_field( |
| 957 | 'number', |
| 958 | 'settings', |
| 959 | 'form_submission_min_waiting_time_input', |
| 960 | $this->form_data, |
| 961 | esc_html__( 'Form submission minimum waiting time (In seconds)', 'everest-forms' ), |
| 962 | array( |
| 963 | 'default' => '5', |
| 964 | 'tooltip' => esc_html__( 'Enter the minimum time waiting time for form submission.', 'everest-forms' ), |
| 965 | 'min_value' => 1, |
| 966 | ) |
| 967 | ); |
| 968 | |
| 969 | do_action( 'everest_forms_inline_form_submission_min_waiting_time_settings', $this, 'form_submission_min_waiting_time', 'connection_1' ); |
| 970 | |
| 971 | do_action( 'everest_forms_inline_form_submission_min_waiting_time_section_settings', $this, 'form_submission_min_waiting_time_section', 'connection_1' ); |
| 972 | echo '</div>'; |
| 973 | echo '</div>'; |
| 974 | echo '</div>'; |
| 975 | |
| 976 | do_action( 'everest_forms_settings_panel_content', $this ); |
| 977 | } |
| 978 | |
| 979 | /** |
| 980 | * Add Custom CSS and JS menu item to the builder settings list. |
| 981 | * |
| 982 | * @param [array] $arr Setting Menu items list. |
| 983 | * @param [array] $form_data Form Data. |
| 984 | * @return array |
| 985 | */ |
| 986 | public function add_custom_css_js_section( $arr, $form_data ) { |
| 987 | |
| 988 | $arr['custom-css-js'] = esc_html__( 'Custom CSS and JS', 'everest-forms' ); |
| 989 | if ( ! defined( 'EFP_PLUGIN_FILE' ) ) { |
| 990 | $pro_addons = array( |
| 991 | 'webhook' => esc_html__( 'WebHook', 'everest-forms' ), |
| 992 | 'form_restriction' => esc_html__( 'Form Restriction', 'everest-forms' ), |
| 993 | 'multi_part' => esc_html__( 'Multi Part', 'everest-forms' ), |
| 994 | 'pdf_submission' => esc_html__( 'PDF Submission', 'everest-forms' ), |
| 995 | 'post_submission' => esc_html__( 'Post Submission', 'everest-forms' ), |
| 996 | 'save_and_continue' => esc_html__( 'Save and Continue', 'everest-forms' ), |
| 997 | 'survey_polls_quiz' => esc_html__( 'Survey,Polls,Quiz', 'everest-forms' ), |
| 998 | 'user_registration' => esc_html__( 'User Registration', 'everest-forms' ), |
| 999 | 'conversation_forms' => esc_html__( 'Conversation Forms', 'everest-forms' ), |
| 1000 | 'sms_notifications' => esc_html__( 'SMS Notifications', 'everest-forms' ), |
| 1001 | 'telegram' => esc_html__( 'Telegram', 'everest-forms' ), |
| 1002 | 'qr_generator' => esc_html__( 'QR Generator', 'everest-forms' ), |
| 1003 | ); |
| 1004 | $arr = array_merge( $arr, $pro_addons ); |
| 1005 | } |
| 1006 | return $arr; |
| 1007 | } |
| 1008 | |
| 1009 | /** |
| 1010 | * Add Custom Css and Js settings section. |
| 1011 | * |
| 1012 | * @param [array] $form_data Form Data. |
| 1013 | * @return void |
| 1014 | */ |
| 1015 | public function add_custom_css_js_settings( $form_data ) { |
| 1016 | // --------------------------------------------------------------------// |
| 1017 | // Custom CSS and JS |
| 1018 | // --------------------------------------------------------------------// |
| 1019 | echo '<div class="evf-content-section evf-content-custom-css-js-settings">'; |
| 1020 | echo '<div class="evf-content-section-title">'; |
| 1021 | esc_html_e( 'Custom CSS and JS', 'everest-forms' ); |
| 1022 | echo '</div>'; |
| 1023 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom CSS', 'everest-forms' ) . '</h4>'; |
| 1024 | everest_forms_panel_field( |
| 1025 | 'toggle', |
| 1026 | 'settings', |
| 1027 | 'evf-enable-custom-css', |
| 1028 | $this->form_data, |
| 1029 | esc_html__( 'Enable Custom CSS', 'everest-forms' ), |
| 1030 | array( |
| 1031 | 'default' => '0', |
| 1032 | ) |
| 1033 | ); |
| 1034 | everest_forms_panel_field( |
| 1035 | 'textarea', |
| 1036 | 'settings', |
| 1037 | 'evf-custom-css', |
| 1038 | $this->form_data, |
| 1039 | esc_html__( 'Custom CSS', 'everest-forms' ) |
| 1040 | ); |
| 1041 | echo '</div>'; |
| 1042 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom JS', 'everest-forms' ) . '</h4>'; |
| 1043 | everest_forms_panel_field( |
| 1044 | 'toggle', |
| 1045 | 'settings', |
| 1046 | 'evf-enable-custom-js', |
| 1047 | $this->form_data, |
| 1048 | esc_html__( 'Enable Custom JS', 'everest-forms' ), |
| 1049 | array( |
| 1050 | 'default' => '0', |
| 1051 | ) |
| 1052 | ); |
| 1053 | everest_forms_panel_field( |
| 1054 | 'textarea', |
| 1055 | 'settings', |
| 1056 | 'evf-custom-js', |
| 1057 | $this->form_data, |
| 1058 | esc_html__( 'Custom JS', 'everest-forms' ) |
| 1059 | ); |
| 1060 | echo '</div>'; |
| 1061 | |
| 1062 | echo '</div>'; |
| 1063 | } |
| 1064 | |
| 1065 | /** |
| 1066 | * Get all pages. |
| 1067 | */ |
| 1068 | public function get_all_pages() { |
| 1069 | $pages = array(); |
| 1070 | foreach ( get_pages() as $page ) { |
| 1071 | $pages[ $page->ID ] = $page->post_title; |
| 1072 | } |
| 1073 | |
| 1074 | return $pages; |
| 1075 | } |
| 1076 | } |
| 1077 | |
| 1078 | return new EVF_Builder_Settings(); |
| 1079 |