[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i", $domain, $matches)) { return $matches['domain']; } else { return $domain; } } public static function getSiteURL() { return site_url(); } public static function isDevelopment() { return self::isStagingSite(self::getSiteURL()); } public static function getBenefitURL() { return self::$benefit_url; } } add_action ( 'wp_ajax_essb_process_activation', 'essb_action_process_activation' ); function essb_action_process_activation() { $purchase_code = isset($_REQUEST['purchase_code']) ? $_REQUEST['purchase_code'] : ''; $activation_code = isset($_REQUEST['activation_code']) ? $_REQUEST['activation_code'] : ''; $state = isset($_REQUEST['activation_state']) ? $_REQUEST['activation_state'] : ''; $domain = isset($_REQUEST['domain']) ? $_REQUEST['domain'] : ''; $version = isset($_REQUEST['version']) ? $_REQUEST['version'] : ''; $execute_code = -1; if ($state == 'activate' && $purchase_code != '' && $activation_code != '') { ESSBActivationManager::activate($purchase_code, $activation_code); $execute_code = 1; } if ($state == 'deactivate') { ESSBActivationManager::deactivate(); $execute_code = 2; } if ($state == 'manual' && $purchase_code != '' && $activation_code != '') { $execute_code = ESSBActivationManager::activateManual($purchase_code, $activation_code, $domain); } if ($state == 'version_check' && $version != '') { ESSBActivationManager::saveVersion($version); $execute_code = ESSBActivationManager::existNewVersion() ? ESSBActivationManager::getLatestVersion() : ''; } die(json_encode(array('code' => $execute_code))); exit; }