Page MenuHomec4science

PhutilSafeHTML.php
No OneTemporary

File Metadata

Created
Tue, Jun 11, 07:14

PhutilSafeHTML.php

<?php
final class PhutilSafeHTML {
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));
}
}

Event Timeline