LocalPath.php
636 Bytes
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
<?php
/**
* Date: 23.01.14
* Time: 22:47
*/
namespace mihaildev\elfinder;
use Yii;
class LocalPath extends BasePath{
public $path;
public $baseUrl = '@web';
public $basePath = '@webroot';
public function getUrl(){
return Yii::getAlias($this->baseUrl.'/'.trim($this->path,'/'));
}
public function getRealPath(){
$path = Yii::getAlias($this->basePath.'/'.trim($this->path,'/'));
if(!is_dir($path))
mkdir($path, 0777, true);
return $path;
}
public function getRoot(){
$options = parent::getRoot();
$options['path'] = $this->getRealPath();
$options['URL'] = $this->getUrl();
return $options;
}
}