-
Notifications
You must be signed in to change notification settings - Fork 1
/
ElFinderPopupAction.php
51 lines (46 loc) · 1.3 KB
/
ElFinderPopupAction.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
<?php
/**
* Class ElFinderPopupAction.
*
* @since 1.1.4
*
* @author Robert Korulczyk <robert@korulczyk.pl>
* @license http://opensource.org/licenses/BSD-3-Clause
*/
abstract class ElFinderPopupAction extends CAction {
/** @var string */
public $connectorRoute = false;
/** @var array */
public $connectorParams = [];
/**
* Popup title.
*
* @var string
*/
public $title = 'Files';
/**
* Client settings.
*
* @see https://github.com/Studio-42/elFinder/wiki/Client-configuration-options
* @var array
*/
public $settings = [];
protected function beforeRun() {
require_once __DIR__ . '/ElFinderHelper.php';
ElFinderHelper::registerAlias();
ElFinderHelper::registerAssets();
// set required options
if (empty($this->connectorRoute)) {
throw new CException('$connectorRoute must be set!');
}
$this->settings['url'] = $this->controller->createUrl($this->connectorRoute, $this->connectorParams);
$this->settings['lang'] = ElFinderHelper::getLanguage();
$this->settings['baseUrl'] = ElFinderHelper::getAssetsDir() . '/';
$this->settings['soundPath'] = ElFinderHelper::getAssetsDir() . '/sounds/';
if (Yii::app()->getRequest()->enableCsrfValidation) {
$this->settings['customData'] = [
Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken,
];
}
}
}