| 1 |
<?php defined('ABSPATH') or die; |
| 2 |
|
| 3 |
if (!function_exists('fluentwp_scheduler_register') && function_exists('add_action')) { // WRCS: DEFINED_VERSION. |
| 4 |
|
| 5 |
if (!class_exists('ActionScheduler_Versions', false)) { |
| 6 |
require_once FLUENT_BOOKING_DIR . 'vendor/woocommerce/action-scheduler/classes/ActionScheduler_Versions.php'; |
| 7 |
add_action('plugins_loaded', array('ActionScheduler_Versions', 'initialize_latest_version'), 1, 0); |
| 8 |
} |
| 9 |
|
| 10 |
add_action('plugins_loaded', 'fluentwp_scheduler_register', 0, 0); // WRCS: DEFINED_VERSION. |
| 11 |
|
| 12 |
/** |
| 13 |
* Registers this version of Action Scheduler. |
| 14 |
*/ |
| 15 |
function fluentwp_scheduler_register() |
| 16 |
{ // WRCS: DEFINED_VERSION. |
| 17 |
$versions = ActionScheduler_Versions::instance(); |
| 18 |
$versions->register('3.6.9', 'fluentwp_scheduler_initialize'); // WRCS: DEFINED_VERSION. |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Initializes this version of Action Scheduler. |
| 23 |
*/ |
| 24 |
function fluentwp_scheduler_initialize() |
| 25 |
{ // WRCS: DEFINED_VERSION. |
| 26 |
// A final safety check is required even here, because historic versions of Action Scheduler |
| 27 |
// followed a different pattern (in some unusual cases, we could reach this point and the |
| 28 |
// ActionScheduler class is already defined—so we need to guard against that). |
| 29 |
if (!class_exists('ActionScheduler', false)) { |
| 30 |
require_once FLUENT_BOOKING_DIR . 'vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php'; |
| 31 |
ActionScheduler::init(FLUENT_BOOKING_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php'); |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
// Support usage in themes - load this version if no plugin has loaded a version yet. |
| 36 |
if (did_action('plugins_loaded') && !doing_action('plugins_loaded') && !class_exists('ActionScheduler', false)) { |
| 37 |
fluentwp_scheduler_initialize(); // WRCS: DEFINED_VERSION. |
| 38 |
do_action('action_scheduler_pre_theme_init'); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound |
| 39 |
ActionScheduler_Versions::initialize_latest_version(); |
| 40 |
} |
| 41 |
} |
| 42 |
|