PluginProbe ʕ •ᴥ•ʔ
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.6
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.6
2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8 0.0.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.12.3 1.13.0 1.13.1 1.13.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.2 2.6.0
sureforms / inc / events-scheduler.php
sureforms / inc Last commit date
abilities 2 days ago admin 3 months ago ai-form-builder 1 month ago blocks 2 months ago compatibility 4 weeks ago database 2 days ago email 4 weeks ago fields 4 weeks ago global-settings 2 days ago lib 1 month ago migrator 2 months ago page-builders 4 weeks ago payments 2 days ago single-form-settings 2 months ago traits 2 months ago activator.php 1 year ago admin-ajax.php 2 days ago background-process.php 9 months ago client-logger.php 2 days ago create-new-form.php 3 months ago duplicate-form.php 2 days ago entries.php 4 weeks ago events-scheduler.php 2 years ago export.php 2 days ago field-validation.php 4 weeks ago form-restriction.php 2 months ago form-styling.php 1 month ago form-submit.php 2 days ago form-views.php 2 days ago forms-data.php 2 days ago frontend-assets.php 2 days ago generate-form-markup.php 2 days ago gutenberg-hooks.php 2 weeks ago helper.php 2 days ago learn.php 4 months ago onboarding.php 2 months ago post-types.php 2 days ago rest-api.php 2 days ago smart-tags.php 1 week ago submit-token.php 2 days ago translatable.php 1 month ago updater-callbacks.php 4 weeks ago updater.php 4 weeks ago
events-scheduler.php
60 lines
1 <?php
2 /**
3 * SureForms events scheduler class.
4 *
5 * @package sureforms.
6 * @since 0.0.2
7 */
8
9 namespace SRFM\Inc;
10
11 use SRFM\Inc\Traits\Get_Instance;
12
13 /**
14 * SureForms events scheduler class.
15 *
16 * @since 0.0.2
17 */
18 class Events_Scheduler {
19 use Get_Instance;
20
21 /**
22 * Constructor
23 *
24 * @since 0.0.2
25 */
26 public function __construct() {
27 add_action( 'init', [ $this, 'srfm_schedule_daily_action' ] );
28 }
29
30 /**
31 * Schedules a action that runs every 24 hours for SureForms.
32 *
33 * @hooked - init
34 * @uses as_has_scheduled_action() To check if the action is already scheduled.
35 * @uses as_schedule_recurring_action() To schedule a recurring action.
36 * @link https://actionscheduler.org/api/
37 * @since 0.0.2
38 * @return void
39 */
40 public function srfm_schedule_daily_action() {
41 // Check if the action is not scheduled. Then schedule a new action.
42 if ( false === as_has_scheduled_action( 'srfm_daily_scheduled_action' ) ) {
43 // Shedule a recurring action srfm_daily_scheduled_events that runs every 24 hours.
44 as_schedule_recurring_action( strtotime( 'tomorrow' ), DAY_IN_SECONDS, 'srfm_daily_scheduled_action', [], 'sureforms', true );
45 }
46 }
47
48 /**
49 * Unschedule any action.
50 *
51 * @param string $hook Event hook name.
52 * @since 0.0.2
53 * @return void
54 */
55 public static function unschedule_events( $hook ) {
56 as_unschedule_all_actions( $hook );
57 }
58
59 }
60