PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / controllers / FrmCronController.php

FrmCronController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.21, at classes/controllers/FrmCronController.php

71 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cron controller
4 *
5 * @since 6.3.2
6 *
7 * @package Formidable
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 die( 'You are not allowed to call this page directly.' );
12 }
13
14 /**
15 * Class FrmCronController
16 */
17 class FrmCronController {
18
19 /**
20 * Gets all cron events.
21 *
22 * @since 6.3.2
23 *
24 * @return string[]
25 */
26 private static function get_events() {
27 return array(
28 'formidable_send_usage' => 'weekly',
29 'frm_daily_event' => 'daily',
30 'frm_payment_cron' => 'daily',
31 );
32 }
33
34 /**
35 * Schedules cron events.
36 *
37 * @since 6.7
38 */
39 public static function schedule_events() {
40 $events = self::get_events();
41
42 // These are scheduled in another place.
43 unset( $events['formidable_send_usage'] );
44 unset( $events['frm_payment_cron'] );
45
46 foreach ( $events as $event => $recurrence ) {
47 if ( ! wp_next_scheduled( $event ) ) {
48 wp_schedule_event( time(), $recurrence, $event );
49 }
50 }
51 }
52
53 /**
54 * Removes all cron events.
55 *
56 * @since 6.3.2
57 *
58 * @return void
59 */
60 public static function remove_crons() {
61 $events = self::get_events();
62
63 foreach ( $events as $event => $recurrence ) {
64 $timestamp = wp_next_scheduled( $event );
65 if ( false !== $timestamp ) {
66 wp_unschedule_event( $timestamp, $event );
67 }
68 }
69 }
70 }
71