1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* elFinder driver for trash bin at local filesystem. |
4
|
|
|
* |
5
|
|
|
* @author NaokiSawada |
6
|
|
|
**/ |
7
|
|
|
class elFinderVolumeTrash extends elFinderVolumeLocalFileSystem |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Driver id |
11
|
|
|
* Must be started from letter and contains [a-z0-9] |
12
|
|
|
* Used as part of volume id. |
13
|
|
|
* |
14
|
|
|
* @var string |
15
|
|
|
**/ |
16
|
|
|
protected $driverId = 't'; |
17
|
|
|
|
18
|
|
|
public function __construct() |
19
|
|
|
{ |
20
|
|
|
parent::__construct(); |
21
|
|
|
// original option of the Trash |
22
|
|
|
$this->options['lockEverything'] = false; // Lock all items in the trash to disable delete, move, rename. |
23
|
|
|
|
24
|
|
|
// common options as the volume driver |
25
|
|
|
$this->options['alias'] = 'Trash'; |
26
|
|
|
$this->options['quarantine'] = ''; |
27
|
|
|
$this->options['rootCssClass'] = 'elfinder-navbar-root-trash'; |
28
|
|
|
$this->options['copyOverwrite'] = false; |
29
|
|
|
$this->options['uiCmdMap'] = ['paste' => 'hidden', 'mkdir' => 'hidden', 'copy' => 'restore']; |
30
|
|
|
$this->options['disabled'] = ['archive', 'duplicate', 'edit', 'extract', 'mkfile', 'places', 'put', 'rename', 'resize', 'upload']; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function mount(array $opts) |
34
|
|
|
{ |
35
|
|
|
if ($this->options['lockEverything']) { |
36
|
|
|
if (! is_array($opts['attributes'])) { |
37
|
|
|
$opts['attributes'] = []; |
38
|
|
|
} |
39
|
|
|
$attr = [ |
40
|
|
|
'pattern' => '/./', |
41
|
|
|
'locked' => true, |
42
|
|
|
]; |
43
|
|
|
array_unshift($opts['attributes'], $attr); |
44
|
|
|
} |
45
|
|
|
// force set `copyJoin` to true |
46
|
|
|
$opts['copyJoin'] = true; |
47
|
|
|
|
48
|
|
|
return parent::mount($opts); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.