PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.1
JetFormBuilder — Dynamic Blocks Form Builder v3.1.1
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
← All changes | includes/request/request-handler.php +160 -156 3.6.23.1.1 View file →
@@ -1,156 +1,160 @@
1 -<?php
2 -
3 -
4 -namespace Jet_Form_Builder\Request;
5 -
6 -use Jet_Form_Builder\Actions\Events\Bad_Request\Bad_Request_Event;
7 -use Jet_Form_Builder\Blocks\Block_Helper;
8 -use Jet_Form_Builder\Classes\Resources\Media_Block_Value;
9 -use Jet_Form_Builder\Exceptions\Action_Exception;
10 -use Jet_Form_Builder\Exceptions\Request_Exception;
11 -use JFB_Modules\Security\Exceptions\Spam_Exception;
12 -use Jet_Form_Builder\Request\Exceptions\Sanitize_Value_Exception;
13 -use JFB_Modules\Logger;
14 -
15 -// If this file is called directly, abort.
16 -if ( ! defined( 'WPINC' ) ) {
17 - die;
18 -}
19 -
20 -class Request_Handler {
21 -
22 - // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
23 - public $_fields = array();
24 -
25 - /**
26 - * Get submitted form data
27 - *
28 - * @throws Action_Exception|Spam_Exception|Request_Exception
29 - */
30 - public function set_form_data() {
31 - $this->_fields = Block_Helper::get_blocks_by_post(
32 - jet_fb_handler()->get_form_id()
33 - );
34 -
35 - do_action( 'jet-form-builder/request' );
36 - }
37 -
38 -
39 - /**
40 - * @deprecated 3.1.0
41 - *
42 - * @param string|array $name 'field_name'|'repeater_name.field_name'|['repeater_name', 'field_name']
43 - */
44 - public function exclude( $name ) {
45 - jet_fb_context()->make_secure( $name );
46 - }
47 -
48 - /**
49 - * @deprecated 3.1.0
50 - *
51 - * @return array
52 - */
53 - public function get_types(): array {
54 - return iterator_to_array( jet_fb_context()->iterate_fields_types() );
55 - }
56 -
57 - /**
58 - * @deprecated 3.1.0
59 - *
60 - * @return array
61 - */
62 - public function get_attrs(): array {
63 - return iterator_to_array( jet_fb_context()->iterate_fields_settings() );
64 - }
65 -
66 - /**
67 - * @deprecated 3.1.0
68 - *
69 - * @param string|array $name 'field_name'|'repeater_name.0.field_name'|['repeater_name', 0, 'field_name']
70 - * @param string $field_type
71 - *
72 - * @return bool
73 - */
74 - public function is_type( $name, string $field_type ): bool {
75 - return jet_fb_context()->get_field_type( $name ) === $field_type;
76 - }
77 -
78 - /**
79 - * @deprecated 3.1.0
80 - * @param $name
81 - *
82 - * @return string
83 - */
84 - public function get_type( $name ): string {
85 - return jet_fb_context()->get_field_type( $name );
86 - }
87 -
88 - /**
89 - * @deprecated 3.1.0
90 - *
91 - * @return array
92 - */
93 - public function get_request(): array {
94 - return jet_fb_context()->get_request();
95 - }
96 -
97 - /**
98 - * @deprecated 3.1.0
99 - *
100 - * @return array
101 - */
102 - public function get_files(): array {
103 - return array_merge(
104 - jet_fb_context()->resolve_files(),
105 - jet_fb_context()->get_files()
106 - );
107 - }
108 -
109 - /**
110 - * @deprecated 3.1.0
111 - * @param string $name
112 - *
113 - * @return false|Media_Block_Value
114 - */
115 - public function get_file( string $name ) {
116 - return jet_fb_context()->get_file( $name );
117 - }
118 -
119 - /**
120 - * @deprecated 3.1.0
121 - *
122 - * @param $field_name
123 - * @param $attr_name
124 - * @param false $if_not_exist
125 - *
126 - * @return mixed
127 - */
128 - public function get_attr(
129 - $field_name,
130 - $attr_name,
131 - $if_not_exist = false
132 - ) {
133 - $attr = jet_fb_context()->get_setting( $attr_name, $field_name );
134 -
135 - return false === $attr ? $if_not_exist : $attr;
136 - }
137 -
138 -
139 - /**
140 - * @param $field_name
141 - * @param string $attr_name
142 - * @param bool $if_empty
143 - *
144 - * @return array
145 - * @deprecated since 2.0.0
146 - * Use jfb_request_handler()->get_attr instead
147 - */
148 - public function get_field_attrs_by_name(
149 - $field_name,
150 - $attr_name = '',
151 - $if_empty = false
152 - ) {
153 - return $this->get_attr( $field_name, $attr_name, $if_empty );
154 - }
155 -
156 -}
1 +<?php
2 +
3 +
4 +namespace Jet_Form_Builder\Request;
5 +
6 +use Jet_Form_Builder\Actions\Events\Bad_Request\Bad_Request_Event;
7 +use Jet_Form_Builder\Blocks\Block_Helper;
8 +use Jet_Form_Builder\Classes\Resources\Media_Block_Value;
9 +use Jet_Form_Builder\Exceptions\Action_Exception;
10 +use Jet_Form_Builder\Exceptions\Request_Exception;
11 +use JFB_Modules\Security\Exceptions\Spam_Exception;
12 +use Jet_Form_Builder\Request\Exceptions\Sanitize_Value_Exception;
13 +use JFB_Modules\Logger;
14 +
15 +// If this file is called directly, abort.
16 +if ( ! defined( 'WPINC' ) ) {
17 + die;
18 +}
19 +
20 +class Request_Handler {
21 +
22 + // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
23 + public $_fields = array();
24 +
25 + /**
26 + * Get submitted form data
27 + *
28 + * @throws Action_Exception|Spam_Exception|Request_Exception
29 + */
30 + public function set_form_data() {
31 + $this->_fields = Block_Helper::get_blocks_by_post(
32 + jet_fb_handler()->get_form_id()
33 + );
34 +
35 + do_action( 'jet-form-builder/request' );
36 +
37 + if ( ! Logger\Module::instance()->has_log( Sanitize_Value_Exception::class ) ) {
38 + return;
39 + }
40 +
41 + jet_fb_events()->execute( Bad_Request_Event::class );
42 +
43 + throw new Request_Exception( 'validation_failed' );
44 + }
45 +
46 +
47 + /**
48 + * @deprecated 3.1.0
49 + *
50 + * @param string|array $name 'field_name'|'repeater_name.field_name'|['repeater_name', 'field_name']
51 + */
52 + public function exclude( $name ) {
53 + jet_fb_context()->make_secure( $name );
54 + }
55 +
56 + /**
57 + * @deprecated 3.1.0
58 + *
59 + * @return array
60 + */
61 + public function get_types(): array {
62 + return iterator_to_array( jet_fb_context()->iterate_fields_types() );
63 + }
64 +
65 + /**
66 + * @deprecated 3.1.0
67 + *
68 + * @return array
69 + */
70 + public function get_attrs(): array {
71 + return iterator_to_array( jet_fb_context()->iterate_fields_settings() );
72 + }
73 +
74 + /**
75 + * @deprecated 3.1.0
76 + *
77 + * @param string|array $name 'field_name'|'repeater_name.0.field_name'|['repeater_name', 0, 'field_name']
78 + * @param string $field_type
79 + *
80 + * @return bool
81 + */
82 + public function is_type( $name, string $field_type ): bool {
83 + return jet_fb_context()->get_field_type( $name ) === $field_type;
84 + }
85 +
86 + /**
87 + * @deprecated 3.1.0
88 + * @param $name
89 + *
90 + * @return string
91 + */
92 + public function get_type( $name ): string {
93 + return jet_fb_context()->get_field_type( $name );
94 + }
95 +
96 + /**
97 + * @deprecated 3.1.0
98 + *
99 + * @return array
100 + */
101 + public function get_request(): array {
102 + return jet_fb_context()->get_request();
103 + }
104 +
105 + /**
106 + * @deprecated 3.1.0
107 + *
108 + * @return array
109 + */
110 + public function get_files(): array {
111 + return array_merge(
112 + jet_fb_context()->resolve_files(),
113 + jet_fb_context()->get_files()
114 + );
115 + }
116 +
117 + /**
118 + * @deprecated 3.1.0
119 + * @param string $name
120 + *
121 + * @return false|Media_Block_Value
122 + */
123 + public function get_file( string $name ) {
124 + return jet_fb_context()->get_file( $name );
125 + }
126 +
127 + /**
128 + * @deprecated 3.1.0
129 + *
130 + * @param $field_name
131 + * @param $attr_name
132 + * @param false $if_not_exist
133 + *
134 + * @return mixed
135 + */
136 + public function get_attr(
137 + $field_name, $attr_name, $if_not_exist = false
138 + ) {
139 + $attr = jet_fb_context()->get_setting( $attr_name, $field_name );
140 +
141 + return false === $attr ? $if_not_exist : $attr;
142 + }
143 +
144 +
145 + /**
146 + * @param $field_name
147 + * @param string $attr_name
148 + * @param bool $if_empty
149 + *
150 + * @return array
151 + * @deprecated since 2.0.0
152 + * Use jfb_request_handler()->get_attr instead
153 + */
154 + public function get_field_attrs_by_name(
155 + $field_name, $attr_name = '', $if_empty = false
156 + ) {
157 + return $this->get_attr( $field_name, $attr_name, $if_empty );
158 + }
159 +
160 +}