Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
class MyModule extends Module {
...
	public function moduleRowMetaKey() {
		return "host_name";
	}
...
}

Registrar Methods

The methods below are required for registrar modules implementing the Blesta\Core\Util\Modules\Registrar interface.

checkAvailability($domain, $module_row_id = null)

The checkAvailability() method is called when an availability check is made for a domain from an order form. It must return true if the domain is available or false otherwise.

Code Block
languagephp
class MyModule extends Module {
...
	public function checkAvailability($domain, $module_row_id = null) {
		// Check if the domain is available (this is dependent on the module's API, omitted here)
		$domain = $api->checkDomain($domain);

		return isset($domain->availability) ? $domain->availability : false;
	}
...
}

getExpirationDate($domain, $format = 'Y-m-d H:i:s', $module_row_id = null)

The getExpirationDate() method is called by the Domain Manager plugin to synchronize the expiration date of the domain with the renewal date of the service.

Code Block
languagephp
class MyModule extends Module {
...
	public function getExpirationDate($domain, $format = 'Y-m-d H:i:s', $module_row_id = null) {
		// Get the domain information (this is dependent on the module's API, omitted here)
		$domain = $api->getDomain($domain);

		return date(strtotime($domain->expirationDate), $format);
	}
...
}

getTlds($module_row_id = null)

The getTlds() method returns a list of the TLDs supported by the registrar module.

Code Block
languagephp
class MyModule extends Module {
...
	public function getTlds($module_row_id = null) {
		return [
			'.com',
			'.net',
			'.org'
		];
	}
...
}

Optional Methods

The methods below are optional, but may be required to implement a module of any utility.

...