Overview

Namespaces

  • None
  • PHP
  • Pry
    • Auth
      • Interfaces
    • Config
    • Controller
    • Date
    • Db
    • Feed
      • Abstracts
      • Writers
    • File
      • Decorator
    • Form
      • Element
    • Image
    • Log
      • Writer
    • Net
      • Exception
    • Session
    • Util
    • Validate
      • Validator
    • View

Classes

  • AutoCompleter
  • Checkbox
  • Colorpicker
  • Date
  • DatePicker
  • Email
  • File
  • Hidden
  • Html
  • Ip
  • Mac
  • Multi
  • NumericStepper
  • Password
  • Radio
  • Select
  • Slider
  • Submit
  • Text
  • Textarea
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * Pry Framework
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file LICENSE.txt.
10:  * 
11:  */
12: 
13: namespace Pry\Form\Element;
14: 
15: use Pry\Form\Error;
16: 
17: /**
18:  * Element MAC. permet de valider une adresse MAC dans un champs text
19:  * 
20:  * @category Pry
21:  * @package Form
22:  * @subpackage Form_Element
23:  * @version 1.0.0 
24:  * @author Olivier ROGER <oroger.fr>
25:  */
26: class Mac extends Text
27: {
28: 
29:     /**
30:      * Construteur.
31:      *
32:      * @param string $nom
33:      * @param Form_Form $form
34:      * @access public
35:      */
36:     public function __construct($nom, $form)
37:     {
38:         parent::__construct($nom, $form);
39:         $this->maxlength(17);
40:         $this->minLength(17);
41:     }
42: 
43:     /**
44:      * Valide l'adresse mac
45:      *
46:      * @param string $value
47:      * @access public
48:      * @return boolean
49:      */
50:     public function isValid($value)
51:     {
52:         if (parent::isValid($value))
53:         {
54:             if (\Pry\Util\Strings::isMac($value) || (!$this->required && $value == ''))
55:                 return true;
56:             else
57:                 $this->errorMsg = Error::NOTMAC;
58:         }
59:         return false;
60:     }
61: 
62: }
63: 
64: ?>
Pry API documentation generated by ApiGen 2.8.0