is_valid) || !isset($license_info->license_title) || !isset($license_info->expire_date)) {
wp_die(__('Error: Invalid license information', $text_domain));
return;
}
// Sanitize license key before masking
$license_key = sanitize_text_field(get_option('AIAutomaticTranslationsForPolylang_lic_Key', ''));
$masked_key = !empty($license_key) ?
esc_html(substr($license_key, 0, 8) . '-XXXXXXXX-XXXXXXXX-' . substr($license_key, -8)) :
'';
$admin_url = esc_url(admin_url('admin-post.php'));
?>
-
is_valid): ?>
β
β
β
β
- license_title); ?>
-
expire_date) !== 'no expiry') {
$expire_date_timestamp = strtotime($license_info->expire_date);
$expire_date_expired = $expire_date_timestamp && $expire_date_timestamp < $current_time;
}
// Handle "no support" case for support_end
if (strtolower($license_info->support_end) === 'no support') {
esc_html_e('No Support', $text_domain);
} else {
// Handle "unlimited" case for support_end
$support_end_expired = false;
if (strtolower($license_info->support_end) !== 'unlimited') {
$support_end_timestamp = strtotime($license_info->support_end);
$support_end_expired = $support_end_timestamp && $support_end_timestamp < $current_time;
}
if ($expire_date_expired) {
echo esc_html(atfpp_pro_formatLicenseDate($license_info->expire_date));
} elseif ($support_end_expired) {
echo esc_html(atfpp_pro_formatLicenseDate($license_info->support_end));
} else {
echo esc_html(atfpp_pro_formatLicenseDate($license_info->expire_date));
}
}
?>
-
is_valid === 'license_expired';
}
function atfpp_is_support_expired($license_info) {
return $license_info->support_end === 'no support' ||
($license_info->is_valid === 'support_expired' ||
(strtolower($license_info->support_end) !== 'unlimited' &&
strtotime($license_info->support_end) < time()));
}
function atfpp_needs_refresh($license_info) {
return atfpp_is_license_expired($license_info) || atfpp_is_support_expired($license_info);
}
function atfpp_render_expiry_message($license_info, $type = 'license') {
$text_domain = 'autopoly-ai-translation-for-polylang-pro';
// Generate version available message using common helper
$version_available_message = AutoPolyPro::atfppGetVersionAvailableMessage();
if ($license_info->msg === 'limit_reached') {
$support_link = sprintf('%s', esc_url('https://my.coolplugins.net/account/support-tickets/'), esc_html__('clicking here', 'atfpp'));
echo wp_kses_post(sprintf(
/* translators: %s: link to support ticket page */
__('There was an issue with your account. Please contact our plugin support team by %s.', 'atfpp'),
$support_link
));
return;
}
$message = $type === 'license'
? __('Your license has expired,', 'atfpp')
: __('Your support has expired,', 'atfpp');
$renew_link = isset($license_info->market) && $license_info->market === 'E'
? ''
: ' '.esc_html__('Renew now', 'atfpp').'';
$final_message = '';
// Add version message if available
if (!empty($version_available_message)) {
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
$final_message .= wp_kses_post($version_available_message) . ' ';
}
// Add license expiry message
$final_message .= esc_html($message) . $renew_link . esc_html__(' to continue receiving updates and priority support.', 'atfpp');
echo $final_message;
}
function atfpp_pro_formatLicenseDate($dateString) {
if (!empty($dateString) && strtolower($dateString) !== 'no expiry') {
$date = new DateTime($dateString);
return $date->format('d M Y');
}
return $dateString;
}