wfScanFile.php
865 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
41
<?php
require_once __DIR__ . '/wfFileUtils.php';
class wfScanFile {
private $realPath = null;
private $wordpressPath = null;
public function __construct($realPath, $wordpressPath) {
$this->realPath = $realPath;
$this->wordpressPath = $wordpressPath;
}
public function getRealPath() {
return $this->realPath;
}
public function getWordpressPath() {
return $this->wordpressPath;
}
public function getDisplayPath() {
if (wfFileUtils::matchPaths($this->realPath, $this->wordpressPath)) {
return '~/' . $this->getWordpressPath();
}
return $this->realPath;
}
public function createChild($childPath) {
return new self(
wfFileUtils::realPath(wfFileUtils::joinPaths($this->realPath, $childPath)),
wfFileUtils::joinPaths($this->wordpressPath, $childPath)
);
}
public function __toString() {
return $this->getRealPath();
}
}