当前位置: 首页>>代码示例>>PHP>>正文


PHP InputFilter\Input类代码示例

本文整理汇总了PHP中Zend\InputFilter\Input的典型用法代码示例。如果您正苦于以下问题:PHP Input类的具体用法?PHP Input怎么用?PHP Input使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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);
 }
开发者ID:juizmill,项目名称:ZF2-Test-Authentication,代码行数:28,代码来源:PostFilter.php

示例2: __construct

 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);
 }
开发者ID:eellak,项目名称:gredu_labs,代码行数:26,代码来源:ApplicationFormItem.php

示例3: Input

 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);
 }
开发者ID:solody,项目名称:xmail,代码行数:25,代码来源:AddressForm.php

示例4: getInputFilter

 public function getInputFilter()
 {
     $maxvalidator = new Validator\StringLength();
     $maxvalidator->setMax(50);
     $minvalidator = new Validator\StringLength();
     $minvalidator->setMin(4);
     $email = new Input('email');
     $email->getValidatorChain()->attach(new Validator\EmailAddress());
     $email->getValidatorChain()->attach($maxvalidator);
     $email->getValidatorChain()->attach($minvalidator);
     $password = new Input('password');
     $password->getValidatorChain()->attach($maxvalidator);
     $password->getValidatorChain()->attach(new Validator\StringLength(array('min' => 6)));
     $first_name = new Input('first_name');
     $first_name->getValidatorChain()->attach($maxvalidator);
     $first_name->getValidatorChain()->attach($minvalidator);
     $user_name = new Input('username');
     $user_name->getValidatorChain()->attach($maxvalidator);
     $user_name->getValidatorChain()->attach($minvalidator);
     $inputFilter = new InputFilter();
     $inputFilter->add($email);
     $inputFilter->add($password);
     $inputFilter->add($first_name);
     $inputFilter->add($user_name);
     return $inputFilter;
 }
开发者ID:shashi99,项目名称:ZF2Demo,代码行数:26,代码来源:RegisterFilter.php

示例5: __construct

 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);
 }
开发者ID:sebaxplace,项目名称:skilla-local,代码行数:30,代码来源:RegistroValidator.php

示例6: getInputFilter

 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;
 }
开发者ID:pawelryznar,项目名称:php-ddd-cargo-sample,代码行数:27,代码来源:CargoForm.php

示例7: __construct

 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);
 }
开发者ID:souzagabi,项目名称:Agenda,代码行数:7,代码来源:ComissaoFilter.php

示例8: __construct

 /**
  * 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);
 }
开发者ID:diego-mi,项目名称:skeleton-gen,代码行数:31,代码来源:CriarControllerFilter.php

示例9: __construct

 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);
 }
开发者ID:juizmill,项目名称:ZF2-Test-Authentication,代码行数:7,代码来源:ResetPasswordFilter.php

示例10: getInputFilter

 /**
  * @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;
 }
开发者ID:jjs180,项目名称:dance-america,代码行数:32,代码来源:SearchSiteForm.php

示例11: __construct

 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);
 }
开发者ID:samsonasik,项目名称:currency-fair-codetest,代码行数:35,代码来源:MessageValidator.php

示例12: prepareFilters

 public function prepareFilters()
 {
     $who = new Input('who');
     $who->getFilterChain()->attachByName('StripTags');
     $what = new Input('what');
     $who->getFilterChain()->attachByName('StripTags');
 }
开发者ID:jordiwes,项目名称:zf2.unlikelysource.org,代码行数:7,代码来源:LoginFilter.php

示例13: __construct

 public function __construct()
 {
     $search = new Input('search');
     $search->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
     $search->getValidatorChain()->attachByName('StringLength', array('min' => 1, 'max' => 128));
     $this->add($search);
 }
开发者ID:jordiwes,项目名称:zf2.unlikelysource.org,代码行数:7,代码来源:SearchFilter.php

示例14: __construct

 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);
 }
开发者ID:eellak,项目名称:gredu_labs,代码行数:34,代码来源:SchoolAsset.php

示例15: __construct

 /**
  * 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);
 }
开发者ID:diego-mi,项目名称:financeiro,代码行数:36,代码来源:CriarControllerFilter.php


注:本文中的Zend\InputFilter\Input类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。