| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* sfValidatorEmail validates emails.
|
|
|
13 |
*
|
|
|
14 |
* @package symfony
|
|
|
15 |
* @subpackage validator
|
|
|
16 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
17 |
* @version SVN: $Id: sfValidatorEmail.class.php 22149 2009-09-18 14:09:53Z Kris.Wallsmith $
|
|
|
18 |
*/
|
|
|
19 |
class sfValidatorEmail extends sfValidatorRegex
|
|
|
20 |
{
|
|
|
21 |
const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* @see sfValidatorRegex
|
|
|
25 |
*/
|
|
|
26 |
protected function configure($options = array(), $messages = array())
|
|
|
27 |
{
|
|
|
28 |
parent::configure($options, $messages);
|
|
|
29 |
|
|
|
30 |
$this->setOption('pattern', self::REGEX_EMAIL);
|
|
|
31 |
}
|
|
|
32 |
}
|