PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 2.0.4
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v2.0.4
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / admin / builder / class-evf-builder-settings.php
everest-forms / includes / admin / builder Last commit date
class-evf-builder-fields.php 2 years ago class-evf-builder-page.php 3 years ago class-evf-builder-settings.php 2 years ago
class-evf-builder-settings.php
810 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 add_filter( 'everest_forms_builder_settings_section', array( $this, 'add_custom_css_js_section' ), 11, 2 );
31 add_action( 'everest_forms_settings_panel_content', array( $this, 'add_custom_css_js_settings' ), 111, 1 );
32
33 parent::__construct();
34 }
35
36 /**
37 * Outputs the builder sidebar.
38 */
39 public function output_sidebar() {
40 $sections = apply_filters(
41 'everest_forms_builder_settings_section',
42 array(
43 'general' => esc_html__( 'General', 'everest-forms' ),
44 'email' => esc_html__( 'Email', 'everest-forms' ),
45 'security' => esc_html__( 'Anti-Spam and Security', 'everest-forms' ),
46 ),
47 $this->form_data
48 );
49
50 if ( ! empty( $sections ) ) {
51 foreach ( $sections as $slug => $section ) {
52 $this->add_sidebar_tab( $section, $slug );
53 do_action( 'everest_forms_settings_connections_' . $slug, $section );
54 }
55 }
56 }
57
58 /**
59 * Get form data
60 *
61 * @return array form data.
62 */
63 private function form_data() {
64 $form_data = array();
65
66 if ( ! empty( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
67 $form_data = evf()->form->get( absint( $_GET['form_id'] ), array( 'content_only' => true ) ); // phpcs:ignore WordPress.Security.NonceVerification
68 }
69
70 return $form_data;
71 }
72
73 /**
74 * Outputs the connection lists on sidebar.
75 */
76 public function output_connections_list() {
77 $form_data = $this->form_data();
78 $email = isset( $form_data['settings']['email'] ) ? $form_data['settings']['email'] : array();
79
80 if ( empty( $email ) ) {
81 $email['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) );
82 }
83
84 ?>
85 <div class="everest-forms-active-email">
86 <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' ); ?>">
87 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
88 <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"/>
89 </svg>
90 <?php printf( esc_html__( 'Add New Email', 'everest-forms' ) ); ?>
91 </button>
92 <ul class="everest-forms-active-email-connections-list">
93 <?php if ( ! empty( $email ) ) { ?>
94 <h4><?php echo esc_html__( 'Email Notifications', 'everest-forms' ); ?> </h4>
95 <?php
96 }
97 if ( ! empty( $email ) ) {
98 foreach ( $email as $connection_id => $connection_data ) {
99 if ( preg_match( '/connection_/', $connection_id ) ) {
100 $connection_name = ! empty( $connection_data['connection_name'] ) ? $connection_data['connection_name'] : '';
101 if ( 'connection_1' !== $connection_id ) {
102 $remove_class = 'email-remove';
103 } else {
104 $remove_class = 'email-default-remove';
105 }
106 if ( isset( $email['enable_email_notification'] ) && '0' === $email['enable_email_notification'] ) {
107 $email_status = isset( $email['enable_email_notification'] ) ? $email['enable_email_notification'] : '1';
108 } else {
109 $email_status = isset( $email[ $connection_id ]['enable_email_notification'] ) ? $email[ $connection_id ]['enable_email_notification'] : '1';
110 }
111 ?>
112 <li class="connection-list" data-connection-id="<?php echo esc_attr( $connection_id ); ?>">
113 <a class="user-nickname" href="#"><?php echo esc_html( $connection_name ); ?></a>
114 <div class="evf-email-side-section">
115 <div class="evf-toggle-section">
116 <span class="everest-forms-toggle-form">
117 <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat">
118 <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 ); ?> >
119 <span class="slider round"></span>
120 </span>
121 </div>
122 <span class="evf-vertical-divider"></span>
123 <a href="#">
124 <span class="<?php echo esc_attr( $remove_class ); ?>">
125 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
126 <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"/>
127 </svg>
128 </a>
129 </div>
130 </li>
131 <?php
132 }
133 }
134 }
135 ?>
136 </ul>
137 </div>
138 <?php
139 }
140
141 /**
142 * Outputs the builder content.
143 */
144 public function output_content() {
145 $settings = isset( $this->form_data['settings'] ) ? $this->form_data['settings'] : array();
146
147 // --------------------------------------------------------------------//
148 // General
149 // --------------------------------------------------------------------//
150 echo '<div class="evf-content-section evf-content-general-settings">';
151 echo '<div class="evf-content-section-title">';
152 esc_html_e( 'General', 'everest-forms' );
153 echo '</div>';
154 everest_forms_panel_field(
155 'text',
156 'settings',
157 'form_title',
158 $this->form_data,
159 esc_html__( 'Form Name', 'everest-forms' ),
160 array(
161 'default' => isset( $this->form->post_title ) ? $this->form->post_title : '',
162 'tooltip' => esc_html__( 'Give a name to this form', 'everest-forms' ),
163 )
164 );
165 everest_forms_panel_field(
166 'textarea',
167 'settings',
168 'form_description',
169 $this->form_data,
170 esc_html__( 'Form description', 'everest-forms' ),
171 array(
172 'input_class' => 'short',
173 'default' => isset( $this->form->form_description ) ? $this->form->form_description : '',
174 'tooltip' => sprintf( esc_html__( 'Give the description to this form', 'everest-forms' ) ),
175 )
176 );
177 everest_forms_panel_field(
178 'textarea',
179 'settings',
180 'form_disable_message',
181 $this->form_data,
182 esc_html__( 'Form disabled message', 'everest-forms' ),
183 array(
184 'input_class' => 'short',
185 'default' => isset( $this->form->form_disable_message ) ? $this->form->form_disable_message : __( 'This form is disabled.', 'everest-forms' ),
186 'tooltip' => sprintf( esc_html__( 'Message that shows up if the form is disabled.', 'everest-forms' ) ),
187 )
188 );
189 everest_forms_panel_field(
190 'textarea',
191 'settings',
192 'successful_form_submission_message',
193 $this->form_data,
194 esc_html__( 'Successful form submission message', 'everest-forms' ),
195 array(
196 'input_class' => 'short',
197 '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' ),
198 /* translators: %1$s - general settings docs url */
199 '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' ) ),
200 )
201 );
202 everest_forms_panel_field(
203 'toggle',
204 'settings',
205 'submission_message_scroll',
206 $this->form_data,
207 __( 'Automatically scroll to the submission message', 'everest-forms' ),
208 array(
209 'default' => '1',
210 )
211 );
212
213 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submission Redirection', 'everest-forms' ) . '</h4>';
214
215 everest_forms_panel_field(
216 'select',
217 'settings',
218 'redirect_to',
219 $this->form_data,
220 esc_html__( 'Redirect To', 'everest-forms' ),
221 array(
222 'default' => 'same',
223 /* translators: %1$s - general settings docs url */
224 '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.everestforms.net/docs/general-settings/#5-toc-title' ) ),
225 'options' => array(
226 'same' => esc_html__( 'Same Page', 'everest-forms' ),
227 'custom_page' => esc_html__( 'Custom Page', 'everest-forms' ),
228 'external_url' => esc_html__( 'External URL', 'everest-forms' ),
229 ),
230 )
231 );
232
233 everest_forms_panel_field(
234 'select',
235 'settings',
236 'custom_page',
237 $this->form_data,
238 esc_html__( 'Custom Page', 'everest-forms' ),
239 array(
240 'default' => '0',
241 'options' => $this->get_all_pages(),
242 )
243 );
244
245 everest_forms_panel_field(
246 'text',
247 'settings',
248 'external_url',
249 $this->form_data,
250 esc_html__( 'External URL', 'everest-forms' ),
251 array(
252 'default' => isset( $this->form->external_url ) ? $this->form->external_url : '',
253 )
254 );
255
256 everest_forms_panel_field(
257 'toggle',
258 'settings',
259 'enable_redirect_query_string',
260 $this->form_data,
261 esc_html__( ' Append Query String', 'everest-forms' ),
262 array(
263 'default' => '0',
264 )
265 );
266
267 everest_forms_panel_field(
268 'text',
269 'settings',
270 'query_string',
271 $this->form_data,
272 esc_html__( 'Query String', 'everest-forms' ),
273 array(
274 'default' => isset( $settings['query_string'] ) ? $settings['query_string'] : '',
275 'class' => isset( $settings['enable_redirect_query_string'] ) && '1' === $settings['enable_redirect_query_string'] ? '' : 'everest-forms-hidden',
276 'smarttags' => array(
277 'type' => 'all',
278 'form_fields' => 'all',
279 ),
280 'after' => '<p class="desc">' . sprintf( esc_html__( 'Example: firstname= {field_id="name_ys0GeZISRs-1"}&email={field_id="email_LbH5NxasXM-2"}', 'everest-forms' ) ) . '</p>',
281 )
282 );
283
284 do_action( 'everest_forms_submission_redirection_settings', $this, 'submission_redirection' );
285 echo '</div>';
286
287 everest_forms_panel_field(
288 'select',
289 'settings',
290 'layout_class',
291 $this->form_data,
292 esc_html__( 'Layout Design', 'everest-forms' ),
293 array(
294 'default' => '0',
295 'tooltip' => esc_html__( 'Choose design template for the Form', 'everest-forms' ),
296 'options' => array(
297 'default' => esc_html__( 'Default', 'everest-forms' ),
298 'layout-two' => esc_html__( 'Classic Layout', 'everest-forms' ),
299 ),
300 )
301 );
302 everest_forms_panel_field(
303 'text',
304 'settings',
305 'form_class',
306 $this->form_data,
307 esc_html__( 'Form Class', 'everest-forms' ),
308 array(
309 'default' => isset( $this->form->form_class ) ? $this->form->form_class : '',
310 /* translators: %1$s - general settings docs url */
311 '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' ) ),
312 )
313 );
314
315 do_action( 'everest_forms_field_required_indicators', $this->form_data, $settings );
316
317 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submit Button', 'everest-forms' ) . '</h4>';
318 everest_forms_panel_field(
319 'text',
320 'settings',
321 'submit_button_text',
322 $this->form_data,
323 esc_html__( 'Submit button text', 'everest-forms' ),
324 array(
325 'default' => isset( $settings['submit_button_text'] ) ? $settings['submit_button_text'] : __( 'Submit', 'everest-forms' ),
326 'tooltip' => esc_html__( 'Enter desired text for submit button.', 'everest-forms' ),
327 )
328 );
329 everest_forms_panel_field(
330 'text',
331 'settings',
332 'submit_button_processing_text',
333 $this->form_data,
334 __( 'Submit button processing text', 'everest-forms' ),
335 array(
336 'default' => isset( $settings['submit_button_processing_text'] ) ? $settings['submit_button_processing_text'] : __( 'Processing&hellip;', 'everest-forms' ),
337 'tooltip' => esc_html__( 'Enter the submit button text that you would like the button to display while the form submission is processing.', 'everest-forms' ),
338 )
339 );
340 everest_forms_panel_field(
341 'text',
342 'settings',
343 'submit_button_class',
344 $this->form_data,
345 esc_html__( 'Submit button class', 'everest-forms' ),
346 array(
347 'default' => isset( $settings['submit_button_class'] ) ? $settings['submit_button_class'] : '',
348 'tooltip' => esc_html__( 'Enter CSS class names for submit button. Multiple class names should be separated with spaces.', 'everest-forms' ),
349 )
350 );
351 do_action( 'everest_forms_inline_submit_settings', $this, 'submit', 'connection_1' );
352 echo '</div>';
353 do_action( 'everest_forms_inline_integrations_settings', $this->form_data, $settings );
354 everest_forms_panel_field(
355 'toggle',
356 'settings',
357 'ajax_form_submission',
358 $this->form_data,
359 esc_html__( 'Enable Ajax Form Submission', 'everest-forms' ),
360 array(
361 'default' => isset( $settings['ajax_form_submission'] ) ? $settings['ajax_form_submission'] : 0,
362 'tooltip' => esc_html__( 'Enables form submission without reloading the page.', 'everest-forms' ),
363 )
364 );
365 everest_forms_panel_field(
366 'toggle',
367 'settings',
368 'disabled_entries',
369 $this->form_data,
370 esc_html__( 'Disable storing entry information', 'everest-forms' ),
371 array(
372 'default' => isset( $settings['disabled_entries'] ) ? $settings['disabled_entries'] : 0,
373 /* translators: %1$s - general settings docs url */
374 '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' ) ),
375 )
376 );
377
378 do_action( 'everest_forms_inline_general_settings', $this );
379
380 echo '</div>';
381
382 // --------------------------------------------------------------------//
383 // Email
384 // --------------------------------------------------------------------//
385 $form_name = isset( $settings['form_title'] ) ? ' - ' . $settings['form_title'] : '';
386 if ( ! isset( $settings['email']['connection_1'] ) ) {
387 $settings['email']['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) );
388 $settings['email']['connection_1']['evf_to_email'] = isset( $settings['email']['evf_to_email'] ) ? $settings['email']['evf_to_email'] : '{admin_email}';
389 $settings['email']['connection_1']['evf_from_name'] = isset( $settings['email']['evf_from_name'] ) ? $settings['email']['evf_from_name'] : get_bloginfo( 'name', 'display' );
390 $settings['email']['connection_1']['evf_from_email'] = isset( $settings['email']['evf_from_email'] ) ? $settings['email']['evf_from_email'] : '{admin_email}';
391 $settings['email']['connection_1']['evf_reply_to'] = isset( $settings['email']['evf_reply_to'] ) ? $settings['email']['evf_reply_to'] : '';
392 /* translators: %s: Form Name */
393 $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 );
394 $settings['email']['connection_1']['evf_email_message'] = isset( $settings['email']['evf_email_message'] ) ? $settings['email']['evf_email_message'] : '{all_fields}';
395
396 $email_settings = array( 'attach_pdf_to_admin_email', 'show_header_in_attachment_pdf_file', 'conditional_logic_status', 'conditional_option', 'conditionals' );
397 foreach ( $email_settings as $email_setting ) {
398 $settings['email']['connection_1'][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : '';
399 }
400
401 // Backward compatibility.
402 $unique_connection_id = sprintf( 'connection_%s', uniqid() );
403 if ( isset( $settings['email']['evf_send_confirmation_email'] ) && '1' === $settings['email']['evf_send_confirmation_email'] ) {
404 $settings['email'][ $unique_connection_id ] = array( 'connection_name' => esc_html__( 'User Notification', 'everest-forms' ) );
405
406 foreach ( $email_settings as $email_setting ) {
407 $settings['email'][ $unique_connection_id ][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : '';
408 }
409 }
410 }
411
412 echo "<div class = 'evf-email-settings-wrapper'>";
413
414 foreach ( $settings['email'] as $connection_id => $connection ) :
415 if ( preg_match( '/connection_/', $connection_id ) ) {
416 // Backward Compatibility.
417 if ( isset( $settings['email']['enable_email_notification'] ) && '0' === $settings['email']['enable_email_notification'] ) {
418 $email_status = isset( $settings['email']['enable_email_notification'] ) ? $settings['email']['enable_email_notification'] : '1';
419 } else {
420 $email_status = isset( $settings['email'][ $connection_id ]['enable_email_notification'] ) ? $settings['email'][ $connection_id ]['enable_email_notification'] : '1';
421 }
422 $hidden_class = '1' !== $email_status ? 'everest-forms-hidden' : '';
423 $hidden_enable_setting_class = '1' === $email_status ? 'everest-forms-hidden' : '';
424 $toggler_hide_class = isset( $toggler_hide_class ) ? 'style=display:none;' : '';
425 echo '<div class="evf-content-section evf-content-email-settings" ' . esc_attr( $toggler_hide_class ) . '>';
426 echo '<div class="evf-content-section-title" ' . esc_attr( $toggler_hide_class ) . '>';
427 echo '<div class="evf-title">' . esc_html__( 'Email', 'everest-forms' ) . '</div>';
428 ?>
429 <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>
430 <div class="evf-toggle-section">
431 <label class="evf-toggle-switch">
432 <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat">
433 <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 ); ?> >
434 <span class="evf-toggle-switch-wrap"></span>
435 <span class="evf-toggle-switch-control"></span>
436 </label>
437 </div></div>
438 <?php
439
440 echo '<div class="evf-content-email-settings-inner ' . esc_attr( $hidden_class ) . '" data-connection_id=' . esc_attr( $connection_id ) . '>';
441
442 everest_forms_panel_field(
443 'text',
444 'email',
445 'connection_name',
446 $this->form_data,
447 '',
448 array(
449 'default' => isset( $settings['email'][ $connection_id ]['connection_name'] ) ? $settings['email'][ $connection_id ]['connection_name'] : __( 'Admin Notification', 'everest-forms' ),
450 'class' => 'everest-forms-email-name',
451 'parent' => 'settings',
452 'subsection' => $connection_id,
453 )
454 );
455
456 everest_forms_panel_field(
457 'text',
458 'email',
459 'evf_to_email',
460 $this->form_data,
461 esc_html__( 'To Address', 'everest-forms' ),
462 array(
463 'default' => isset( $settings['email'][ $connection_id ]['evf_to_email'] ) ? $settings['email'][ $connection_id ]['evf_to_email'] : '{admin_email}',
464 /* translators: %1$s - general settings docs url */
465 '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' ) ),
466 'smarttags' => array(
467 'type' => 'fields',
468 'form_fields' => 'email',
469 ),
470 'parent' => 'settings',
471 'subsection' => $connection_id,
472 )
473 );
474 if ( 'yes' === get_option( 'everest_forms_enable_email_copies' ) ) {
475 everest_forms_panel_field(
476 'text',
477 'email',
478 'evf_carboncopy',
479 $this->form_data,
480 esc_html__( 'Cc Address', 'everest-forms' ),
481 array(
482 'default' => isset( $settings['email'][ $connection_id ]['evf_carboncopy'] ) ? $settings['email'][ $connection_id ]['evf_carboncopy'] : '',
483 'tooltip' => esc_html__( 'Enter Cc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ),
484 'smarttags' => array(
485 'type' => 'fields',
486 'form_fields' => 'email',
487 ),
488 'parent' => 'settings',
489 'subsection' => $connection_id,
490 )
491 );
492 everest_forms_panel_field(
493 'text',
494 'email',
495 'evf_blindcarboncopy',
496 $this->form_data,
497 esc_html__( 'Bcc Address', 'everest-forms' ),
498 array(
499 'default' => isset( $settings['email'][ $connection_id ]['evf_blindcarboncopy'] ) ? $settings['email'][ $connection_id ]['evf_blindcarboncopy'] : '',
500 'tooltip' => esc_html__( 'Enter Bcc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ),
501 'smarttags' => array(
502 'type' => 'fields',
503 'form_fields' => 'email',
504 ),
505 'parent' => 'settings',
506 'subsection' => $connection_id,
507 )
508 );
509 }
510 everest_forms_panel_field(
511 'text',
512 'email',
513 'evf_from_name',
514 $this->form_data,
515 esc_html__( 'From Name', 'everest-forms' ),
516 array(
517 'default' => isset( $settings['email'][ $connection_id ]['evf_from_name'] ) ? $settings['email'][ $connection_id ]['evf_from_name'] : get_bloginfo( 'name', 'display' ),
518 /* translators: %1$s - general settings docs url */
519 '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' ) ),
520 'smarttags' => array(
521 'type' => 'all',
522 'form_fields' => 'all',
523 ),
524 'parent' => 'settings',
525 'subsection' => $connection_id,
526 )
527 );
528 everest_forms_panel_field(
529 'text',
530 'email',
531 'evf_from_email',
532 $this->form_data,
533 esc_html__( 'From Address', 'everest-forms' ),
534 array(
535 'default' => isset( $settings['email'][ $connection_id ]['evf_from_email'] ) ? $settings['email'][ $connection_id ]['evf_from_email'] : '{admin_email}',
536 /* translators: %1$s - general settings docs url */
537 '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' ) ),
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_reply_to',
550 $this->form_data,
551 esc_html__( 'Reply To', 'everest-forms' ),
552 array(
553 'default' => isset( $settings['email'][ $connection_id ]['evf_reply_to'] ) ? $settings['email'][ $connection_id ]['evf_reply_to'] : '',
554 /* translators: %1$s - general settings docs url */
555 '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' ) ),
556 'smarttags' => array(
557 'type' => 'fields',
558 'form_fields' => 'email',
559 ),
560 'parent' => 'settings',
561 'subsection' => $connection_id,
562 )
563 );
564 everest_forms_panel_field(
565 'text',
566 'email',
567 'evf_email_subject',
568 $this->form_data,
569 esc_html__( 'Email Subject', 'everest-forms' ),
570 array(
571 /* translators: %s: Form Name */
572 '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 ),
573 /* translators: %1$s - General Settings docs url */
574 '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' ) ),
575 'smarttags' => array(
576 'type' => 'all',
577 'form_fields' => 'all',
578 ),
579 'parent' => 'settings',
580 'subsection' => $connection_id,
581 )
582 );
583 // --------------------------------------------------------------------//
584 // Everest Forms AI Setting Section Start
585 // --------------------------------------------------------------------//
586 if ( ! empty( get_option( 'everest_forms_ai_api_key' ) ) ) {
587 everest_forms_panel_field(
588 'toggle',
589 'email',
590 'enable_ai_email_prompt',
591 $this->form_data,
592 esc_html__( 'Enable Email Prompt', 'everest-forms' ),
593 array(
594 'default' => ! empty( $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ) ? $settings['email'][ $connection_id ]['enable_ai_email_prompt'] : '0',
595 'class' => 'everest-forms-enable-email-prompt',
596 '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' ) ),
597 'parent' => 'settings',
598 'subsection' => $connection_id,
599 )
600 );
601 everest_forms_panel_field(
602 'textarea',
603 'email',
604 'evf_email_message_prompt',
605 $this->form_data,
606 esc_html__( 'Email Message Prompt', 'everest-forms' ),
607 array(
608 'default' => isset( $settings['email'][ $connection_id ]['evf_email_message_prompt'] ) ? $settings['email'][ $connection_id ]['evf_email_message_prompt'] : '',
609 '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',
610 /* translators: %1$s - general settings docs url */
611 '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' ) ),
612 'smarttags' => array(
613 'type' => 'all',
614 'form_fields' => 'all',
615 ),
616 'parent' => 'settings',
617 'subsection' => $connection_id,
618 )
619 );
620 }
621 // --------------------------------------------------------------------//
622 // Everest Forms AI Setting Section End
623 // --------------------------------------------------------------------//
624 everest_forms_panel_field(
625 'tinymce',
626 'email',
627 'evf_email_message',
628 $this->form_data,
629 esc_html__( 'Email Message', 'everest-forms' ),
630 array(
631 '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' ),
632 /* translators: %1$s - general settings docs url */
633 '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' ) ),
634 'smarttags' => array(
635 'type' => 'all',
636 'form_fields' => 'all',
637 ),
638 'parent' => 'settings',
639 'subsection' => $connection_id,
640 /* translators: %s - all fields smart tag. */
641 'after' => empty( get_option( '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>',
642 )
643 );
644
645 do_action( 'everest_forms_inline_email_settings', $this, $connection_id );
646
647 echo '</div></div>';
648 }
649
650 endforeach;
651
652 echo '</div>';
653 // --------------------------------------------------------------------//
654 // Spam Protection and Security
655 // --------------------------------------------------------------------//
656 echo '<div class="evf-content-section evf-content-security-settings">';
657 echo '<div class="evf-content-section-title">';
658 esc_html_e( 'Anti-Spam and Security', 'everest-forms' );
659 echo '</div>';
660 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Honeypot', 'everest-forms' ) . '</h4>';
661 everest_forms_panel_field(
662 'toggle',
663 'settings',
664 'honeypot',
665 $this->form_data,
666 esc_html__( 'Enable anti-spam honeypot', 'everest-forms' ),
667 array(
668 'default' => '1',
669 )
670 );
671 do_action( 'everest_forms_inline_honeypot_settings', $this, 'honeypot', 'connection_1' );
672 echo '</div>';
673 if ( 'yes' === get_option( 'everest_forms_recaptcha_v2_invisible' ) ) {
674 $recaptcha_type = get_option( 'everest_forms_recaptcha_type', 'v2' );
675 $recaptcha_key = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_invisible_site_key' );
676 $recaptcha_secret = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_invisible_secret_key' );
677 } else {
678 $recaptcha_type = get_option( 'everest_forms_recaptcha_type', 'v2' );
679 $recaptcha_key = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_site_key' );
680 $recaptcha_secret = get_option( 'everest_forms_recaptcha_' . $recaptcha_type . '_secret_key' );
681 }
682
683 switch ( $recaptcha_type ) {
684 case 'v2':
685 $recaptcha_label = esc_html__( 'Enable Google reCAPTCHA v2', 'everest-forms' );
686 break;
687
688 case 'v3':
689 $recaptcha_label = esc_html__( 'Enable Google reCAPTCHA v3', 'everest-forms' );
690 break;
691
692 case 'hcaptcha':
693 $recaptcha_label = esc_html__( 'Enable hCaptcha', 'everest-forms' );
694 break;
695
696 case 'turnstile':
697 $recaptcha_label = esc_html__( 'Enable Cloudflare Turnstile', 'everest-forms' );
698 break;
699 }
700 $recaptcha_label = 'yes' === get_option( 'everest_forms_recaptcha_v2_invisible' ) && 'v2' === $recaptcha_type ? esc_html__( 'Enable Google Invisible reCAPTCHA v2', 'everest-forms' ) : $recaptcha_label;
701 if ( ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ) {
702 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Captcha', 'everest-forms' ) . '</h4>';
703
704 everest_forms_panel_field(
705 'toggle',
706 'settings',
707 'recaptcha_support',
708 $this->form_data,
709 $recaptcha_label,
710 array(
711 'default' => '0',
712 /* translators: %1$s - general settings docs url */
713 '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.everestforms.net/docs/how-to-integrate-google-recaptcha/#7-toc-title' ) ),
714 )
715 );
716
717 do_action( 'everest_forms_inline_captcha_settings', $this, 'captcha', 'connection_1' );
718 echo '</div>';
719 }
720 do_action( 'everest_forms_inline_security_settings', $this );
721 echo '</div>';
722
723 do_action( 'everest_forms_settings_panel_content', $this );
724 }
725
726 /**
727 * Add Custom CSS and JS menu item to the builder settings list.
728 *
729 * @param [array] $arr Setting Menu items list.
730 * @param [array] $form_data Form Data.
731 * @return array
732 */
733 public function add_custom_css_js_section( $arr, $form_data ) {
734
735 $arr['custom-css-js'] = esc_html__( 'Custom CSS and JS', 'everest-forms' );
736
737 return $arr;
738 }
739
740 /**
741 * Add Custom Css and Js settings section.
742 *
743 * @param [array] $form_data Form Data.
744 * @return void
745 */
746 public function add_custom_css_js_settings( $form_data ) {
747 // --------------------------------------------------------------------//
748 // Custom CSS and JS
749 // --------------------------------------------------------------------//
750 echo '<div class="evf-content-section evf-content-custom-css-js-settings">';
751 echo '<div class="evf-content-section-title">';
752 esc_html_e( 'Custom CSS and JS', 'everest-forms' );
753 echo '</div>';
754 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom CSS', 'everest-forms' ) . '</h4>';
755 everest_forms_panel_field(
756 'toggle',
757 'settings',
758 'evf-enable-custom-css',
759 $this->form_data,
760 esc_html__( 'Enable Custom CSS', 'everest-forms' ),
761 array(
762 'default' => '0',
763 )
764 );
765 everest_forms_panel_field(
766 'textarea',
767 'settings',
768 'evf-custom-css',
769 $this->form_data,
770 esc_html__( 'Custom CSS', 'everest-forms' )
771 );
772 echo '</div>';
773 echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom JS', 'everest-forms' ) . '</h4>';
774 everest_forms_panel_field(
775 'toggle',
776 'settings',
777 'evf-enable-custom-js',
778 $this->form_data,
779 esc_html__( 'Enable Custom JS', 'everest-forms' ),
780 array(
781 'default' => '0',
782 )
783 );
784 everest_forms_panel_field(
785 'textarea',
786 'settings',
787 'evf-custom-js',
788 $this->form_data,
789 esc_html__( 'Custom JS', 'everest-forms' )
790 );
791 echo '</div>';
792
793 echo '</div>';
794 }
795
796 /**
797 * Get all pages.
798 */
799 public function get_all_pages() {
800 $pages = array();
801 foreach ( get_pages() as $page ) {
802 $pages[ $page->ID ] = $page->post_title;
803 }
804
805 return $pages;
806 }
807 }
808
809 return new EVF_Builder_Settings();
810