forked from d3yii2/d3files
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD3Files.php
More file actions
51 lines (45 loc) · 1.19 KB
/
D3Files.php
File metadata and controls
51 lines (45 loc) · 1.19 KB
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
namespace d3yii2\d3files;
use Yii;
use yii\base\Module;
use yii\i18n\PhpMessageSource;
/**
* d3files module definition class
*/
class D3Files extends Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'd3yii2\d3files\controllers';
/** @var string|callable upload directory */
public $uploadDir;
public $fileTypes;
public $disableController;
public $hashSalt;
public $sharedExpireDays;
public $sharedLeftLoadings;
public $imageExtensions = ['jpg', 'gif', 'png', 'bmp'];
public $models = [];
public $enableNotes;
public function init()
{
parent::init();
self::registerTranslations();
}
public static function registerTranslations(): void
{
$i18n = Yii::$app->i18n;
$i18n->translations['d3files'] = [
'class' => PhpMessageSource::class,
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . '/messages',
'forceTranslation' => true
];
}
public function getView($view)
{
$this->viewPath or $this->viewPath = __DIR__ . '/views';
return $this->viewPath . '/' . $view . '.php';
}
}