PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.2.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.2.2
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 / InitRoutes.php

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

54 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 use BitCode\BitForm\Frontend\CustomRoutes;
8 use BitCode\BitForm\Frontend\FormEntryView;
9 use BitCode\BitForm\Frontend\StandaloneFormView;
10
11 $bitforms_routes = new CustomRoutes();
12 // $bitforms_routes->add('bitform-form-view/([0-9]+)/?', [StandaloneFormView::class, 'preview']);
13 // $bitforms_routes->add('bitform-form-entry-edit/([0-9]+)/?([0-9]+)/?', [FormEntryView::class, 'preview']);
14
15 // if (class_exists('\BitCode\BitFormPro\Admin\DownloadFile')) {
16 // $routes->add('bitform-download-file', [\BitCode\BitFormPro\Admin\DownloadFile::class, 'download']); // for all users
17 // $routes->add('bitform-download-pdf', [\BitCode\BitFormPro\Admin\DownloadFile::class, 'adminDownloadPDF']); // for admin users
18 // }
19
20 add_action('template_redirect', function () {
21 // form preview
22 // url structure = siteurl/?bitform-form-view=2
23 if (isset($_REQUEST['bitform-form-view'])) {
24 StandaloneFormView::preview();
25 exit;
26 }
27
28 // form entry edit
29 // url structure = siteurl/?bitform-form-entry-edit=1&formid=3&entryid=23
30 if (isset($_REQUEST['bitform-form-entry-edit'], $_REQUEST['formId'], $_REQUEST['entryId']) && 1 === intval(sanitize_text_field(wp_unslash($_REQUEST['bitform-form-entry-edit'])))) {
31 FormEntryView::preview();
32 exit;
33 }
34
35 //pdf file preview
36 //url structure = siteurl/?bitform-download-pdf=1&formID=1&pdftemp=1&entryId=35
37 if (
38 (isset($_REQUEST['bitform-download-pdf'], $_REQUEST['formID'], $_REQUEST['pdftemp'],$_REQUEST['entryId']) ||
39 isset($_REQUEST['bitform-download-file'], $_REQUEST['token']))
40 && class_exists('\BitCode\BitFormPro\Admin\DownloadFile')) {
41 // admin download pdf
42 if (1 === intval(sanitize_text_field(wp_unslash($_REQUEST['bitform-download-pdf']))) && !isset($_REQUEST['bitform-download-file'])) {
43 \BitCode\BitFormPro\Admin\DownloadFile::adminDownloadPDF();
44 exit;
45 }
46
47 // all user
48 if (1 === intval(sanitize_text_field(wp_unslash($_REQUEST['bitform-download-file']))) && !isset($_REQUEST['bitform-download-pdf'])) {
49 \BitCode\BitFormPro\Admin\DownloadFile::download();
50 exit;
51 }
52 }
53 });
54