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


PHP Factory::createInput方法代码示例

本文整理汇总了PHP中Zend\InputFilter\Factory::createInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createInput方法的具体用法?PHP Factory::createInput怎么用?PHP Factory::createInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\InputFilter\Factory的用法示例。


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

示例1: getInputFilter

 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         $inputFilter->add($factory->createInput(['name' => 'item_id', 'required' => true, 'filters' => array(array("name" => "Int")), 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'It was not possible to find the package to change the participant for.'), 'callback' => function ($value, $context = array()) {
             # check if order with the id of $value exists
             if (!is_numeric($value)) {
                 return false;
             }
             $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
             $item = $em->getRepository("ErsBase\\Entity\\Item")->findOneBy(array('id' => $value));
             if ($item) {
                 return true;
             }
             return false;
         })))]));
         $inputFilter->add($factory->createInput(['name' => 'user_id', 'required' => true, 'filters' => array(array("name" => "Int")), 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'It was not possible to find the user that should be set as participant.'), 'callback' => function ($value, $context = array()) {
             # check if user with the id of $value exists
             if (!is_numeric($value)) {
                 return false;
             }
             $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
             $user = $em->getRepository("ErsBase\\Entity\\User")->findOneBy(array('id' => $value));
             if ($user) {
                 return true;
             }
             return false;
         })))]));
         $inputFilter->add($factory->createInput(['name' => 'comment', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty'))]));
         $this->inputFilter = $inputFilter;
     }
     return $this->inputFilter;
 }
开发者ID:odegroot,项目名称:ers,代码行数:34,代码来源:AcceptParticipantChangeItem.php

示例2: init

 public function init()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'id', 'required' => false)));
     $this->add($factory->createInput(array('name' => 'mode', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))));
     $this->add($factory->createInput(array('name' => 'timecreated', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => $this->_getValidatorSpecification())));
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:7,代码来源:DateFilterFieldsetInputFilter.php

示例3: getInputFilter

 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         /*
                     $inputFilter->add($factory->createInput(array(
                         'name'     => 'name',
                         'required' => true,
                         'filters'  => array(
                             array('name' => 'StripTags'),
                             array('name' => 'StringTrim'),
                         ),
                         'validators' => array(
                             array(
                                 'name'    => 'StringLength',
                                 'options' => array(
                                     'encoding' => 'UTF-8',
                                     'min'      => 1,
                                     'max'      => 100,
                                 ),
                             ),
                         ),
                     )));
         */
         $inputFilter->add($factory->createInput(array('name' => 'min_start_range', 'required' => true)));
         $inputFilter->add($factory->createInput(array('name' => 'max_start_range', 'required' => true)));
         $this->inputFilter = $inputFilter;
     }
     return $this->inputFilter;
 }
开发者ID:bladehr8,项目名称:bowhunter2015,代码行数:31,代码来源:Deerinfo.php

示例4: getInputFilter

 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         $inputFilter->add($factory->createInput(array('name' => 'title', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 5, 'max' => 50))))));
         /*
         		$inputFilter->add($factory->createInput(array(
                         'name'     => 'short_note',
                         'required' => true,
                         'filters'  => array(
                             array('name' => 'StripTags'),
                             array('name' => 'StringTrim'),
                         ),
                         'validators' => array(
                             array(
                                 'name'    => 'StringLength',
                                 'options' => array(
                                     'encoding' => 'UTF-8',
                                     'min'      => 5,
                                     'max'      => 500,
                                 ),
                             ),
                         ),
                     )));
         */
         $inputFilter->add($factory->createInput(array('name' => 'field_image', 'required' => false)));
         $inputFilter->add($factory->createInput(array('name' => 'external_link', 'required' => true)));
         $this->inputFilter = $inputFilter;
     }
     return $this->inputFilter;
 }
开发者ID:bladehr8,项目名称:bowhunter2015,代码行数:32,代码来源:OthersGame.php

示例5: loginAction

 public function loginAction()
 {
     $form = new LoginForm('', false, $this->getServiceLocator());
     $request = $this->getRequest();
     if ($request->isPost()) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         $inputFilter->add($factory->createInput(array('name' => 'username', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty')))));
         $inputFilter->add($factory->createInput(array('name' => 'password', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty')))));
         $form->setInputFilter($inputFilter);
         $form->setData($request->getPost());
         if ($form->isValid()) {
             //check authentication...
             $this->getAuthService()->getAdapter()->setIdentity('' . $request->getPost('username'))->setCredential('' . $request->getPost('password'));
             $result = $this->getAuthService()->authenticate();
             foreach ($result->getMessages() as $message) {
                 //save message temporary into flashmessenger
                 $this->flashmessenger()->addMessage($message);
             }
             if ($result->isValid()) {
                 $this->getAuthService()->getStorage()->write($this->getAuthService()->getAdapter()->getResultRowObject(null));
                 return $this->redirect()->toRoute('bhome');
             }
         }
     }
     return array('form' => $form);
 }
开发者ID:Patinger,项目名称:Browsergame,代码行数:27,代码来源:LoginController.php

示例6: InputFactory

 function __construct()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'title', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('break_chain_on_failure' => true, 'name' => 'NotEmpty', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => 'Обязательное поле')))))));
     $this->add($factory->createInput(array('name' => 'description', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => 'NotEmpty', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => 'Обязательное поле')))))));
     $this->add($factory->createInput(array('name' => 'date', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => 'NotEmpty', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => 'Обязательное поле')))))));
 }
