| @@ -23,16 +23,36 @@ | ||
| 23 | 23 | */ |
| 24 | 24 | private static function get_events() { |
| 25 | 25 | return array( |
| 26 | 26 | 'formidable_send_usage' => 'weekly', |
| 27 | + 'frm_daily_event' => 'daily', | |
| 28 | + 'frm_payment_cron' => 'daily', | |
| 27 | 29 | ); |
| 28 | 30 | } |
| 29 | 31 | |
| 32 | + /** | |
| 33 | + * Schedules cron events. | |
| 34 | + * | |
| 35 | + * @since 6.7 | |
| 36 | + */ | |
| 37 | + public static function schedule_events() { | |
| 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. | |
| 30 | 41 | |
| 42 | + foreach ( $events as $event => $recurrence ) { | |
| 43 | + if ( ! wp_next_scheduled( $event ) ) { | |
| 44 | + wp_schedule_event( time(), $recurrence, $event ); | |
| 45 | + } | |
| 46 | + } | |
| 47 | + } | |
| 48 | + | |
| 31 | 49 | /** |
| 32 | 50 | * Removes all cron events. |
| 33 | 51 | * |
| 34 | 52 | * @since 6.3.2 |
| 53 | + * | |
| 54 | + * @return void | |
| 35 | 55 | */ |
| 36 | 56 | public static function remove_crons() { |
| 37 | 57 | $events = self::get_events(); |
| 38 | 58 | |