PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
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 / class-evf-admin-preview-confirmation.php
everest-forms / includes / admin Last commit date
builder 4 weeks ago form-migrator 4 weeks ago plugin-updates 8 years ago settings 4 weeks ago views 4 weeks ago class-evf-admin-addons.php 4 months ago class-evf-admin-assets.php 1 week ago class-evf-admin-builder.php 2 months ago class-evf-admin-dashboard.php 4 weeks ago class-evf-admin-editor.php 4 years ago class-evf-admin-embed-wizard.php 2 years ago class-evf-admin-entries-table-list.php 2 months ago class-evf-admin-entries.php 2 months ago class-evf-admin-form-templates.php 4 weeks ago class-evf-admin-forms-table-list.php 4 months ago class-evf-admin-forms.php 4 months ago class-evf-admin-import-export.php 4 weeks ago class-evf-admin-menus.php 4 weeks ago class-evf-admin-notices.php 4 months ago class-evf-admin-preview-confirmation.php 1 year ago class-evf-admin-settings.php 4 weeks ago class-evf-admin-tools.php 2 months ago class-evf-admin-welcome.php 2 years ago class-evf-admin.php 2 months ago class-evf-base-list-table.php 4 months ago evf-admin-functions.php 4 weeks ago
class-evf-admin-preview-confirmation.php
126 lines
1 <?php
2 /**
3 * Preview Confirmation.
4 *
5 * @package EverestForms/Admin
6 * @version 2.0.8
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * Embed Wizard Class.
13 *
14 * @since 2.0.8
15 */
16 class EVF_Admin_Preview_Confirmation {
17
18 /**
19 * Initialize class.
20 *
21 * @since 2.0.8
22 */
23 public static function init() {
24 add_action( 'everest_forms_preview_confirmation', array( __CLASS__, 'preview_confirmation' ), 20, 3 );
25 add_filter( 'everest_forms_notice_types', array( __CLASS__, 'add_notice' ) );
26 }
27
28 /**
29 * Add notice type.
30 *
31 * @param [array] $notices notices type.
32 */
33 public static function add_notice( $notices ) {
34 $notices[] = 'preview';
35 return $notices;
36 }
37
38 /**
39 * Show preview confirmation after form submission.
40 *
41 * @since 2.0.8
42 *
43 * @param [array] $form_data Form Data.
44 * @param [array] $form_fields Form Fields.
45 * @param [string] $preview_style Preview Style.
46 */
47 public static function preview_confirmation( $form_data, $form_fields, $preview_style ) {
48
49 $output = '';
50 $output .= '<div class="everest_forms_preview_confirmation_' . $preview_style . '">';
51
52 $exclude = array(
53 'captcha',
54 'password',
55 );
56
57 $labels = array();
58 $fields = array();
59
60 foreach ( $form_data['form_fields'] as $id => $data ) {
61 if ( in_array( $data['type'], $exclude, true ) ) {
62 continue;
63 }
64
65 $formatted_string = '';
66
67 if ( isset( $form_fields[ $id ]['type'] ) ) {
68 if ( has_filter( "everest_forms_field_exporter_{$form_fields[ $id ]['type']}" ) ) {
69 $formatted_string = apply_filters( "everest_forms_field_exporter_{$form_fields[ $id ]['type']}", $form_fields[ $id ] );
70
71 if ( false === $formatted_string['value'] || empty( $formatted_string['value'] ) ) {
72 continue; // Skip empty fields
73 }
74 }
75 } elseif ( empty( $form_fields[ $id ]['value'] ) ) {
76 continue; // Skip empty fields
77 } elseif ( 'basic' === $preview_style ) {
78 $output .= '<div class="everest_forms_preview_confirmation_' . $preview_style . '_label">' . $form_fields[ $id ]['name'] . '<a href="' . esc_url( $form_fields[ $id ]['value'] ) . '" rel="noopener noreferrer" target="_blank"><img src="' . esc_url( $form_fields[ $id ]['value'] ) . '" style="width:200px;" /></a></div>';
79 continue;
80 }
81
82 if ( isset( $form_fields[ $id ]['type'] ) && 'select' === $form_fields[ $id ]['type'] ) {
83 $formatted_string = str_replace( '<br>', '', $formatted_string );
84 }
85
86 $label = isset( $formatted_string['label'] ) ? $formatted_string['label'] : '';
87
88 if ( in_array( $label, $labels ) && empty( $formatted_string['value'] ) ) {
89 continue; // Skip fields with duplicate labels and empty values
90 }
91
92 $labels[] = $label;
93 $fields[] = $formatted_string;
94
95 }
96
97 $close_div = 'basic' === $preview_style ? '' : '</div>';
98
99 foreach ( $fields as $formatted_string ) {
100 if ( is_array( $formatted_string ) && isset( $formatted_string['label'], $formatted_string['value'] ) ) {
101 if ( 'basic' === $preview_style ) {
102 $output .= '<div class="everest_forms_preview_confirmation_' . $preview_style . '_label">' . $formatted_string['label'] . ' : ' . $close_div;
103 $output .= '<span>' . $formatted_string['value'] . '</span></div>';
104 } else {
105 $output .= '<div class="everest_forms_preview_confirmation_' . $preview_style . '_label">' . $formatted_string['label'] . ' : ' . $close_div;
106 $output .= '<div class="everest_forms_preview_confirmation_' . $preview_style . '_value">' . $formatted_string['value'] . '</div>';
107 }
108 }
109 }
110
111 $output .= '</div>';
112
113 $ajax_form_submission = isset( $form_data['settings']['ajax_form_submission'] ) ? $form_data['settings']['ajax_form_submission'] : 0;
114
115 if ( $ajax_form_submission ) {
116 return $output;
117 } else {
118 evf_add_notice( $output, 'preview' );
119 }
120 }
121
122
123 }
124
125 EVF_Admin_Preview_Confirmation::init();
126