-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathverisignEppExtension.php
66 lines (65 loc) · 2.85 KB
/
verisignEppExtension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
// +----------------------------------------------------------------------
// | 在我们年轻的城市里,没有不可能的事!
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://srs.micang.com All rights reserved.
// +----------------------------------------------------------------------
// | Author : Jansen <[email protected]>
// +----------------------------------------------------------------------
namespace Metaregistrar\EPP;
trait verisignEppExtension{
/**
* add verisign namestore extension
* @param eppDomain $domain
* @author:Jansen <[email protected]>
*/
public function addNamestore(?eppDomain $domain=null){
if ($domain instanceof eppDomain){
$tld = substr(strrchr($domain->getDomainname(), '.'), 1);
}else{
$tld = 'com';
}
$namestoreExt = $this->createElement('namestoreExt:namestoreExt');
$namestoreExt->setAttribute('xmlns:namestoreExt', 'http://www.verisign-grs.com/epp/namestoreExt-1.1');
$namestoreExt->appendChild($this->createElement('namestoreExt:subProduct', strtoupper($tld)));
$this->getExtension()->appendChild($namestoreExt);
}
/**
* add idn language extension
* @param string $lang idn language tag value
* @see https://www.verisign.com/assets/idn-valid-language-tags.pdf
*/
public function addIdnLang(string $lang='ENG'){
$idnLangExt = $this->createElement('idnLang:tag', $lang);
$idnLangExt->setAttribute('xmlns:idnLang', 'http://www.verisign.com/epp/idnLang-1.0');
$this->getExtension()->appendChild($idnLangExt);
}
/**
* add verification code extendsion
* @param string $rnvc real name verification code
* @param string $dnvc domain name verification code
* @author:Jansen <[email protected]>
*/
public function addVerificationCode(?string $rnvc=null, ?string $dnvc=null){
//添加实名认证拓展
$verifyExt = $this->createElement('verificationCode:encodedSignedCode');
$verifyExt->setAttribute('xmlns:verificationCode', 'urn:ietf:params:xml:ns:verificationCode-1.0');
if (!empty($rnvc)) {
$verifyExt->appendChild($this->createElement('verificationCode:code', $rnvc));
}
if(!empty($dnvc)){
$verifyExt->appendChild($this->createElement('verificationCode:code', $dnvc));
}
$this->getExtension()->appendChild($verifyExt);
}
/**
* add verification code info extendsion
* @return void
* @throws \DOMException
*/
public function addVerificationCodeInfo(){
$verifyExt = $this->createElement('verificationCode:info');
$verifyExt->setAttribute('xmlns:verificationCode', 'urn:ietf:params:xml:ns:verificationCode-1.0');
$this->getExtension()->appendChild($verifyExt);
}
}