コード例 #1
0
 private function validarPropuesta($data)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addRule('referido', new Validate\Rule\NumNatural())->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML())->addFilter('referido', FilterFactory::emptyToNull())->addFilter('tags', FilterFactory::explode(','))->addOptional('referido');
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }
コード例 #2
0
 private function validarDocumento($data, $cuerpo = true)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('descripcion', new Validate\Rule\MinLength(8))->addRule('descripcion', new Validate\Rule\MaxLength(1024))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addFilter('tags', FilterFactory::explode(','));
     if ($cuerpo) {
         $vdt->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML());
     }
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }
コード例 #3
0
ファイル: EventoCtrl.php プロジェクト: DiegoVI/virtuagora
 private function validarEvento($data)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addRule('lugar', new Validate\Rule\MinLength(4))->addRule('lugar', new Validate\Rule\MaxLength(128))->addRule('fecha', new Validate\Rule\Date('Y-m-d H:i:s'))->addRule('tags', new Validate\Rule\Required())->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML())->addFilter('asociar', FilterFactory::booleanFilter())->addFilter('tags', FilterFactory::explode(','));
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }