PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.2
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.2
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Modules / Entries / EntryViewRenderer.php

EntryViewRenderer.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.2, at app/Modules/Entries/EntryViewRenderer.php

95 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules\Entries;
4
5 use FluentForm\App\Helpers\Helper;
6 use FluentForm\App\Modules\Form\FormFieldsParser;
7 use FluentForm\App\Modules\Registerer\TranslationString;
8 use FluentForm\Framework\Helpers\ArrayHelper;
9
10 class EntryViewRenderer
11 {
12 public function renderEntries($form_id)
13 {
14 wp_enqueue_script('fluentform_form_entries');
15
16 $forms = wpFluent()
17 ->table('fluentform_forms')
18 ->select(['id', 'title'])
19 ->orderBy('id', 'DESC')
20 ->get();
21
22 $emailNotifications = wpFluent()
23 ->table('fluentform_form_meta')
24 ->where('form_id', $form_id)
25 ->where('meta_key', 'notifications')
26 ->get();
27
28 $formattedNotification = [];
29
30 foreach ($emailNotifications as $notification) {
31 $value = \json_decode($notification->value, true);
32 $formattedNotification[] = [
33 'id' => $notification->id,
34 'name' => ArrayHelper::get($value, 'name'),
35 ];
36 }
37
38 $form = wpFluent()->table('fluentform_forms')->find($form_id);
39 $submissionShortcodes = \FluentForm\App\Services\FormBuilder\EditorShortCode::getSubmissionShortcodes($form);
40 $submissionShortcodes['shortcodes']['{submission.ip}'] = __('Submitter IP', 'fluentform');
41 if ($form->has_payment) {
42 $submissionShortcodes['shortcodes']['{payment.payment_status}'] = __('Payment Status','fluentform');
43 $submissionShortcodes['shortcodes']['{payment.payment_total}'] = __('Payment Total','fluentform');
44 }
45 $formInputs = FormFieldsParser::getEntryInputs($form, ['admin_label', 'raw']);
46 $inputLabels = FormFieldsParser::getAdminLabels($form, $formInputs);
47 $data = [
48 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
49 'forms' => $forms,
50 'form_id' => $form->id,
51 'enabled_auto_delete' => Helper::isEntryAutoDeleteEnabled($form_id),
52 'current_form_title' => $form->title,
53 'entry_statuses' => Helper::getEntryStatuses($form_id),
54 'entries_url_base' => admin_url('admin.php?page=fluent_forms&route=entries&form_id='),
55 'no_found_text' => __('Sorry! No entries found. All your entries will be shown here once you start getting form submissions',
56 'fluentform'),
57 'has_pro' => defined('FLUENTFORMPRO'),
58 'printStyles' => [fluentformMix('css/settings_global.css')],
59 'email_notifications' => $formattedNotification,
60 'available_countries' => getFluentFormCountryList(),
61 'upgrade_url' => fluentform_upgrade_url(),
62 'form_entries_str' => TranslationString::getEntriesI18n(),
63 'editor_shortcodes' => $submissionShortcodes['shortcodes'],
64 'input_labels' => $inputLabels,
65 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is just passing URL parameter to frontend for display
66 'update_status' => isset($_REQUEST['update_status']) ? sanitize_text_field(wp_unslash($_REQUEST['update_status'])) : '',
67 'address_fields' => array_keys(FormFieldsParser::getAddressFields($form)),
68 ];
69
70 $data = apply_filters_deprecated(
71 'fluent_form_entries_vars',
72 [
73 $data,
74 $form
75 ],
76 FLUENTFORM_FRAMEWORK_UPGRADE,
77 'fluentform/entries_vars',
78 'Use fluentform/entries_vars instead of fluent_form_entries_vars.'
79 );
80
81 $fluentFormEntriesVars = apply_filters('fluentform/entries_vars', $data, $form);
82
83 wp_localize_script(
84 'fluentform_form_entries',
85 'fluent_form_entries_vars',
86 $fluentFormEntriesVars
87 );
88
89 wpFluentForm('view')->render('admin.form.entries', [
90 'form_id' => $form_id,
91 'has_pdf' => defined('FLUENTFORM_PDF_VERSION') ? 'true' : 'false',
92 ]);
93 }
94 }
95