Something went wrong. Try again.
@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
Something went wrong. Try again.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<?php
abstract class AphrontStandaloneHTMLResponse extends AphrontHTMLResponse {
abstract protected function getResources(); abstract protected function getResponseTitle(); abstract protected function getResponseBodyClass(); abstract protected function getResponseBody(); abstract protected function buildPlainTextResponseString();
final public function buildResponseString() { // Check to make sure we aren't requesting this via Ajax or Conduit. if (isset($_REQUEST['__ajax__']) || isset($_REQUEST['__conduit__'])) { return (string)hsprintf('%s', $this->buildPlainTextResponseString()); }
$title = $this->getResponseTitle(); $resources = $this->buildResources(); $body_class = $this->getResponseBodyClass(); $body = $this->getResponseBody();
return (string)hsprintf(<<<EOTEMPLATE<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <title>%s</title> %s </head> %s</html>EOTEMPLATE , $title, $resources, phutil_tag( 'body', array( 'class' => $body_class, ), $body)); }
private function buildResources() { $paths = $this->getResources();
$webroot = dirname(phutil_get_library_root('phabricator')).'/webroot/';
$resources = array(); foreach ($paths as $path) { $resources[] = phutil_tag( 'style', array('type' => 'text/css'), phutil_safe_html(Filesystem::readFile($webroot.'/rsrc/'.$path))); }
return phutil_implode_html("\n", $resources); }
}