PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 1.12.0
Tracking Code Manager v1.12.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 2.3.0 2.4.0 2.5.0 2.6.0
tracking-code-manager / includes / classes / utils / Cron.php
tracking-code-manager / includes / classes / utils Last commit date
Cron.php 8 years ago Ecommerce.php 7 years ago Language.php 10 years ago Logger.php 8 years ago MobileDetect.php 8 years ago Options.php 8 years ago Plugin.php 10 years ago Properties.php 10 years ago Tracking.php 8 years ago Utils.php 8 years ago
Cron.php
37 lines
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