Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Helper_Admin_Add_Ons::handle_deactivations()
Deactivate license keys with LifterLMS.com api
Description Description
Output errors / successes & removes keys from the db.
Return Return
(void)
Source Source
File: libraries/lifterlms-helper/includes/class-llms-helper-admin-add-ons.php
private function handle_deactivations() {
$obfuscated_keys = llms_filter_input( INPUT_POST, 'llms_remove_keys', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY );
$keys = array();
// De-obfuscate the keys before sending to deactivation server or removing from the site.
$my_keys = llms_helper_options()->get_license_keys();
foreach ( $my_keys as $key ) {
foreach ( $obfuscated_keys as $obfuscated_key ) {
if ( llms_obfuscate_license_key( $key['license_key'] ) === $obfuscated_key ) {
$keys[] = $key['license_key'];
}
}
}
$res = LLMS_Helper_Keys::deactivate_keys( $keys );
if ( is_wp_error( $res ) ) {
LLMS_Admin_Notices::flash_notice( $res->get_error_message(), 'error' );
return;
}
foreach ( $keys as $key ) {
LLMS_Helper_Keys::remove_license_key( $key );
/* Translators: %s = License Key */
LLMS_Admin_Notices::flash_notice( sprintf( __( 'License key "%s" was removed from this site.', 'lifterlms' ), llms_obfuscate_license_key( $key ) ), 'info' );
}
if ( isset( $data['errors'] ) ) {
foreach ( $data['errors'] as $error ) {
LLMS_Admin_Notices::flash_notice( make_clickable( $error ), 'error' );
}
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.4.0 | Use core textdomain. |
| 3.2.0 | Don't access $_POST directly. |
| 3.0.0 | Introduced. |