1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
domain_registrar.php
См. документацию.
1<?php
2
4{
9 'ru' => '\Bitrix\Mail\Registrar\RegRu',
10 'ua' => '\Bitrix\Mail\Registrar\Omnilance'
11 ];
12
17 private static $classRegistrar = '\Bitrix\Mail\Registrar\RegRu';
18
24 public static function setRegistrarClass(string $className): void
25 {
26 if (in_array($className, self::REGISTRAR_CLASSES))
27 {
28 self::$classRegistrar = $className;
29 }
30 }
31
40 public static function isDomainExists(string $user, string $password, string $domain, ?string &$error): ?bool
41 {
42 $result = self::$classRegistrar::checkDomain($user, $password, $domain, $error);
43
44 if ($result === null)
45 {
46 $error = self::getErrorCode($error);
47 return null;
48 }
49 else
50 {
51 return $result;
52 }
53 }
54
65 public static function suggestDomain(string $user, string $password, ?string $word1, ?string $word2, array $tlds, ?string &$error): ?array
66 {
67 $result = self::$classRegistrar::suggestDomain($user, $password, $word1, $word2, $tlds, $error);
68
69 if ($result === null)
70 {
71 $error = self::getErrorCode($error);
72 return null;
73 }
74 else
75 {
76 return $result;
77 }
78 }
79
89 public static function createDomain(string $user, string $password, string $domain, array $params, ?string &$error): ?bool
90 {
91 $result = self::$classRegistrar::createDomain($user, $password, $domain, $params, $error);
92
93 if ($result === null)
94 {
95 $error = self::getErrorCode($error);
96 return null;
97 }
98 else
99 {
100 return $result;
101 }
102 }
103
104 public static function checkDomain($user, $password, $domain, &$error)
105 {
107
108 if ($result !== false)
109 {
110 if (isset($result['dname']) && mb_strtolower($result['dname']) == mb_strtolower($domain))
111 return $result;
112 else
113 $error = 'unknown';
114 }
115
116 $error = self::getErrorCode($result['error_code']);
117 return null;
118 }
119
128 public static function renewDomain(string $user, string $password, string $domain, ?string &$error): ?bool
129 {
130 $result = self::$classRegistrar::renewDomain($user, $password, $domain, $error);
131
132 if ($result === null)
133 {
134 $error = self::getErrorCode($error);
135 return null;
136 }
137 else
138 {
139 return $result;
140 }
141 }
142
152 public static function updateDns(string $user, string $password, string $domain, array $params, ?string &$error): ?bool
153 {
154 $result = self::$classRegistrar::updateDns($user, $password, $domain, $params, $error);
155
156 if ($result === null)
157 {
158 $error = self::getErrorCode($error);
159 return null;
160 }
161 else
162 {
163 return $result;
164 }
165 }
166
175 public static function getDomainsList(string $user, string $password, $filter = array(), &$error): ?array
176 {
177 $result = self::$classRegistrar::getDomainsList($user, $password, $error);
178
179 if ($result === null)
180 {
181 $error = self::getErrorCode($error);
182 return null;
183 }
184 else
185 {
186 return $result;
187 }
188 }
189
195 private static function getErrorCode(?string $error): int
196 {
197 $errorsList = [
198 'unknown' => CMail::ERR_API_DEFAULT,
199 'INVALID_DOMAIN_NAME_PUNYCODE' => CMail::ERR_API_DEFAULT,
200 'TLD_DISABLED' => CMail::ERR_API_DEFAULT,
201 'DOMAIN_BAD_NAME' => CMail::ERR_API_DEFAULT,
202 'INVALID_DOMAIN_NAME_FORMAT' => CMail::ERR_API_DEFAULT,
203 'DOMAIN_INVALID_LENGTH' => CMail::ERR_API_DEFAULT,
204 'HAVE_MIXED_CODETABLES' => CMail::ERR_API_DEFAULT
205 ];
206
207 return array_key_exists($error, $errorsList) ? $errorsList[$error] : CMail::ERR_API_DEFAULT;
208 }
209}
static renewDomain(string $user, string $password, string $domain, ?string &$error)
Определения domain_registrar.php:128
static updateDns(string $user, string $password, string $domain, array $params, ?string &$error)
Определения domain_registrar.php:152
static suggestDomain(string $user, string $password, ?string $word1, ?string $word2, array $tlds, ?string &$error)
Определения domain_registrar.php:65
static isDomainExists(string $user, string $password, string $domain, ?string &$error)
Определения domain_registrar.php:40
static setRegistrarClass(string $className)
Определения domain_registrar.php:24
static checkDomain($user, $password, $domain, &$error)
Определения domain_registrar.php:104
const REGISTRAR_CLASSES
Определения domain_registrar.php:8
static createDomain(string $user, string $password, string $domain, array $params, ?string &$error)
Определения domain_registrar.php:89
static getDomainsList(string $user, string $password, $filter=array(), &$error)
Определения domain_registrar.php:175
const ERR_API_DEFAULT
Определения mail.php:22
static checkDomainInfo($user, $password, $domain, &$error)
Определения regru.php:68
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$filter
Определения iblock_catalog_list.php:54
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$password
Определения result.php:7
$error
Определения subscription_card_product.php:20