| @@ -2,10 +2,8 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Cron controller |
| 4 | 4 | * |
| 5 | 5 | * @since 6.3.2 |
| 6 | - * | |
| 7 | - * @package Formidable | |
| 8 | 6 | */ |
| 9 | 7 | |
| 10 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 9 | die( 'You are not allowed to call this page directly.' ); |
| @@ -34,18 +32,14 @@ | ||
| 34 | 32 | /** |
| 35 | 33 | * Schedules cron events. |
| 36 | 34 | * |
| 37 | 35 | * @since 6.7 |
| 38 | - * | |
| 39 | - * @return void | |
| 40 | 36 | */ |
| 41 | 37 | public static function schedule_events() { |
| 42 | 38 | $events = self::get_events(); |
| 39 | + unset( $events['formidable_send_usage'] ); // This is scheduled in another place. | |
| 40 | + unset( $events['frm_payment_cron'] ); // This is scheduled in another place. | |
| 43 | 41 | |
| 44 | - // These are scheduled in another place. | |
| 45 | - unset( $events['formidable_send_usage'] ); | |
| 46 | - unset( $events['frm_payment_cron'] ); | |
| 47 | - | |
| 48 | 42 | foreach ( $events as $event => $recurrence ) { |
| 49 | 43 | if ( ! wp_next_scheduled( $event ) ) { |
| 50 | 44 | wp_schedule_event( time(), $recurrence, $event ); |
| 51 | 45 | } |
| @@ -59,11 +53,12 @@ | ||
| 59 | 53 | * |
| 60 | 54 | * @return void |
| 61 | 55 | */ |
| 62 | 56 | public static function remove_crons() { |
| 63 | - foreach ( self::get_events() as $event => $recurrence ) { | |
| 57 | + $events = self::get_events(); | |
| 58 | + | |
| 59 | + foreach ( $events as $event => $recurrence ) { | |
| 64 | 60 | $timestamp = wp_next_scheduled( $event ); |
| 65 | - | |
| 66 | 61 | if ( false !== $timestamp ) { |
| 67 | 62 | wp_unschedule_event( $timestamp, $event ); |
| 68 | 63 | } |
| 69 | 64 | } |