1 | <?php |
||
20 | class DomainValidator extends \yii\validators\RegularExpressionValidator |
||
21 | { |
||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public $pattern = '/^([a-z0-9][a-z0-9-]*\.)+[a-z0-9][a-z0-9-]*$/'; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | public $enableIdn = false; |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function init() |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | public function validateAttribute($model, $attribute) |
||
54 | |||
55 | /** |
||
56 | * @param string $value the IDN domain name that should be converted to ASCII |
||
57 | * @return string |
||
58 | */ |
||
59 | public function convertIdnToAscii($value) |
||
63 | |||
64 | public function convertAsciiToIdn($value) |
||
68 | |||
69 | |||
70 | public function clientValidateAttribute($model, $attribute, $view) |
||
81 | |||
82 | } |
||
83 |