Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/aphront/response/AphrontWebpageResponse.php
12241 views
1
<?php
2
3
final class AphrontWebpageResponse extends AphrontHTMLResponse {
4
5
private $content;
6
private $unexpectedOutput;
7
8
public function setContent($content) {
9
$this->content = $content;
10
return $this;
11
}
12
13
public function setUnexpectedOutput($unexpected_output) {
14
$this->unexpectedOutput = $unexpected_output;
15
return $this;
16
}
17
18
public function getUnexpectedOutput() {
19
return $this->unexpectedOutput;
20
}
21
22
public function buildResponseString() {
23
$unexpected_output = $this->getUnexpectedOutput();
24
if ($unexpected_output !== null && strlen($unexpected_output)) {
25
$style = array(
26
'background: linear-gradient(180deg, #eeddff, #ddbbff);',
27
'white-space: pre-wrap;',
28
'z-index: 200000;',
29
'position: relative;',
30
'padding: 16px;',
31
'font-family: monospace;',
32
'text-shadow: 1px 1px 1px white;',
33
);
34
35
$unexpected_header = phutil_tag(
36
'div',
37
array(
38
'style' => implode(' ', $style),
39
),
40
$unexpected_output);
41
} else {
42
$unexpected_header = '';
43
}
44
45
return hsprintf('%s%s', $unexpected_header, $this->content);
46
}
47
48
}
49
50