DomainsTlds extends DomainsModel
Domain Manager TLDs Management Model
Table of Contents
Properties
| $config_option_features | |
| $package_meta_features |
Methods
| add() | Add a TLD |
| addPackage() | Adds a package to a given tld |
| assignClientPackage() | Assigns a TLD package to a client, for unrestricted access |
| delete() | Permanently deletes the given TLD |
| deletePackages() | Permanently deletes packages for the given TLD. NOTE: this triggers an event that will delete the tld itself |
| disable() | Disables the given TLD |
| duplicate() | Duplicates the existing TLD in to a new module |
| edit() | Edit a TLD |
| enable() | Enables the given TLD |
| get() | Fetches the given TLD |
| getAll() | Returns all TLDs in the system for the given filters |
| getByPackage() | Fetches a TLD by the given package id |
| getDefaultTlds() | Gets a list TLDs to include with Blesta by default |
| getDomainsCompanySettings() | Returns the plugin company settings |
| getDuplicateTldPackages() | Gets all packages for TLDs that have duplicates |
| getDuplicateTlds() | Gets all TLDs that have active packages other than the primary a TLD and module |
| getFeatures() | Returns a list of the features supported by the domain manager |
| getList() | Returns a list of TLDs for the given company |
| getListCount() | Returns the total number of TLDs for the given filters |
| getPricing() | Get the pricing of a TLD by term and currency |
| getTldFields() | Fetches the package fields, html, email tags and email template of the given package id |
| getTldPackage() | Get all the packages assigned to a TLD. |
| getTldPackageByModuleId() | Gets the package assigned to the given TLD that utilizes the provided module |
| getTldPackages() | Get all the packages assigned to a TLD. |
| hasMultipleTldPackages() | Check if there are multiple packages for the given TLD within the domains package group |
| import() | Imports the TLDs and their pricing from a registrar module, if available |
| sort() | Sort the TLDs |
| updateDomainsCompanySettings() | Updates the plugin company settings |
| updateOverridePriceSetting() | Updates the taxation status of the TLD packages |
| updatePricings() | Updates the pricings of a TLD |
| updateTax() | Updates the taxation status of the TLD packages |
| updateWelcomeEmail() | Updates the Welcome Email template for a given TLD |
| addPricing() | Adds a new pricing for the given package |
| appendFeatures() | Append features to the TLD and marks them based on which configurable option groups are assigned to the package |
| assignFeatures() | Assigns feature configurable options groups to the given package |
| createPackage() | Creates a package for a given TLD |
| disablePricing() | Disable a TLD pricing |
| getPricingsByTermCurrency() | Get the pricings of a TLD |
| getRules() | Returns all validation rules for adding/editing extensions |
| getTlds() | Returns a partial query |
| migrateModule() | Migrate the TLD to a new module |
| requiresModuleMigration() | Validates if a package will require a module migration. |
| updatePricing() | Updates an existing pricing |
| updateSinglePackagePricing() | Updates the pricings for a single package |
Properties
$config_option_features
private
array<string|int, mixed>
$config_option_features
= ['dns_management', 'email_forwarding', 'id_protection']
A list of config option controlled potential features
$package_meta_features
private
array<string|int, mixed>
$package_meta_features
= ['epp_code']
A list of package meta controlled potential features
Methods
add()
Add a TLD
public
add(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
An array of input data including:
- tld The TLD to add
- ns A numerically indexed array, containing the nameservers for the given TLD
- company_id The ID of the company for which this TLD is available (optional)
- package_id The ID of the package to be used for pricing and sale of this TLD (optional)
- package_group_id The ID of the TLDs package group (optional)
- module_id The ID of the registrar module to be used for this TLD
- dns_management Whether to include DNS management for this TLD
- email_forwarding Whether to include email forwarding for this TLD
- id_protection Whether to include ID protection for this TLD
- epp_code Whether to include EPP Code for this TLD
Return values
array<string|int, mixed> —An array containing the TLD
addPackage()
Adds a package to a given tld
public
addPackage(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
An array of input data including:
- tld The TLD to add (opional)
- tld_id The id of the TLD to add (required if 'tld' is not submitted)
- package_id The ID of the package to add
assignClientPackage()
Assigns a TLD package to a client, for unrestricted access
public
assignClientPackage(int $client_id, int $package_id) : mixed
Parameters
- $client_id : int
-
The ID of the client
- $package_id : int
-
The ID of the restricted package for a TLD
delete()
Permanently deletes the given TLD
public
delete(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The identifier of the TLD to delete
- $company_id : int = null
-
The ID of the company for which to filter by
deletePackages()
Permanently deletes packages for the given TLD. NOTE: this triggers an event that will delete the tld itself
public
deletePackages(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The identifier of the TLD to delete
- $company_id : int = null
-
The ID of the company for which to filter by
disable()
Disables the given TLD
public
disable(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The identifier of the TLD to disable
- $company_id : int = null
-
The ID of the company for which to filter by
duplicate()
Duplicates the existing TLD in to a new module
public
duplicate(string $tld, int $module_id[, int $company_id = null ]) : int
Parameters
- $tld : string
-
The TLD to migrate
- $module_id : int
-
The ID of the new module for the TLD
- $company_id : int = null
-
The ID of the company for which to filter by (optional)
Return values
int —The ID of the new package for the TLD
edit()
Edit a TLD
public
edit(string $tld, array<string|int, mixed> $vars) : string
Parameters
- $tld : string
-
The identifier of the TLD to edit
- $vars : array<string|int, mixed>
-
An array of input data including:
- company_id The ID of the company for which this TLD is available (optional)
- package_id The ID of the package to be used for pricing and sale of this TLD
- dns_management Whether to include DNS management for this TLD
- email_forwarding Whether to include email forwarding for this TLD
- id_protection Whether to include ID protection for this TLD
- epp_code Whether to include EPP Code for this TLD
- module_id The ID of the module this package belongs to (optional, default NULL)
- module_row The module row this package belongs to (optional, default NULL)
- module_group The module group this package belongs to (optional, default NULL)
- taxable Whether or not this package is taxable (optional, default 0)
- email_content A numerically indexed array of email content including:
- lang The language of the email content
- html The html content for the email (optional)
- text The text content for the email, will be created automatically from html if not given (optional)
- option_groups A numerically indexed array of package option group assignments (optional)
- meta A set of miscellaneous fields to pass, in addition to the above fields, to the module when adding the package (optional)
Return values
string —The identifier of the TLD that was updated, void on error
enable()
Enables the given TLD
public
enable(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The identifier of the TLD to enable
- $company_id : int = null
-
The ID of the company for which to filter by
get()
Fetches the given TLD
public
get(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The TLD of the record to fetch
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
mixed —A stdClass object representing the TLD, false if no such record exists
getAll()
Returns all TLDs in the system for the given filters
public
getAll([array<string|int, mixed> $filters = [] ][, array<string|int, mixed> $order = ['package_group.order' => 'asc'] ]) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed> = []
-
A list of filters for the query
- tld The TLD
- tlds A list of TLDs to fetch
- company_id The ID of the company for which this TLD is available
- package_id The package to be used for pricing and sale of this TLD
- status The status of the package to be used for pricing and sale of this TLD
- module_id The ID of the registrar module
- search_tld Partial match for the TLD
- $order : array<string|int, mixed> = ['package_group.order' => 'asc']
-
A key/value pair array of fields to order the results by
Return values
array<string|int, mixed> —An array of stdClass objects
getByPackage()
Fetches a TLD by the given package id
public
getByPackage(int $package_id[, int $company_id = null ]) : mixed
Parameters
- $package_id : int
-
The Package ID belonging to the TLD to fetch
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
mixed —A stdClass object representing the TLD, false if no such record exists
getDefaultTlds()
Gets a list TLDs to include with Blesta by default
public
getDefaultTlds() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of TLDs
getDomainsCompanySettings()
Returns the plugin company settings
public
getDomainsCompanySettings([int $company_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int = null
-
The ID of the company to fetch the plugin settings
Return values
array<string|int, mixed> —An array containing all the Domains plugin company settings
getDuplicateTldPackages()
Gets all packages for TLDs that have duplicates
public
getDuplicateTldPackages([int $company_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int = null
-
The ID of the company
Return values
array<string|int, mixed> —An array of duplicate packages grouped by TLD
getDuplicateTlds()
Gets all TLDs that have active packages other than the primary a TLD and module
public
getDuplicateTlds([int $company_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int = null
-
The ID of the company
Return values
array<string|int, mixed> —An array of TLD names that have duplicate packages
getFeatures()
Returns a list of the features supported by the domain manager
public
getFeatures() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of the supported features by the plugin
getList()
Returns a list of TLDs for the given company
public
getList([array<string|int, mixed> $filters = [] ][, int $page = 1 ][, array<string|int, mixed> $order = ['package_group.order' => 'asc'] ]) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed> = []
-
A list of filters for the query
- tld The TLD
- tlds A list of TLDs to fetch
- company_id The ID of the company for which this TLD is available
- package_id The package to be used for pricing and sale of this TLD
- status The status of the package to be used for pricing and sale of this TLD
- module_id The ID of the registrar module
- search_tld Partial match for the TLD
- $page : int = 1
-
The page number of results to fetch
- $order : array<string|int, mixed> = ['package_group.order' => 'asc']
-
A key/value pair array of fields to order the results by
Return values
array<string|int, mixed> —An array of stdClass objects
getListCount()
Returns the total number of TLDs for the given filters
public
getListCount([array<string|int, mixed> $filters = [] ]) : int
Parameters
- $filters : array<string|int, mixed> = []
-
A list of filters for the query
- tld The TLD
- tlds A list of TLDs to fetch
- company_id The ID of the company for which this TLD is available
- package_id The package to be used for pricing and sale of this TLD
- status The status of the package to be used for pricing and sale of this TLD
- module_id The ID of the registrar module
- search_tld Partial match for the TLD
Return values
int —The total number of TLDs for the given filters
getPricing()
Get the pricing of a TLD by term and currency
public
getPricing(int $package_id, int $term, string $currency) : stdClass
Parameters
- $package_id : int
-
The ID of the package belonging ot the TLD
- $term : int
-
The term of the pricing to look for
- $currency : string
-
The currency of the pricing to look for
Return values
stdClass —An object containing the pricing matching the given term and currency, void if a match could not be found
getTldFields()
Fetches the package fields, html, email tags and email template of the given package id
public
getTldFields(int $package_id) : array<string|int, mixed>
Parameters
- $package_id : int
-
The ID of the package to fetch the fields
Return values
array<string|int, mixed> —An array containing the package fields, html, tags and email template
getTldPackage()
Get all the packages assigned to a TLD.
public
getTldPackage(string $tld[, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The TLD to fetch the packages
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
mixed —An array of objects containing the assigned packages to the given tld
getTldPackageByModuleId()
Gets the package assigned to the given TLD that utilizes the provided module
public
getTldPackageByModuleId(string $tld, int $module_id[, int $company_id = null ]) : stdClass
Parameters
- $tld : string
-
The TLD for which the package will be looked up
- $module_id : int
-
The ID of the module the package should have
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
stdClass —An object representing the package
getTldPackages()
Get all the packages assigned to a TLD.
public
getTldPackages(string $tld[, string $status = null ][, int $company_id = null ]) : mixed
Parameters
- $tld : string
-
The TLD to fetch the packages
- $status : string = null
-
The status of the packages to fetch, it can be "active", "inactive" or null (default, null)
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
mixed —An array of objects containing the assigned packages to the given tld
hasMultipleTldPackages()
Check if there are multiple packages for the given TLD within the domains package group
public
hasMultipleTldPackages(string $tld, int $current_package_id[, int $company_id = null ]) : bool
Parameters
- $tld : string
-
The TLD to check
- $current_package_id : int
-
The current package ID to exclude from the check
- $company_id : int = null
-
The ID of the company for which to filter by
Return values
bool —True if multiple packages exist for this TLD, false otherwise
import()
Imports the TLDs and their pricing from a registrar module, if available
public
import(array<string|int, mixed> $tlds, int $module_id[, int $company_id = null ][, array<string|int, mixed> $filters = [] ]) : bool
Parameters
- $tlds : array<string|int, mixed>
-
A list containing the TLDs to import from the registrar module
- $module_id : int
-
The ID of the registrar module
- $company_id : int = null
-
The ID of the company to import the TLDs
- $filters : array<string|int, mixed> = []
-
A list of filters for the process
- terms A list of terms to import for the TLD, if supported
Return values
bool —True if all the TLDs where imported successfully, false otherwise
sort()
Sort the TLDs
public
sort([array<string|int, mixed> $tlds = [] ][, mixed $company_id = null ]) : mixed
Parameters
- $tlds : array<string|int, mixed> = []
-
A key => value array, where the key is the order of the TLD and the value the ID of the package belonging to the TLD
- $company_id : mixed = null
updateDomainsCompanySettings()
Updates the plugin company settings
public
updateDomainsCompanySettings(int $company_id, array<string|int, mixed> $settings) : mixed
Parameters
- $company_id : int
-
The ID of the company to fetch the plugin settings
- $settings : array<string|int, mixed>
-
An array containing all the Domains plugin company settings
updateOverridePriceSetting()
Updates the taxation status of the TLD packages
public
updateOverridePriceSetting(int $override_prices) : mixed
Parameters
- $override_prices : int
-
Whether or not to set override prices automatically on services created from this package
updatePricings()
Updates the pricings of a TLD
public
updatePricings(string $tld, array<string|int, mixed> $pricings[, int $company_id = null ][, array<string|int, mixed> $filters = [] ][, bool $update_all_packages = false ]) : mixed
Parameters
- $tld : string
-
The identifier of the TLD to edit
- $pricings : array<string|int, mixed>
-
A key => value array, where the key is the package pricing ID and the value the pricing row
- $company_id : int = null
-
The ID of the company for which to filter by
- $filters : array<string|int, mixed> = []
-
A list of filters for the process
- terms A list of terms to import for the TLD, if supported
- $update_all_packages : bool = false
-
If true, update pricing for all packages matching this TLD
updateTax()
Updates the taxation status of the TLD packages
public
updateTax(int $taxable) : mixed
Parameters
- $taxable : int
-
Whether or not this package is taxable (optional, default 0)
updateWelcomeEmail()
Updates the Welcome Email template for a given TLD
public
updateWelcomeEmail(string $tld, array<string|int, mixed> $vars[, int $company_id = null ]) : void
Parameters
- $tld : string
-
The identifier of the TLD
- $vars : array<string|int, mixed>
-
An array of input data including:
- update_scope The scope of the template update, it could be:
- tld Updates the welcome email for this TLD
- module Updates the welcome email for all TLDs using this module
- all Updates the welcome email for all TLDs, regardless of the module
- email_content A numerically indexed array of email content including:
- lang The language of the email content
- html The html content for the email (optional)
- text The text content for the email, will be created automatically from html if not given (optional)
- update_scope The scope of the template update, it could be:
- $company_id : int = null
-
The ID of the company for which to filter by
addPricing()
Adds a new pricing for the given package
private
addPricing(int $package_id, array<string|int, mixed> $vars) : mixed
Parameters
- $package_id : int
-
The ID of the package to add the new pricing
- $vars : array<string|int, mixed>
-
An array of pricing info including:
- term The term as an integer 1-65535 (optional, default 1)
- price The price of this term (optional, default 0.00)
- price_renews The renewal price of this term (optional, default null)
- price_transfer The transfer price of this term (optional, default null)
- currency The ISO 4217 currency code for this pricing (optional, default USD)
appendFeatures()
Append features to the TLD and marks them based on which configurable option groups are assigned to the package
private
appendFeatures(stdClass $tld) : stdClass
Parameters
- $tld : stdClass
-
The TLD object to which features are appended
Return values
stdClass —The modified TLD object
assignFeatures()
Assigns feature configurable options groups to the given package
private
assignFeatures(int $package_id, array<string|int, mixed> $vars) : mixed
Parameters
- $package_id : int
-
The ID of the package to assign the configurable options
- $vars : array<string|int, mixed>
-
An array of input data including:
- company_id The ID of the company for which this TLD is available (optional)
- dns_management Whether to include DNS management for this TLD
- email_forwarding Whether to include email forwarding for this TLD
- id_protection Whether to include ID protection for this TLD
- epp_code Whether to include EPP Code for this TLD
createPackage()
Creates a package for a given TLD
private
createPackage(array<string|int, mixed> $vars) : int
Parameters
- $vars : array<string|int, mixed>
-
An array of input data including:
- tld The TLD of the package
- module_id The ID of the registrar module for this package
- status The status for the new package (optional, default inactive)
- ns A numerically indexed array, containing the nameservers for the given TLD (optional)
- package_group_id The ID of the TLDs package group (optional)
- company_id The ID of the company for which the TLD of this package is available (optional)
Return values
int —The ID of the TLD package
disablePricing()
Disable a TLD pricing
private
disablePricing(int $pricing_id) : int
Parameters
- $pricing_id : int
-
The ID of the pricing to disable
Return values
int —The ID of the pricing, void on error
getPricingsByTermCurrency()
Get the pricings of a TLD
private
getPricingsByTermCurrency(int $package_id) : array<string|int, mixed>
Parameters
- $package_id : int
-
The ID of the package belonging to the TLD
Return values
array<string|int, mixed> —A list of objects containing the pricing
getRules()
Returns all validation rules for adding/editing extensions
private
getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
An array of input key/value pairs
- tld The TLD
- package_id The package to be used for pricing and sale of this TLD
- dns_management Whether to include DNS management for this TLD
- email_forwarding Whether to include email forwarding for this TLD
- id_protection Whether to include ID protection for this TLD
- $edit : bool = false
-
True if this if an edit, false otherwise
Return values
array<string|int, mixed> —An array of validation rules
getTlds()
Returns a partial query
private
getTlds([array<string|int, mixed> $filters = [] ]) : Record
Parameters
- $filters : array<string|int, mixed> = []
-
A list of filters for the query
- tld The TLD to fetch
- tlds A list of TLDs to fetch
- company_id The ID of the company for which this TLD is available
- package_id The package to be used for pricing and sale of this TLD
- status The status of the package to be used for pricing and sale of this TLD
- module_id The ID of the registrar module
- search_tld Partial match for the TLD
Return values
Record —A partially built query
migrateModule()
Migrate the TLD to a new module
private
migrateModule(string $tld, int $new_module_id[, int $company_id = null ][, bool $override = true ]) : int
Parameters
- $tld : string
-
The TLD to migrate
- $new_module_id : int
-
The ID of the new module for the TLD
- $company_id : int = null
-
The ID of the company for which to filter by
- $override : bool = true
-
Replaces the previous TLD package with the new one
Return values
int —The ID of the new package for the TLD
requiresModuleMigration()
Validates if a package will require a module migration.
private
requiresModuleMigration(string $tld, int $new_module_id[, int $company_id = null ]) : bool
Parameters
- $tld : string
-
The TLD to validate
- $new_module_id : int
-
The ID of the new module
- $company_id : int = null
-
The ID of the company for which to filter by (optional)
Return values
bool —True if the package needs to be migrated to the new module, false otherwise
updatePricing()
Updates an existing pricing
private
updatePricing(int $pricing_id, array<string|int, mixed> $vars) : mixed
Parameters
- $pricing_id : int
-
The ID of the pricing to update
- $vars : array<string|int, mixed>
-
An array of pricing info including:
- company_id The ID of the company for which this TLD is available (optional)
- term The term as an integer 1-65535 (optional, default 1)
- price The price of this term (optional, default 0.00)
- price_renews The renewal price of this term (optional, default null)
- price_transfer The transfer price of this term (optional, default null)
- currency The ISO 4217 currency code for this pricing (optional, default USD)
updateSinglePackagePricing()
Updates the pricings for a single package
private
updateSinglePackagePricing(string $tld, int $package_id, array<string|int, mixed> $pricings, int $company_id[, array<string|int, mixed> $filters = [] ]) : mixed
Parameters
- $tld : string
-
The TLD string
- $package_id : int
-
The package ID to update
- $pricings : array<string|int, mixed>
-
The pricing data
- $company_id : int
-
The company ID
- $filters : array<string|int, mixed> = []
-
Filters for the process