本文整理汇总了PHP中Utilities::sanitizeOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::sanitizeOutput方法的具体用法?PHP Utilities::sanitizeOutput怎么用?PHP Utilities::sanitizeOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::sanitizeOutput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitizeOutput
/**
* Sanitize data to avoid tag replacement
*
* @param mixed data
*
* @return string
*
*/
public static function sanitizeOutput($data)
{
return self::sanitize(Utilities::sanitizeOutput($data));
}
示例2: replace
//.........这里部分代码省略.........
// Is there any negation ?
$andpart = trim($andpart);
if (substr($andpart, 0, 1) == '!') {
$neg = true;
$andpart = trim(substr($andpart, 1));
}
// Resolve compared value
$value = $placeholder_resolver($andpart);
// Placeholder not (yet) available, cannot choose, leave part as is
if (is_null($value)) {
$leftand[] = ($neg ? '!' : '') . $andpart . ($op != 'bool' ? $op . $ov : '');
$smatch = false;
break;
}
// Cast value to scalar
if (is_object($value)) {
$value = true;
}
if (is_array($value)) {
$value = count($value);
}
// Cast value to compare to
if ($ov == 'true') {
$ov = true;
} else {
if ($ov == 'false') {
$ov = false;
} else {
if (is_float($ov)) {
$ov = (double) $ov;
} else {
if (is_numeric($ov)) {
$ov = (int) $ov;
} else {
if (is_string($ov)) {
if (preg_match('`^(["\'])(.*)\\1$`', $ov, $m)) {
$ov = $m[2];
}
}
}
}
}
}
// Run the test
switch ($op) {
case '==':
$smatch &= $value == $ov;
break;
case '!=':
$smatch &= $value != $ov;
break;
case '<':
$smatch &= $value < $ov;
break;
case '<=':
$smatch &= $value <= $ov;
break;
case '>':
$smatch &= $value > $ov;
break;
case '>=':
$smatch &= $value >= $ov;
break;
case 'bool':
default:
$smatch &= (bool) $value;
}
}
// Any test that we couldn't run ? Then leave what's not resolved for later, reduce value otherwise
if (count($leftand)) {
$leftor[] = implode('&', $leftand);
} else {
if ($smatch) {
$match = true;
break;
}
}
}
// Part of the test remains, set it for next replace
if (!$match && count($leftor)) {
return '{if:' . implode('|', $leftor) . '}' . $ifcontent . ($elsecontent ? '{else}' . $elsecontent : '') . '{endif}';
}
// Return fitting content
return $match ? $ifcontent : $elsecontent;
}, $translation);
// Basic placeholder replacement
foreach ($placeholders as $k => $v) {
$translation = preg_replace_callback('`\\{(([^:\\}]+:)?' . $k . '(\\.[a-z0-9_\\(\\)]+)*)\\}`iU', function ($m) use($placeholder_resolver) {
if (substr($m[0], 0, 4) == '{if:') {
return $m[0];
}
// Remaining ifs
$v = $placeholder_resolver($m[1]);
return substr($m[0], 0, 5) == '{raw:' ? $v : Utilities::sanitizeOutput($v);
// Ensure sanity
}, $translation);
}
// Return new translation object for further replacements
return new self($translation);
}
示例3: TokenHasBadFormatException
if (!Utilities::isValidUID($token)) {
throw new TokenHasBadFormatException($token);
}
$lang = array_key_exists('lang', $_REQUEST) ? $_REQUEST['lang'] : null;
$available = Lang::getAvailableLanguages();
if (!array_key_exists($lang, $available)) {
$lang = Lang::getCode();
}
$url = '?s=translate_email&token=' . $token . '&lang=';
if (count($available) > 1) {
echo '<div class="buttons">';
foreach ($available as $id => $dfn) {
if ($id == $lang) {
echo '<span class="selected">' . Utilities::sanitizeOutput($dfn['name']) . '</span>';
} else {
echo '<a href="' . $url . $id . '">' . Utilities::sanitizeOutput($dfn['name']) . '</a>';
}
}
echo '</div>';
}
$translatable = TranslatableEmail::fromToken($token);
$translation = $translatable->translate($lang);
/*
* Do not call Template::sanitizeOutput on email contents after that because
* TranslatableEmail::translate calls Translation::replace which itself calls
* Utilities::sanitizeOutput, use Template::sanitize instead !
*/
$subject = array_filter($translation->subject->out());
?>
<dl>
示例4: method_exists
?>
</pre>
<?php
}
?>
<div class="report">
<?php
if (Config::get('support_email')) {
?>
{tr:you_can_report_exception_by_email} : <a href="mailto:<?php
echo Config::get('support_email');
?>
?subject=Exception <?php
echo method_exists($exception, 'getUid') ? Utilities::sanitizeOutput($exception->getUid()) : '';
?>
">{tr:report_exception}</a>
<?php
} else {
if (method_exists($exception, 'getUid')) {
?>
{tr:you_can_report_exception} : <?php
echo Utilities::sanitizeOutput($exception->getUid());
?>
<?php
}
}
?>
</div>
</div>