PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / class-smart-post-show-cron.php

class-smart-post-show-cron.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at admin/class-smart-post-show-cron.php

75 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The admin-specific functionality of the plugin.
4 *
5 * @link https://wpsmartpost.com/
6 * @since 3.0.12
7 *
8 * @package Smart_Post_Show
9 * @subpackage Smart_Post_Show/admin
10 * @author ShapedPlugin <[email protected]>
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * Smart_Post_Show_Cron
19 */
20 class Smart_Post_Show_Cron {
21
22 /**
23 * Initialize the class and set its properties.
24 *
25 * @since 3.0.12
26 */
27 public function __construct() {
28 add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
29 add_action( 'wp', array( $this, 'schedule_events' ) );
30 }
31
32 /**
33 * Registers new cron schedules
34 *
35 * @since 3.0.12
36 *
37 * @param array $schedules time schedule.
38 * @return array
39 */
40 public function add_schedules( $schedules = array() ) {
41 // Adds once weekly to the existing schedules.
42 $schedules['weekly'] = array(
43 'interval' => WEEK_IN_SECONDS,
44 'display' => __( 'Once Weekly', 'post-carousel' ),
45 );
46
47 return $schedules;
48 }
49
50 /**
51 * Schedules our events
52 *
53 * @since 3.0.12
54 * @return void
55 */
56 public function schedule_events() {
57 $this->weekly_events();
58 }
59
60 /**
61 * Schedule weekly events
62 *
63 * @access private
64 * @since 3.0.12
65 * @return void
66 */
67 private function weekly_events() {
68 if ( ! wp_next_scheduled( 'smart_post_show_weekly_scheduled_events' ) ) {
69 wp_schedule_event( time(), 'weekly', 'smart_post_show_weekly_scheduled_events' );
70 }
71 }
72 }
73
74 new Smart_Post_Show_Cron();
75