PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / trunk
JetFormBuilder — Dynamic Blocks Form Builder vtrunk
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 / jobs / traits / job-trait.php
jetformbuilder / modules / jobs / traits Last commit date
job-logger-trait.php 2 years ago job-trait.php 2 years ago self-execution-job-trait.php 2 years ago time-based-trait.php 2 years ago
job-trait.php
65 lines
1 <?php
2
3
4 namespace JFB_Modules\Jobs\Traits;
5
6 use JFB_Modules\Post_Type\Module;
7
8 // If this file is called directly, abort.
9 if ( ! defined( 'WPINC' ) ) {
10 die();
11 }
12
13 trait Job_Trait {
14
15 private $hook = '';
16 private $args = array();
17
18 public function set_hook( string $hook ) {
19 $this->hook = sprintf( 'jet-form-builder/as/%s', $hook );
20 }
21
22 public function get_hook(): string {
23 return $this->hook;
24 }
25
26 public function set_arg( $name, $value ) {
27 $this->args[ $name ] = $value;
28 }
29
30 public function get_arg( $name ) {
31 return $this->args[ $name ] ?? false;
32 }
33
34 public function set_args( array $args ) {
35 $this->args = $args;
36 }
37
38 public function get_args(): array {
39 return $this->args;
40 }
41
42 public function unschedule() {
43 if ( empty( $this->get_args() ) ) {
44 as_unschedule_all_actions( $this->get_hook() );
45
46 return;
47 }
48
49 as_unschedule_action( $this->get_hook(), $this->get_args(), Module::SLUG );
50 }
51
52 public function is_scheduled(): bool {
53 if ( ! function_exists( 'as_has_scheduled_action' ) ) {
54 return false;
55 }
56
57 $args = $this->get_args();
58 // null will matches any args
59 $args = $args ?: null;
60
61 return as_has_scheduled_action( $this->get_hook(), $args, Module::SLUG );
62 }
63
64 }
65