| Server IP : 47.82.179.145 / Your IP : 216.73.216.89 Web Server : nginx/1.26.3 System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64 User : www ( 1001) PHP Version : 8.3.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/sureforms/inc/ |
Upload File : |
<?php
/**
* SureForms events scheduler class.
*
* @package sureforms.
* @since 0.0.2
*/
namespace SRFM\Inc;
use SRFM\Inc\Traits\Get_Instance;
/**
* SureForms events scheduler class.
*
* @since 0.0.2
*/
class Events_Scheduler {
use Get_Instance;
/**
* Constructor
*
* @since 0.0.2
*/
public function __construct() {
add_action( 'init', [ $this, 'srfm_schedule_daily_action' ] );
}
/**
* Schedules a action that runs every 24 hours for SureForms.
*
* @hooked - init
* @uses as_has_scheduled_action() To check if the action is already scheduled.
* @uses as_schedule_recurring_action() To schedule a recurring action.
* @link https://actionscheduler.org/api/
* @since 0.0.2
* @return void
*/
public function srfm_schedule_daily_action() {
// Check if the action is not scheduled. Then schedule a new action.
if ( false === as_has_scheduled_action( 'srfm_daily_scheduled_action' ) ) {
// Shedule a recurring action srfm_daily_scheduled_events that runs every 24 hours.
as_schedule_recurring_action( strtotime( 'tomorrow' ), DAY_IN_SECONDS, 'srfm_daily_scheduled_action', [], 'sureforms', true );
}
}
/**
* Unschedule any action.
*
* @param string $hook Event hook name.
* @since 0.0.2
* @return void
*/
public static function unschedule_events( $hook ) {
as_unschedule_all_actions( $hook );
}
}