<?php
namespace Moto\Application\ServerTest\InputFilter; use Moto\InputFilter\AbstractInputFilter; use Zend\Validator; class DataBase extends AbstractInputFilter { protected $_name = 'serverTest.database'; public function init() { $this->add(array( 'name' => 'hostname', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'min' => 1, 'max' => 256, ), ), array( 'name' => 'Hostname', 'options' => array( 'allow' => Validator\Hostname::ALLOW_ALL, ) ), ), )); $this->add(array( 'name' => 'username', 'required' => true, 'filters' => array( array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'min' => 1, 'max' => 256, ), ), ), )); $this->add(array( 'name' => 'database', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'min' => 1, 'max' => 64, ), ), ), )); $this->add(array( 'name' => 'password', 'required' => false, 'filters' => array( array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'max' => 100, ), ), ), )); $this->add(array( 'name' => 'prefix', 'required' => false, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'Regex', 'break_chain_on_failure' => true, 'options' => array( 'pattern' => '/^[a-z]{1,}[a-z0-9\_\-]*$/' ) ), array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'max' => 12, ), ), ), )); } }