PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.8
JetFormBuilder — Dynamic Blocks Form Builder v3.0.8
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 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / form-actions / get-form-data.php
jetformbuilder / includes / form-actions Last commit date
types 3 years ago base-form-action.php 3 years ago form-actions-manager.php 3 years ago get-form-data.php 3 years ago import-form-trait.php 3 years ago
get-form-data.php
77 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Form_Actions;
5
6 trait Get_Form_Data {
7
8 /**
9 * Get post ID from the current request and validate user acess to this post
10 *
11 * @return [type] [description]
12 */
13 public function get_post_id_from_request() {
14
15 /**
16 * Nonce verifies earlier
17 *
18 * @see \Jet_Form_Builder\Form_Actions\Base_Form_Action::do_action
19 */
20 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
21 $post_id = ! empty( $_GET['post'] ) ? absint( $_GET['post'] ) : false;
22
23 if ( ! $post_id ) {
24 wp_die( 'Form ID not found in the request', 'Error!' );
25 }
26
27 if ( ! $this->check_user_access( $post_id ) ) {
28 wp_die( 'You haven`t access to this form', 'Error!' );
29 }
30
31 return $post_id;
32
33 }
34
35 /**
36 * Returns from data by ID
37 *
38 * @param [type] $form_id [description]
39 *
40 * @return [type] [description]
41 */
42 public function get_from_data( $form_id ) {
43 $post = get_post( $form_id );
44 $meta_value = $this->parse_meta_value(
45 get_post_meta( $form_id ),
46 array( '_edit_lock' )
47 );
48
49 $for_encoding = $this->parse_form_data(
50 array(
51 'post_title' => $post->post_title,
52 'post_content' => $post->post_content,
53 'meta_input' => $meta_value,
54 )
55 );
56
57 return array( $post, $for_encoding );
58 }
59
60 public function parse_form_data( $data ) {
61 return $data;
62 }
63
64 private function parse_meta_value( $meta, $exclude = array() ) {
65 $response = array();
66
67 foreach ( $meta as $key => $value ) {
68 if ( in_array( $key, $exclude ) ) {
69 continue;
70 }
71 $response[ $key ] = $value[0];
72 }
73
74 return $response;
75 }
76 }
77