abstracts
2 years ago
admin
2 years ago
elementor
4 years ago
export
3 years ago
fields
2 years ago
interfaces
8 years ago
libraries
2 years ago
log-handlers
4 years ago
shortcodes
2 years ago
stats
3 years ago
templates
5 years ago
class-everest-forms.php
2 years ago
class-evf-ajax.php
2 years ago
class-evf-autoloader.php
7 years ago
class-evf-background-updater.php
7 years ago
class-evf-cache-helper.php
6 years ago
class-evf-cron.php
3 years ago
class-evf-deprecated-action-hooks.php
6 years ago
class-evf-deprecated-filter-hooks.php
5 years ago
class-evf-emails.php
2 years ago
class-evf-fields.php
2 years ago
class-evf-form-block.php
4 years ago
class-evf-form-handler.php
3 years ago
class-evf-form-task.php
2 years ago
class-evf-forms-features.php
2 years ago
class-evf-frontend-scripts.php
2 years ago
class-evf-install.php
2 years ago
class-evf-integrations.php
7 years ago
class-evf-log-levels.php
8 years ago
class-evf-logger.php
5 years ago
class-evf-post-types.php
5 years ago
class-evf-privacy.php
6 years ago
class-evf-session-handler.php
7 years ago
class-evf-shortcodes.php
4 years ago
class-evf-smart-tags.php
2 years ago
class-evf-template-loader.php
2 years ago
class-evf-validation.php
6 years ago
evf-conditional-functions.php
6 years ago
evf-core-functions.php
2 years ago
evf-deprecated-functions.php
6 years ago
evf-entry-functions.php
3 years ago
evf-formatting-functions.php
4 years ago
evf-notice-functions.php
4 years ago
evf-template-functions.php
4 years ago
evf-template-hooks.php
7 years ago
evf-update-functions.php
5 years ago
class-evf-cron.php
67 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Everest Forms Cron |
| 4 | * |
| 5 | * @package EverestForms |
| 6 | * @since 1.9.8 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Cron Class |
| 13 | * |
| 14 | * This class handles scheduled events |
| 15 | */ |
| 16 | class EVF_Cron { |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Init WordPress hook |
| 21 | * |
| 22 | * @see EVF_Cron::weekly_events() |
| 23 | */ |
| 24 | public function __construct() { |
| 25 | add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
| 26 | add_action( 'init', array( $this, 'schedule_events' ) ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Registers new cron schedules |
| 31 | * |
| 32 | * @param array $schedules Schedules. |
| 33 | */ |
| 34 | public function add_schedules( $schedules = array() ) { |
| 35 | // Adds once in biweekly to the existing schedules. |
| 36 | $schedules['biweekly'] = array( |
| 37 | 'interval' => ( DAY_IN_SECONDS * 15 ), |
| 38 | 'display' => __( 'Every 15 days', 'everest-forms' ), |
| 39 | ); |
| 40 | |
| 41 | return $schedules; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Schedules our events |
| 46 | * |
| 47 | * @return void |
| 48 | */ |
| 49 | public function schedule_events() { |
| 50 | $this->biweekly_events(); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Schedule biweekly events |
| 55 | * |
| 56 | * @return void |
| 57 | */ |
| 58 | private function biweekly_events() { |
| 59 | if ( ! wp_next_scheduled( 'everest_forms_biweekly_scheduled_events' ) ) { |
| 60 | wp_schedule_event( time(), 'biweekly', 'everest_forms_biweekly_scheduled_events' ); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | $everest_forms_cron = new EVF_Cron(); |
| 67 |