开发者ID:AlekseiMordas,项目名称:medtravel,代码行数:7,代码来源:CalendarInputFilter.php

示例7: getInputFilter

 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         $inputFilter->add($factory->createInput(array('name' => 'UID', 'required' => true, 'filters' => array(array('name' => 'Int')))));
         $inputFilter->add($factory->createInput(array('name' => 'NOMBRE', 'required' => true)));
         $inputFilter->add($factory->createInput(array('name' => 'APELLIDO', 'required' => true)));
         $inputFilter->add($factory->createInput(array('name' => 'USER_NAME', 'required' => true)));
         $inputFilter->add($factory->createInput(array('name' => 'EMAIL', 'required' => true)));
         /*$inputFilter->add($factory->createInput(array(
               'name'     => 'title',
               'required' => true,
               'filters'  => array(
                   array('name' => 'StripTags'),
                   array('name' => 'StringTrim'),
               ),
               'validators' => array(
                   array(
                       'name'    => 'StringLength',
                       'options' => array(
                           'encoding' => 'UTF-8',
                           'min'      => 1,
                           'max'      => 100,
                       ),
                   ),
               ),
           )));*/
         $this->inputFilter = $inputFilter;
     }
     return $this->inputFilter;
 }
开发者ID:rodrigogk87,项目名称:djme,代码行数:32,代码来源:User.php

示例8: InputFactory

 function __construct()
 {
     parent::__construct();
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'role', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => 'NotEmpty', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => 'Обязательное поле')))))));
     $this->add($factory->createInput(array('name' => 'displayName', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => 'NotEmpty', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => 'Обязательное поле')))))));
 }
开发者ID:AlekseiMordas,项目名称:medtravel,代码行数:7,代码来源:UserInputFilter.php

示例9: getInputFilter

 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $inputFilter = new InputFilter();
         $factory = new InputFactory();
         $inputFilter->add($factory->createInput(['name' => 'firstname', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 45)), array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'The provided name contains invalid character. These charaters are not allowed: !"§$%()=<>|^;{}[]'), 'callback' => function ($value, $context = array()) {
             $alphabet = '!"§$%()=<>|^;{}[]';
             $alpha = str_split($alphabet);
             foreach ($alpha as $char) {
                 if (strstr($value, $char)) {
                     return false;
                 }
             }
             return true;
         })))]));
         $inputFilter->add($factory->createInput(['name' => 'surname', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 45)), array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'The provided name contains invalid character. These charaters are not allowed: !"§$%()=<>|^;{}[]'), 'callback' => function ($value, $context = array()) {
             $alphabet = '!"§$%()=<>|^;{}[]';
             $alpha = str_split($alphabet);
             foreach ($alpha as $char) {
                 if (strstr($value, $char)) {
                     return false;
                 }
             }
             return true;
         })))]));
         $inputFilter->add($factory->createInput(['name' => 'birthday', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Date', 'options' => array('format' => 'd.m.Y')), array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'Please choose a valid birthday'), 'callback' => function ($value, $context = array()) {
             $min = \DateTime::createFromFormat('d.m.Y', '01.01.1900');
             $max = new \DateTime();
             $birthday = \DateTime::createFromFormat('d.m.Y', $value);
             if (!$birthday instanceof \DateTime) {
                 return false;
             }
             if ($min->getTimestamp() > $birthday->getTimestamp()) {
                 return false;
             }
             if ($max->getTimestamp() < $birthday->getTimestamp()) {
                 return false;
             }
             return true;
         })))]));
         $inputFilter->add($factory->createInput(['name' => 'email', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'EmailAddress', 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Email address format is not invalid'))), array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'There is already a person with this email address in the system.'), 'callback' => function ($value, $context = array()) {
             /*if(
                   isset($context['session_id']) && 
                   is_numeric($context['session_id']) && 
                   $context['session_id'] != 0
               ) {
                   return true;
               }*/
             $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
             $user = $em->getRepository("ErsBase\\Entity\\User")->findOneBy(array('email' => $value));
             if ($user && $user->getId() != $context['id']) {
                 return false;
             }
             return true;
         })))]));
         $this->inputFilter = $inputFilter;
     }
     return $this->inputFilter;
 }
开发者ID:odegroot,项目名称:ers,代码行数:59,代码来源:User.php

