User Guide and Documentation

__construct()Release Date: 2019/07/29

This function is used when the class is called, it is assigned to standard variables in the class.

In the code example given below, it assigns the content of the module in the "config.php" file to the variable.

$this->config   = Modules::Config("Registrars",__CLASS__);

In the code example given below, it assigns the php file in module's "lang" folder to the variable. The system automatically finds the language file according to the client.

$this->lang     = Modules::Lang("Registrars",__CLASS__);

As can be understood from the code example given below, we include the files of API service to be integrated.

if(!class_exists("ExampleRegistrarModule_API")){
   // Calling API files
   include __DIR__.DS."api.php";
}

In the following code example, we transfer the values defined in Whois privacy settings to the variable.

if(isset($this->config["settings"]["whidden-amount"])){
   $whidden_amount = $this->config["settings"]["whidden-amount"];
   $whidden_currency = $this->config["settings"]["whidden-currency"];
   $this->whidden["amount"] = $whidden_amount;
   $this->whidden["currency"] = $whidden_currency;
}


We add the $api variable into the class.

class ExampleRegistrarModule {
   public $api   = false;

In the code example given below, we define the information received from settings to API class.

   // Set API Credentials 
   $username   = $this->config["settings"]["username"];
   $password   = $this->config["settings"]["password"];
   $password   = Crypt::decode($password,Config::get("crypt/system"));
   $sandbox    = (bool)$this->config["settings"]["test-mode"];
   $this->api  =  new ExampleRegistrarModule_API($sandbox);
   $this->api->set_credentials($username,$password);
Copyright © 2019. All rights reserved.
Top