PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.1.1
JetFormBuilder — Dynamic Blocks Form Builder v2.1.1
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 / actions / executors / action-executor-base.php
jetformbuilder / includes / actions / executors Last commit date
action-default-executor.php 3 years ago action-executor-base.php 3 years ago action-required-executor.php 3 years ago
action-executor-base.php
88 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Actions\Executors;
5
6 use Jet_Form_Builder\Classes\Repository\Repository_Item_With_Class;
7 use Jet_Form_Builder\Exceptions\Action_Exception;
8
9 abstract class Action_Executor_Base {
10
11 const SOFT = 'soft_run_actions';
12 const NORMAL = 'run_actions';
13
14 /** @var int[] */
15 protected $actions_ids = array();
16
17 use Repository_Item_With_Class;
18
19 /**
20 * @return int[]
21 */
22 public function get_actions_ids(): array {
23 if ( ! empty( $this->actions_ids ) ) {
24 return $this->actions_ids;
25 }
26
27 foreach ( jet_fb_action_handler()->get_all() as $index => $action ) {
28 if ( self::rep_item_id() === $action->get_flow_handler() ) {
29 $this->actions_ids[] = $index;
30 }
31 }
32
33 return $this->actions_ids;
34 }
35
36
37 /**
38 * Doesn't throw an exception if there are no actions
39 *
40 * @return $this
41 * @throws Action_Exception
42 */
43 public function soft_run_actions() {
44 if ( empty( $this->get_actions_ids() ) ) {
45 return $this;
46 }
47 $this->run_actions();
48
49 return $this;
50 }
51
52 /**
53 * @throws Action_Exception
54 */
55 public function run_actions() {
56 if ( empty( $this->get_actions_ids() ) ) {
57 throw new Action_Exception( 'failed', 'Empty actions' );
58 }
59
60 /**
61 * Start cycle
62 */
63 $this->start_flow();
64 jet_fb_action_handler()->size_all = count( $this->get_actions_ids() );
65
66 foreach ( $this->get_actions_ids() as $index ) {
67 jet_fb_action_handler()->process_single_action( $index );
68 }
69
70 /**
71 * End the cycle
72 */
73 jet_fb_action_handler()->set_current_action( false );
74 jet_fb_action_handler()->end_flow();
75 }
76
77 public function start_flow() {
78 jet_fb_action_handler()->start_flow( static::rep_item_id() );
79 }
80
81 public function set_form_id( $form_id ) {
82 return jet_fb_action_handler()->set_form_id( $form_id );
83 }
84
85
86
87 }
88