示例10: getInputFilter

 /**
  * Return a configured input filter to be able to validate and
  * filter the data.
  *
  * @return InputFilter
  */
 public function getInputFilter()
 {
     $inputFilter = new InputFilter();
     $factory = new InputFactory();
     $inputFilter->add($factory->createInput(array('name' => 'user_id', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim'), array('name' => 'Int')), 'validators' => array(array('name' => 'NotEmpty'), array('name' => 'Digits'), array('name' => 'Zend\\Validator\\Db\\RecordExists', 'options' => array('table' => 'users', 'field' => 'id', 'adapter' => $this->adapter))))));
     $inputFilter->add($factory->createInput(array('name' => 'url', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty'), array('name' => 'StringLength', 'options' => array('max' => 2048)), array('name' => '\\Users\\Validator\\Url')))));
     return $inputFilter;
 }
开发者ID:navidnahidi,项目名称:zf2_api,代码行数:14,代码来源:UserLinksTable.php

示例11: addCompanyHasUser

 /**
  * Add company_has_user input filter with doctrine validation
  * 
  * @author Hrayr Shahbazyan
  * @param \Doctrine\ORM\EntityRepository $companyRepo
  * @param \Doctrine\ORM\EntityRepository $usersRepo
  * @return \Zend\InputFilter\InputFilter
  */
 public function addCompanyHasUser($companyRepo, $usersRepo)
 {
     $inputFilter = new InputFilter();
     $factory = new InputFactory();
     $inputFilter->add($factory->createInput(array('name' => 'user_id', 'required' => true, 'filters' => array(array('name' => 'Int')), 'validators' => array(array('name' => '\\DoctrineModule\\Validator\\ObjectExists', 'options' => array('object_repository' => $usersRepo, 'fields' => 'id', 'messages' => array('noObjectFound' => 'The User does not exist!')))))));
     $inputFilter->add($factory->createInput(array('name' => 'company_id', 'required' => true, 'filters' => array(array('name' => 'Int')), 'validators' => array(array('name' => '\\DoctrineModule\\Validator\\ObjectExists', 'options' => array('object_repository' => $companyRepo, 'fields' => 'id', 'messages' => array('noObjectFound' => 'Company does not exist!')))))));
     return $inputFilter;
 }
开发者ID:EngrHaiderAli,项目名称:incoverage-backend,代码行数:16,代码来源:CompanyHasUser.php

示例12: __construct

 public function __construct()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'nid', 'required' => false, 'filters' => array(array('name' => 'Int')))));
     $this->add($factory->createInput(array('name' => 'id_row', 'required' => false)));
     $this->add($factory->createInput(array('name' => 'target_type_object', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 50))))));
     $this->add($factory->createInput(array('name' => 'target_id_row', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 40))))));
     $this->add($factory->createInput(array('name' => 'rate', 'required' => true, 'filters' => array(array('name' => 'Int')))));
 }
开发者ID:shiqizhang,项目名称:php-sample,代码行数:9,代码来源:RatingInputFilter.php

示例13: __construct

 public function __construct()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'type_lov', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 50))))));
     $this->add($factory->createInput(array('name' => 'new_type_lov', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 50))))));
     $this->add($factory->createInput(array('name' => 'nid_language', 'required' => true, 'filters' => array(array('name' => 'Int')))));
     $this->add($factory->createInput(array('name' => 'bool_translateable', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 1))))));
     $this->add($factory->createInput(array('name' => 'bool_controlbypoxn', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 1))))));
 }
开发者ID:shiqizhang,项目名称:php-sample,代码行数:9,代码来源:LovChangeTypeInputFilter.php

示例14: __construct

 public function __construct()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'nid', 'required' => false, 'filters' => array(array('name' => 'Int')))));
     $this->add($factory->createInput(array('name' => 'id_row', 'required' => false)));
     $this->add($factory->createInput(array('name' => 'name_commtype', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 100))))));
     $this->add($factory->createInput(array('name' => 'access_form', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 1, 'max' => 100))))));
     $this->add($factory->createInput(array('name' => 'comment', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'min' => 0, 'max' => 1000))))));
 }
开发者ID:shiqizhang,项目名称:php-sample,代码行数:9,代码来源:CommtypeInputFilter.php

示例15: __construct

 public function __construct()
 {
     $factory = new InputFactory();
     $this->add($factory->createInput(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Please enter Tour Name'))), array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 100))))));
     $this->add($factory->createInput(array('name' => 'price', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8'))))));
     $this->add($factory->createInput(array('name' => 'category', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')))));
     $this->add($factory->createInput(array('name' => 'description', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Please enter Details'))), array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 5000))))));
     $this->add($factory->createInput(array('name' => 'image', 'required' => false, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')))));
 }
开发者ID:nmnb18,项目名称:Aufri.com,代码行数:9,代码来源:ProductsInputFilter.php


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