本文整理汇总了PHP中html_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP html_encode函数的具体用法?PHP html_encode怎么用?PHP html_encode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: from
/**
* Return a BoostVersion representation of value.
* @return BoostVersion
*/
static function from($value)
{
if ($value instanceof BoostVersion) {
return $value;
} else {
if (is_string($value)) {
$value = trim($value, " \t\n\r\v/");
switch ($value) {
case 'master':
return self::master();
case 'develop':
return self::develop();
case 'latest':
return self::latest();
}
// TODO: Make this stricter by only matching whole string. Might break something?
if (preg_match('@(\\d+)[._](\\d+)[._](\\d+)([-._ ]?b(?:eta)?(\\d*))?@', $value, $matches)) {
return self::release((int) $matches[1], (int) $matches[2], (int) $matches[3], empty($matches[4]) ? false : (int) ($matches[5] ?: 1));
} else {
throw new BoostVersion_Exception("Invalid version: " . html_encode($value));
}
} else {
die("Can't convert to BoostVersion.");
}
}
}
示例2: printHeadingImage
function printHeadingImage($randomImage)
{
global $_zp_themeroot;
$id = getAlbumId();
echo '<div id="randomhead">';
if (is_null($randomImage)) {
echo '<img src="' . $_zp_themeroot . '/images/zen-logo.jpg" alt="' . gettext('There were no images from which to select the random heading.') . '" />';
} else {
$randomAlbum = $randomImage->getAlbum();
$randomAlt1 = $randomAlbum->getTitle();
if ($randomAlbum->getAlbumId() != $id) {
$randomAlbum = $randomAlbum->getParent();
while (!is_null($randomAlbum) && $randomAlbum->getAlbumId() != $id) {
$randomAlt1 = $randomAlbum->getTitle() . ":\n" . $randomAlt1;
$randomAlbum = $randomAlbum->getParent();
}
}
$randomImageURL = html_encode(getURL($randomImage));
if (getOption('allow_upscale')) {
$wide = 620;
$high = 180;
} else {
$wide = min(620, $randomImage->getWidth());
$high = min(180, $randomImage->getHeight());
}
echo "<a href='" . $randomImageURL . "' title='" . gettext('Random picture...') . "'>";
$html = "<img src='" . html_encode($randomImage->getCustomImage(NULL, $wide, $high, $wide, $high, NULL, NULL, !getOption('Watermark_head_image'))) . "' width='{$wide}' height='{$high}' alt=" . '"' . html_encode($randomAlt1) . ":\n" . html_encode($randomImage->getTitle()) . '" />';
$html = zp_apply_filter('custom_image_html', $html, false);
echo $html;
echo '</a>';
}
echo '</div>';
}
示例3: do_bbcode_img
function do_bbcode_img($action, $attributes, $content, $params, $node_object)
{
if ($action == "validate") {
return true;
}
return "<img src=\"" . html_encode($content) . "\" alt=\"\" title=\"\" />";
}
示例4: display
function display($results, $db)
{
setlocale(LC_MONETARY, 'en_US');
$outputArray = array();
foreach ($results as $result) {
$formattedRec = "";
if ($formattedRec == "") {
if ($result["grant_title"] != "") {
$formattedRec = html_encode($result["grant_title"]) . ", ";
}
if ($result["funding_status"] == "funded") {
if ($result["amount_received"] != "") {
$formattedRec = $formattedRec . money_format('%(#10n', $result["amount_received"]) . ", ";
}
} else {
if ($result["funding_status"] == "submitted") {
if ($result["amount_received"] != "") {
$formattedRec = $formattedRec . money_format('%(#10n', $result["amount_received"]) . ", ";
}
}
}
if ($result["type"] != "") {
$formattedRec = $formattedRec . html_encode($result["type"]) . ", ";
}
if (isset($result["agency"]) && $result["agency"] != "") {
$formattedRec = $formattedRec . html_encode($result["agency"]) . ", ";
}
if (isset($result["start_year"])) {
$formattedRec = $formattedRec . html_encode($result['start_month']) . "-" . html_encode($result['start_year']) . " / " . (html_encode($result['end_month']) == 0 ? "N/A" : html_encode($result['end_month']) . "-" . html_encode($result['end_year'])) . ", ";
}
if ($result["principal_investigator"] != "") {
$formattedRec = $formattedRec . html_encode($result["principal_investigator"]);
}
if ($result["co_investigator_list"] != "") {
$formattedRec = $formattedRec . html_encode($result["co_investigator_list"]);
}
// Check for existance of extra comma or colon at the end of the record
// if there is one remove it
$lengthOfRec = strlen($formattedRec) - 2;
$lastChar = substr($formattedRec, $lengthOfRec, 1);
if ($lastChar == "," || $lastChar == ":") {
$formattedRec = substr($formattedRec, 0, $lengthOfRec);
}
}
// Do not allow duplicates (i.e. multiple faculty report the same publication.
if (in_array($formattedRec, $outputArray) === false) {
$outputArray[] = $formattedRec;
}
}
if (count($outputArray) > 0) {
for ($u = 0; $u < count($outputArray); $u++) {
$ctr = $u + 1;
$outputString = $outputArray[$u] . "<br /><br />";
echo $outputString;
}
} else {
echo "No Grants for the specified query.<br>";
}
}
示例5: set_var
function set_var(&$result, $var, $type, $multibyte = false, $regex = '')
{
settype($var, $type);
$result = $var;
if ($type == 'string') {
$result = html_encode($result, $multibyte);
}
}
示例6: handleOption
function handleOption($option, $currentValue)
{
$list = unserialize(getOption('filterIPAccess_IP_list'));
if (getOption('zp_plugin_filterIPAccess')) {
$disabled = '';
} else {
$disabled = ' disabled="disabled"';
}
$key = 0;
foreach ($list as $key => $range) {
?>
<input type="textbox" size="20" name="filterIPAccess_ip_start_<?php
echo $key;
?>
" value="<?php
echo html_encode($range['start']);
?>
"<?php
echo $disabled;
?>
/>
-
<input type="textbox" size="20" name="filterIPAccess_ip_end_<?php
echo $key;
?>
" value="<?php
echo html_encode($range['end']);
?>
"<?php
echo $disabled;
?>
/>
<br />
<?php
}
$i = $key;
while ($i < $key + 4) {
$i++;
?>
<input type="textbox" size="20" name="filterIPAccess_ip_start_<?php
echo $i;
?>
" value=""<?php
echo $disabled;
?>
/>
-
<input type="textbox" size="20" name="filterIPAccess_ip_end_<?php
echo $i;
?>
" value=""<?php
echo $disabled;
?>
/>
<br />
<?php
}
}
示例7: html_encode_with_fallback
function html_encode_with_fallback($text)
{
// Could probably handle this better with php 5.4 or multibyte
// extensions.
$encoded_text = html_encode($text);
if ($text && !$encoded_text) {
$encoded_text = html_encode(preg_replace('/[\\x80-\\xFF]/', "�", $text));
}
return $encoded_text;
}
示例8: filter_test
function filter_test($filter, $params, $expected)
{
ob_start();
echo_filtered($filter, $params);
$result = ob_get_clean();
if (trim($result) != trim($expected)) {
global $failure_count;
++$failure_count;
echo "<h2>Failure for filter {$filter}</h2>", '<p>Expected:</p><pre>', html_encode($expected), '</pre><p>Result:</p><pre>', html_encode($result), '</pre>';
}
}
示例9: m9PrintBreadcrumb
function m9PrintBreadcrumb()
{
global $_zp_current_album, $_zp_last_album;
$parents = getParentAlbums();
$n = count($parents);
if ($n > 0) {
foreach ($parents as $parent) {
$url = rewrite_path("/" . pathurlencode($parent->name) . "/", "/index.php?album=" . urlencode($parent->name));
echo '<li><a href="' . htmlspecialchars($url) . '">' . html_encode($parent->getTitle()) . '</a></li>';
}
}
}
示例10: upload_form
function upload_form($uploadlimit, $passedalbum)
{
?>
<input type="hidden" name="existingfolder" id="existingfolder" value="false" />
<input type="hidden" name="folder" id="folderslot" value="<?php
echo html_encode($passedalbum);
?>
" />
<input type="hidden" name="albumtitle" id="albumtitleslot" value="" />
<input type="hidden" name="publishalbum" id="publishalbumslot" value="" />
<?php
}
示例11: serializationAction
function serializationAction(&$body)
{
//Take the raw response
$rawResponse =& $body->getResults();
adapterMap($rawResponse);
//Now serialize it
$encodedResponse = html_encode($rawResponse);
if (count(NetDebug::getTraceStack()) > 0) {
$trace = "/*" . implode("\n", NetDebug::getTraceStack()) . "*/";
$encodedResponse = $trace . "\n" . $encodedResponse;
}
$body->setResults($encodedResponse);
}
示例12: error_404
static function error_404($file, $message = null)
{
$error = "404 Not Found";
header("{$_SERVER["SERVER_PROTOCOL"]} {$error}");
$head = <<<HTML
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>Boost C++ Libraries - 404 Not Found</title>
HTML;
$content = '<h1>' . html_encode($error) . '</h1><p>File "' . html_encode($file) . '" not found.</p><p>';
$content .= html_encode($message);
$content .= '</p>';
BoostFilter::display_template(array('head' => $head, 'content' => $content));
}
示例13: edit
static function edit($output, $image, $prefix, $subpage, $tagsort)
{
if (isImagePhoto($image)) {
if (is_array($image->filename)) {
$albumname = dirname($image->filename['source']);
$imagename = basename($image->filename['source']);
} else {
$albumname = $image->albumlink;
$imagename = $image->filename;
}
$output .= '<div class="button buttons tooltip" title="' . gettext('Permanently crop the actual image.') . '">' . "\n" . '<a href="' . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/crop_image.php?a=' . pathurlencode($albumname) . "\n" . '&i=' . urlencode($imagename) . '&performcrop=backend&subpage=' . $subpage . '&tagsort=' . html_encode($tagsort) . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '<br class="clearall" />' . '</div>' . "\n";
}
return $output;
}
示例14: debug
function debug($obj, $title = '-', $html_encode = false)
{
// if config file says to ignore errors, suppress debugging info as well
$display_errors = get_cfg_var('display_errors');
if (!$display_errors) {
return;
}
$out = print_r($obj, true);
if ($html_encode) {
$out = html_encode($out);
}
echo "<fieldset><legend>{$title}</legend><pre>{$out}</pre></fieldset>";
return $out;
}
示例15: handleOption
/**
* Custom opton handler--creates the clear ratings button
*
* @param string $option
* @param string $currentValue
*/
function handleOption($option, $currentValue)
{
if ($option == "PHPMailer_password") {
?>
<input type="password" size="40" name="<?php
echo $option;
?>
" style="width: 338px" value="<?php
echo html_encode($currentValue);
?>
">
<?php
}
}