PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 2.25.0
Block Animations, Motion & Scroll Effects – Ghost Kit v2.25.0
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / classes / class-breakpoints-background.php

class-breakpoints-background.php in Block Animations, Motion & Scroll Effects – Ghost Kit 2.25.0, at classes/class-breakpoints-background.php

107 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Breakpoints Background.
4 *
5 * @package ghostkit
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 if ( ! class_exists( 'WP_Background_Process' ) ) {
13 require_once ghostkit()->plugin_path . 'vendor/deliciousbrains/wp-background-processing/wp-background-processing.php';
14 }
15
16 /**
17 * GhostKit_Breakpoints_Background class
18 */
19 class GhostKit_Breakpoints_Background extends WP_Background_Process {
20 /**
21 * Name of Cron Action Task.
22 *
23 * @var string
24 */
25 protected $action = 'ghostkit_run_breakpoints_processing';
26
27 /**
28 * Cron Interval.
29 *
30 * @var integer
31 */
32 protected $cron_interval = 2;
33
34 /**
35 * Cron Queue Lock Time.
36 *
37 * @var integer
38 */
39 protected $queue_lock_time = 25;
40
41 /**
42 * Task
43 *
44 * Override this method to perform any actions required on each
45 * queue item. Return the modified item for further processing
46 * in the next pass through. Or, return false to remove the
47 * item from the queue.
48 *
49 * @param mixed $item Queue item to iterate over.
50 *
51 * @return mixed
52 */
53 protected function task( $item ) {
54 new GhostKit_Scss_Compiler( $item );
55 return false;
56 }
57
58 /**
59 * Schedule event
60 */
61 protected function schedule_event() {
62 if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
63 wp_schedule_event( time() + ( 60 * $this->cron_interval ), $this->cron_interval_identifier, $this->cron_hook_identifier );
64 }
65 }
66
67 /**
68 * Dispatch
69 *
70 * @access public
71 * @return void
72 */
73 public function dispatch() {
74 // Schedule the cron healthcheck.
75 $this->schedule_event();
76 }
77
78 /**
79 * Schedule cron healthcheck
80 *
81 * @access public
82 *
83 * @param mixed $schedules Schedules.
84 *
85 * @return mixed
86 */
87 public function schedule_cron_healthcheck( $schedules ) {
88 // phpcs:ignore
89 $interval = apply_filters( $this->identifier . '_cron_interval', 5 );
90
91 if ( property_exists( $this, 'cron_interval' ) ) {
92 // phpcs:ignore
93 $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
94 }
95
96 // Adds every 5 minutes to the existing schedules.
97 $schedules[ $this->identifier . '_cron_interval' ] = array(
98 'interval' => (int) MINUTE_IN_SECONDS * $interval,
99 // translators: %d - Interval.
100 'display' => sprintf( __( 'Every %d Minutes', 'ghostkit' ), $interval ),
101 );
102
103 return $schedules;
104 }
105
106 }
107