Skip to content

Internal API (function 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 );

Below you will find all the functions to modify licenses.

/**
* 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 );

This function creates a new license inside the database.

$license_data (array) The license data (must match the columns of the licenses table)

/**
* 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 );

This function updates a license inside the database.

$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

/**
* 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 );

This function updates a license inside the database.

$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

/**
* Finds a license in the database
*
* @param int $license_id
*
* @return bool|ELM_Data_Store_License_Model
*/
function elm_find_license( int $license_id );

This function searches for a license inside the database.

$license_id (int) The license ID

/**
* 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 );

This function searches for a license inside the database.

$where (array) The license localization data (must match the columns of the licenses table).

$order_by (array) The data for ordering

/**
* 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 );

This function locks a license inside the database.

$license (ELM_Data_Store_License_Model) The license object

/**
* 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 );

This function unlocks a license inside the database.

$license (ELM_Data_Store_License_Model) The license object

/**
* 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 );

This function changes the status of a license inside the database.

$license (ELM_Data_Store_License_Model) The license object

$status (string) The license status

/**
* 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;

This function deletes a license from the database.

$license (ELM_Data_Store_License_Model) The license object

/**
* Deletes a license from the database
*
* @param array $where
*
* @return bool
*/
function elm_delete_license_by( array $where ): bool;

This function deletes a license from the database.

$where (array) The license localization data (must match the columns of the licenses table).

Below you will find all the functions to modify license activations.

/**
* 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 );

This function creates a new license activation inside the database.

$license_activation_data (array) The license activation data (must match the columns of the license activations table)

/**
* 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 );

This function updates a license activation inside the database.

$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

/**
* 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 );

This function searches for a license activation inside the database.

$license_activation_id (int) The license activation ID

/**
* 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 );

This function searches for a license activation inside the database.

$where (array) The license activation localization data (must match the columns of the license activations table)

$order_by (array) The data for ordering

/**
* 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;

This function deletes a license activation from the database.

$license_activation (ELM_Data_Store_License_Activation_Model) The license activation object

/**
* Deletes a license activation from the database
*
* @param array $where
*
* @return bool
*/
function elm_delete_license_activation_by( array $where ): bool;

This function deletes a license activation from the database.

$where (array) The license activation localization data (must match the columns of the license activations table)

Below you will find all the functions to modify generators.

/**
* 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 );

This function creates a new generator inside the database.

$generator_data (array) The generator data (must match the columns of the generators table)

/**
* 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 );

This function updates a generator inside the database.

$generator_update_data (array) The generator update data (must match the generators table columns)

$generator (ELM_Data_Store_Generator_Model) The generator object

/**
* Finds a generator in the database
*
* @param int $generator_id
*
* @return ELM_Data_Store_Generator_Model|false
*/
function elm_find_generator( int $generator_id );

This function searches for a generator inside the database.

$generator_id (int) The generator ID

/**
* 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;

This function deletes a generator from the database.

$generator (ELM_Data_Store_Generator_Model) The generator object

/**
* 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 );

This function generates new license keys by using a generator.

$generator (ELM_Data_Store_Generator_Model) The generator object

$amount (int) The number to be generated

Below you will find all the functions to modify distributors.

/**
* 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 );

This function creates a new distributor inside the database.

$distributor_data (array) The distributor data (must match the columns of the distributors table)

/**
* 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 );

This function updates a distributor inside the database.

$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

/**
* Finds a distributor in the database
*
* @param int $distributor_id
*
* @return bool|ELMP_Data_Store_Distributor_Model
*/
function elmp_find_distributor( int $distributor_id );

This function searches for a distributor inside the database.

$distributor_id (int) The distributor ID

/**
* 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 );

This function locks a distributor inside the database.

$distributor (ELMP_Data_Store_Distributor_Model) The distributor object

/**
* 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 );

This function unlocks a distributor inside the database.

$distributor (ELMP_Data_Store_Distributor_Model) The distributor object

/**
* 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;

This function deletes a distributor from the database.

$distributor (ELMP_Data_Store_Distributor_Model) The distributor object

Below you will find all the functions to modify distributor codes.

/**
* 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 );

This function creates a new distributor code inside the database.

$distributor_code_data (array) The distributor code data (must match the columns of the distributor codes table)

/**
* 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 );

This function updates a distributor code inside the database.

$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

/**
* 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 );

This function searches for a distributor code inside the database.

$distributor_code_id (int) The distributor code ID

/**
* 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 );

This function searches for a distributor code inside the database.

$where (array) The distributor code localization data (must match the columns of the distributor codes table)

$order_by (array) The data for ordering

/**
* 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 );

This function changes the status of a distributor code inside the database.

$distributor_code (ELMP_Data_Store_Distributor_Code_Model) The distributor code object

$redeemed (bool) Whether redeemed or not

/**
* 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;

This function deletes a distributor code from the database.

$distributor_code (ELMP_Data_Store_Distributor_Code_Model) The distributor code object

/**
* 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;

This function generates new distributor codes.

$amount (int) The number to be generated

$prefix (string) Adds a prefix

$suffix (string) Adds a suffix

Below you will find all the functions to modify releases.

/**
* 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 );

This function creates a new release inside the database.

$release_data (array) The release data (must match the columns of the release table)

/**
* 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 );

This function updates a release inside the database.

$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

/**
* Finds a release in the database
*
* @param int $release_id
*
* @return bool|ELMP_Data_Store_Release_Model
*/
function elmp_find_release( int $release_id );

This function searches for a release inside the database.

$release_id (int) The release ID

/**
* 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;

This function deletes a release from the database.

$release (ELMP_Data_Store_Release_Model) The release object