Path: blob/master/src/infrastructure/markup/PhutilSafeHTML.php
12241 views
<?php12final class PhutilSafeHTML extends Phobject {34private $content;56public function __construct($content) {7$this->content = (string)$content;8}910public function __toString() {11return $this->content;12}1314public function getHTMLContent() {15return $this->content;16}1718public function appendHTML($html /* , ... */) {19foreach (func_get_args() as $html) {20$this->content .= phutil_escape_html($html);21}22return $this;23}2425public static function applyFunction($function, $string /* , ... */) {26$args = func_get_args();27array_shift($args);28$args = array_map('phutil_escape_html', $args);29return new PhutilSafeHTML(call_user_func_array($function, $args));30}3132// Requires http://pecl.php.net/operator.3334public function __concat($html) {35$clone = clone $this;36return $clone->appendHTML($html);37}3839public function __assign_concat($html) {40return $this->appendHTML($html);41}4243}444546