function __construct() { parent::__construct('console_address'); $element_id = new Element\Hidden('id'); $element_id->setValue(''); $this->add($element_id); $this->add(array('name' => 'username', 'type' => 'Text')); $this->add(array('name' => 'domain', 'type' => 'Text')); $this->add(array('name' => 'nickname', 'type' => 'Text')); $element_sex = new Element\Select('sex'); $element_sex->setValueOptions(array(self::ADDRESS_SEX_BOY => '男性', self::ADDRESS_SEX_GIRL => '女性')); $this->add($element_sex); $this->add(array('name' => 'submit', 'type' => 'Submit')); /** * Setting up inputFilter */ $input_id = new Input('id'); $input_id->setRequired(false)->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50)))->attach(new \Zend\Validator\Digits()); $input_username = new Input('username'); $input_username->setRequired(true)->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 18)))->attach(new \Zend\Validator\Digits()); $input_filter = new InputFilter(); $input_filter->add($input_id); $input_filter->add($input_username); $this->setInputFilter($input_filter); }
public function __construct() { $email = new Input('email'); $email->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $email->getValidatorChain()->attach(new NotEmpty()); $this->add($email); }
public function __construct(LabServiceInterface $labService, AssetServiceInterface $assetsService) { $id = new Input('id'); $id->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $itemCategoryId = new Input('itemcategory_id'); $itemCategoryId->setRequired(true)->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($assetsService) { try { $itemCategory = $assetsService->getItemCategoryById($value); return isset($itemCategory['id']) && $itemCategory['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Ο τύπος δεν βρέθηκε'])); $labId = new Input('lab_id'); $labId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $labId->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($labService) { try { $lab = $labService->getLabById($value); return isset($lab['id']) && $lab['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Το εργαστήριο δεν βρέθηκε'])); $qty = new Input('qty'); $qty->setRequired(true)->getFilterChain()->attach(new Filter\Digits())->attach(new Filter\ToInt()); $qty->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0])); $acquisitionYear = new Input('acquisition_year'); $acquisitionYear->setRequired(false)->getFilterChain()->attach(new Filter\Digits()); $acquisitionYear->getValidatorChain()->attach(new Validator\Date(['format' => 'Y']))->attach(new Validator\LessThan(['max' => date('Y'), 'inclusive' => true])); $comments = new Input('comments'); $comments->setRequired(false)->getFilterChain()->attach(new Filter\StripTags())->attach(new Filter\StringTrim()); $this->inputFilter = new InputFilter(); $this->inputFilter->add($id)->add($labId)->add($itemCategoryId)->add($qty)->add($acquisitionYear)->add($comments); }
/** * @return InputFilterInterface */ public function getInputFilter() { if (!$this->inputFilter) { $searchParam = new Input('search_param'); $searchParam->setAllowEmpty(false); $searchParam->setRequired(true); $radius = new Input('radius'); $radius->setAllowEmpty(true); $radius->setRequired(false); $city = new Input('city'); $city->setAllowEmpty(true); $city->setRequired(false); $state = new Input('state'); $state->setAllowEmpty(true); $state->setRequired(false); $postalCode = new Input('postal_code'); $postalCode->setAllowEmpty(true); $postalCode->setRequired(false); // $contactEmail = new Input('contact_email'); // $contactEmail ->setRequired(false); // $contactEmail ->setAllowEmpty(true) // ->getValidatorChain() // ->addValidator(new \Zend\Validator\EmailAddress()); $inputFilter = new InputFilter(); $inputFilter->add($searchParam)->add($radius)->add($city)->add($state)->add($postalCode); $this->inputFilter = $inputFilter; } return $this->inputFilter; }
public function __construct() { $translator = new \Zend\I18n\Translator\Translator(); $translator->addTranslationFile('phparray', './module/Utenti/language/es.php'); $translatorMvc = new \Zend\Mvc\I18n\Translator($translator); \Zend\Validator\AbstractValidator::setDefaultTranslator($translatorMvc); $nombre = new Input('nome'); $nombre->setRequired(true); $nombre->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim'); $nombre->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum)); $this->add($nombre); $password = new Input('password'); $password->setRequired(true); $password->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum)); $this->add($password); $confirmarPassword = new Input('confirmarPassword'); $confirmarPassword->setRequired(true); $confirmarPassword->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum))->addValidator(new Identical(array('token' => 'password', 'messages' => array('notSame' => 'I dati sono errati, riprova.')))); $this->add($confirmarPassword); $imagen = new FileInput('immagine'); $imagen->setRequired(false); $imagen->getFilterChain()->attach(new RenameUpload(array('target' => './httpdocs/immagine/utenti/utenti_', 'use_upload_extension' => true, 'randomize' => true))); $imagen->getValidatorChain()->attach(new Size(array('max' => substr(ini_get('upload_max_filesize'), 0, -1) . 'MB'))); /* $imagen->getValidatorChain()->attach(new MimeType(array( 'mimeType' => 'image/png,image/x-png,image/gif,image/jpeg,image/pjpeg', 'enableHeaderCheck' => true ))); */ $this->add($imagen); }
function __construct() { parent::__construct('merchant_setting'); $this->add(array('name' => 'alipay_account', 'type' => 'Text')); $this->add(array('name' => 'bank_type', 'type' => 'Text')); $this->add(array('name' => 'bank_account_name', 'type' => 'Text')); $this->add(array('name' => 'bank_account_card', 'type' => 'Text')); $this->add(array('name' => 'submit', 'type' => 'Submit')); /** * Setting up inputFilter */ $input_AlipayAccount = new Input('alipay_account'); $input_AlipayAccount->setRequired(false); $input_AlipayAccount->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_AlipayAccount->getValidatorChain()->attach(new \Zend\Validator\EmailAddress()); $input_BankType = new Input('bank_type'); $input_BankType->setRequired(false); $input_BankType->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountName = new Input('bank_account_name'); $input_BankAccountName->setRequired(false); $input_BankAccountName->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountCard = new Input('bank_account_card'); $input_BankAccountCard->setRequired(false); $input_BankAccountCard->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountCard->getValidatorChain()->attach(new \Zend\Validator\Digits()); $input_filter = new InputFilter(); $input_filter->add($input_AlipayAccount); $input_filter->add($input_BankType); $input_filter->add($input_BankAccountName); $input_filter->add($input_BankAccountCard); $this->setInputFilter($input_filter); }
public function __construct(array $categoria = array()) { $this->categoria = $categoria; //Titulo $titulo = new Input('titulo'); $titulo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $titulo->getValidatorChain()->attach(new NotEmpty()); $this->add($titulo); //Descricao $descricao = new Input('descricao'); $descricao->setRequired(false)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $this->add($descricao); //Texto $texto = new Input('texto'); $texto->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $texto->getValidatorChain()->attach(new NotEmpty()); $this->add($texto); //ativo $ativo = new Input('ativo'); $ativo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $this->add($ativo); $inArray = new InArray(); $inArray->setOptions(array('haystack' => $this->haystack($this->categoria))); $categoria = new Input('category'); $categoria->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $categoria->getValidatorChain()->attach($inArray); $this->add($categoria); }
public function __construct(EntityManager $objectManager) { // Nom $nom = new Input('nom'); $nom->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $nom->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('max' => 50))); $this->add($nom); // Image $image = new Input('image'); $image->setRequired(false); // TODO $this->add($image); // Date début $dateDebut = new Input('dateDebut'); $dateDebut->setRequired(true); //->getValidatorChain() //->attach(new DateTime(array('format' => 'd/m/Y'))); // TODO //$this->add($dateDebut); // Date fin $dateFin = new Input('dateFin'); $dateFin->setRequired(true); //->getValidatorChain() //->attach(new DateTime(array('format' => 'd/m/Y'))); // TODO //$this->add($dateFin); // TODO joueurs }
public function getInputFilter() { if (is_null($this->filter)) { $trackingIdValidator = new StringLength(36); $regexValidator = new Regex('/^[a-zA-Z0-9_-]+$/'); $trackingIdInput = new Input('trackingId'); $trackingIdInput->allowEmpty(); $trackingIdInput->setRequired(false); $trackingIdInput->getValidatorChain()->attach($trackingIdValidator)->attach($regexValidator); $inArrayValidator = new InArray(); $inArrayValidator->setHaystack(array_keys($this->locations)); $originInput = new Input('origin'); $originInput->getValidatorChain()->attach($inArrayValidator); $notSameValidator = new Callback(array('callback' => function ($value, $context = null) { if ($context) { return $value !== $context['origin']; } return true; }, 'messages' => array(Callback::INVALID_VALUE => 'Origin and Destination are the same'))); $destinationInput = new Input('final_destination'); $destinationInput->getValidatorChain()->attach($inArrayValidator)->attach($notSameValidator); $filter = new InputFilter(); $filter->add($trackingIdInput)->add($originInput)->add($destinationInput); $this->filter = $filter; } return $this->filter; }
public function __construct() { $this->inputFilter = new InputFilter(); $id = new Input('id_equalTo'); $id->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $id->setRequired(false); $mailTo = new Input('mailTo_like'); $mailTo->getFilterChain()->attachByName('StringTrim'); $mailTo->getValidatorChain()->attachByName('StringLength', ['min' => 0, 'max' => 50]); $mailTo->setRequired(false); $layoutId = new Input('layoutId_equalTo'); $layoutId->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0, 'max' => 1]); $layoutId->setRequired(false); $templateId = new Input('templateId_equalTo'); $templateId->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0, 'max' => 7]); $templateId->setRequired(false); $limit = new Input('limit'); $limit->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $limit->setRequired(false); $page = new Input('page'); $page->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $page->setRequired(false); $createdDtLessThen = new Input('createdDt_lessThan'); $createdDtLessThen->setRequired(false); $createdDtGreaterThan = new Input('createdDt_greaterThan'); $createdDtGreaterThan->setRequired(false); $this->inputFilter->add($id); $this->inputFilter->add($mailTo); $this->inputFilter->add($layoutId); $this->inputFilter->add($templateId); $this->inputFilter->add($limit); $this->inputFilter->add($page); $this->inputFilter->add($createdDtLessThen); $this->inputFilter->add($createdDtGreaterThan); }
public function __construct(AuthenticationService $authService) { parent::__construct('login'); $this->filter = new InputFilter(); $email = new Element\Email('email'); $email->setAttribute('required', true); $email->setAttribute('placeholder', 'Email Address'); $this->add($email); $emailFilter = new Input('email'); $emailFilter->setRequired(true); $this->filter->add($emailFilter); $password = new Element\Password('password'); $password->setAttribute('required', true); $password->setAttribute('placeholder', 'Password'); $this->add($password); $passwordFilter = new Input('password'); $passwordFilter->setRequired(true); $passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password'))); $this->filter->add($passwordFilter); $buttons = new Form('buttons'); $buttons->setOption('twb-layout', 'inline'); $buttons->setAttribute('class', 'form-group'); $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn-primary pull-right'); $submit->setOption('glyphicon', 'log-in'); $submit->setLabel('Log In'); $buttons->add($submit); $forgot = new Element\Submit('forgot'); $forgot->setAttribute('formnovalidate', true); $forgot->setAttribute('class', 'btn-warning pull-right'); $forgot->setOption('glyphicon', 'question-sign'); $forgot->setLabel('Forgot Password'); $buttons->add($forgot); $this->add($buttons); }
public function __construct() { $input = new Input('userId'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsInt())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('currencyFrom'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('currencyTo'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('amountSell'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('amountBuy'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('rate'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('timePlaced'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Date(['format' => 'd-M-y H:i:s'])); $this->add($input); $input = new Input('originatingCountry'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); }
public function __construct($uploadTmpPath, LabServiceInterface $labService, $attachmentSize) { $id = new Input('id'); $id->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $name = new Input('name'); $name->setRequired(true)->getFilterChain()->attach(new Filter\StringTrim()); $name->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\StringLength(['min' => 3])); $labTypeId = new Input('labtype_id'); $labTypeId->setRequired(true); $labTypeId->getValidatorChain()->attach(new Validator\NotEmpty()); $isNew = new Input('is_new'); $isNew->setRequired(false)->getFilterChain()->attach(new Filter\ToInt()); $responsibleId = new Input('responsible_id'); $responsibleId->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $area = new Input('area'); $area->setRequired(true)->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Digits()); $lessons = new Input('lessons'); $lessons->setRequired(false); $lessons->getValidatorChain()->attach(new Validator\NotEmpty()); $attachment = new FileInput('attachment'); $attachment->setRequired(false)->getFilterChain()->attach(new Filter\File\RenameUpload(['target' => $uploadTmpPath, 'randomize' => true])); $attachment->getValidatorChain()->attach(new Validator\File\UploadFile())->attach(new Validator\File\MimeType(['application/zip', 'application/x-rar-compressed', 'application/octet-stream', 'application/pdf', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp', 'image/vnd.microsoft.icon', 'image/tiff', 'image/tiff', 'image/svg+xml', 'image/svg+xml', 'image/vnd.adobe.photoshop']))->attach(new Validator\File\Size(['max' => $attachmentSize])); $use_ext_program = new Input('use_ext_program'); $use_ext_program->setRequired(false); $use_in_program = new Input('use_in_program'); $use_in_program->setRequired(false); $has_network = new Input('has_network'); $has_network->setRequired(false); $has_network->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\InArray(['haystack' => $labService->getHasNetworkValues()])); $has_server = new Input('has_server'); $has_server->setRequired(false); $has_server->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\InArray(['haystack' => $labService->getHasServerValues()])); $this->inputFilter = new InputFilter(); $this->inputFilter->add($id)->add($name)->add($labTypeId)->add($isNew)->add($responsibleId)->add($area)->add($lessons)->add($attachment)->add($use_in_program)->add($use_ext_program)->add($has_server)->add($has_network); }
/** * CriarControllerFilter constructor. */ public function __construct() { # filter for strForm $strForm = new Input('strForm'); $strForm->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strForm->getValidatorChain()->attach(new NotEmpty()); $this->add($strForm); # filter for strController $strController = new Input('strController'); $strController->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strController->getValidatorChain()->attach(new NotEmpty()); $this->add($strController); # filter for strRoute $strRoute = new Input('strRoute'); $strRoute->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strRoute->getValidatorChain()->attach(new NotEmpty()); $this->add($strRoute); # filter for strService $strService = new Input('strService'); $strService->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strService->getValidatorChain()->attach(new NotEmpty()); $this->add($strService); # filter for strEntity $strEntity = new Input('strEntity'); $strEntity->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strEntity->getValidatorChain()->attach(new NotEmpty()); $this->add($strEntity); }
public function __construct(LabServiceInterface $labService, AssetServiceInterface $assetsService) { $labId = new Input('lab_id'); $labId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $labId->getValidatorChain()->attach(new Validator\NotEmpty()); $itemCategoryId = new Input('itemcategory_id'); $itemCategoryId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $itemCategoryId->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($assetsService) { try { $type = $assetsService->getItemCategoryById($value); return $type && $type['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Ο τύπος εξοπλισμού δεν είναι έγκυρος'])); $qty = new Input('qty'); $qty->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $qty->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0])); $qtyacquired = new Input('qtyacquired'); $qtyacquired->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $qtyacquired->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0, 'inclusive' => true])); $reasons = new Input('reasons'); $reasons->setRequired(true)->getFilterChain()->attach(new Filter\StripTags())->attach(new Filter\StringTrim()); $reasons->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($labId)->add($itemCategoryId)->add($qty)->add($qtyacquired)->add($reasons); }
public function __construct() { $login = new Input('login'); $login->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $login->getValidatorChain()->attach(new NotEmpty()); $this->add($login); }
public function __construct() { $nome = new Input('descricao'); $nome->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $nome->getValidatorChain()->attach(new NotEmpty()); $this->add($nome); }
/** * CriarControllerFilter constructor. */ public function __construct() { # filter for strModuleName $strModuleName = new Input('strModuleName'); $strModuleName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strModuleName->getValidatorChain()->attach(new NotEmpty()); $this->add($strModuleName); # filter for strFormName $strFormName = new Input('strFormName'); $strFormName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strFormName->getValidatorChain()->attach(new NotEmpty()); $this->add($strFormName); # filter for strControllerName $strControllerName = new Input('strControllerName'); $strControllerName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strControllerName->getValidatorChain()->attach(new NotEmpty()); $this->add($strControllerName); # filter for strRouteName $strRouteName = new Input('strRouteName'); $strRouteName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strRouteName->getValidatorChain()->attach(new NotEmpty()); $this->add($strRouteName); # filter for strServiceName $strServiceName = new Input('strServiceName'); $strServiceName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strServiceName->getValidatorChain()->attach(new NotEmpty()); $this->add($strServiceName); # filter for strEntityName $strEntityName = new Input('strEntityName'); $strEntityName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strEntityName->getValidatorChain()->attach(new NotEmpty()); $this->add($strEntityName); }
public function __construct(ServiceLocatorInterface $sl) { $translator = $sl->get('translator'); $email = new Input('email'); $email->setRequired(TRUE)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $email->getValidatorChain()->attach(new NotEmpty(['messages' => [NotEmpty::IS_EMPTY => $translator->translate('Field Required')]])); $this->add($email); }
/** * Add the optional fields to the input filter. * It's a basic utility function to avoid writing loads of redundant duplicate code. * * @return \BabyMonitor\InputFilter\DeleteFeedInputFilter */ protected function _addOptionalFields() { foreach ($this->_optionalFields as $fieldName) { $input = new Input($fieldName); $input->setRequired(true)->setAllowEmpty(true)->setFilterChain($this->_getStandardFilter()); $this->add($input); } return $this; }
public function __construct() { // Validações do titulo $titulo = new Input('titulo'); $titulo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $titulo->getValidatorChain()->attach(new NotEmpty()); //** Adicionando filtros **// $this->add($titulo); }
public function __construct() { $loginEmail = new Input('loginEmail'); $loginEmail->setRequired(true); $loginEmail->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim'); $loginEmail->getValidatorChain()->addValidator(new EmailAddress(array('domain' => false))); $this->add($loginEmail); $this->add(array('name' => 'loginPassword', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')))); }
public function createInputFilter() { $inputFilter = new InputFilter\InputFilter(); //username $username = new InputFilter\Input('username'); $username->setRequired(true); $inputFilter->add($username); return $inputFilter; }
public function testRenderFieldsShowsRequiredFlagForAppropriateFields() { $inputFilter = new InputFilter(); $input = new Input('one'); $input->setRequired(true); $inputFilter->add($input); $html = $this->view->bootstrapForm()->renderFields($this->getFields(), $inputFilter, $this->view->editControlRenderer()); $this->assertEquals(1, count($this->queryDom('.glyphicon-asterisk', $html))); }
public function __construct() { $this->add(array('name' => 'name', 'required' => TRUE, 'filters' => array(array('name' => 'StripTags')), 'validators' => array(array('name' => 'stringLength', 'options' => array('min' => 5, 'max' => 20))))); $e = new Input('password'); $e->setRequired(true); $e->getValidatorChain()->attach(new StringLength(array('encoding' => 'UTF-8', 'min' => 6, 'max' => 32))); $e->getFilterChain()->attach(new StringTrim()); $this->add($e); }
public function __construct() { parent::__construct(); $this->get('selectors')->setRequired(false); $input = new Input('content_name'); $input->setRequired(true); $chain = $input->getValidatorChain(); $chain->attach(new Validator\IsStringValidator()); $this->add($input); }
public function __construct(array $pessoa = array()) { $this->pessoa = $pessoa; $inArray = new InArray(); $inArray->setOptions(array('haystack' => $this->haystack($this->pessoa))); $classific = new Input('pessoa_id'); $classific->setRequired(true)->getFilterChain()->attach(new StripTags())->attach(new StringTrim()); $classific->getValidatorChain()->attach($inArray); $this->add($classific); }
public function getInputFilter() { if (!$this->inputFilter) { $input = new Input(); $input->setName('entities'); $input->setRequired(false); $this->inputFilter = new RealInputFilter(); $this->inputFilter->add($input); } return $this->inputFilter; }
public function __construct() { $membro = new Input('membro'); $membro->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $membro->getValidatorChain()->attach(new NotEmpty()); $this->add($membro); $cargo = new Input('cargo'); $cargo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $cargo->getValidatorChain()->attach(new NotEmpty()); $this->add($cargo); }
public function getInputFilter() { $email = new Input('email'); $email->setRequired(TRUE); $email->getValidatorChain()->attach(new Validator\EmailAddress()); $this->add($email); $password = new Input('password'); $password->setRequired(TRUE); $this->add($password); return $this; }