| @@ -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.' ); |
| @@ -25,45 +23,24 @@ | ||
| 25 | 23 | */ |
| 26 | 24 | private static function get_events() { |
| 27 | 25 | return array( |
| 28 | 26 | 'formidable_send_usage' => 'weekly', |
| 29 | - 'frm_daily_event' => 'daily', | |
| 30 | 27 | 'frm_payment_cron' => 'daily', |
| 31 | 28 | ); |
| 32 | 29 | } |
| 33 | 30 | |
| 34 | 31 | /** |
| 35 | - * Schedules cron events. | |
| 32 | + * Removes all cron events. | |
| 36 | 33 | * |
| 37 | - * @since 6.7 | |
| 34 | + * @since 6.3.2 | |
| 38 | 35 | * |
| 39 | 36 | * @return void |
| 40 | 37 | */ |
| 41 | - public static function schedule_events() { | |
| 38 | + public static function remove_crons() { | |
| 42 | 39 | $events = self::get_events(); |
| 43 | 40 | |
| 44 | - // These are scheduled in another place. | |
| 45 | - unset( $events['formidable_send_usage'] ); | |
| 46 | - unset( $events['frm_payment_cron'] ); | |
| 47 | - | |
| 48 | 41 | foreach ( $events as $event => $recurrence ) { |
| 49 | - if ( ! wp_next_scheduled( $event ) ) { | |
| 50 | - wp_schedule_event( time(), $recurrence, $event ); | |
| 51 | - } | |
| 52 | - } | |
| 53 | - } | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Removes all cron events. | |
| 57 | - * | |
| 58 | - * @since 6.3.2 | |
| 59 | - * | |
| 60 | - * @return void | |
| 61 | - */ | |
| 62 | - public static function remove_crons() { | |
| 63 | - foreach ( self::get_events() as $event => $recurrence ) { | |
| 64 | 42 | $timestamp = wp_next_scheduled( $event ); |
| 65 | - | |
| 66 | 43 | if ( false !== $timestamp ) { |
| 67 | 44 | wp_unschedule_event( $timestamp, $event ); |
| 68 | 45 | } |
| 69 | 46 | } |