PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.1.4
JetFormBuilder — Dynamic Blocks Form Builder v2.1.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 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
71 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 $post_id = ! empty( $_GET['post'] ) ? absint( $_GET['post'] ) : false;
16
17 if ( ! $post_id ) {
18 wp_die( 'Form ID not found in the request', 'Error!' );
19 }
20
21 if ( ! $this->check_user_access( $post_id ) ) {
22 wp_die( 'You haven`t access to this form', 'Error!' );
23 }
24
25 return $post_id;
26
27 }
28
29 /**
30 * Returns from data by ID
31 *
32 * @param [type] $form_id [description]
33 *
34 * @return [type] [description]
35 */
36 public function get_from_data( $form_id ) {
37 $post = get_post( $form_id );
38 $meta_value = $this->parse_meta_value(
39 get_post_meta( $form_id ),
40 array( '_edit_lock' )
41 );
42
43 $for_encoding = $this->parse_form_data(
44 array(
45 'post_title' => $post->post_title,
46 'post_content' => $post->post_content,
47 'meta_input' => $meta_value,
48 )
49 );
50
51 return array( $post, $for_encoding );
52 }
53
54 public function parse_form_data( $data ) {
55 return $data;
56 }
57
58 private function parse_meta_value( $meta, $exclude = array() ) {
59 $response = array();
60
61 foreach ( $meta as $key => $value ) {
62 if ( in_array( $key, $exclude ) ) {
63 continue;
64 }
65 $response[ $key ] = $value[0];
66 }
67
68 return $response;
69 }
70 }
71