Classi per la configurazione upload
Cristiano Magro
2019-07-09 239c0068baa2d7f8544557feca928c26f7480243
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
 * User: Cristiano Magro
 * Date: 09/07/2019
 */
 
class FilterExt {
 
 
    private $titolo;
    private $extensions;
 
    public function __construct($titolo = null, $ext = null )
    {
        $this->titolo = $titolo;
        $this->extensions[$ext] = $ext;
    }
 
    public function getFilter()
    {
        $new = new stdClass();
        $new->titolo = $this->titolo;
 
        //riordino le chiavi
        sort($this->extensions);
 
        $new->extensions = implode(',', $this->extensions);
 
        return json_encode($new);
    }
 
    public function addExt($newExt)
    {
        $this->extensions[$newExt] = $newExt;
        return $this;
    }
}