PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.4.5.2
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 / modules / actions-v2 / insert-post / properties / base-post-action.php
jetformbuilder / modules / actions-v2 / insert-post / properties Last commit date
abstract-post-modifier.php 1 year ago base-post-action.php 1 year ago insert-action.php 1 year ago post-author-property.php 1 year ago post-comments-property.php 1 year ago post-content-property.php 1 year ago post-date-gmt-property.php 1 year ago post-date-property.php 1 year ago post-excerpt-property.php 1 year ago post-id-property.php 1 year ago post-meta-property.php 1 year ago post-modifier.php 1 year ago post-parent-property.php 1 year ago post-status-property.php 1 year ago post-terms-property.php 1 year ago post-thumbnail-property.php 1 year ago post-title-property.php 1 year ago post-type-property.php 1 year ago trash-action.php 1 year ago update-action.php 1 year ago
base-post-action.php
100 lines
1 <?php
2
3
4 namespace JFB_Modules\Actions_V2\Insert_Post\Properties;
5
6 use Jet_Form_Builder\Actions\Methods\Base_Modifier_Action;
7 use JFB_Modules\Actions_V2\Insert_Post\Insert_Post_Action;
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 abstract class Base_Post_Action extends Base_Modifier_Action {
15
16 protected $inserted_id = 0;
17
18 public function do_after() {
19 if ( ! $this->inserted_id ) {
20 return;
21 }
22 $this->add_inserted_post_id();
23 $this->add_context_once();
24
25 /**
26 * Perform any actions after post inserted/updated
27 */
28 do_action(
29 'jet-form-builder/action/after-post-' . $this->get_id(),
30 jet_fb_action_handler()->get_current_action(),
31 jet_fb_action_handler()
32 );
33 }
34
35 public function pre_check(): bool {
36 return apply_filters(
37 'jet-form-builder/action/insert-post/pre-check',
38 true,
39 $this->modifier->source_arr,
40 jet_fb_action_handler()->get_current_action()
41 );
42 }
43
44 public function add_inserted_post_id() {
45 $handler = jet_fb_action_handler();
46
47 if ( ! $handler->in_loop() ) {
48 return;
49 }
50
51 if ( empty( $handler->response_data['inserted_post_id'] ) ) {
52 $handler->response_data['inserted_post_id'] = $this->inserted_id;
53 jet_fb_context()->update_request( $this->inserted_id, 'inserted_post_id' );
54 } else {
55 $handler->response_data['inserted_posts'][] = array(
56 'post_id' => $this->inserted_id,
57 'action_id' => $handler->get_current_action()->_id,
58 );
59 }
60
61 $post_type = $this->modifier->source_arr['post_type'] ?? '';
62
63 if ( ! $post_type ) {
64 $post_type = get_post_type( $this->inserted_id );
65 }
66
67 $inserted_key = jet_fb_context()->get_unique_name(
68 'inserted_' . $post_type
69 );
70
71 jet_fb_context()->update_request( $this->inserted_id, $inserted_key );
72 }
73
74 public function add_context_once() {
75 if ( ! jet_fb_action_handler()->in_loop() ) {
76 return;
77 }
78 /**
79 * For Redirect to Page action
80 */
81 jet_fb_action_handler()->add_context_once(
82 'insert_post',
83 array(
84 Insert_Post_Action::get_context_post_key( $this->inserted_id ) => array_merge(
85 array(
86 '__action' => $this->get_id(),
87 'ID' => $this->inserted_id,
88 ),
89 $this->modifier->source_arr
90 ),
91 )
92 );
93 }
94
95 public function get_inserted(): int {
96 return $this->inserted_id;
97 }
98
99 }
100