當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。