Advertisement
Eddz

Untitled

Sep 3rd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.32 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Fcm\Form;
  4.  
  5. use Zend\InputFilter\InputFilter;
  6.  
  7. /**
  8.  * BlockFormInputFilter
  9.  * @package DluTwBootstrapDemo
  10.  * @copyright David Lukas (c) - http://www.zfdaily.com
  11.  * @license http://www.zfdaily.com/code/license New BSD License
  12.  * @link http://www.zfdaily.com
  13.  * @link https://bitbucket.org/dlu/dlutwbootstrap-demo
  14.  */
  15. class ClientAddInputFilter extends InputFilter
  16. {
  17.  
  18.     public function __construct()
  19.     {
  20.         //Fieldset 1 Input filter
  21.         $fs1InputFilter = new InputFilter();
  22.         // Name
  23.         $fs1InputFilter->add(array(
  24.             'name' => 'id',
  25.             'required' => false,
  26.         ));
  27.  
  28.         $fs1InputFilter->add(array(
  29.             'name' => 'name',
  30.             'required' => true,
  31.             'validators' => array(
  32.                 array(
  33.                     'name' => 'string_length',
  34.                 ),
  35.             ),
  36.         ));
  37.         // Website
  38.         $fs1InputFilter->add(array(
  39.             'name' => 'website',
  40.             'required' => false,
  41.             'validators' => array(new \Zend\Validator\Hostname(\Zend\Validator\Hostname::ALLOW_ALL)),
  42.         ));
  43.         // Contact
  44.         $fs1InputFilter->add(array(
  45.             'name' => 'contact',
  46.             'required' => true,
  47.             'validators' => array(
  48.                 array(
  49.                     'name' => 'string_length',
  50.                 ),
  51.             ),
  52.         ));
  53.         // Email
  54.         // new \Zend\Validator\EmailAddress()
  55.         $fs1InputFilter->add(array(
  56.             'name' => 'email',
  57.             'validators' => array(),
  58.             'filters' => array(
  59.                 array('name' => 'Zend\Filter\StringTrim'),
  60.             ),
  61.             'required' => true,
  62.         ));
  63.         // Phone
  64.         $fs1InputFilter->add(array(
  65.             'name' => 'phone',
  66.             'required' => false,
  67.             'validators' => array(
  68.                 array(
  69.                     'name' => 'string_length',
  70.                 ),
  71.             ),
  72.         ));
  73.         // Comment
  74.         $fs1InputFilter->add(array(
  75.             'name' => 'comment',
  76.             'required' => false,
  77.             'validators' => array(
  78.                 array(
  79.                     'name' => 'string_length',
  80.                 ),
  81.             ),
  82.         ));
  83.         $this->add($fs1InputFilter, 'fsOne');
  84.     }
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement