403Webshell
Server IP : 65.109.86.83  /  Your IP : 37.27.51.148
Web Server : nginx/1.14.1
System : Linux libra 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 20:24:04 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.31
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/pixel-caffeine/includes/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/pixel-caffeine/includes/models/class-job.php
<?php
/**
 * Support class for the cron jobs
 *
 * @package Pixel Caffeine
 */

namespace PixelCaffeine\Model;

/**
 * Class Job
 *
 * @package PixelCaffeine\Model
 */
abstract class Job {

	/**
	 * Setup the job tasks and eventually recurrences
	 *
	 * @return void
	 */
	public function init() {
		add_filter( 'cron_schedules', array( $this, 'recurrences' ) );
		add_action( 'init', array( $this, 'register_events' ) );
	}

	/**
	 * Register the recurrences in the cron_schedules hook
	 *
	 * @param array $recurrences The recurrences.
	 *
	 * @return array {
	 *     @type int $interval
	 *     @type string $display
	 * }
	 */
	public function recurrences( $recurrences ) {
		return $recurrences;
	}

	/**
	 * Register the events
	 *
	 * @return void
	 */
	public function register_events() {
		$recurrences = wp_get_schedules();

		foreach ( $this->tasks() as $interval => $job ) {
			if ( ! wp_next_scheduled( $job['hook'], $job['callback_args'] ) ) {
				wp_schedule_event( time() + $recurrences[ $interval ]['interval'], $interval, $job['hook'], $job['callback_args'] );
			}

			add_action( $job['hook'], $job['callback'] );
		}
	}

	/**
	 * Unschedule the job
	 *
	 * @param string $hook Parameter passed from the scheduled event.
	 *
	 * @return void
	 */
	public function unschedule( $hook = '' ) {
		foreach ( $this->tasks() as $interval => $job ) {
			$timestamp = wp_next_scheduled( $job['hook'], $job['callback_args'] );
			if ( false !== $timestamp ) {
				wp_unschedule_event( $timestamp, $job['hook'], $job['callback_args'] );
			}
		}
	}

	/**
	 * Register the tasks
	 *
	 * @return mixed
	 */
	abstract public function tasks();

}

Youez - 2016 - github.com/yon3zu
LinuXploit