/* Decoded by unphp.net */
function check_license()
{
$license = trim(get_option($this->theme_slug . "_license_key"));
$strings = $this->strings;
$api_params = array("edd_action" => "check_license", "license" => $license, "item_name" => urlencode($this->item_name), "url" => home_url("/"));
$response = $this->get_api_response($api_params);
if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) {
if (is_wp_error($response)) {
$message = $response->get_error_message();
if (strpos($message, "Could not resolve host") !== false) {
$message = esc_html__("Could not connect to license server", TEXT_DOMAIN);
}
} else {
$message = $strings["license-status-unknown"];
}
} else {
$license_data = json_decode(wp_remote_retrieve_body($response));
if (!isset($license_data->license)) {
$message = $strings["license-status-unknown"];
return $message;
}
if ($license_data && isset($license_data->license)) {
update_option($this->theme_slug . "_license_key_status", $license_data->license);
}
$expires = false;
if (isset($license_data->expires) && "lifetime" != $license_data->expires) {
$expires = date_i18n(get_option("date_format"), strtotime($license_data->expires, current_time("timestamp")));
$renew_link = "get_renewal_link()) . "" target="_blank">" . $strings["renew"] . "";
} elseif (isset($license_data->expires) && "lifetime" == $license_data->expires) {
$expires = "lifetime";
}
$site_count = isset($license_data->site_count) ? $license_data->site_count : '';
$customer_name = isset($license_data->customer_name) ? $license_data->customer_name : '';
$customer_email = isset($license_data->customer_email) ? $license_data->customer_email : '';
$license_limit = isset($license_data->license_limit) ? $license_data->license_limit : '';
if (0 == $license_limit) {
$license_limit = $strings["unlimited"];
}
if ($license_data->license == "valid") {
$message = $strings["license-key-is-active"] . " ";
if (isset($expires) && "lifetime" != $expires) {
$message .= "
" . sprintf($strings["expires%s"], $expires) . " ";
}
if (isset($expires) && "lifetime" == $expires) {
$message .= "
" . $strings["expires-never"];
}
if ($site_count && $license_limit) {
$message .= "
" . sprintf($strings["%1$s/%2$-sites"], $site_count, $license_limit);
}
if ($customer_name && $license_limit) {
$message .= "
" . sprintf($strings["customer-name-%1$s"], $customer_name, $license_limit);
}
if ($customer_email && $license_limit) {
$message .= "
" . sprintf($strings["customer-email-%1$s"], $customer_email, $license_limit);
}
} else {
if ($license_data->license == "expired") {
if ($expires) {
$message = "
" . sprintf($strings["license-key-expired-%s"], $expires);
} else {
$message = $strings["license-key-expired"];
}
if ($renew_link) {
$message .= " " . $renew_link;
}
} else {
if ($license_data->license == "invalid") {
$message = $strings["license-keys-do-not-match"];
} else {
if ($license_data->license == "inactive") {
$message = $strings["license-is-inactive"];
} else {
if ($license_data->license == "disabled") {
$message = $strings["license-key-is-disabled"];
} else {
if ($license_data->license == "site_inactive") {
$message = $strings["site-is-inactive"];
} else {
$message = $strings["license-status-unknown"];
}
}
}
}
}
}
}
return $message;
} ?>