class-evf-builder-fields.php
3 years ago
class-evf-builder-page.php
3 years ago
class-evf-builder-settings.php
3 years ago
class-evf-builder-settings.php
661 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EverestForms Builder Settings |
| 4 | * |
| 5 | * @package EverestForms\Admin |
| 6 | * @since 1.2.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | if ( class_exists( 'EVF_Builder_Settings', false ) ) { |
| 12 | return new EVF_Builder_Settings(); |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * EVF_Builder_Settings class. |
| 17 | */ |
| 18 | class EVF_Builder_Settings extends EVF_Builder_Page { |
| 19 | |
| 20 | /** |
| 21 | * Constructor. |
| 22 | */ |
| 23 | public function __construct() { |
| 24 | $this->id = 'settings'; |
| 25 | $this->label = esc_html__( 'Settings', 'everest-forms' ); |
| 26 | $this->sidebar = true; |
| 27 | |
| 28 | add_action( 'everest_forms_settings_connections_email', array( $this, 'output_connections_list' ) ); |
| 29 | |
| 30 | parent::__construct(); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Outputs the builder sidebar. |
| 35 | */ |
| 36 | public function output_sidebar() { |
| 37 | $sections = apply_filters( |
| 38 | 'everest_forms_builder_settings_section', |
| 39 | array( |
| 40 | 'general' => esc_html__( 'General', 'everest-forms' ), |
| 41 | 'email' => esc_html__( 'Email', 'everest-forms' ), |
| 42 | 'security' => esc_html__( 'Anti-Spam and Security', 'everest-forms' ), |
| 43 | ), |
| 44 | $this->form_data |
| 45 | ); |
| 46 | |
| 47 | if ( ! empty( $sections ) ) { |
| 48 | foreach ( $sections as $slug => $section ) { |
| 49 | $this->add_sidebar_tab( $section, $slug ); |
| 50 | do_action( 'everest_forms_settings_connections_' . $slug, $section ); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get form data |
| 57 | * |
| 58 | * @return array form data. |
| 59 | */ |
| 60 | private function form_data() { |
| 61 | $form_data = array(); |
| 62 | |
| 63 | if ( ! empty( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
| 64 | $form_data = evf()->form->get( absint( $_GET['form_id'] ), array( 'content_only' => true ) ); // phpcs:ignore WordPress.Security.NonceVerification |
| 65 | } |
| 66 | |
| 67 | return $form_data; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Outputs the connection lists on sidebar. |
| 72 | */ |
| 73 | public function output_connections_list() { |
| 74 | $form_data = $this->form_data(); |
| 75 | $email = isset( $form_data['settings']['email'] ) ? $form_data['settings']['email'] : array(); |
| 76 | |
| 77 | if ( empty( $email ) ) { |
| 78 | $email['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 79 | } |
| 80 | |
| 81 | ?> |
| 82 | <div class="everest-forms-active-email"> |
| 83 | <button class="everest-forms-btn everest-forms-btn-primary everest-forms-email-add" data-form_id="<?php echo isset( $_GET['form_id'] ) ? absint( sanitize_text_field( wp_unslash( $_GET['form_id'] ) ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification ?>" data-source="email" data-type="<?php echo esc_attr( 'connection' ); ?>"> |
| 84 | <?php printf( esc_html__( 'Add New Email', 'everest-forms' ) ); ?> |
| 85 | </button> |
| 86 | <ul class="everest-forms-active-email-connections-list"> |
| 87 | <?php if ( ! empty( $email ) ) { ?> |
| 88 | <h4><?php echo esc_html__( 'Email Notifications', 'everest-forms' ); ?> </h4> |
| 89 | <?php |
| 90 | } |
| 91 | if ( ! empty( $email ) ) { |
| 92 | foreach ( $email as $connection_id => $connection_data ) { |
| 93 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 94 | $connection_name = ! empty( $connection_data['connection_name'] ) ? $connection_data['connection_name'] : ''; |
| 95 | if ( 'connection_1' !== $connection_id ) { |
| 96 | $remove_class = 'email-remove'; |
| 97 | } else { |
| 98 | $remove_class = 'email-default-remove'; |
| 99 | } |
| 100 | ?> |
| 101 | <li class="connection-list" data-connection-id="<?php echo esc_attr( $connection_id ); ?>"> |
| 102 | <a class="user-nickname" href="#"><?php echo esc_html( $connection_name ); ?></a> |
| 103 | <a href="#"><span class="<?php echo esc_attr( $remove_class ); ?>"><?php esc_html_e( 'Remove', 'everest-forms' ); ?></a> |
| 104 | </li> |
| 105 | <?php |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | ?> |
| 110 | </ul> |
| 111 | </div> |
| 112 | <?php |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Outputs the builder content. |
| 117 | */ |
| 118 | public function output_content() { |
| 119 | $settings = isset( $this->form_data['settings'] ) ? $this->form_data['settings'] : array(); |
| 120 | |
| 121 | // --------------------------------------------------------------------// |
| 122 | // General |
| 123 | // --------------------------------------------------------------------// |
| 124 | echo '<div class="evf-content-section evf-content-general-settings">'; |
| 125 | echo '<div class="evf-content-section-title">'; |
| 126 | esc_html_e( 'General', 'everest-forms' ); |
| 127 | echo '</div>'; |
| 128 | everest_forms_panel_field( |
| 129 | 'text', |
| 130 | 'settings', |
| 131 | 'form_title', |
| 132 | $this->form_data, |
| 133 | esc_html__( 'Form Name', 'everest-forms' ), |
| 134 | array( |
| 135 | 'default' => isset( $this->form->post_title ) ? $this->form->post_title : '', |
| 136 | 'tooltip' => esc_html__( 'Give a name to this form', 'everest-forms' ), |
| 137 | ) |
| 138 | ); |
| 139 | everest_forms_panel_field( |
| 140 | 'textarea', |
| 141 | 'settings', |
| 142 | 'form_description', |
| 143 | $this->form_data, |
| 144 | esc_html__( 'Form description', 'everest-forms' ), |
| 145 | array( |
| 146 | 'input_class' => 'short', |
| 147 | 'default' => isset( $this->form->form_description ) ? $this->form->form_description : '', |
| 148 | 'tooltip' => sprintf( esc_html__( 'Give the description to this form', 'everest-forms' ) ), |
| 149 | ) |
| 150 | ); |
| 151 | everest_forms_panel_field( |
| 152 | 'textarea', |
| 153 | 'settings', |
| 154 | 'form_disable_message', |
| 155 | $this->form_data, |
| 156 | esc_html__( 'Form disabled message', 'everest-forms' ), |
| 157 | array( |
| 158 | 'input_class' => 'short', |
| 159 | 'default' => isset( $this->form->form_disable_message ) ? $this->form->form_disable_message : __( 'This form is disabled.', 'everest-forms' ), |
| 160 | 'tooltip' => sprintf( esc_html__( 'Message that shows up if the form is disabled.', 'everest-forms' ) ), |
| 161 | ) |
| 162 | ); |
| 163 | everest_forms_panel_field( |
| 164 | 'textarea', |
| 165 | 'settings', |
| 166 | 'successful_form_submission_message', |
| 167 | $this->form_data, |
| 168 | esc_html__( 'Successful form submission message', 'everest-forms' ), |
| 169 | array( |
| 170 | 'input_class' => 'short', |
| 171 | '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' ), |
| 172 | /* translators: %1$s - general settings docs url */ |
| 173 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/general-settings/#successful-form-submission-message' ) ), |
| 174 | ) |
| 175 | ); |
| 176 | everest_forms_panel_field( |
| 177 | 'checkbox', |
| 178 | 'settings', |
| 179 | 'submission_message_scroll', |
| 180 | $this->form_data, |
| 181 | __( 'Automatically scroll to the submission message', 'everest-forms' ), |
| 182 | array( |
| 183 | 'default' => '1', |
| 184 | ) |
| 185 | ); |
| 186 | |
| 187 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submission Redirection', 'everest-forms' ) . '</h4>'; |
| 188 | |
| 189 | everest_forms_panel_field( |
| 190 | 'select', |
| 191 | 'settings', |
| 192 | 'redirect_to', |
| 193 | $this->form_data, |
| 194 | esc_html__( 'Redirect To', 'everest-forms' ), |
| 195 | array( |
| 196 | 'default' => 'same', |
| 197 | /* translators: %1$s - general settings docs url */ |
| 198 | 'tooltip' => sprintf( esc_html__( 'Choose where to redirect after form submission. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.wpeverest.com/docs/everest-forms/individual-form-settings/general-settings/#redirect-to' ) ), |
| 199 | 'options' => array( |
| 200 | 'same' => esc_html__( 'Same Page', 'everest-forms' ), |
| 201 | 'custom_page' => esc_html__( 'Custom Page', 'everest-forms' ), |
| 202 | 'external_url' => esc_html__( 'External URL', 'everest-forms' ), |
| 203 | ), |
| 204 | ) |
| 205 | ); |
| 206 | |
| 207 | everest_forms_panel_field( |
| 208 | 'select', |
| 209 | 'settings', |
| 210 | 'custom_page', |
| 211 | $this->form_data, |
| 212 | esc_html__( 'Custom Page', 'everest-forms' ), |
| 213 | array( |
| 214 | 'default' => '0', |
| 215 | 'options' => $this->get_all_pages(), |
| 216 | ) |
| 217 | ); |
| 218 | |
| 219 | everest_forms_panel_field( |
| 220 | 'text', |
| 221 | 'settings', |
| 222 | 'external_url', |
| 223 | $this->form_data, |
| 224 | esc_html__( 'External URL', 'everest-forms' ), |
| 225 | array( |
| 226 | 'default' => isset( $this->form->external_url ) ? $this->form->external_url : '', |
| 227 | ) |
| 228 | ); |
| 229 | |
| 230 | everest_forms_panel_field( |
| 231 | 'checkbox', |
| 232 | 'settings', |
| 233 | 'enable_redirect_query_string', |
| 234 | $this->form_data, |
| 235 | esc_html__( ' Append Query String', 'everest-forms' ), |
| 236 | array( |
| 237 | 'default' => '0', |
| 238 | ) |
| 239 | ); |
| 240 | |
| 241 | everest_forms_panel_field( |
| 242 | 'text', |
| 243 | 'settings', |
| 244 | 'query_string', |
| 245 | $this->form_data, |
| 246 | esc_html__( 'Query String', 'everest-forms' ), |
| 247 | array( |
| 248 | 'default' => isset( $settings['query_string'] ) ? $settings['query_string'] : '', |
| 249 | 'class' => isset( $settings['enable_redirect_query_string'] ) && '1' === $settings['enable_redirect_query_string'] ? '' : 'everest-forms-hidden', |
| 250 | 'smarttags' => array( |
| 251 | 'type' => 'all', |
| 252 | 'form_fields' => 'all', |
| 253 | ), |
| 254 | 'after' => '<p class="desc">' . sprintf( esc_html__( 'Example: firstname= {field_id="name_ys0GeZISRs-1"}&email={field_id="email_LbH5NxasXM-2"}', 'everest-forms' ) ) . '</p>', |
| 255 | ) |
| 256 | ); |
| 257 | |
| 258 | do_action( 'everest_forms_submission_redirection_settings', $this, 'submission_redirection' ); |
| 259 | echo '</div>'; |
| 260 | |
| 261 | everest_forms_panel_field( |
| 262 | 'select', |
| 263 | 'settings', |
| 264 | 'layout_class', |
| 265 | $this->form_data, |
| 266 | esc_html__( 'Layout Design', 'everest-forms' ), |
| 267 | array( |
| 268 | 'default' => '0', |
| 269 | 'tooltip' => esc_html__( 'Choose design template for the Form', 'everest-forms' ), |
| 270 | 'options' => array( |
| 271 | 'default' => esc_html__( 'Default', 'everest-forms' ), |
| 272 | 'layout-two' => esc_html__( 'Classic Layout', 'everest-forms' ), |
| 273 | ), |
| 274 | ) |
| 275 | ); |
| 276 | everest_forms_panel_field( |
| 277 | 'text', |
| 278 | 'settings', |
| 279 | 'form_class', |
| 280 | $this->form_data, |
| 281 | esc_html__( 'Form Class', 'everest-forms' ), |
| 282 | array( |
| 283 | 'default' => isset( $this->form->form_class ) ? $this->form->form_class : '', |
| 284 | /* translators: %1$s - general settings docs url */ |
| 285 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/general-settings/#form-class' ) ), |
| 286 | ) |
| 287 | ); |
| 288 | |
| 289 | do_action( 'everest_forms_field_required_indicators', $this->form_data, $settings ); |
| 290 | |
| 291 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submit Button', 'everest-forms' ) . '</h4>'; |
| 292 | everest_forms_panel_field( |
| 293 | 'text', |
| 294 | 'settings', |
| 295 | 'submit_button_text', |
| 296 | $this->form_data, |
| 297 | esc_html__( 'Submit button text', 'everest-forms' ), |
| 298 | array( |
| 299 | 'default' => isset( $settings['submit_button_text'] ) ? $settings['submit_button_text'] : __( 'Submit', 'everest-forms' ), |
| 300 | 'tooltip' => esc_html__( 'Enter desired text for submit button.', 'everest-forms' ), |
| 301 | ) |
| 302 | ); |
| 303 | everest_forms_panel_field( |
| 304 | 'text', |
| 305 | 'settings', |
| 306 | 'submit_button_processing_text', |
| 307 | $this->form_data, |
| 308 | __( 'Submit button processing text', 'everest-forms' ), |
| 309 | array( |
| 310 | 'default' => isset( $settings['submit_button_processing_text'] ) ? $settings['submit_button_processing_text'] : __( 'Processing…', 'everest-forms' ), |
| 311 | 'tooltip' => esc_html__( 'Enter the submit button text that you would like the button to display while the form submission is processing.', 'everest-forms' ), |
| 312 | ) |
| 313 | ); |
| 314 | everest_forms_panel_field( |
| 315 | 'text', |
| 316 | 'settings', |
| 317 | 'submit_button_class', |
| 318 | $this->form_data, |
| 319 | esc_html__( 'Submit button class', 'everest-forms' ), |
| 320 | array( |
| 321 | 'default' => isset( $settings['submit_button_class'] ) ? $settings['submit_button_class'] : '', |
| 322 | 'tooltip' => esc_html__( 'Enter CSS class names for submit button. Multiple class names should be separated with spaces.', 'everest-forms' ), |
| 323 | ) |
| 324 | ); |
| 325 | do_action( 'everest_forms_inline_submit_settings', $this, 'submit', 'connection_1' ); |
| 326 | echo '</div>'; |
| 327 | do_action( 'everest_forms_inline_integrations_settings', $this->form_data, $settings ); |
| 328 | everest_forms_panel_field( |
| 329 | 'checkbox', |
| 330 | 'settings', |
| 331 | 'ajax_form_submission', |
| 332 | $this->form_data, |
| 333 | esc_html__( 'Enable Ajax Form Submission', 'everest-forms' ), |
| 334 | array( |
| 335 | 'default' => isset( $settings['ajax_form_submission'] ) ? $settings['ajax_form_submission'] : 0, |
| 336 | 'tooltip' => esc_html__( 'Enables form submission without reloading the page.', 'everest-forms' ), |
| 337 | ) |
| 338 | ); |
| 339 | everest_forms_panel_field( |
| 340 | 'checkbox', |
| 341 | 'settings', |
| 342 | 'disabled_entries', |
| 343 | $this->form_data, |
| 344 | esc_html__( 'Disable storing entry information', 'everest-forms' ), |
| 345 | array( |
| 346 | 'default' => isset( $settings['disabled_entries'] ) ? $settings['disabled_entries'] : 0, |
| 347 | /* translators: %1$s - general settings docs url */ |
| 348 | 'tooltip' => sprintf( esc_html__( 'Disable storing form entries. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.wpeverest.com/docs/everest-forms/individual-form-settings/general-settings/#disable-storing-entry-information' ) ), |
| 349 | ) |
| 350 | ); |
| 351 | |
| 352 | do_action( 'everest_forms_inline_general_settings', $this ); |
| 353 | |
| 354 | echo '</div>'; |
| 355 | |
| 356 | // --------------------------------------------------------------------// |
| 357 | |
| 358 | // --------------------------------------------------------------------// |
| 359 | $form_name = isset( $settings['form_title'] ) ? ' - ' . $settings['form_title'] : ''; |
| 360 | if ( ! isset( $settings['email']['connection_1'] ) ) { |
| 361 | $settings['email']['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 362 | $settings['email']['connection_1']['evf_to_email'] = isset( $settings['email']['evf_to_email'] ) ? $settings['email']['evf_to_email'] : '{admin_email}'; |
| 363 | $settings['email']['connection_1']['evf_from_name'] = isset( $settings['email']['evf_from_name'] ) ? $settings['email']['evf_from_name'] : get_bloginfo( 'name', 'display' ); |
| 364 | $settings['email']['connection_1']['evf_from_email'] = isset( $settings['email']['evf_from_email'] ) ? $settings['email']['evf_from_email'] : '{admin_email}'; |
| 365 | $settings['email']['connection_1']['evf_reply_to'] = isset( $settings['email']['evf_reply_to'] ) ? $settings['email']['evf_reply_to'] : ''; |
| 366 | /* translators: %s: Form Name */ |
| 367 | $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 ); |
| 368 | $settings['email']['connection_1']['evf_email_message'] = isset( $settings['email']['evf_email_message'] ) ? $settings['email']['evf_email_message'] : '{all_fields}'; |
| 369 | |
| 370 | $email_settings = array( 'attach_pdf_to_admin_email', 'show_header_in_attachment_pdf_file', 'conditional_logic_status', 'conditional_option', 'conditionals' ); |
| 371 | foreach ( $email_settings as $email_setting ) { |
| 372 | $settings['email']['connection_1'][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 373 | } |
| 374 | |
| 375 | // Backward compatibility. |
| 376 | $unique_connection_id = sprintf( 'connection_%s', uniqid() ); |
| 377 | if ( isset( $settings['email']['evf_send_confirmation_email'] ) && '1' === $settings['email']['evf_send_confirmation_email'] ) { |
| 378 | $settings['email'][ $unique_connection_id ] = array( 'connection_name' => esc_html__( 'User Notification', 'everest-forms' ) ); |
| 379 | |
| 380 | foreach ( $email_settings as $email_setting ) { |
| 381 | $settings['email'][ $unique_connection_id ][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | echo "<div class = 'evf-email-settings-wrapper'>"; |
| 387 | |
| 388 | foreach ( $settings['email'] as $connection_id => $connection ) : |
| 389 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 390 | // Backward Compatibility. |
| 391 | if ( isset( $settings['email']['enable_email_notification'] ) && '0' === $settings['email']['enable_email_notification'] ) { |
| 392 | $email_status = isset( $settings['email']['enable_email_notification'] ) ? $settings['email']['enable_email_notification'] : '1'; |
| 393 | } else { |
| 394 | $email_status = isset( $settings['email'][ $connection_id ]['enable_email_notification'] ) ? $settings['email'][ $connection_id ]['enable_email_notification'] : '1'; |
| 395 | } |
| 396 | $hidden_class = '1' !== $email_status ? 'everest-forms-hidden' : ''; |
| 397 | $toggler_hide_class = isset( $toggler_hide_class ) ? 'style=display:none;' : ''; |
| 398 | echo '<div class="evf-content-section evf-content-email-settings">'; |
| 399 | echo '<div class="evf-content-section-title" ' . esc_attr( $toggler_hide_class ) . '>'; |
| 400 | echo '<div class="evf-title">' . esc_html__( 'Email', 'everest-forms' ) . '</div>'; |
| 401 | ?> |
| 402 | <div class="evf-toggle-section"> |
| 403 | <label class="evf-toggle-switch"> |
| 404 | <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat"> |
| 405 | <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 ); ?> > |
| 406 | <span class="evf-toggle-switch-wrap"></span> |
| 407 | <span class="evf-toggle-switch-control"></span> |
| 408 | </label> |
| 409 | </div></div> |
| 410 | <?php |
| 411 | |
| 412 | echo '<div class="evf-content-email-settings-inner ' . esc_attr( $hidden_class ) . '" data-connection_id=' . esc_attr( $connection_id ) . '>'; |
| 413 | |
| 414 | everest_forms_panel_field( |
| 415 | 'text', |
| 416 | 'email', |
| 417 | 'connection_name', |
| 418 | $this->form_data, |
| 419 | '', |
| 420 | array( |
| 421 | 'default' => isset( $settings['email'][ $connection_id ]['connection_name'] ) ? $settings['email'][ $connection_id ]['connection_name'] : __( 'Admin Notification', 'everest-forms' ), |
| 422 | 'class' => 'everest-forms-email-name', |
| 423 | 'parent' => 'settings', |
| 424 | 'subsection' => $connection_id, |
| 425 | ) |
| 426 | ); |
| 427 | |
| 428 | everest_forms_panel_field( |
| 429 | 'text', |
| 430 | 'email', |
| 431 | 'evf_to_email', |
| 432 | $this->form_data, |
| 433 | esc_html__( 'To Address', 'everest-forms' ), |
| 434 | array( |
| 435 | 'default' => isset( $settings['email'][ $connection_id ]['evf_to_email'] ) ? $settings['email'][ $connection_id ]['evf_to_email'] : '{admin_email}', |
| 436 | /* translators: %1$s - general settings docs url */ |
| 437 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#to-address' ) ), |
| 438 | 'smarttags' => array( |
| 439 | 'type' => 'fields', |
| 440 | 'form_fields' => 'email', |
| 441 | ), |
| 442 | 'parent' => 'settings', |
| 443 | 'subsection' => $connection_id, |
| 444 | ) |
| 445 | ); |
| 446 | if ( 'yes' === get_option( 'everest_forms_enable_email_copies' ) ) { |
| 447 | everest_forms_panel_field( |
| 448 | 'text', |
| 449 | 'email', |
| 450 | 'evf_carboncopy', |
| 451 | $this->form_data, |
| 452 | esc_html__( 'Cc Address', 'everest-forms' ), |
| 453 | array( |
| 454 | 'default' => isset( $settings['email'][ $connection_id ]['evf_carboncopy'] ) ? $settings['email'][ $connection_id ]['evf_carboncopy'] : '', |
| 455 | 'tooltip' => esc_html__( 'Enter Cc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 456 | 'smarttags' => array( |
| 457 | 'type' => 'fields', |
| 458 | 'form_fields' => 'email', |
| 459 | ), |
| 460 | 'parent' => 'settings', |
| 461 | 'subsection' => $connection_id, |
| 462 | ) |
| 463 | ); |
| 464 | everest_forms_panel_field( |
| 465 | 'text', |
| 466 | 'email', |
| 467 | 'evf_blindcarboncopy', |
| 468 | $this->form_data, |
| 469 | esc_html__( 'Bcc Address', 'everest-forms' ), |
| 470 | array( |
| 471 | 'default' => isset( $settings['email'][ $connection_id ]['evf_blindcarboncopy'] ) ? $settings['email'][ $connection_id ]['evf_blindcarboncopy'] : '', |
| 472 | 'tooltip' => esc_html__( 'Enter Bcc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 473 | 'smarttags' => array( |
| 474 | 'type' => 'fields', |
| 475 | 'form_fields' => 'email', |
| 476 | ), |
| 477 | 'parent' => 'settings', |
| 478 | 'subsection' => $connection_id, |
| 479 | ) |
| 480 | ); |
| 481 | } |
| 482 | everest_forms_panel_field( |
| 483 | 'text', |
| 484 | 'email', |
| 485 | 'evf_from_name', |
| 486 | $this->form_data, |
| 487 | esc_html__( 'From Name', 'everest-forms' ), |
| 488 | array( |
| 489 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_name'] ) ? $settings['email'][ $connection_id ]['evf_from_name'] : get_bloginfo( 'name', 'display' ), |
| 490 | /* translators: %1$s - general settings docs url */ |
| 491 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#from-name' ) ), |
| 492 | 'smarttags' => array( |
| 493 | 'type' => 'all', |
| 494 | 'form_fields' => 'all', |
| 495 | ), |
| 496 | 'parent' => 'settings', |
| 497 | 'subsection' => $connection_id, |
| 498 | ) |
| 499 | ); |
| 500 | everest_forms_panel_field( |
| 501 | 'text', |
| 502 | 'email', |
| 503 | 'evf_from_email', |
| 504 | $this->form_data, |
| 505 | esc_html__( 'From Address', 'everest-forms' ), |
| 506 | array( |
| 507 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_email'] ) ? $settings['email'][ $connection_id ]['evf_from_email'] : '{admin_email}', |
| 508 | /* translators: %1$s - general settings docs url */ |
| 509 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#from-address' ) ), |
| 510 | 'smarttags' => array( |
| 511 | 'type' => 'fields', |
| 512 | 'form_fields' => 'email', |
| 513 | ), |
| 514 | 'parent' => 'settings', |
| 515 | 'subsection' => $connection_id, |
| 516 | ) |
| 517 | ); |
| 518 | everest_forms_panel_field( |
| 519 | 'text', |
| 520 | 'email', |
| 521 | 'evf_reply_to', |
| 522 | $this->form_data, |
| 523 | esc_html__( 'Reply To', 'everest-forms' ), |
| 524 | array( |
| 525 | 'default' => isset( $settings['email'][ $connection_id ]['evf_reply_to'] ) ? $settings['email'][ $connection_id ]['evf_reply_to'] : '', |
| 526 | /* translators: %1$s - general settings docs url */ |
| 527 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#reply-to' ) ), |
| 528 | 'smarttags' => array( |
| 529 | 'type' => 'fields', |
| 530 | 'form_fields' => 'email', |
| 531 | ), |
| 532 | 'parent' => 'settings', |
| 533 | 'subsection' => $connection_id, |
| 534 | ) |
| 535 | ); |
| 536 | everest_forms_panel_field( |
| 537 | 'text', |
| 538 | 'email', |
| 539 | 'evf_email_subject', |
| 540 | $this->form_data, |
| 541 | esc_html__( 'Email Subject', 'everest-forms' ), |
| 542 | array( |
| 543 | /* translators: %s: Form Name */ |
| 544 | '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 ), |
| 545 | /* translators: %1$s - General Settings docs url */ |
| 546 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#email-subject' ) ), |
| 547 | 'smarttags' => array( |
| 548 | 'type' => 'all', |
| 549 | 'form_fields' => 'all', |
| 550 | ), |
| 551 | 'parent' => 'settings', |
| 552 | 'subsection' => $connection_id, |
| 553 | ) |
| 554 | ); |
| 555 | everest_forms_panel_field( |
| 556 | 'tinymce', |
| 557 | 'email', |
| 558 | 'evf_email_message', |
| 559 | $this->form_data, |
| 560 | esc_html__( 'Email Message', 'everest-forms' ), |
| 561 | array( |
| 562 | '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' ), |
| 563 | /* translators: %1$s - general settings docs url */ |
| 564 | '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.wpeverest.com/docs/everest-forms/individual-form-settings/email-settings/#email-message' ) ), |
| 565 | 'smarttags' => array( |
| 566 | 'type' => 'all', |
| 567 | 'form_fields' => 'all', |
| 568 | ), |
| 569 | 'parent' => 'settings', |
| 570 | 'subsection' => $connection_id, |
| 571 | /* translators: %s - all fields smart tag. */ |
| 572 | 'after' => '<p class="desc">' . sprintf( esc_html__( 'To display all form fields, use the %s Smart Tag.', 'everest-forms' ), '<code>{all_fields}</code>' ) . '</p>', |
| 573 | ) |
| 574 | ); |
| 575 | |
| 576 | do_action( 'everest_forms_inline_email_settings', $this, $connection_id ); |
| 577 | |
| 578 | echo '</div></div>'; |
| 579 | } |
| 580 | |
| 581 | endforeach; |
| 582 | |
| 583 | echo '</div>'; |
| 584 | // --------------------------------------------------------------------// |
| 585 | // Spam Protection and Security |
| 586 | // --------------------------------------------------------------------// |
| 587 | echo '<div class="evf-content-section evf-content-security-settings">'; |
| 588 | echo '<div class="evf-content-section-title">'; |
| 589 | esc_html_e( 'Anti-Spam and Security', 'everest-forms' ); |
| 590 | echo '</div>'; |
| 591 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Honeypot', 'everest-forms' ) . '</h4>'; |
| 592 | everest_forms_panel_field( |
| 593 | 'checkbox', |
| 594 | 'settings', |
| 595 | 'honeypot', |
| 596 | $this->form_data, |
| 597 | esc_html__( 'Enable anti-spam honeypot', 'everest-forms' ), |
| 598 | array( |
| 599 | 'default' => '1', |
| 600 | ) |
| 601 | ); |
| 602 | do_action( 'everest_forms_inline_honeypot_settings', $this, 'honeypot', 'connection_1' ); |
| 603 | echo '</div>'; |
| 604 | $recaptcha_type = get_option( 'everest_forms_recaptcha_type', 'v2' ); |
| 605 | $recaptcha_key = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_site_key' ); |
| 606 | $recaptcha_secret = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_secret_key' ); |
| 607 | switch ( $recaptcha_type ) { |
| 608 | case 'v2': |
| 609 | $recaptcha_label = esc_html__( 'Enable Google reCAPTCHA v2', 'everest-forms' ); |
| 610 | break; |
| 611 | |
| 612 | case 'v3': |
| 613 | $recaptcha_label = esc_html__( 'Enable Google reCAPTCHA v3', 'everest-forms' ); |
| 614 | break; |
| 615 | |
| 616 | case 'hcaptcha': |
| 617 | $recaptcha_label = esc_html__( 'Enable hCaptcha', 'everest-forms' ); |
| 618 | break; |
| 619 | } |
| 620 | $recaptcha_label = 'yes' === get_option( 'everest_forms_recaptcha_v2_invisible' ) && 'v2' === $recaptcha_type ? esc_html__( 'Enable Google Invisible reCAPTCHA v2', 'everest-forms' ) : $recaptcha_label; |
| 621 | if ( ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ) { |
| 622 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Captcha', 'everest-forms' ) . '</h4>'; |
| 623 | |
| 624 | everest_forms_panel_field( |
| 625 | 'checkbox', |
| 626 | 'settings', |
| 627 | 'recaptcha_support', |
| 628 | $this->form_data, |
| 629 | $recaptcha_label, |
| 630 | array( |
| 631 | 'default' => '0', |
| 632 | /* translators: %1$s - general settings docs url */ |
| 633 | 'tooltip' => sprintf( esc_html__( 'Enable reCaptcha. Make sure the site key and secret key is set in settings page. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.wpeverest.com/docs/everest-forms/individual-form-settings/general-settings/#enable-recaptcha-support' ) ), |
| 634 | ) |
| 635 | ); |
| 636 | |
| 637 | do_action( 'everest_forms_inline_captcha_settings', $this, 'captcha', 'connection_1' ); |
| 638 | echo '</div>'; |
| 639 | } |
| 640 | do_action( 'everest_forms_inline_security_settings', $this ); |
| 641 | echo '</div>'; |
| 642 | |
| 643 | do_action( 'everest_forms_settings_panel_content', $this ); |
| 644 | |
| 645 | } |
| 646 | |
| 647 | /** |
| 648 | * Get all pages. |
| 649 | */ |
| 650 | public function get_all_pages() { |
| 651 | $pages = array(); |
| 652 | foreach ( get_pages() as $page ) { |
| 653 | $pages[ $page->ID ] = $page->post_title; |
| 654 | } |
| 655 | |
| 656 | return $pages; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | return new EVF_Builder_Settings(); |
| 661 |