PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.5.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.5.0
1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / src / Jobs / ActionScheduler.php
hostinger-reach / src / Jobs Last commit date
AbandonedCartsJob.php 6 months ago AbstractBatchedJob.php 6 months ago AbstractJob.php 3 months ago ActionScheduler.php 5 months ago CleanupCartsJob.php 6 months ago ImportJob.php 5 months ago JobInterface.php 7 months ago RecurringJobInterface.php 7 months ago
ActionScheduler.php
50 lines
1 <?php
2
3 namespace Hostinger\Reach\Jobs;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class ActionScheduler {
8
9 public const STATUS_PENDING = 'pending';
10 public const STATUS_COMPLETE = 'complete';
11 public const STATUS_FAILED = 'failed';
12
13 public function get_group(): string {
14 return defined( 'HOSTINGER_REACH_PLUGIN_SLUG' ) ? HOSTINGER_REACH_PLUGIN_SLUG : 'hostinger-reach';
15 }
16
17 public function schedule_recurring( int $interval, string $hook, array $args = array() ): int {
18 if ( ! function_exists( 'as_schedule_recurring_action' ) ) {
19 return 0;
20 }
21
22 $group = $this->get_group();
23 return as_schedule_recurring_action( gmdate( 'U' ), $interval, $hook, $args, $group, true );
24 }
25
26 public function schedule_single( int $timestamp, string $hook, array $args = array() ): int {
27 if ( ! function_exists( 'as_schedule_single_action' ) ) {
28 return 0;
29 }
30
31 return as_schedule_single_action( $timestamp, $hook, $args, $this->get_group() );
32 }
33
34 public function schedule_immediate( string $hook, array $args = array() ): int {
35 if ( ! function_exists( 'as_schedule_single_action' ) ) {
36 return 0;
37 }
38
39 return as_schedule_single_action( gmdate( 'U' ), $hook, $args, $this->get_group() );
40 }
41
42 public function has_scheduled_action( string $hook, array $args = array() ): bool {
43 if ( ! function_exists( 'as_next_scheduled_action' ) ) {
44 return false;
45 }
46
47 return as_next_scheduled_action( $hook, $args, $this->get_group() ) !== false;
48 }
49 }
50