PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.6
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.6
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 / Transfer / Transfer.php

Transfer.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.6, at app/Modules/Transfer/Transfer.php

66 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace FluentForm\App\Modules\Transfer;
3
4 use Exception;
5 use FluentForm\App\Services\Transfer\TransferService;
6 use FluentForm\Framework\Foundation\App;
7
8 class Transfer
9 {
10
11 /**
12 * Request object
13 *
14 * @var \FluentForm\Framework\Request\Request $request
15 */
16 protected $request = null;
17
18
19 public function __construct()
20 {
21 $this->request = App::getInstance()->make('request');
22 }
23
24
25 /**
26 * Export forms as JSON.
27 */
28 public function exportForms()
29 {
30 try {
31 $formIds = $this->request->get('forms');
32 TransferService::exportForms($formIds);
33 } catch (Exception $exception) {
34 wp_send_json([
35 'message' => $exception->getMessage()
36 ], 424);
37 }
38 }
39
40 /**
41 * Import forms from a previously exported JSON file.
42 */
43 public function importForms()
44 {
45 try {
46 $file = $this->request->file('file');
47 $applyDefaultStyle = $this->request->get('apply_default_style') === '1';
48 wp_send_json(TransferService::importForms($file, $applyDefaultStyle), 200);
49 } catch (Exception $exception) {
50 wp_send_json([
51 'message' => $exception->getMessage()
52 ], 424);
53 }
54 }
55
56 public function exportEntries() {
57 try {
58 TransferService::exportEntries($this->request->get());
59 } catch (Exception $exception) {
60 wp_send_json([
61 'message' => $exception->getMessage()
62 ], 424);
63 }
64 }
65
66 }