@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 49 lines 1.2 kB view raw
1<?php 2 3final 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 (phutil_nonempty_string($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 'color: black;', 33 'text-shadow: 1px 1px 1px white;', 34 ); 35 36 $unexpected_header = phutil_tag( 37 'div', 38 array( 39 'style' => implode(' ', $style), 40 ), 41 $unexpected_output); 42 } else { 43 $unexpected_header = ''; 44 } 45 46 return hsprintf('%s%s', $unexpected_header, $this->content); 47 } 48 49}