-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathController.php
69 lines (49 loc) · 1.26 KB
/
Controller.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Date: 20.01.14
* Time: 13:26
*/
namespace mihaildev\elfinder;
use mihaildev\elfinder\volume\Local;
use Yii;
use yii\helpers\ArrayHelper;
/**
* Class Controller
* @package mihaildev\elfinder
* @property array $options
*/
class Controller extends BaseController{
public $roots = [];
public $disabledCommands = ['netmount'];
public $watermark;
private $_options;
public function getOptions()
{
if($this->_options !== null)
return $this->_options;
$this->_options['roots'] = [];
foreach($this->roots as $root){
if(is_string($root))
$root = ['path' => $root];
if(!isset($root['class']))
$root['class'] = Local::className();
$root = Yii::createObject($root);
/** @var \mihaildev\elfinder\volume\Local $root*/
if($root->isAvailable())
$this->_options['roots'][] = $root->getRoot();
}
if(!empty($this->watermark)){
$this->_options['bind']['upload.presave'] = 'Plugin.Watermark.onUpLoadPreSave';
if(is_string($this->watermark)){
$watermark = [
'source' => $this->watermark
];
}else{
$watermark = $this->watermark;
}
$this->_options['plugin']['Watermark'] = $watermark;
}
$this->_options = ArrayHelper::merge($this->_options, $this->connectOptions);
return $this->_options;
}
}