Blame view

vendor/mihaildev/yii2-elfinder/FtpPath.php 1.19 KB
ad2e91f7   Mihail   move multyparser ...
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
  <?php
  /**
   * Date: 30.03.15
   * Time: 13:48
   *
   * This file is part of the MihailDev project.
   *
   * (c) MihailDev project <http://github.com/mihaildev/>
   *
   * For the full copyright and license information, please view the LICENSE
   * file that was distributed with this source code.
  */
  
  namespace mihaildev\elfinder;
  
  /**
   * Class FtpPath
   *
   * @package mihaildev\elfinder
   */
  class FtpPath extends BasePath{
  	public $driver = 'FTP';
  
  	public $baseUrl = '';
  
  	public $basePath = '';
  
  	public $host = 'localhost';
  	public $port = 21;
  
  	public $user = '';
  	public $pass = '';
  
  	public $path = '/';
  	public $mode = 'passive';
  
  	public $iss = false;
  
  	public function getUrl(){
  		return rtrim($this->baseUrl,'/').'/'.trim($this->path,'/');
  	}
  
  	public function getRealPath(){
  		return rtrim($this->basePath,'/').'/'.trim($this->path,'/');
  	}
  
  	public function getRoot(){
  		if($this->iss)
  			$this->driver = 'FTPIIS';
  
  		$options = parent::getRoot();
  
  		$options['host'] = $this->host;
  		$options['port'] = $this->port;
  		$options['user'] = $this->user;
  		$options['pass'] = $this->pass;
  		$options['mode'] = $this->mode;
  		$options['path'] = $this->getRealPath();
  		$options['URL'] = $this->getUrl();
  
  		return $options;
  	}
  }