Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
17003 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\InMail;
6
 
7
use Laminas\InputFilter\InputFilter;
8
 
9
class SendFilter extends InputFilter
10
{
11
 
12
 
13
    public function __construct()
14
    {
15
 
16
 
17
 
18
        $this->add([
19
            'name' => 'message',
20
            'required' => true,
21
            'filters' => [
22
                ['name' => \Laminas\Filter\StringTrim::class],
23
                ['name' => \Laminas\Filter\StripTags::class],
24
            ],
25
            'validators' => [
26
                [
27
                    'name' => \Laminas\Validator\NotEmpty::class,
28
                ],
29
                [
30
                    'name' => \Laminas\Validator\StringLength::class,
31
                    'options' => [
32
                        'max' => 250
33
                    ]
34
                ],
35
            ],
36
        ]);
37
 
38
 
39
 
40
        $this->add([
41
            'name' => 'filename',
42
            'required' => false,
43
            'filters' => [
44
                ['name' => \Laminas\Filter\BaseName::class],
45
            ],
46
            'validators' => [
47
                [
48
                    'name' => \Laminas\Validator\NotEmpty::class,
49
                ],
50
                [
51
                    'name' => \Laminas\Validator\File\Extension::class,
52
                    'options' => [
53
                        'extension' => ['mov', 'webm','mp4','mpeg','jpg','jpeg','png', 'pdf']
54
                    ]
55
                ],
56
                [
57
                    'name' => \Laminas\Validator\File\MimeType::class,
58
                    'options' => [
59
                        'mimeType' => [ 'video/quicktime','video/webm', 'video/mp4', 'video/mpeg', 'image/jpg', 'image/jpeg', 'image/png', 'application/pdf'],
60
                        'enableHeaderCheck' => true,
61
                    ]
62
                ],
63
            ],
64
        ]);
65
 
66
 
67
    }
68
}