Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Form_Element_AutoCompleter
  • Form_Element_Checkbox
  • Form_Element_Colorpicker
  • Form_Element_Date
  • Form_Element_DatePicker
  • Form_Element_Email
  • Form_Element_File
  • Form_Element_Hidden
  • Form_Element_Html
  • Form_Element_Ip
  • Form_Element_Mac
  • Form_Element_Multi
  • Form_Element_NumericStepper
  • Form_Element_Password
  • Form_Element_Radio
  • Form_Element_Select
  • Form_Element_Slider
  • Form_Element_Submit
  • Form_Element_Text
  • Form_Element_Textarea
  • Overview
  • Package
  • Class
  • Tree
 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 MAC. permet de valider une adresse MAC dans un champs text
15:  * 
16:  * @category Pry
17:  * @package Form
18:  * @subpackage Form_Element
19:  * @version 1.0.0 
20:  * @author Olivier ROGER <oroger.fr>
21:  */
22: class Form_Element_Mac extends Form_Element_Text
23: {
24:     /**
25:      * Construteur.
26:      *
27:      * @param string $nom
28:      * @param Form_Form $form
29:      * @access public
30:      */
31:     public function __construct($nom,$form)
32:     {
33:         parent::__construct($nom,$form);
34:         $this->maxlength(17);
35:         $this->minLength(17);
36:     }
37:     
38:     /**
39:      * Valide l'adresse mac
40:      *
41:      * @param string $value
42:      * @access public
43:      * @return boolean
44:      */
45:     public function isValid($value)
46:     {   
47:         if(parent::isValid($value))
48:         {
49:             if(Util_String::isMac($value) || (!$this->required && $value==''))
50:                 return true;
51:             else
52:                 $this->errorMsg = Form_Error::NOTMAC;
53:         }
54:         return false;
55:     }
56: }
57:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1