HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcdev/wp-content/plugins/tracking-code-manager/includes/classes/utils/Cron.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class TCMP_Cron {
	public function __construct() {

	}
	public function init() {
		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
		add_action( 'wp', array( $this, 'schedule_Events' ) );
	}
	public function add_schedules( $schedules = array() ) {
		global $tcmp;
		// Adds once weekly to the existing schedules.
		$schedules['weekly'] = array(
			'interval' => 604800,
			'display'  => $tcmp->lang->L( 'Once Weekly' ),
		);

		return $schedules;
	}
	public function schedule_Events() {
		$this->weekly_events();
		$this->daily_events();
	}
	private function weekly_events() {
		if ( ! wp_next_scheduled( 'tcmp_weekly_scheduled_events' ) ) {
			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'tcmp_weekly_scheduled_events' );
		}
	}
	private function daily_events() {
		if ( ! wp_next_scheduled( 'tcmp_daily_scheduled_events' ) ) {
			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'tcmp_daily_scheduled_events' );
		}
	}
}