Cron.php
3 years ago
Ecommerce.php
3 years ago
Language.php
3 years ago
Logger.php
3 years ago
MobileDetect.php
3 years ago
Options.php
3 years ago
Plugin.php
3 years ago
Properties.php
3 years ago
Tracking.php
3 years ago
Utils.php
2 years ago
Cron.php
39 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; |
| 4 | } |
| 5 | |
| 6 | class TCMP_Cron { |
| 7 | public function __construct() { |
| 8 | |
| 9 | } |
| 10 | public function init() { |
| 11 | add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
| 12 | add_action( 'wp', array( $this, 'schedule_Events' ) ); |
| 13 | } |
| 14 | public function add_schedules( $schedules = array() ) { |
| 15 | global $tcmp; |
| 16 | // Adds once weekly to the existing schedules. |
| 17 | $schedules['weekly'] = array( |
| 18 | 'interval' => 604800, |
| 19 | 'display' => $tcmp->lang->L( 'Once Weekly' ), |
| 20 | ); |
| 21 | |
| 22 | return $schedules; |
| 23 | } |
| 24 | public function schedule_Events() { |
| 25 | $this->weekly_events(); |
| 26 | $this->daily_events(); |
| 27 | } |
| 28 | private function weekly_events() { |
| 29 | if ( ! wp_next_scheduled( 'tcmp_weekly_scheduled_events' ) ) { |
| 30 | wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'tcmp_weekly_scheduled_events' ); |
| 31 | } |
| 32 | } |
| 33 | private function daily_events() { |
| 34 | if ( ! wp_next_scheduled( 'tcmp_daily_scheduled_events' ) ) { |
| 35 | wp_schedule_event( current_time( 'timestamp' ), 'daily', 'tcmp_daily_scheduled_events' ); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 |