PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.2.6
JetFormBuilder — Dynamic Blocks Form Builder v1.2.6
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 4 years ago base-form-action.php 4 years ago form-actions-manager.php 4 years ago get-form-data.php 4 years ago import-form-trait.php 4 years ago
get-form-data.php
69 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Form_Actions;
5
6
7 trait Get_Form_Data {
8
9 /**
10 * Get post ID from the current request and validate user acess to this post
11 *
12 * @return [type] [description]
13 */
14 public function get_post_id_from_request() {
15
16 $post_id = ! empty( $_GET['post'] ) ? absint( $_GET['post'] ) : false;
17
18 if ( ! $post_id ) {
19 wp_die( 'Form ID not found in the request', 'Error!' );
20 }
21
22 if ( ! $this->check_user_access( $post_id ) ) {
23 wp_die( 'You haven`t access to this form', 'Error!' );
24 }
25
26 return $post_id;
27
28 }
29
30 /**
31 * Returns from data by ID
32 *
33 * @param [type] $form_id [description]
34 *
35 * @return [type] [description]
36 */
37 public function get_from_data( $form_id ) {
38 $post = get_post( $form_id );
39 $meta_value = $this->parse_meta_value(
40 get_post_meta( $form_id ),
41 array( '_edit_lock' )
42 );
43
44 $for_encoding = $this->parse_form_data( array(
45 'post_title' => $post->post_title,
46 'post_content' => $post->post_content,
47 'meta_input' => $meta_value,
48 ) );
49
50 return array( $post, $for_encoding );
51 }
52
53 public function parse_form_data( $data ) {
54 return $data;
55 }
56
57 private function parse_meta_value( $meta, $exclude = array() ) {
58 $response = array();
59
60 foreach ( $meta as $key => $value ) {
61 if ( in_array( $key, $exclude ) ) {
62 continue;
63 }
64 $response[ $key ] = $value[0];
65 }
66
67 return $response;
68 }
69 }