Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/markup/render.php
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | function phutil_tag($tag, array $attributes = array(), $content = null) { | ||||
return new PhutilSafeHTML('<'.$tag.$attr_string.'>'.$content.'</'.$tag.'>'); | return new PhutilSafeHTML('<'.$tag.$attr_string.'>'.$content.'</'.$tag.'>'); | ||||
} | } | ||||
function phutil_tag_div($class, $content = null) { | function phutil_tag_div($class, $content = null) { | ||||
return phutil_tag('div', array('class' => $class), $content); | return phutil_tag('div', array('class' => $class), $content); | ||||
} | } | ||||
function phutil_escape_html($string) { | function phutil_escape_html($string) { | ||||
if ($string === null) { | |||||
return ''; | |||||
} | |||||
if ($string instanceof PhutilSafeHTML) { | if ($string instanceof PhutilSafeHTML) { | ||||
return $string; | return $string; | ||||
} else if ($string instanceof PhutilSafeHTMLProducerInterface) { | } else if ($string instanceof PhutilSafeHTMLProducerInterface) { | ||||
$result = $string->producePhutilSafeHTML(); | $result = $string->producePhutilSafeHTML(); | ||||
if ($result instanceof PhutilSafeHTML) { | if ($result instanceof PhutilSafeHTML) { | ||||
return phutil_escape_html($result); | return phutil_escape_html($result); | ||||
} else if (is_array($result)) { | } else if (is_array($result)) { | ||||
return phutil_escape_html($result); | return phutil_escape_html($result); | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |