PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.4
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.4
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.4, at includes/Frontend/FormEntryView.php

42 lines 1.3 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 $requestUri = $_SERVER['REQUEST_URI'];
17 $uri = explode('/', $requestUri);
18
19 if (is_array($uri) && count($uri) > 0) {
20 $formID = $uri[count($uri) - 2];
21 $entryID = $uri[count($uri) - 1];
22 $attr = ['form_id' => $formID, 'entry_id' => $entryID, 'form_preview' => true];
23
24 $frontendFormHandler = new FrontendFormHandler();
25 $formViewObject = $frontendFormHandler->handleFrontendRenderRequest($attr);
26 if ('string' === gettype($formViewObject)) {
27 Render::view('views/form-not-found');
28 exit;
29 }
30
31 $formHTML = $formViewObject->html;
32 $font = $formViewObject->font;
33 $bfGlobals = $formViewObject->bfGlobals;
34
35 set_transient('bitform_form_preview', true);
36 $frontendFormHandler->generateJs($formID, $entryID);
37 $title = 'BitForm Entry edit';
38 Render::view('views/entry-edit-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals'));
39 }
40 }
41 }
42