Advertisement
Guest User

Untitled

a guest
Nov 11th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.84 KB | None | 0 0
  1.    public function getInputFilter()
  2.     {
  3.         if (!$this->inputFilter) {
  4.             $inputFilter = new InputFilter();
  5.  
  6.             $factory = new InputFactory();
  7.  
  8.             $inputFilter->add($factory->createInput(array(
  9.                 'name'       => 'id',
  10.                 'required'   => true,
  11.                 'filters' => array(
  12.                     array('name'    => 'Int'),
  13.                 ),
  14.             )));
  15.  
  16.             $inputFilter->add($factory->createInput(array(
  17.                 'name'     => 'agencyName',
  18.                 'required' => true,
  19.                 'filters'  => array(
  20.                     array('name' => 'StripTags'),
  21.                     array('name' => 'StringTrim'),
  22.                 ),
  23.                 'validators' => array(
  24.                     array(
  25.                         'name'    => 'StringLength',
  26.                         'options' => array(
  27.                             'encoding' => 'UTF-8',
  28.                             'min'      => 1,
  29.                             'max'      => 100,
  30.                         ),
  31.                     ),
  32.                 ),
  33.             )));
  34.  
  35.             $inputFilter->add($factory->createInput(array(
  36.                 'name'      => 'applicationUrl',
  37.                 'required'  => true,
  38.                 'filters'   => array(
  39.                     array('name' => 'StripTags'),
  40.                     array('name' => 'StringTrim'),
  41.                 ),
  42.                 'validators' => array(
  43.                     array(
  44.                         'name'    => 'StringLength',
  45.                         'options' => array(
  46.                             'encoding' => 'UTF-8',
  47.                             'min'      => 1,
  48.                             'max'      => 200,
  49.                         ),
  50.                     ),
  51.                 ),
  52.             )));
  53.            
  54.             $inputFilter->add($factory->createInput(array(
  55.                 'type'      => 'Zend\InputFilter\FileInput',
  56.                 'name'      => 'logoName',
  57.                 'required'  => true,
  58.                 'validators' => array(
  59.                     array(
  60.                         'name'      => 'File\MimeType',
  61.                         'options'   => array(
  62.                             'mimeType' => 'image/png'
  63.                         )
  64.                     )
  65.                 )
  66.             )));    
  67.  
  68.             $inputFilter->add($factory->createInput(array(
  69.                 'type'      => 'Zend\InputFilter\FileInput',
  70.                 'name'      => 'cssFilename',
  71.                 'required'  => true,
  72.                 'validators' => array(
  73.                         array(
  74.                             'name'      => 'File\MimeType',
  75.                             'options'   => array(
  76.                                 'mimeType' => 'text'
  77.                             )
  78.                         )
  79.                     )
  80.             )));            
  81.            
  82.             $this->inputFilter = $inputFilter;        
  83.         }
  84.  
  85.         return $this->inputFilter;
  86.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement