PluginProbe
Tracking Code Manager / 1.11.8
Tracking Code Manager v1.11.8
2.8.0 2.7.0 trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 All 29 releases
tracking-code-manager / includes / classes / utils / Cron.php
Cron.php
37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 class TCMP_Cron {
5 public function __construct() {
6
7 }
8 public function init() {
9 add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
10 add_action( 'wp', array( $this, 'schedule_Events' ) );
11 }
12 public function add_schedules( $schedules = array() ) {
13 global $tcmp;
14 // Adds once weekly to the existing schedules.
15 $schedules['weekly'] = array(
16 'interval' => 604800,
17 'display' => $tcmp->Lang->L('Once Weekly')
18 );
19
20 return $schedules;
21 }
22 public function schedule_Events() {
23 $this->weekly_events();
24 $this->daily_events();
25 }
26 private function weekly_events() {
27 if ( ! wp_next_scheduled( 'tcmp_weekly_scheduled_events' ) ) {
28 wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'tcmp_weekly_scheduled_events' );
29 }
30 }
31 private function daily_events() {
32 if ( ! wp_next_scheduled( 'tcmp_daily_scheduled_events' ) ) {
33 wp_schedule_event( current_time( 'timestamp' ), 'daily', 'tcmp_daily_scheduled_events' );
34 }
35 }
36 }
37