docs depage-forms
Validators
Validators/Email.php
Go to the documentation of this file.
1
<?php
7
namespace
Depage\HtmlForm\Validators
;
8
12
class
Email
extends
Validator
13
{
21
public
function
validate
($email, $parameters = array())
22
{
23
$valid = (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
24
25
if
($valid && $parameters[
'checkDns'
]) {
26
list($user, $domain) = explode(
'@'
, $email);
27
28
$domain = idn_to_ascii($domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
29
30
$valid = checkdnsrr(idn_to_ascii($domain .
"."
),
'MX'
);
31
}
32
33
return
$valid;
34
}
35
}
Depage\HtmlForm\Validators\Email
default validator for email input elements
Definition
Validators/Email.php:13
Depage\HtmlForm\Validators\Email\validate
validate($email, $parameters=array())
email validation
Definition
Validators/Email.php:21
Depage\HtmlForm\Validators\Validator
parent validator class
Definition
Validator.php:15
Depage\HtmlForm\Validators
Validators for HTML input-elements.