PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.7
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.7
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / classes / class-merchant-general-hooks.php

class-merchant-general-hooks.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.2.7, at inc/classes/class-merchant-general-hooks.php

66 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Merchant_Option Class.
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly
8 }
9
10 if ( ! class_exists( 'Merchant_General_Hooks' ) ) {
11 class Merchant_General_Hooks {
12
13 /**
14 * The single class instance.
15 */
16 private static $instance = null;
17
18 /**
19 * Instance.
20 */
21 public static function instance() {
22 if ( is_null( self::$instance ) ) {
23 self::$instance = new self();
24 }
25
26 return self::$instance;
27 }
28
29 /**
30 * Constructor.
31 */
32 private function __construct() {
33 }
34
35 /**
36 * Attach functions to WordPress
37 *
38 * @return void
39 */
40 public function load_hooks() {
41 add_action( 'init', array( $this, 'register_weekly_schedule' ) );
42 }
43
44 /**
45 * Register weekly schedule.
46 *
47 * @return void
48 */
49 public function register_weekly_schedule() {
50 if ( function_exists( 'as_schedule_recurring_action' ) ) {
51 if ( ! as_next_scheduled_action( 'merchant_weekly_schedule' ) ) {
52 as_schedule_recurring_action( time(), WEEK_IN_SECONDS, 'merchant_weekly_schedule' );
53 }
54
55 return;
56 }
57
58 if ( ! wp_next_scheduled( 'merchant_weekly_schedule' ) ) {
59 wp_schedule_event( time(), 'weekly', 'merchant_weekly_schedule' );
60 }
61 }
62 }
63 }
64
65 $merchant_general_hooks = Merchant_General_Hooks::instance();
66 $merchant_general_hooks->load_hooks();