license_key_visible) {
$submitted_license_key = trim($_REQUEST['_license_key']);
} else {
$submitted_license_key = get_option(License::LICENSE_KEY_OPTION_NAME);
}
if (License::isValidOvrKey($submitted_license_key)) {
License::setOvrKey($submitted_license_key);
} else {
if (preg_match('/^[a-f0-9]{32}$/i', $submitted_license_key)) {
update_option(License::LICENSE_KEY_OPTION_NAME, $submitted_license_key);
$license_activation_response = License::changeLicenseActivation(true);
switch ($license_activation_response) {
case License::ACTIVATION_RESPONSE_OK:
$action_response = DUP_PRO_U::__("License Activated");
break;
case License::ACTIVATION_RESPONSE_POST_ERROR:
$error_response = sprintf(
DUP_PRO_U::__("Cannot communicate with snapcreek.com. Please see this FAQ entry for possible causes and resolutions."),
'https://snapcreek.com/duplicator/docs/faqs-tech/#faq-licensing-005-q'
);
break;
case License::ACTIVATION_RESPONSE_INVALID:
default:
$error_response = DUP_PRO_U::__('Error activating license.');
break;
}
} else {
$error_response = DUP_PRO_U::__('Please enter a valid key. Key should be 32 characters long.');
}
}
break;
case 'deactivate':
case 'clear_key':
DUP_PRO_U::verifyNonce($_POST['_wpnonce'], 'duplicator-pro-licence');
if (License::isValidOvrKey(License::getLicenseKey())) {
// Reset license key otherwise will be artificially stuck on as valid
update_option(License::LICENSE_KEY_OPTION_NAME, '');
} else {
$license_activation_response = License::changeLicenseActivation(false);
switch ($license_activation_response) {
case License::ACTIVATION_RESPONSE_OK:
$action_response = DUP_PRO_U::__("License Deactivated");
break;
case License::ACTIVATION_RESPONSE_POST_ERROR:
$error_response = sprintf(
DUP_PRO_U::__("Cannot communicate with snapcreek.com. Please see this FAQ entry for possible causes and resolutions."),
'https://snapcreek.com/duplicator/docs/faqs-tech/#faq-licensing-005-q'
);
break;
case License::ACTIVATION_RESPONSE_INVALID:
default:
$error_response = DUP_PRO_U::__('Error deactivating license.');
break;
}
}
if ($action == 'clear_key') {
update_option(License::LICENSE_KEY_OPTION_NAME, '');
$global->license_key_visible = true;
$sglobal->lkp = '';
$global->save();
$sglobal->save();
}
break;
case 'hide_key':
DUP_PRO_U::verifyNonce($_POST['_wpnonce'], 'duplicator-pro-licence');
$password = sanitize_text_field($_POST['_key_password']);
$password_confirmation = sanitize_text_field($_POST['_key_password_confirmation']);
if (empty($password)) {
$error_response = DUP_PRO_U::__('Password cannot be empty.');
} else {
if ($password == $password_confirmation) {
$global->license_key_visible = false;
$sglobal->lkp = $password;
$global->save();
$sglobal->save();
$action_response = DUP_PRO_U::__("Key now hidden.");
} else {
$error_response = DUP_PRO_U::__("Passwords don't match.");
}
}
break;
case 'show_key':
DUP_PRO_U::verifyNonce($_POST['_wpnonce'], 'duplicator-pro-licence');
$password = sanitize_text_field($_POST['_key_password']);
if ($password == $sglobal->lkp) {
$global->license_key_visible = true;
$sglobal->lkp = '';
$global->save();
$sglobal->save();
$action_response = DUP_PRO_U::__("Key now visible.");
} else {
$error_response = DUP_PRO_U::__("Wrong password entered. Key remains hidden.");
}
break;
}
$force_refresh = true;
}
$license_status = License::getLicenseStatus($force_refresh);
$license_text_disabled = false;
$activate_button_text = DUP_PRO_U::__('Activate');
$license_status_text_alt = '';
if ($license_status == License::STATUS_VALID) {
$license_status_style = 'color:#509B18';
$activate_button_text = DUP_PRO_U::__('Deactivate');
$license_text_disabled = true;
$license_key = License::getLicenseKey();
if (License::isValidOvrKey($license_key)) {
$standard_key = License::getStandardKeyFromOvrKey($license_key);
$license_status_text = DUP_PRO_U::__("Status: Active (Using license override for key {$standard_key})");
} else {
$license_status_text = DUP_PRO_U::__('Status: Active');
}
//INACTIVE
} elseif (($license_status == License::STATUS_INACTIVE)) {
$license_status_style = 'color:#dd3d36;';
$license_status_text = DUP_PRO_U::__('Status: Inactive');
//SITE-INACTIVE
} elseif ($license_status == License::STATUS_SITE_INACTIVE) {
$license_status_style = 'color:#dd3d36;';
$global = DUP_PRO_Global_Entity::get_instance();
$license_status_text = ($global->license_no_activations_left) ? DUP_PRO_U::__('Status: Inactive (out of site licenses).
Please use the link above to login to your snapcreek.com dashboard to manage your licenses.') : DUP_PRO_U::__('Status: Inactive');
//EXPIRED
} elseif ($license_status == License::STATUS_EXPIRED) {
$renewal_url = 'https://snapcreek.com/checkout?edd_license_key=' . License::getLicenseKey();
$license_status_style = 'color:#dd3d36;';
$license_status_text = sprintf('Your Duplicator Pro license key has expired so you aren\'t getting important updates! Renew your license now', $renewal_url);
//DEFAULT
} else {
$license_status_string = License::getLicenseStatusString($license_status);
$license_status_style = 'color:#dd3d36;';
$license_status_text = DUP_PRO_U::__('Status: ') . $license_status_string . '
';
$license_status_text_alt = DUP_PRO_U::__('If the license fails to activate please wait a few minutes and try again.');
$license_status_text_alt .= '
';
$license_status_text_alt .= sprintf(
DUP_PRO_U::__('- Failure to activate after several attempts please review %1$sfaq activation steps%2$s'),
'',
'.
'
);
$license_status_text_alt .= sprintf(DUP_PRO_U::__('- To upgrade or renew your license visit %1$ssnapcreek.com%2$s'), '', '.
');
}
function DUP_PRO_Type_Viewer($opts)
{
$opts['mu1'] = ' ';
$opts['mu2'] = $opts['mu2'] == 1 ? ' ' : ' ';
$txt_lic_hdr = DUP_PRO_U::__('Site Licenses');
$txt_lic_msg = DUP_PRO_U::__('Number of site licenses indicates the number of sites the plugin can be active on at any one time. At any point you may deactivate/uninstall the plugin to free up the license and use the plugin elsewhere if needed.');
$txt_mu1_hdr = DUP_PRO_U::__('Multisite Basic');
$txt_mu1_msg = DUP_PRO_U::__('Can backup & migrate standalone sites and full multisite networks.');
$txt_mu2_hdr = DUP_PRO_U::__('Multisite Plus+');
$txt_mu2_msg = DUP_PRO_U::__('Ability to install a subsite as a standalone site. Additional subsite features are planned for Multisite Plus+ in the future. This option is only available in Business and Gold.');
//ARRAY:
echo '