本文整理汇总了PHP中htmlSpecialChars函数的典型用法代码示例。如果您正苦于以下问题:PHP htmlSpecialChars函数的具体用法?PHP htmlSpecialChars怎么用?PHP htmlSpecialChars使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了htmlSpecialChars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_breadcrumbs
/**
* Get the path to the resource as (breadcrumbs)
*
* @param array $params
* @param Smarty $smarty
*
* @return string
*/
function smarty_function_breadcrumbs($params, $smarty)
{
$defaultParams = array('trail' => array(), 'separator' => ' > ', 'truncate' => 40);
// initialize the parameters
foreach ($defaultParams as $k => $v) {
if (!isset($params[$k])) {
$params[$k] = $v;
}
}
// load the truncate modifier
if ($params['truncate'] > 0) {
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
}
$links = array();
$numSteps = count($params['trail']);
for ($i = 0; $i < $numSteps; $i++) {
$step = $params['trail'][$i];
// truncate the title if required
if ($params['truncate'] > 0) {
$step['title'] = smarty_modifier_truncate($step['title'], $params['truncate']);
}
// build the link if it's set and isn't the last step
if (strlen($step['link']) > 0 && $i < $numSteps - 1) {
$links[] = sprintf('<a href="%s" title="%s">%s</a>', htmlSpecialChars($step['link']), htmlSpecialChars($step['title']), htmlSpecialChars($step['title']));
} else {
// either the link isn't set, or it's the last step
$links[] = htmlSpecialChars($step['title']);
}
}
// join the links using the specified separator
return join($params['separator'], $links);
}
示例2: if
if (!function_exists($_l->blocks['obsah'][] = '_lb30b34e254e_obsah')) { function _lb30b34e254e_obsah($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v
?><table>
<tr>
<th class="vel25">Datum</th>
<th class="oddo">Sport</th>
<th class="width_auto">Název</th>
</tr>
<?php if ($seznam_akci): $iterations = 0; foreach ($seznam_akci as $akce): ?>
<tr>
<td><?php echo NTemplateHelpers::escapeHtml($template->datumKonani($akce['od'], $akce['do']), ENT_NOQUOTES) ?></td>
<td><?php echo NTemplateHelpers::escapeHtml($akce['sport'], ENT_NOQUOTES) ?></td>
<td><a href="<?php echo htmlSpecialChars($_control->link("detail", array($akce->id))) ?>
"><?php echo NTemplateHelpers::escapeHtml($akce->nazev, ENT_NOQUOTES) ?></a></td>
</tr>
<?php $iterations++; endforeach ;else: ?>
<tr><td colspan='2'>Nebyly nalezeny žádné akce.</td></tr>
<?php endif ?>
</table>
<?php if ($opravneni['add']): ?>
<div class="bottom_nav">
<a href="<?php echo htmlSpecialChars($_control->link("add")) ?>">Nová akce</a>
<a href="<?php echo htmlSpecialChars($_control->link("archiv")) ?>">Archiv</a>
</div>
<?php endif ;
}}
示例3: render
/**
* Renders debug bar.
* @return void
*/
public function render()
{
$obLevel = ob_get_level();
$panels = array();
foreach ($this->panels as $id => $panel) {
try {
$panels[] = array('id' => preg_replace('#[^a-z0-9]+#i', '-', $id), 'tab' => $tab = (string) $panel->getTab(), 'panel' => $tab ? (string) $panel->getPanel() : NULL);
} catch (\Exception $e) {
$panels[] = array('id' => "error-" . preg_replace('#[^a-z0-9]+#i', '-', $id), 'tab' => "Error in {$id}", 'panel' => '<h1>Error: ' . $id . '</h1><div class="nette-inner">' . nl2br(htmlSpecialChars($e, ENT_IGNORE)) . '</div>');
while (ob_get_level() > $obLevel) {
// restore ob-level if broken
ob_end_clean();
}
}
}
@session_start();
$session =& $_SESSION['__NF']['debuggerbar'];
if (preg_match('#^Location:#im', implode("\n", headers_list()))) {
$session[] = $panels;
return;
}
foreach (array_reverse((array) $session) as $reqId => $oldpanels) {
$panels[] = array('tab' => '<span title="Previous request before redirect">previous</span>', 'panel' => NULL, 'previous' => TRUE);
foreach ($oldpanels as $panel) {
$panel['id'] .= '-' . $reqId;
$panels[] = $panel;
}
}
$session = NULL;
require __DIR__ . '/templates/bar.phtml';
}
示例4: formatContent
/**
* Formats cell's content.
* @param mixed
* @param \DibiRow|array
* @return string
*/
public function formatContent($value, $data = NULL)
{
$value = htmlSpecialChars($value);
if (is_array($this->replacement) && !empty($this->replacement)) {
if (in_array($value, array_keys($this->replacement))) {
$value = $this->replacement[$value];
}
}
foreach ($this->formatCallback as $callback) {
if (is_callable($callback)) {
$value = call_user_func($callback, $value, $data);
}
}
// translate & truncate
if ($value instanceof Nette\Utils\Html) {
$text = $this->dataGrid->translate($value->getText());
if ($this->maxLength != 0) {
$text = Nette\Utils\Strings::truncate($text, $this->maxLength);
}
$value->setText($text);
$value->title = $this->dataGrid->translate($value->title);
} else {
if ($this->maxLength != 0) {
$value = Nette\Utils\Strings::truncate($value, $this->maxLength);
}
}
return $value;
}
示例5: if
if (!function_exists($_l->blocks['content'][] = '_lb119884e882_content')) { function _lb119884e882_content($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v
;$_ctrl = $_control->getComponent("seznamClanku"); if ($_ctrl instanceof IRenderable) $_ctrl->validateControl(); $_ctrl->render() ?>
<div width="100%" class="right"><a href="<?php echo htmlSpecialChars($_control->link("Archiv:default")) ?>
">další články</a></div>
<?php
}}
示例6: if
if (!function_exists($_l->blocks['content'][] = '_lb7a70701f43_content')) { function _lb7a70701f43_content($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v
;$_ctrl = $_control->getComponent("drobeckovaNavigace"); if ($_ctrl instanceof IRenderable) $_ctrl->validateControl(); $_ctrl->render() ;call_user_func(reset($_l->blocks['title']), $_l, get_defined_vars()) ?>
<?php $_ctrl = $_control->getComponent("seznamClanku"); if ($_ctrl instanceof IRenderable) $_ctrl->validateControl(); $_ctrl->render() ;$iterations = 0; foreach ($iterator = $_l->its[] = new NSmartCachingIterator($akce) as $ak): if ($iterator->isFirst()): ?>
<div>
<h2>Akce</h2>
<ul>
<?php endif ?>
<li><a href="<?php echo htmlSpecialChars($_control->link("Kalendar:detail", array($ak['id']))) ?>
"><?php echo NTemplateHelpers::escapeHtml($ak['nazev'], ENT_NOQUOTES) ?> (<?php echo NTemplateHelpers::escapeHtml($template->datumKonani($ak['od'], $ak['do']), ENT_NOQUOTES) ?>)</a></li>
<?php if ($iterator->isLast()): ?>
</ul>
</div>
<?php endif ;$iterations++; endforeach; array_pop($_l->its); $iterator = end($_l->its) ;$iterations = 0; foreach ($iterator = $_l->its[] = new NSmartCachingIterator($oddily) as $oddil): if ($iterator->isFirst()): ?>
<div>
<h2>Oddíly</h2>
<ul>
<?php endif ?>
<li><a href="<?php echo htmlSpecialChars($_control->link("Adresar:oddil", array($oddil['id']))) ?>
"><?php echo NTemplateHelpers::escapeHtml($oddil['nazev'], ENT_NOQUOTES) ?></a></li>
<?php if ($iterator->isLast()): ?>
</ul>
</div>
<?php endif ;$iterations++; endforeach; array_pop($_l->its); $iterator = end($_l->its) ;$iterations = 0; foreach ($iterator = $_l->its[] = new NSmartCachingIterator($osoby) as $osoba): if ($iterator->isFirst()): ?>
<div>
<h2>Osoby</h2>
<ul>
<?php endif ?>
<li><a href="<?php echo htmlSpecialChars($_control->link("Osoby:default", array($osoba['id']))) ?>
"><?php echo NTemplateHelpers::escapeHtml($osoba['jmeno'], ENT_NOQUOTES) ?> <?php echo NTemplateHelpers::escapeHtml($osoba['prijmeni'], ENT_NOQUOTES) ?></a></li>
<?php if ($iterator->isLast()): ?>
</ul>
</div>
<?php endif ;$iterations++; endforeach; array_pop($_l->its); $iterator = end($_l->its) ;
}}
示例7: if
if (!function_exists($_l->blocks['content'][] = '_lb3bb298d597_content')) { function _lb3bb298d597_content($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v
;$_ctrl = $_control->getComponent("drobeckovaNavigace"); if ($_ctrl instanceof IRenderable) $_ctrl->validateControl(); $_ctrl->render() ;call_user_func(reset($_l->blocks['title']), $_l, get_defined_vars()) ?>
<img src="<?php echo htmlSpecialChars($basePath) ?>/css/datum.png" /> <?php echo NTemplateHelpers::escapeHtml($template->datumKonani($akce['od'], $akce['do']), ENT_NOQUOTES) ?>
<br />
<?php if ($akce['misto']): ?><img src="<?php echo htmlSpecialChars($basePath) ?>
/css/location.png" /> pořadatel: <?php echo NTemplateHelpers::escapeHtml($akce['misto'], ENT_NOQUOTES) ?>
<br /><?php endif ?>
<?php if ($existuji_vysledky): ?>
<br />
<?php NFormMacros::renderFormBegin($form = $_form = (is_object("seznamKategoriiForm") ? "seznamKategoriiForm" : $_control["seznamKategoriiForm"]), array()) ;$_input = is_object("kategorie") ? "kategorie" : $_form["kategorie"]; if ($_label = $_input->getLabel()) echo $_label->addAttributes(array()) ?>
: <?php $_input = (is_object("kategorie") ? "kategorie" : $_form["kategorie"]); echo $_input->getControl()->addAttributes(array()) ;$_input = (is_object("send") ? "send" : $_form["send"]); echo $_input->getControl()->addAttributes(array()) ;NFormMacros::renderFormEnd($_form) ?>
<?php if ($kategorie): ?>
<h3><?php echo NTemplateHelpers::escapeHtml($kategorie['nazev'], ENT_NOQUOTES) ?></h3>
<table>
<tr><td>Sport:</td><td><?php echo NTemplateHelpers::escapeHtml($sporty[$kategorie['sport']], ENT_NOQUOTES) ?></td></tr>
</table>
<?php endif ;$_ctrl = $_control->getComponent("vysledky"); if ($_ctrl instanceof IRenderable) $_ctrl->validateControl(); $_ctrl->render() ;else: ?>
<p>Elektronické výsledky této akce nebyly nalezeny.</p>
<?php endif ?>
<br />
<a href="<?php echo htmlSpecialChars($_control->link("Kalendar:detail", array($akce['id']))) ?>
">zpět na detail závodu</a>
<?php
}}
示例8: array
if (!function_exists($_l->blocks['obsah'][] = '_lb73da57502c_obsah')) { function _lb73da57502c_obsah($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v
?><div>
<?php NFormMacros::renderFormBegin($form = $_form = (is_object("vyhledatOddilForm") ? "vyhledatOddilForm" : $_control["vyhledatOddilForm"]), array()) ;if ($form->hasErrors()): ?> <ul class="errors">
<?php $iterations = 0; foreach ($form->errors as $error): ?> <li><?php echo NTemplateHelpers::escapeHtml($error, ENT_NOQUOTES) ?></li>
<?php $iterations++; endforeach ?>
</ul>
<?php endif ?>
<table>
<tr >
<th><?php $_input = is_object("popis") ? "popis" : $_form["popis"]; if ($_label = $_input->getLabel()) echo $_label->addAttributes(array()) ?></th>
<td><?php $_input = (is_object("popis") ? "popis" : $_form["popis"]); echo $_input->getControl()->addAttributes(array()) ?></td>
<td><?php $_input = (is_object("send") ? "send" : $_form["send"]); echo $_input->getControl()->addAttributes(array()) ?></td>
</tr>
</table>
<?php $_input = is_object("id") ? "id" : $_form["id"]; if ($_label = $_input->getLabel()) echo $_label->addAttributes(array()) ;$_input = (is_object("id") ? "id" : $_form["id"]); echo $_input->getControl()->addAttributes(array()) ;NFormMacros::renderFormEnd($_form) ?>
</div>
<?php if (isset($oddily)): ?>
<div>
<table>
<?php $iterations = 0; foreach ($oddily as $oddil): ?>
<tr>
<td><a href="<?php echo htmlSpecialChars($_control->link("prehled", array($oddil['id']))) ?>
"><?php echo NTemplateHelpers::escapeHtml($oddil['nazev'], ENT_NOQUOTES) ?></a></td>
</tr>
<?php $iterations++; endforeach ?>
</table>
</div>
<?php endif ;
}}
示例9: imageHandler
/**
* User handler for images
*
* @param TexyHandlerInvocation handler invocation
* @param TexyImage
* @param TexyLink
* @return TexyHtml|string|FALSE
*/
function imageHandler($invocation, $image, $link)
{
$texy = $invocation->getTexy();
if (substr($image->URL, -4) === '.swf') {
$movie = Texy::prependRoot($image->URL, $texy->imageModule->root);
$dimensions = ($image->width ? 'width="' . $image->width . '" ' : '') . ($image->height ? 'width="' . $image->height . '" ' : '');
$movie = htmlSpecialChars($movie);
$altContent = htmlSpecialChars($image->modifier->title);
// @see http://phpfashion.com/how-to-correctly-insert-a-flash-into-xhtml
$code = '
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="' . $movie . '" ' . $dimensions . '>
<!-- <![endif]-->
<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' . $dimensions . '
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
<param name="movie" value="' . $movie . '" />
<!--><!--dgx-->
<p>' . $altContent . '</p>
</object>
<!-- <![endif]-->
';
return $texy->protect($code, Texy::CONTENT_BLOCK);
}
return $invocation->proceed();
}
示例10: dumpSql
/**
* Returns syntax highlighted SQL command.
* @param string
* @return string
*/
public static function dumpSql($sql)
{
static $keywords1 = 'SELECT|(?:ON\\s+DUPLICATE\\s+KEY)?UPDATE|INSERT(?:\\s+INTO)?|REPLACE(?:\\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\\s+BY|ORDER\\s+BY|LIMIT|OFFSET|SET|VALUES|LEFT\\s+JOIN|INNER\\s+JOIN|TRUNCATE';
static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|RLIKE|REGEXP|TRUE|FALSE';
// insert new lines
$sql = " {$sql} ";
$sql = preg_replace("#(?<=[\\s,(])({$keywords1})(?=[\\s,)])#i", "\n\$1", $sql);
// reduce spaces
$sql = preg_replace('#[ \\t]{2,}#', " ", $sql);
$sql = wordwrap($sql, 100);
$sql = preg_replace("#([ \t]*\r?\n){2,}#", "\n", $sql);
// syntax highlight
$sql = htmlSpecialChars($sql);
$sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])({$keywords1})(?=[\\s,)])|(?<=[\\s,(=])({$keywords2})(?=[\\s,)=])#is", function ($matches) {
if (!empty($matches[1])) {
// comment
return '<em style="color:gray">' . $matches[1] . '</em>';
}
if (!empty($matches[2])) {
// error
return '<strong style="color:red">' . $matches[2] . '</strong>';
}
if (!empty($matches[3])) {
// most important keywords
return '<strong style="color:blue">' . $matches[3] . '</strong>';
}
if (!empty($matches[4])) {
// other keywords
return '<strong style="color:green">' . $matches[4] . '</strong>';
}
}, $sql);
return '<pre class="dump">' . trim($sql) . "</pre>\n";
}
示例11: escapeXML
/**
* Escapes string for use inside XML 1.0 template.
* @param string UTF-8 encoding
* @return string
*/
public static function escapeXML($s)
{
// XML 1.0: \x09 \x0A \x0D and C1 allowed directly, C0 forbidden
// XML 1.1: \x00 forbidden directly and as a character reference,
// \x09 \x0A \x0D \x85 allowed directly, C0, C1 and \x7F allowed as character references
return htmlSpecialChars(preg_replace('#[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]+#', '', $s), ENT_QUOTES, 'UTF-8');
}
示例12: array
if (!function_exists($_l->blocks['_k_prihlaseni'][] = '_lbfcd3fed6ce__k_prihlaseni')) { function _lbfcd3fed6ce__k_prihlaseni($_l, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v; $_control->validateControl('k_prihlaseni')
;NFormMacros::renderFormBegin($form = $_form = (is_object("sportyFiltrForm") ? "sportyFiltrForm" : $_control["sportyFiltrForm"]), array()) ?>
<table>
<tbody>
<tr>
<td><?php $_input = (is_object("sporty") ? "sporty" : $_form["sporty"]); echo $_input->getControl()->addAttributes(array()) ?></td>
<td><?php $_input = (is_object("send") ? "send" : $_form["send"]); echo $_input->getControl()->addAttributes(array()) ?></td>
</tr>
</tbody>
</table>
<?php NFormMacros::renderFormEnd($_form) ;$iterations = 0; foreach ($iterator = $_l->its[] = new NSmartCachingIterator($k_prihlaseni) as $akce): if ($iterator->isFirst()): ?>
<table class="hover">
<tr>
<th>Datum</th><th class="oddo">Sport</th><th>Akce</th><th>Přihlášky do</th><th> </th><th> </th>
</tr>
<?php endif ?>
<tr>
<td><?php echo NTemplateHelpers::escapeHtml($template->datumKonani($akce['od'], $akce['do']), ENT_NOQUOTES) ?></td>
<td><?php echo NTemplateHelpers::escapeHtml($akce['sport'], ENT_NOQUOTES) ?></td>
<td><a href="<?php echo htmlSpecialChars($_control->link("info", array($akce['id'], $oddil))) ?>
"><?php echo NTemplateHelpers::escapeHtml($akce['nazev'], ENT_NOQUOTES) ?></a></td>
<td><?php echo NTemplateHelpers::escapeHtml($template->date($akce['uzavirka_prihlasek'], 'j.n.Y'), ENT_NOQUOTES) ?></td>
<td><?php if ($opravneni['prihlasky'] && $akce['elektronicke_prihlasky']): ?>
<a href="<?php echo htmlSpecialChars($_control->link("prihlasky", array($akce['id'], $oddil))) ?>
">přihlásit</a><?php endif ?></td>
<td><?php if ($akce['prihlaseno']): ?><img src="<?php echo htmlSpecialChars($basePath) ?>
/css/ico-ok.gif" alt="ano" title="přihlášeno <?php echo htmlSpecialChars($akce['prihlaseno']) ?>
osob" /><?php else: ?> <?php endif ?></td>
</tr>
<?php if ($iterator->isLast()): ?></table><?php endif ?>
<?php $iterations++; endforeach; array_pop($_l->its); $iterator = end($_l->its) ;
}}
开发者ID:krecek,项目名称:nrsn,代码行数:33,代码来源:_Zavody.prehledPrihlasek.latte-4eb7768ae9aeb8afdd20b8e74a097d2f.php
示例13: renderNode
public function renderNode(&$node)
{
if (!empty($this->onRenderNode)) {
$this->onRenderNode($node);
} else {
echo htmlSpecialChars($node->getNodeCaption());
}
}
示例14: getTab
public function getTab()
{
return '<span title="Nette\Database ' . htmlSpecialChars($this->name) . '">'
. '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC" />'
. count($this->queries) . ' queries'
. ($this->totalTime ? ' / ' . sprintf('%0.1f', $this->totalTime * 1000) . 'ms' : '')
. '</span>';
}
示例15: _lbe5b98e46bf_content
function _lbe5b98e46bf_content($_l, $_args)
{
foreach ($_args as $__k => $__v) {
${$__k} = $__v;
}
?>
<div id="banner">
<?php
call_user_func(reset($_l->blocks['title']), $_l, get_defined_vars());
?>
</div>
<div id="content">
<h2>
<a href="<?php
echo htmlSpecialChars($_control->link("ciselnikPodskupina:default"));
?>
">Ciselnik podskupina</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("ciselnikSkupina:default"));
?>
">Ciselnik skupina</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("ciselnikStruktura:default"));
?>
">Ciselnik struktura</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("ciselnikTextura:default"));
?>
">Ciselnik textura</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("lokalitaSlovensko:default"));
?>
">Lokalita Slovensko</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("ciselnikFarba:default"));
?>
">Cislenik Farba</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("hornina:default"));
?>
">Hornina</a><br>
<a href="<?php
echo htmlSpecialChars($_control->link("horninaObrazok:default"));
?>
">Obrazok - hornina</a>
</h2>
</div>
<?php
}
开发者ID:cujan,项目名称:atlashornin,代码行数:57,代码来源:_Homepage.default.latte-415071b76fa342cbdb350a49dcf33b0b.php