- Overview
- License
- License activation
- Generator
- Distributor (Pro)
- Distributor code (Pro)
- Release (Pro)
Overview
Enwikuna License Manager has functions that you can use internally to customize licenses & generators. Below you will find an overview of all functions that can be used for this purpose. Please note that these functions are only available when the plugin is active.
The listed methods abstract only existing classes and their methods. As an experienced developer, we recommend that you use the methods of a class by importing the class directly into PHP.
Here is an example
use Enwikuna\Enwikuna_License_Manager\ELM_License;
$license = ELM_License::get_instance()->find( $license_id );
However, if you don’t want to use imports, you can fall back on methods that already do this import and pass your request to the executing method of the respective class.
Here is an example
$license = elm_find_license_by( array $where );
License
Below you will find all the functions to modify licenses.
elm_create_license()
/**
* Creates a new license in the database
*
* @param array $license_data
*
* @return ELM_Data_Store_License_Model|false
*/
function elm_create_license( array $license_data );
Description
This function creates a new license inside the database.
Parameter
$license_data (array) The license data (must match the columns of the licenses table)
elm_update_license()
/**
* Updates a license in the database
*
* @param array $license_update_data
* @param ELM_Data_Store_License_Model $license
* @param bool $skip_before_functions
*
* @return ELM_Data_Store_License_Model|false
*/
function elm_update_license( array $license_update_data, ELM_Data_Store_License_Model $license, bool $skip_before_functions = false );
Description
This function updates a license inside the database.
Parameter
$license_update_data (array) The license update data (must match the columns of the licenses table)
$license (ELM_Data_Store_License_Model) The license object
$skip_before_functions (bool) Whether the before functions should be skipped or not
elm_update_license_by()
/**
* Updates a license in the database
*
* @param array $license_update_data
* @param array $where
* @param bool $skip_before_functions
*
* @return bool|ELM_Data_Store_License_Model[]
*/
function elm_update_license_by( array $license_update_data, array $where, bool $skip_before_functions = false );
Description
This function updates a license inside the database.
Parameter
$license_update_data (array) The license update data (must match the columns of the licenses table)
$where (array) The license localization data (must match the columns of the licenses table).
$skip_before_functions (bool) Whether the before functions should be skipped or not
elm_find_license()
/**
* Finds a license in the database
*
* @param int $license_id
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_find_license( int $license_id );
Description
This function searches for a license inside the database.
Parameter
$license_id (int) The license ID
elm_find_license_by()
/**
* Finds a license in the database
*
* @param array $where
* @param array|null $order_by
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_find_license_by( array $where, array $order_by = null );
Description
This function searches for a license inside the database.
Parameter
$where (array) The license localization data (must match the columns of the licenses table).
$order_by (array) The data for ordering
elm_lock_license()
/**
* Locks a license in the database
*
* @param ELM_Data_Store_License_Model $license
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_lock_license( ELM_Data_Store_License_Model $license );
Description
This function locks a license inside the database.
Parameter
$license (ELM_Data_Store_License_Model) The license object
elm_unlock_license()
/**
* Unlocks a license in the database
*
* @param ELM_Data_Store_License_Model $license
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_unlock_license( ELM_Data_Store_License_Model $license );
Description
This function unlocks a license inside the database.
Parameter
$license (ELM_Data_Store_License_Model) The license object
elm_change_license_status()
/**
* Changes a license status
*
* @param ELM_Data_Store_License_Model $license
* @param string $status
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_change_license_status( ELM_Data_Store_License_Model $license, string $status );
Description
This function changes the status of a license inside the database.
Parameter
$license (ELM_Data_Store_License_Model) The license object
$status (string) The license status
elm_delete_license()
/**
* Deletes a license from the database
*
* @param ELM_Data_Store_License_Model $license
*
* @return bool
*/
function elm_delete_license( ELM_Data_Store_License_Model $license ): bool;
Description
This function deletes a license from the database.
Parameter
$license (ELM_Data_Store_License_Model) The license object
elm_delete_license_by()
/**
* Deletes a license from the database
*
* @param array $where
*
* @return bool
*/
function elm_delete_license_by( array $where ): bool;
Description
This function deletes a license from the database.
Parameter
$where (array) The license localization data (must match the columns of the licenses table).
License activation
Below you will find all the functions to modify license activations.
elm_create_license_activation()
/**
* Creates a new license activation in the database
*
* @param array $license_activation_data
*
* @return ELM_Data_Store_License_Activation_Model|false
*/
function elm_create_license_activation( array $license_activation_data );
Description
This function creates a new license activation inside the database.
Parameter
$license_activation_data (array) The license activation data (must match the columns of the license activations table)
elm_update_license_activation()
/**
* Updates a license activation in the database
*
* @param array $license_activation_update_data
* @param ELM_Data_Store_License_Activation_Model $license_activation
*
* @return ELM_Data_Store_License_Activation_Model|false
*/
function elm_update_license_activation( array $license_activation_update_data, ELM_Data_Store_License_Activation_Model $license_activation );
Description
This function updates a license activation inside the database.
Parameter
$license_activation_update_data (array) The license activation update data (must match the columns of the license activations table)
$license_activation (ELM_Data_Store_License_Activation_Model) The license activation object
elm_find_license_activation()
/**
* Finds a license activation in the database
*
* @param int $license_activation_id
*
* @return bool|ELM_Data_Store_License_Activation_Model
*/
function elm_find_license_activation( int $license_activation_id );
Description
This function searches for a license activation inside the database.
Parameter
$license_activation_id (int) The license activation ID
elm_find_license_activation_by()
/**
* Finds a license activation in the database
*
* @param array $where
* @param array|null $order_by
*
* @return bool|ELM_Data_Store_License_Activation_Model
*/
function elm_find_license_activation_by( array $where, array $order_by = null );
Description
This function searches for a license activation inside the database.
Parameter
$where (array) The license activation localization data (must match the columns of the license activations table)
$order_by (array) The data for ordering
elm_delete_license_activation()
/**
* Deletes a license activation from the database
*
* @param ELM_Data_Store_License_Activation_Model $license_activation
*
* @return bool
*/
function elm_delete_license_activation( ELM_Data_Store_License_Activation_Model $license_activation ): bool;
Description
This function deletes a license activation from the database.
Parameter
$license_activation (ELM_Data_Store_License_Activation_Model) The license activation object
elm_delete_license_activation_by()
/**
* Deletes a license activation from the database
*
* @param array $where
*
* @return bool
*/
function elm_delete_license_activation_by( array $where ): bool;
Description
This function deletes a license activation from the database.
Parameter
$where (array) The license activation localization data (must match the columns of the license activations table)
Generator
Below you will find all the functions to modify generators.
elm_create_generator()
/**
* Creates a new generator in the database
*
* @param array $generator_data
*
* @return ELM_Data_Store_Generator_Model|false
*/
function elm_create_generator( array $generator_data );
Description
This function creates a new generator inside the database.
Parameter
$generator_data (array) The generator data (must match the columns of the generators table)
elm_update_generator()
/**
* Updates a generator in the database
*
* @param array $generator_update_data
* @param ELM_Data_Store_Generator_Model $generator
*
* @return ELM_Data_Store_Generator_Model|false
*/
function elm_update_generator( array $generator_update_data, ELM_Data_Store_Generator_Model $generator );
Description
This function updates a generator inside the database.
Parameter
$generator_update_data (array) The generator update data (must match the generators table columns)
$generator (ELM_Data_Store_Generator_Model) The generator object
elm_find_generator()
/**
* Finds a generator in the database
*
* @param int $generator_id
*
* @return ELM_Data_Store_Generator_Model|false
*/
function elm_find_generator( int $generator_id );
Description
This function searches for a generator inside the database.
Parameter
$generator_id (int) The generator ID
elm_delete_generator()
/**
* Deletes a generator from the database
*
* @param ELM_Data_Store_Generator_Model $generator
*
* @return bool
*/
function elm_delete_generator( ELM_Data_Store_Generator_Model $generator ): bool;
Description
This function deletes a generator from the database.
Parameter
$generator (ELM_Data_Store_Generator_Model) The generator object
elm_generate_license_keys()
/**
* Generates license keys using a generator
*
* @param ELM_Data_Store_Generator_Model $generator
* @param int $amount
*
* @return array|WP_Error
*/
function elm_generate_license_keys( ELM_Data_Store_Generator_Model $generator, int $amount = 1 );
Description
This function generates new license keys by using a generator.
Parameter
$generator (ELM_Data_Store_Generator_Model) The generator object
$amount (int) The number to be generated
Distributor (Pro)
Below you will find all the functions to modify distributors.
elmp_create_distributor()
/**
* Creates a new distributor in the database
*
* @param array $distributor_data
*
* @return ELMP_Data_Store_Distributor_Model|false
*/
function elmp_create_distributor( array $distributor_data );
Description
This function creates a new distributor inside the database.
Parameter
$distributor_data (array) The distributor data (must match the columns of the distributors table)
elmp_update_distributor()
/**
* Updates a distributor in the database
*
* @param array $distributor_update_data
* @param ELMP_Data_Store_Distributor_Model $distributor
*
* @return ELMP_Data_Store_Distributor_Model|false
*/
function elmp_update_distributor( array $distributor_update_data, ELMP_Data_Store_Distributor_Model $distributor );
Description
This function updates a distributor inside the database.
Parameter
$distributor_update_data (array) The distributor update data (must match the columns of the distributors table)
$distributor (ELMP_Data_Store_Distributor_Model) The distributor object
elmp_find_distributor()
/**
* Finds a distributor in the database
*
* @param int $distributor_id
*
* @return bool|ELMP_Data_Store_Distributor_Model
*/
function elmp_find_distributor( int $distributor_id );
Description
This function searches for a distributor inside the database.
Parameter
$distributor_id (int) The distributor ID
elmp_lock_distributor()
/**
* Locks a distributor in the database
*
* @param ELMP_Data_Store_Distributor_Model $distributor
*
* @return bool|ELMP_Data_Store_Distributor_Model
*/
function elmp_lock_distributor( ELMP_Data_Store_Distributor_Model $distributor );
Description
This function locks a distributor inside the database.
Parameter
$distributor (ELMP_Data_Store_Distributor_Model) The distributor object
elmp_unlock_distributor()
/**
* Unlocks a distributor in the database
*
* @param ELMP_Data_Store_Distributor_Model $distributor
*
* @return bool|ELMP_Data_Store_Distributor_Model
*/
function elmp_unlock_distributor( ELMP_Data_Store_Distributor_Model $distributor );
Description
This function unlocks a distributor inside the database.
Parameter
$distributor (ELMP_Data_Store_Distributor_Model) The distributor object
elmp_delete_distributor()
/**
* Deletes a distributor from the database
*
* @param ELMP_Data_Store_Distributor_Model $distributor
*
* @return bool
*/
function elmp_delete_distributor( ELMP_Data_Store_Distributor_Model $distributor ): bool;
Description
This function deletes a distributor from the database.
Parameter
$distributor (ELMP_Data_Store_Distributor_Model) The distributor object
Distributor code (Pro)
Below you will find all the functions to modify distributor codes.
elmp_create_distributor_code()
/**
* Creates a new distributor code in the database
*
* @param array $distributor_code_data
*
* @return ELMP_Data_Store_Distributor_Code_Model|false
*/
function elmp_create_distributor_code( array $distributor_code_data );
Description
This function creates a new distributor code inside the database.
Parameter
$distributor_code_data (array) The distributor code data (must match the columns of the distributor codes table)
elmp_update_distributor_code()
/**
* Updates a distributor code in the database
*
* @param array $distributor_code_update_data
* @param ELMP_Data_Store_Distributor_Code_Model $distributor_code
*
* @return ELMP_Data_Store_Distributor_Code_Model|false
*/
function elmp_update_distributor_code( array $distributor_code_update_data, ELMP_Data_Store_Distributor_Code_Model $distributor_code );
Description
This function updates a distributor code inside the database.
Parameter
$distributor_code_update_data (array) The distributor code update data (must match the columns of the distributor codes table)
$distributor_code (ELMP_Data_Store_Distributor_Code_Model) The distributor code object
elmp_find_distributor_code()
/**
* Finds a distributor code in the database
*
* @param int $distributor_code_id
*
* @return bool|ELMP_Data_Store_Distributor_Code_Model
*/
function elmp_find_distributor_code( int $distributor_code_id );
Description
This function searches for a distributor code inside the database.
Parameter
$distributor_code_id (int) The distributor code ID
elmp_find_distributor_code_by()
/**
* Finds a distributor code in the database
*
* @param array $where
* @param array|null $order_by
*
* @return bool|ELMP_Data_Store_Distributor_Code_Model
*/
function elmp_find_distributor_code_by( array $where, array $order_by = null );
Description
This function searches for a distributor code inside the database.
Parameter
$where (array) The distributor code localization data (must match the columns of the distributor codes table)
$order_by (array) The data for ordering
elmp_change_distributor_code_status()
/**
* Changes a distributor code status
*
* @param ELMP_Data_Store_Distributor_Code_Model $distributor_code
* @param bool $redeemed
*
* @return bool|ELMP_Data_Store_Distributor_Code_Model
*/
function elmp_change_distributor_code_status( ELMP_Data_Store_Distributor_Code_Model $distributor_code, bool $redeemed );
Description
This function changes the status of a distributor code inside the database.
Parameter
$distributor_code (ELMP_Data_Store_Distributor_Code_Model) The distributor code object
$redeemed (bool) Whether redeemed or not
elmp_delete_distributor_code()
/**
* Deletes a distributor code from the database
*
* @param ELMP_Data_Store_Distributor_Code_Model $distributor_code
*
* @return bool
*/
function elmp_delete_distributor_code( ELMP_Data_Store_Distributor_Code_Model $distributor_code ): bool;
Description
This function deletes a distributor code from the database.
Parameter
$distributor_code (ELMP_Data_Store_Distributor_Code_Model) The distributor code object
elmp_generate_distributor_codes()
/**
* Generates distributor codes
*
* @param int $amount
* @param string $prefix
* @param string $suffix
*
* @return array
*/
function elmp_generate_distributor_codes( int $amount, string $prefix, string $suffix ): array;
Description
This function generates new distributor codes.
Parameter
$amount (int) The number to be generated
$prefix (string) Adds a prefix
$suffix (string) Adds a suffix
Release (Pro)
Below you will find all the functions to modify releases.
elmp_create_release()
/**
* Creates a new release in the database
*
* @param array $release_data
*
* @return ELMP_Data_Store_Release_Model|false
*/
function elmp_create_release( array $release_data );
Description
This function creates a new release inside the database.
Parameter
$release_data (array) The release data (must match the columns of the release table)
elmp_update_release()
/**
* Updates a release in the database
*
* @param array $release_update_data
* @param ELMP_Data_Store_Release_Model $release
*
* @return ELMP_Data_Store_Release_Model|false
*/
function elmp_update_release( array $release_update_data, ELMP_Data_Store_Release_Model $release );
Description
This function updates a release inside the database.
Parameter
$release_update_data (array) The release update data (must match the columns of the releases table)
$release (ELMP_Data_Store_Release_Model) The release object
elmp_find_release()
/**
* Finds a release in the database
*
* @param int $release_id
*
* @return bool|ELMP_Data_Store_Release_Model
*/
function elmp_find_release( int $release_id );
Description
This function searches for a release inside the database.
Parameter
$release_id (int) The release ID
elmp_delete_release()
/**
* Deletes a release from the database
*
* @param ELMP_Data_Store_Release_Model $release
*
* @return bool
*/
function elmp_delete_release( ELMP_Data_Store_Release_Model $release ): bool;
Description
This function deletes a release from the database.
Parameter
$release (ELMP_Data_Store_Release_Model) The release object