1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\services\validation\email\strategies; |
4
|
|
|
|
5
|
|
|
use EventEspresso\core\domain\services\validation\email\EmailValidationException; |
6
|
|
|
|
7
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class EmailValidationInternationalDNS |
13
|
|
|
* Validates the email in the same way as the parent, but also |
14
|
|
|
* verifies the domain exists. |
15
|
|
|
* |
16
|
|
|
* @package Event Espresso |
17
|
|
|
* @author Mike Nelson |
18
|
|
|
* @since $VID:$ |
19
|
|
|
*/ |
20
|
|
|
class InternationalDNS extends International |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Validates the email in teh same way as the parent, but also |
25
|
|
|
* verifies the domain exists. |
26
|
|
|
* @param string $email_address |
27
|
|
|
* @return bool |
28
|
|
|
* @throws EmailValidationException |
29
|
|
|
*/ |
30
|
|
|
public function validate($email_address) |
31
|
|
|
{ |
32
|
|
|
parent::validate($email_address); |
33
|
|
|
$domain = $this->getDomainPartOfEmail( |
34
|
|
|
$email_address, |
35
|
|
|
$this->getAtIndex($email_address) |
36
|
|
|
); |
37
|
|
|
if (! checkdnsrr($domain, 'MX')) { |
38
|
|
|
// domain not found in MX records |
39
|
|
|
throw new EmailValidationException( |
40
|
|
|
__( |
41
|
|
|
// @codingStandardsIgnoreStart |
42
|
|
|
'Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.', |
43
|
|
|
// @codingStandardsIgnoreEnd |
44
|
|
|
'event_espresso' |
45
|
|
|
) |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
if (! checkdnsrr($domain, 'A')) { |
49
|
|
|
// domain not found in A records |
50
|
|
|
throw new EmailValidationException( |
51
|
|
|
__( |
52
|
|
|
// @codingStandardsIgnoreStart |
53
|
|
|
'Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.', |
54
|
|
|
// @codingStandardsIgnoreEnd |
55
|
|
|
'event_espresso' |
56
|
|
|
) |
57
|
|
|
); |
58
|
|
|
} |
59
|
|
|
return true; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
} |
64
|
|
|
// End of file EmailValidationInternationalDNS.php |
65
|
|
|
// Location: core\services\validation/EmailValidationInternationalDNS.php |
66
|
|
|
|