PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.13
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.13
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Frontend / FormEntryView.php

FormEntryView.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.21.13, at includes/Frontend/FormEntryView.php

43 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Frontend;
4
5 use BitCode\BitForm\Core\Util\Render;
6 use BitCode\BitForm\Frontend\Form\FrontendFormHandler;
7
8 class FormEntryView
9 {
10 public static function preview()
11 {
12 if (!(current_user_can('manage_options') || current_user_can('manage_bitform') || current_user_can('bitform_entry_edit'))) {
13 auth_redirect();
14 return;
15 }
16 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- REQUEST_URI is parsed/compared, not output directly.
17 $requestUri = isset($_SERVER['REQUEST_URI']) ? wp_unslash($_SERVER['REQUEST_URI']) : '';
18 $uri = explode('/', $requestUri);
19
20 if (is_array($uri) && count($uri) > 0) {
21 $formID = $uri[count($uri) - 2];
22 $entryID = $uri[count($uri) - 1];
23 $attr = ['form_id' => $formID, 'entry_id' => $entryID, 'form_preview' => true];
24
25 $frontendFormHandler = new FrontendFormHandler();
26 $formViewObject = $frontendFormHandler->handleFrontendRenderRequest($attr);
27 if ('string' === gettype($formViewObject)) {
28 Render::view('views/form-not-found');
29 exit;
30 }
31
32 $formHTML = $formViewObject->html;
33 $font = $formViewObject->font;
34 $bfGlobals = $formViewObject->bfGlobals;
35
36 set_transient('bitform_form_preview', true);
37 $frontendFormHandler->generateJs($formID, $entryID);
38 $title = 'BitForm Entry edit';
39 Render::view('views/entry-edit-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals'));
40 }
41 }
42 }
43