| 1 |
<?php |
| 2 |
/** |
| 3 |
* StoreEngine License Management Client SDK. |
| 4 |
* |
| 5 |
* Copyright (c) 2025, KodeZen. (https://kodezen.com/contact-us/) |
| 6 |
* Portions copyright (c) 2019 Automattic, Inc. (https://automattic.com/contact/) |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
* |
| 21 |
* @package StoreEngine\LicenseManagementClientSDK |
| 22 |
*/ |
| 23 |
|
| 24 |
declare( strict_types=1 ); |
| 25 |
|
| 26 |
// IMPORTANT — loading order with multiple bundled copies: |
| 27 |
// The "newest version wins" election below only counts copies whose init.php |
| 28 |
// actually runs. Composer's autoload_files de-dupes this file by a |
| 29 |
// package-stable hash, so when several active plugins each bundle this SDK only |
| 30 |
// the first plugin's vendor/autoload.php includes it — the rest are skipped and |
| 31 |
// never register their version. To be immune to load order, require this file |
| 32 |
// DIRECTLY (require_once '.../vendor/storeengine/wordpress-sdk/init.php') rather |
| 33 |
// than relying solely on Composer autoload. See README "loading order". |
| 34 |
|
| 35 |
if ( ! function_exists( 'se_license_manager_register_1_dot_5_dot_7' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION. |
| 36 |
|
| 37 |
if ( ! class_exists( 'SE_License_SDK_Version_Manager', false ) ) { |
| 38 |
require_once __DIR__ . '/classes/SE_License_SDK_Version_Manager.php'; |
| 39 |
add_action( 'plugins_loaded', [ 'SE_License_SDK_Version_Manager', 'initialize_latest_version' ], 1, 0 ); |
| 40 |
} |
| 41 |
|
| 42 |
add_action( 'plugins_loaded', 'se_license_manager_register_1_dot_5_dot_7', 0, 0 ); // WRCS: DEFINED_VERSION. |
| 43 |
|
| 44 |
// phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace |
| 45 |
/** |
| 46 |
* Registers this version of SE_License_SDK. |
| 47 |
*/ |
| 48 |
function se_license_manager_register_1_dot_5_dot_7() { // WRCS: DEFINED_VERSION. |
| 49 |
$versions = SE_License_SDK_Version_Manager::instance(); |
| 50 |
$versions->register( '1.5.7', 'se_license_manager_initialize_1_dot_5_dot_7' ); // WRCS: DEFINED_VERSION. |
| 51 |
} |
| 52 |
|
| 53 |
// phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace |
| 54 |
/** |
| 55 |
* Initializes this version of Action Scheduler. |
| 56 |
*/ |
| 57 |
function se_license_manager_initialize_1_dot_5_dot_7() { // WRCS: DEFINED_VERSION. |
| 58 |
// A final safety check is required even here, because historic versions of Action Scheduler |
| 59 |
// followed a different pattern. (In some unusual cases, we could reach this point and the |
| 60 |
// SE_License_SDK class is already defined—so we need to guard against that.) |
| 61 |
if ( ! class_exists( 'SE_License_SDK', false ) ) { |
| 62 |
require_once __DIR__ . '/classes/abstracts/SE_License_SDK.php'; |
| 63 |
SE_License_SDK::init( __FILE__, '1.5.7' ); |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
// Support usage in themes - load this version if no plugin has loaded a version yet. |
| 68 |
if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'SE_License_SDK', false ) ) { |
| 69 |
se_license_manager_initialize_1_dot_5_dot_7(); // WRCS: DEFINED_VERSION. |
| 70 |
do_action( 'action_scheduler_pre_theme_init' ); |
| 71 |
SE_License_SDK_Version_Manager::initialize_latest_version(); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
// End of file init.php. |