本文整理汇总了PHP中Helpers::escapeHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::escapeHtml方法的具体用法?PHP Helpers::escapeHtml怎么用?PHP Helpers::escapeHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::escapeHtml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatHtml
public static function formatHtml($mask)
{
$args = func_get_args();
return preg_replace_callback('#%#', function () use(&$args, &$count) {
return Helpers::escapeHtml($args[++$count]);
}, $mask);
}
示例2: renderHtml
private function renderHtml()
{
$res = '<style>code, pre {white-space:nowrap} a {text-decoration:none} pre {color:gray;display:inline} big {color:red}</style><code>';
foreach ($this->list as $item) {
$stack = [];
foreach (array_slice($item[3], 1) as $t) {
$t += ['class' => '', 'type' => '', 'function' => ''];
$stack[] = "{$t['class']}{$t['type']}{$t['function']}()" . (isset($t['file'], $t['line']) ? ' in ' . basename($t['file']) . ":{$t['line']}" : '');
}
$res .= '<span title="' . Helpers::escapeHtml(implode("\n", $stack)) . '">' . Helpers::editorLink($item[0], $item[1]) . ' ' . str_replace(self::BOM, '<big>BOM</big>', Dumper::toHtml($item[2])) . "</span><br>\n";
}
return $res . '</code>';
}
示例3: e
function e($s)
{
return Helpers::escapeHtml($s);
}
示例4: highlightFile
/**
* Returns syntax highlighted source code.
* @param string
* @param int
* @param int
* @return string|NULL
*/
public static function highlightFile($file, $line, $lines = 15, array $vars = NULL)
{
$source = @file_get_contents($file);
// @ file may not exist
if ($source) {
$source = static::highlightPhp($source, $line, $lines, $vars);
if ($editor = Helpers::editorUri($file, $line)) {
$source = substr_replace($source, ' data-tracy-href="' . Helpers::escapeHtml($editor) . '"', 4, 0);
}
return $source;
}
}
示例5: renderPanels
/**
* @return array
*/
private function renderPanels($suffix = NULL)
{
set_error_handler(function ($severity, $message, $file, $line) {
if (error_reporting() & $severity) {
throw new \ErrorException($message, 0, $severity, $file, $line);
}
});
$obLevel = ob_get_level();
$panels = [];
foreach ($this->panels as $id => $panel) {
$idHtml = preg_replace('#[^a-z0-9]+#i', '-', $id) . $suffix;
try {
$tab = (string) $panel->getTab();
$panelHtml = $tab ? (string) $panel->getPanel() : NULL;
if ($tab && $panel instanceof \Nette\Diagnostics\IBarPanel) {
$e = new \Exception('Support for Nette\\Diagnostics\\IBarPanel is deprecated');
}
} catch (\Throwable $e) {
} catch (\Exception $e) {
}
if (isset($e)) {
while (ob_get_level() > $obLevel) {
// restore ob-level if broken
ob_end_clean();
}
$idHtml = "error-{$idHtml}";
$tab = "Error in {$id}";
$panelHtml = "<h1>Error: {$id}</h1><div class='tracy-inner'>" . nl2br(Helpers::escapeHtml($e)) . '</div>';
unset($e);
}
$panels[] = (object) ['id' => $idHtml, 'tab' => $tab, 'panel' => $panelHtml];
}
restore_error_handler();
return $panels;
}