本文整理汇总了PHP中Zend\InputFilter\Input::getFilterChain方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::getFilterChain方法的具体用法?PHP Input::getFilterChain怎么用?PHP Input::getFilterChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\InputFilter\Input
的用法示例。
在下文中一共展示了Input::getFilterChain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFilters
public function prepareFilters()
{
$who = new Input('who');
$who->getFilterChain()->attachByName('StripTags');
$what = new Input('what');
$who->getFilterChain()->attachByName('StripTags');
}
示例2: __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);
}
示例3: __construct
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
}
示例4: __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);
}
示例5: __construct
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);
}
示例6: buildFilter
public function buildFilter()
{
//category char 16 not null,
$category = new Input('category');
$category->setAllowEmpty(TRUE);
$category->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags')->attachByName('StringToLower');
$category->getValidatorChain()->attachByName('inArray', array('haystack' => $this->categories));
//title varchar 128 not null
$title = new Input('title');
$title->setAllowEmpty(TRUE);
$title->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags');
$titleRegex = new Regex(array('pattern' => '/^[a-zA-Z0-9 ]*$/'));
$titleRegex->setMessage('Title should contain only numbers, letters or spaces.');
$title->getValidatorChain()->attach($titleRegex)->attachByName('StringLength', array('min' => 1, 'max' => 128));
//date_created timestamp not null default current_timestamp
$dateCreated = new Input('dateCreated');
$dateCreated->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags');
$dateCreated->getValidatorChain()->attachByName('StringLength', array('min' => 10, 'max' => 10));
// date_expires timestamp not null default null
// descripton varchar 4096 default null
// photo_filename varchar 1024 default null
// contact_name varchar 255 default null
// contact_email varchar 255 default null
// contact_phone varchar 32 default null
// city varchar 128 default null
// country char 2 not null
// price decimal 12,2 not null
// delete_code char 16 character set utf8 collate utf8_bin default null
$this->add($category)->add($title)->add($dateCreated);
}
示例7: __construct
public function __construct()
{
// Email
$email = new Input('email');
$email->getFilterChain()->attach(new StringTrim())->attach(new StripTags());
$email->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('max' => 255)))->attach(new EmailAddress());
$this->add($email);
}
示例8: __construct
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'))));
}
示例9: __construct
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);
}
示例10: addInputFilter
public function addInputFilter()
{
$file = new InputFilter\Input('file');
$file->getValidatorChain()->attach(new Validator\File\Size(array('max' => 3100000)))->attach(new Validator\File\ImageSize(array('minWidth' => 600, 'minHeight' => 600)));
$file->getFilterChain()->attachByName('filerenameupload', array('target' => './public/uploads/', 'randomize' => true));
//-- Bind filters ---------------------------------
$inputFilters = new InputFilter\InputFilter();
$inputFilters->add($file);
$this->setInputFilter($inputFilters);
}
示例11: buildFilter
public function buildFilter()
{
$listingsId = new Input('listings_id');
$listingsId->getFilterChain()->attach(new StripTags())->attach(new StringTrim())->attach(new StringToLower());
$listingsId->getValidatorChain()->attachByName('Digits');
$deleteCode = new Input('delete_code');
$deleteCode->setAllowEmpty(TRUE);
$deleteCode->getFilterChain()->attach(new StripTags())->attach(new StringTrim());
$deleteCode->getValidatorChain()->attachByName('Alnum', array('allowWhiteSpace' => false));
$this->add($listingsId)->add($deleteCode);
}
示例12: buildFilter
public function buildFilter()
{
/******************************************************************
* Isto é um exemplo de como realizar a configurações do filtro,
* O importante é registrar o campos do formulário pedidos no exercícios
**********************************************************************/
// filter & validate by fields
$category = new Input('category');
$category->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags')->attachByName('StringToLower');
$category->getValidatorChain()->attachByName('InArray', array('haystack' => $this->getCategories()));
$title = new Input('title');
$title->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags');
$titleRegex = new Regex(array('pattern' => '/^[a-zA-Z0-9 ]*$/'));
$titleRegex->setMessage('Title should only contain numbers, letters or spaces!');
$title->getValidatorChain()->attach($titleRegex)->attachByName('StringLength', array('min' => 1, 'max' => 128));
$photo = new Input('photo_filename');
$photo->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$photo->getValidatorChain()->attachByName('Regex', array('pattern' => '!^(http://)?[a-z0-9./_-]+(jp(e)?g|png)$!i'));
$photo->setErrorMessage('Photo must be a URL or a valid filename ending with jpg or png');
$price = new Input('price');
$price->setAllowEmpty(TRUE);
$price->getValidatorChain()->addByName('GreaterThan', array('min' => 0.0));
$price->getFilterChain()->attach(new Float());
// custom filter
$expires = new Input('expires');
$expires->setAllowEmpty(TRUE);
$expires->getValidatorChain()->attachByName('InArray', array('haystack' => array_keys($this->getExpireDays())));
$expires->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$city = new Input('cityCode');
$city->setAllowEmpty(TRUE);
$city->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$name = new Input('contact_name');
$name->setAllowEmpty(TRUE);
$name->getValidatorChain()->attachByName('Regex', array('pattern' => '/^[a-z0-9., -]{1,255}$/i'));
$name->setErrorMessage('Name should only contain letters, numbers, and some punctuation.');
$name->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$phone = new Input('contact_phone');
$phone->setAllowEmpty(TRUE);
$phone->getValidatorChain()->attachByName('Regex', array('pattern' => '/^\\+?\\d{1,4}(-\\d{3,4})+$/'));
$phone->setErrorMessage('Phone number must be in this format: +nnnn-nnn-nnn-nnnn');
$phone->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$email = new Input('contact_email');
$email->setAllowEmpty(TRUE);
$email->getValidatorChain()->attachByName('EmailAddress');
$email->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$description = new Input('description');
$description->setAllowEmpty(TRUE);
$description->getValidatorChain()->attachByName('StringLength', array('min' => 1, 'max' => 4096));
$description->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$delCode = new Input('delete_code');
$delCode->setRequired(TRUE);
$delCode->getValidatorChain()->addByName('Digits');
$this->add($category)->add($title)->add($photo)->add($price)->add($expires)->add($city)->add($name)->add($phone)->add($email)->add($description)->add($delCode);
}
示例13: __construct
public function __construct()
{
$translator = new \Zend\I18n\Translator\Translator();
$translator->addTranslationFile('phparray', './module/Posterlabs/language/es.php');
$translatorMvc = new \Zend\Mvc\I18n\Translator($translator);
\Zend\Validator\AbstractValidator::setDefaultTranslator($translatorMvc);
$nombre = new Input('titolo');
$nombre->setRequired(true);
$nombre->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim');
$nombre->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum));
$this->add($nombre);
$this->add(array('name' => 'durata', 'required' => true, 'validators' => array(array('name' => 'Int'))));
}
示例14: getInputFilter
/**
* Return an instance of InputFilter
*
* @return InputFilter
*/
public function getInputFilter()
{
if (!isset($this->inputFilter)) {
$inputFilter = parent::getInputFilter();
// count
$count = new Input('count');
$count->setAllowEmpty(true);
$count->getFilterChain()->attach(new Int());
$count->getValidatorChain()->attach(new Digits());
$inputFilter->add($count);
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
示例15: __construct
public function __construct()
{
// Email
$email = new Input('email');
$email->getFilterChain()->attach(new StringTrim())->attach(new StripTags());
$email->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('max' => 255)))->attach(new EmailAddress());
$this->add($email);
// Password
$password = new Input('encryptedPassword');
$password->setRequired(true);
$password->getFilterChain()->attach(new StringTrim());
$password->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('min' => 6, 'max' => 32)));
$this->add($password);
}