PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 2.7.0
Tracking Code Manager v2.7.0
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 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 4 years ago Ecommerce.php 4 years ago Language.php 4 years ago Logger.php 1 month ago MobileDetect.php 1 month ago Options.php 1 month ago Plugin.php 1 month ago Properties.php 4 years ago Tracking.php 1 month ago Utils.php 1 month 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