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 hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
955 B · 44 lines
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445<?php
final class PhutilSafeHTML extends Phobject {
private $content;
public function __construct($content) { $this->content = (string)$content; }
public function __toString() { return $this->content; }
public function getHTMLContent() { return $this->content; }
public function appendHTML($html /* , ... */) { foreach (func_get_args() as $html) { $this->content .= phutil_escape_html($html); } return $this; }
public static function applyFunction($function, $string /* , ... */) { $args = func_get_args(); array_shift($args); $args = array_map('phutil_escape_html', $args); return new PhutilSafeHTML(call_user_func_array($function, $args)); }
// Requires http://pecl.php.net/operator.
public function __concat($html) { $clone = clone $this; return $clone->appendHTML($html); }
public function __assign_concat($html) { return $this->appendHTML($html); }
}