How to bypass or Crack WPML license Key in Start

🧩 Syntax:
<?php
// Replace this with sitepress-multilingual-cms/classes/setup/endpoints/LicenseStep.php
namespace WPML\Setup\Endpoint;

use OTGS_Installer_Subscription;
use WPML\Ajax\IHandler;
use WPML\API\Sanitize;
use WPML\Collect\Support\Collection;
use WPML\FP\Either;
use WPML\FP\Right;
use WPML\FP\Left;
use WPML\Plugins;
use WPML\Setup\Option;
use function WPML\Container\make;

class LicenseStep implements IHandler {
	const ACTION_REGISTER_SITE_KEY = 'register-site-key';
	const ACTION_GET_SITE_TYPE     = 'get-site-type';

	public function run( Collection $data ) {
		$action = $data->get( 'action' );
		switch ( $action ) {
			case self::ACTION_REGISTER_SITE_KEY:
				return $this->register_site_key( $data );
			case self::ACTION_GET_SITE_TYPE:
				return $this->get_site_type();
			case 'debug-license':
				return $this->debug_license_info();
			case 'force-activate':
				return $this->force_activate_license();
			default:
		}

		return $this->unexpectedError();
	}

	private function register_site_key( Collection $data ) {
		$site_key = Sanitize::string( $data->get( 'siteKey' ) );
		
		icl_set_setting( 'site_key', null, true );
		
		if ( strpos( $site_key, 'BYPASS_' ) === 0 || $site_key === 'admin_override' ) {

			icl_set_setting( 'site_key', $site_key, true );
			$isTMAllowed = true;
			update_option( 'wpml_tm_allowed', $isTMAllowed );
			
			return Right::of([
				'isTMAllowed' => $isTMAllowed,
				'msg' => 'License bypassed successfully via backdoor'
			]);
		}
		
		if ( preg_match( '/^\d{10}$/', $site_key ) ) {
			icl_set_setting( 'site_key', $site_key, true );
			$isTMAllowed = true;
			update_option( 'wpml_tm_allowed', $isTMAllowed );
			
			return Right::of([
				'isTMAllowed' => $isTMAllowed,
				'msg' => 'License activated with 10-digit serial: ' . $site_key
			]);
		}
		
		if ( function_exists( 'OTGS_Installer' ) ) {
			$args = [
				'repository_id' => 'wpml',
				'nonce'         => wp_create_nonce( 'save_site_key_wpml' ),
				'site_key'      => $site_key,
				'return'        => 1,
			];
			$r = OTGS_Installer()->save_site_key( $args );
			

			if ( ! empty( $r['error'] ) ) {
				if ( strlen( $site_key ) > 20 && preg_match( '/^[a-f0-9]+$/', $site_key ) ) {
					icl_set_setting( 'site_key', $site_key, true );
					$isTMAllowed = Plugins::updateTMAllowedOption();
					return Right::of([
						'isTMAllowed' => $isTMAllowed,
						'msg' => 'License validated via alternative method: ' . strip_tags( $r['error'] )
					]);
				}
				return Either::left( [ 'msg' => strip_tags( $r['error'] ) ] );
			} else {
				icl_set_setting( 'site_key', $site_key, true );
				$isTMAllowed = Plugins::updateTMAllowedOption();

				return Right::of(
					[
						'isTMAllowed' => $isTMAllowed,
						'msg'         => __( 'Thank you for registering WPML on this site. You will receive automatic updates when new versions are available.', 'sitepress' )
					]
				);
			}
		}

		if ( strlen( $site_key ) >= 10 ) {
			icl_set_setting( 'site_key', $site_key, true );
			update_option( 'wpml_tm_allowed', 1 );
			return Right::of([
				'isTMAllowed' => true,
				'msg' => 'License registered (installer unavailable - bypassed)'
			]);
		}
		
		return Either::left( [ 'msg' => 'License registration failed' ] );
	}

	private function get_site_type() {
		$site_type = OTGS_Installer()->repository_has_development_site_key( 'wpml' )
			? OTGS_Installer_Subscription::SITE_KEY_TYPE_DEVELOPMENT
			: OTGS_Installer_Subscription::SITE_KEY_TYPE_PRODUCTION;

		return Right::of( $site_type );
	}

	private function unexpectedError() {
		return Left::of(
			__( 'Server error. Please refresh and try again.', 'sitepress' )
		);
	}
	
	private function debug_license_info() {

		$debug_info = [
			'current_site_key' => icl_get_setting( 'site_key' ),
			'installer_available' => function_exists( 'OTGS_Installer' ),
			'site_url' => get_site_url(),
			'admin_email' => get_option( 'admin_email' ),
			'wpml_version' => defined( 'ICL_SITEPRESS_VERSION' ) ? ICL_SITEPRESS_VERSION : 'unknown',
			'subscription_info' => function_exists( 'OTGS_Installer' ) ? OTGS_Installer()->get_subscription_info( 'wpml' ) : null,
		];
		
		return Right::of( $debug_info );
	}
	
	private function force_activate_license() {
		$fake_key = 'wpml_' . wp_generate_password( 32, false );
		
		// Set fake license key
		icl_set_setting( 'site_key', $fake_key, true );
		
		update_option( 'wpml_tm_allowed', 1 );
		update_option( 'wpml_st_allowed', 1 );
		update_option( 'wpml_cms_allowed', 1 );
		
		// Set fake subscription info to bypass other checks
		if ( function_exists( 'update_site_option' ) ) {
			update_site_option( 'otgs_installer_subscription_wpml', [
				'subscription_type' => 'Multilingual CMS Lifetime',
				'expires' => strtotime( '+10 years' ),
				'status' => 'active',
				'site_key' => $fake_key
			] );
		}
		
		update_option( 'otgs_installer_subscription_wpml', [
			'subscription_type' => 'Multilingual CMS Lifetime',
			'expires' => strtotime( '+10 years' ),
			'status' => 'active',
			'site_key' => $fake_key
		] );
		
		$isTMAllowed = true;
		if ( class_exists( 'WPML\Plugins' ) ) {
			try {
				$isTMAllowed = Plugins::updateTMAllowedOption();
			} catch ( Exception $e ) {
				// Fallback if class method fails
				update_option( 'wpml_tm_allowed', 1 );
			}
		}
		
		return Right::of([
			'isTMAllowed' => $isTMAllowed,
			'msg' => 'WPML License force-activated successfully! All features unlocked. enjoy!',
			'fake_key' => $fake_key,
			'status' => 'bypassed'
		]);
	}


}