PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
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 / Http / Controllers / LogController.php

LogController.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.14, at app/Http/Controllers/LogController.php

88 lines 2.7 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\Http\Controllers;
4
5 use Exception;
6 use FluentForm\App\Services\Logger\Logger;
7
8 class LogController extends Controller
9 {
10 public function get(Logger $logger)
11 {
12 try {
13 $attributes = $this->request->all();
14
15 $sanitizeMap = [
16 'form_id' => 'intval',
17 'page' => 'intval',
18 'per_page' => 'intval',
19 'search' => 'sanitize_text_field',
20 'log_type' => 'sanitize_text_field',
21 ];
22 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
23
24 return $this->sendSuccess(
25 $logger->get($attributes)
26 );
27 } catch (Exception $e) {
28 $response = ['message' => __('Something went wrong, please try again!', 'fluentform')];
29 if (defined('WP_DEBUG') && WP_DEBUG) {
30 $response['error'] = $e->getMessage();
31 }
32 return $this->sendError($response);
33 }
34 }
35
36 public function getFilters(Logger $logger)
37 {
38 try {
39 $attributes = $this->request->all();
40
41 $sanitizeMap = [
42 'form_id' => 'intval',
43 ];
44 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
45
46 return $this->sendSuccess(
47 $logger->getFilters($attributes)
48 );
49 } catch (Exception $e) {
50 $response = ['message' => __('Something went wrong, please try again!', 'fluentform')];
51 if (defined('WP_DEBUG') && WP_DEBUG) {
52 $response['error'] = $e->getMessage();
53 }
54 return $this->sendError($response);
55 }
56 }
57
58 public function remove(Logger $logger)
59 {
60 try {
61 $attributes = $this->request->all();
62
63 $sanitizeMap = [
64 'log_id' => 'intval',
65 'log_ids' => function ($value) {
66 if (is_array($value)) {
67 return array_map('intval', $value);
68 }
69
70 return [];
71 },
72 'type' => 'sanitize_text_field',
73 ];
74 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
75
76 return $this->sendSuccess(
77 $logger->remove($attributes)
78 );
79 } catch (Exception $e) {
80 $response = ['message' => __('Something went wrong, please try again!', 'fluentform')];
81 if (defined('WP_DEBUG') && WP_DEBUG) {
82 $response['error'] = $e->getMessage();
83 }
84 return $this->sendError($response);
85 }
86 }
87 }
88