1: <?php
2: /**
3: * Pry Framework
4: *
5: * LICENSE
6: *
7: * This source file is subject to the new BSD license that is bundled
8: * with this package in the file LICENSE.txt.
9: *
10: * @version $Revision: 276 $
11: */
12:
13: /**
14: * Element Email. Permet de valider une adresse mail dans un champs text
15: *
16: * @category Pry
17: * @package Form
18: * @subpackage Form_Element
19: * @version 1.0.1
20: * @author Olivier ROGER <oroger.fr>
21: */
22: class Form_Element_Email extends Form_Element_Text
23: {
24: /**
25: * Validation de contenu
26: *
27: * @param string $value
28: * @access public
29: * @return boolean
30: */
31: public function isValid($value)
32: {
33: if(parent::isValid($value))
34: {
35: if(Util_String::isMail($value) || (!$this->required && empty($value)))
36: return true;
37: else
38: $this->errorMsg = Form_Error::MAIL;
39: return false;
40: }
41: }
42: }
43: ?>