| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/filester/vendor-prefixed/src/License/ |
Upload File : |
<?php
namespace FilesterScoped\YayCommerce\AdminShell\License;
\defined('ABSPATH') || exit;
/**
* EDD HTTP client — all calls go through wp_remote_get.
*
* Ported from YayMail Pro LicenseAPI.php — YAYCOMMERCE_SELLER_SITE_URL constant
* replaced with $store_url parameter sourced from LicenseConfigAdapter::get_store_url().
* @internal
*/
class LicenseAPI
{
public static function activate_license(string $store_url, int $item_id, string $license_key) : array
{
try {
$url = $store_url . '?edd_action=activate_license&item_id=' . $item_id . '&license=' . \rawurlencode($license_key) . '&url=' . \home_url();
$raw = wp_remote_get($url);
if (is_wp_error($raw)) {
throw new \Error('WP HTTP error', 1);
}
$response = \json_decode(wp_remote_retrieve_body($raw));
if (isset($response->success) && $response->success) {
return ['success' => \true, 'license' => $response->license ?? 'valid', 'expires' => $response->expires ?? null, 'license_limit' => $response->license_limit ?? 0, 'payment_id' => $response->payment_id ?? '', 'customer_name' => $response->customer_name ?? ''];
}
return ['success' => \false, 'message' => $response->error ?? 'unknown_error'];
} catch (\Error $error) {
return ['success' => \false, 'message' => 'server_error', 'is_server_error' => \true];
}
}
public static function deactivate_license(string $store_url, int $item_id, string $license_key) : array
{
try {
$url = $store_url . '?edd_action=deactivate_license&item_id=' . $item_id . '&license=' . \rawurlencode($license_key) . '&url=' . \home_url();
$raw = wp_remote_get($url);
if (is_wp_error($raw)) {
return ['success' => \false, 'is_server_error' => \true];
}
$response = \json_decode(wp_remote_retrieve_body($raw));
return ['success' => isset($response->success) && $response->success, 'license' => $response->license ?? 'deactivated'];
} catch (\Error $error) {
return ['success' => \false, 'is_server_error' => \true];
}
}
public static function check_license(string $store_url, int $item_id, $license_key) : array
{
try {
$url = $store_url . '?edd_action=check_license&item_id=' . $item_id . '&license=' . \rawurlencode((string) $license_key) . '&url=' . \home_url();
$raw = wp_remote_get($url);
if (is_wp_error($raw)) {
throw new \Error('WP HTTP error', 1);
}
$response = \json_decode(wp_remote_retrieve_body($raw));
if (isset($response->success) && \true === $response->success) {
if ('valid' === $response->license || 'expired' === $response->license) {
return ['success' => \true, 'license' => $response->license, 'expires' => $response->expires ?? null, 'license_limit' => $response->license_limit ?? 0, 'payment_id' => $response->payment_id ?? '', 'customer_name' => $response->customer_name ?? ''];
}
}
return ['success' => \false];
} catch (\Error $error) {
return ['success' => \false, 'is_server_error' => \true];
}
}
public static function get_version(string $store_url, int $item_id, ?string $license_key = null)
{
try {
$url = $store_url . '?edd_action=get_version&item_id=' . $item_id;
if (!empty($license_key)) {
$url .= '&license=' . \rawurlencode($license_key);
}
$raw = wp_remote_get($url);
$response = \json_decode(wp_remote_retrieve_body($raw));
if (isset($response->new_version)) {
return (array) $response;
}
return \false;
} catch (\Error $error) {
return \false;
}
}
public static function get_error_message(string $message) : string
{
$messages = ['missing' => "License doesn't exist", 'license_not_activable' => "Attempting to activate a bundle's parent license", 'disabled' => 'License key revoked', 'no_activations_left' => 'No activations left', 'expired' => 'License has expired', 'key_mismatch' => 'License is not valid for this product', 'item_name_mismatch' => 'License is not valid for this product', 'server_error' => 'Your license could not be activated because of server error.'];
return $messages[$message] ?? 'Your license could not be activated.';
}
}