forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAphrontView.php
66 lines (54 loc) · 1.38 KB
/
AphrontView.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
abstract class AphrontView extends Phobject
implements PhutilSafeHTMLProducerInterface {
protected $user;
protected $children = array();
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
protected function getUser() {
return $this->user;
}
protected function canAppendChild() {
return true;
}
final public function appendChild($child) {
if (!$this->canAppendChild()) {
$class = get_class($this);
throw new Exception(
pht("View '%s' does not support children.", $class));
}
$this->children[] = $child;
return $this;
}
final protected function renderChildren() {
return $this->children;
}
/**
* @deprecated
*/
final protected function renderSingleView($child) {
phutil_deprecated(
'AphrontView->renderSingleView()',
"This method no longer does anything; it can be removed and replaced ".
"with its arguments.");
return $child;
}
final protected function isEmptyContent($content) {
if (is_array($content)) {
foreach ($content as $element) {
if (!$this->isEmptyContent($element)) {
return false;
}
}
return true;
} else {
return !strlen((string)$content);
}
}
abstract public function render();
public function producePhutilSafeHTML() {
return $this->render();
}
}