PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | modules/wordads/php/class-wordads-cron.php +57 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,57 @@
1 +<?php
2 +/**
3 + * WordAds cron tasks.
4 + *
5 + * @package automattic/jetpack
6 + */
7 +
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 0 );
10 +}
11 +
12 +/**
13 + * WordAds cron tasks
14 + *
15 + * @since 4.5.0
16 + */
17 +class WordAds_Cron {
18 +
19 + /**
20 + * Add the actions the cron tasks will use
21 + *
22 + * @since 4.5.0
23 + */
24 + public function __construct() {
25 + add_action( 'wordads_cron_status', array( $this, 'update_wordads_status' ) );
26 + }
27 +
28 + /**
29 + * Registered scheduled events on activation
30 + *
31 + * @since 4.5.0
32 + */
33 + public static function activate() {
34 + wp_schedule_event( time(), 'daily', 'wordads_cron_status' );
35 + }
36 +
37 + /**
38 + * Clear scheduled hooks on deactivation
39 + *
40 + * @since 4.5.0
41 + */
42 + public static function deactivate() {
43 + wp_clear_scheduled_hook( 'wordads_cron_status' );
44 + }
45 +
46 + /**
47 + * Grab WordAds status from WP.com API
48 + *
49 + * @since 4.5.0
50 + */
51 + public static function update_wordads_status() {
52 + WordAds_API::update_wordads_status_from_api();
53 + }
54 +}
55 +
56 +global $wordads_cron;
57 +$wordads_cron = new WordAds_Cron();