| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Modules\Jobs; |
| 5 |
|
| 6 |
use JFB_Modules\Jobs\Interfaces\Job_It; |
| 7 |
use JFB_Modules\Jobs\Interfaces\Once_Job_It; |
| 8 |
use JFB_Modules\Jobs\Traits\Job_Trait; |
| 9 |
use JFB_Modules\Jobs\Traits\Time_Based_Trait; |
| 10 |
|
| 11 |
// If this file is called directly, abort. |
| 12 |
if ( ! defined( 'WPINC' ) ) { |
| 13 |
die(); |
| 14 |
} |
| 15 |
|
| 16 |
class Once_Job implements Once_Job_It { |
| 17 |
|
| 18 |
use Job_Trait; |
| 19 |
use Time_Based_Trait; |
| 20 |
|
| 21 |
public function schedule(): int { |
| 22 |
if ( ! function_exists( 'as_schedule_single_action' ) ) { |
| 23 |
return 0; |
| 24 |
} |
| 25 |
|
| 26 |
return as_schedule_single_action( |
| 27 |
$this->get_timestamp(), |
| 28 |
$this->get_hook(), |
| 29 |
$this->get_args(), |
| 30 |
\JFB_Modules\Post_Type\Module::SLUG |
| 31 |
); |
| 32 |
} |
| 33 |
} |
| 34 |
|