<?php
/**
 * License Bootstrap
 *
 * Loads Elite Licenser base class and LicenseManager. Must be loaded before
 * plugin init to perform license validation.
 *
 * @package WP_PowerSuite
 * @since 1.0.0
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$licensing_dir = __DIR__;
$client_file   = $licensing_dir . '/class-wpps-elite-licenser-client.php';
$base_file     = $licensing_dir . '/class-w-p-power-suite-premium-base.php';
$manager_file  = $licensing_dir . '/class-wpps-license-manager.php';

if ( ! file_exists( $client_file ) || ! file_exists( $base_file ) || ! file_exists( $manager_file ) ) {
	return;
}

require_once $client_file;
require_once $base_file;
require_once $manager_file;

$integrity_file = $licensing_dir . '/class-wpps-package-integrity.php';
if ( file_exists( $integrity_file ) ) {
	require_once $integrity_file;
}

$updater_file = $licensing_dir . '/class-wpps-license-updater.php';
if ( file_exists( $updater_file ) ) {
	require_once $updater_file;
	if ( class_exists( 'WPPS_License_Updater', false ) ) {
		WPPS_License_Updater::register();
	}
}

$updates_file = $licensing_dir . '/class-wpps-license-updates.php';
if ( file_exists( $updates_file ) ) {
	require_once $updates_file;
	if ( class_exists( 'WPPS_License_Updates', false ) ) {
		WPPS_License_Updates::register();
	}
}

$admin_file = $licensing_dir . '/class-wpps-license-admin.php';
if ( file_exists( $admin_file ) ) {
	require_once $admin_file;
	if ( class_exists( 'WPPS_License_Admin', false ) ) {
		WPPS_License_Admin::register();
	}
}

$cli_file = $licensing_dir . '/class-wpps-license-cli.php';
if ( file_exists( $cli_file ) ) {
	require_once $cli_file;
	if ( class_exists( 'WPPS_License_CLI', false ) ) {
		WPPS_License_CLI::register();
	}
}
