• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP html_encode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中html_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP html_encode函数的具体用法?PHP html_encode怎么用?PHP html_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了html_encode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.");
         }
     }
 }
开发者ID:jwakely,项目名称:website,代码行数:30,代码来源:boost_version.php


示例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>';
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:33,代码来源:functions.php


示例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=\"\" />";
 }
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:7,代码来源:bbcode.class.php


示例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>";
     }
 }
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:59,代码来源:my_departmental_grants.inc.php


示例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);
    }
}
开发者ID:nopticon,项目名称:npt,代码行数:8,代码来源:functions.php


示例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 
        }
    }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:58,代码来源:filterIPAccess.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;
 }
开发者ID:mariomulansky,项目名称:website,代码行数:10,代码来源:boost_filter_text.php


示例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>';
    }
}
开发者ID:jwakely,项目名称:website,代码行数:11,代码来源:test_filters.php


示例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>';
        }
    }
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:12,代码来源:functions.php


示例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 
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:12,代码来源:upload_form.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);
}
开发者ID:rdmpage,项目名称:gbif-sdr,代码行数:13,代码来源:Actions.php


示例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));
    }
开发者ID:raffienficiaud,项目名称:website,代码行数:13,代码来源:boost_web.php


示例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" . '&amp;i=' . urlencode($imagename) . '&amp;performcrop=backend&amp;subpage=' . $subpage . '&amp;tagsort=' . html_encode($tagsort) . '">' . "\n" . '<img src="images/shape_handles.png" alt="" />' . gettext("Crop image") . '</a>' . "\n" . '<br class="clearall" />' . '</div>' . "\n";
     }
     return $output;
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:14,代码来源:crop_image.php


示例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;
}
开发者ID:ilri,项目名称:genebank-gg_server,代码行数:14,代码来源:util.php


示例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 
        }
    }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:20,代码来源:PHPMailer.php


示例16: imageError

/**
 * If in debug mode, prints the given error message and continues; otherwise redirects
 * to the given error message image and exits; designed for a production gallery.
 * @param $errormessage string the error message to print if $_GET['debug'] is set.
 * @param $errorimg string the filename of the error image to display for production. Defaults
 *   to 'err-imagegeneral.png'. Images should be located in /zen/images .
 */
function imageError($status_text, $errormessage, $errorimg = 'err-imagegeneral.png')
{
    global $newfilename, $album, $image;
    $debug = isset($_GET['debug']);
    if ($debug) {
        echo '<strong>' . sprintf(gettext('Zenphoto Image Processing Error: %s'), $errormessage) . '</strong>' . '<br /><br />' . sprintf(gettext('Request URI: [ <code>%s</code> ]'), html_encode(getRequestURI())) . '<br />PHP_SELF: [ <code>' . html_encode($_SERVER['PHP_SELF']) . '</code> ]' . (empty($newfilename) ? '' : '<br />' . sprintf(gettext('Cache: [<code>%s</code>]'), '/' . CACHEFOLDER . '/' . html_encode(sanitize($newfilename, 3))) . ' ') . (empty($image) || empty($album) ? '' : ' <br />' . sprintf(gettext('Image: [<code>%s</code>]'), html_encode(sanitize($album . '/' . $image, 3))) . ' <br />');
    } else {
        if (DEBUG_IMAGE_ERR) {
            trigger_error($errormessage, E_USER_NOTICE);
        }
        header("HTTP/1.0 {$status_text}");
        header("Status: {$status_text}");
        header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/images/' . $errorimg);
    }
    exitZP();
}
开发者ID:rb26,项目名称:zenphoto,代码行数:23,代码来源:functions-image.php


示例17: fetch_event_resources_text

function fetch_event_resources_text($event_id = 0)
{
    global $db;
    $output = array();
    if ($event_id = (int) $event_id) {
        $query = "SELECT * FROM `event_files` WHERE `event_id` = " . $db->qstr($event_id);
        $results = $db->GetAll($query);
        if ($results) {
            $output["html"] = "";
            $output["text"] = "";
            $output["html"] .= "<table style=\"margin-top: 20px; width: 100%\" cellspacing=\"0\" cellpadding=\"3\" border=\"0\">\n";
            $output["html"] .= "<thead>\n";
            $output["html"] .= "\t<tr>\n";
            $output["html"] .= "\t\t<td style=\"background-color: #EEEEEE; border: 1px #666666 solid; font-weight: bold\">File Title</td>\n";
            $output["html"] .= "\t\t<td style=\"background-color: #EEEEEE; border: 1px #666666 solid; border-left: none; font-weight: bold\">Last Updated</td>\n";
            $output["html"] .= "\t</tr>\n";
            $output["html"] .= "</thead>\n";
            $output["html"] .= "<tbody>\n";
            foreach ($results as $result) {
                $output["html"] .= "<tr>\n";
                $output["html"] .= "\t<td>\n";
                $output["html"] .= "\t\t<a href=\"" . ENTRADA_URL . "/admin/events?section=content&id=" . $event_id . "\" title=\"Click to update " . html_encode($result["file_title"]) . "\" style=\"font-weight: bold\">" . html_encode($result["file_title"]) . "</a>";
                $output["html"] .= "\t\t<span class=\"content-small\">(" . readable_size($result["file_size"]) . ")</span>";
                $output["html"] .= "\t</td>\n";
                $output["html"] .= "\t<td>" . ((int) $result["updated_date"] ? date(DEFAULT_DATE_FORMAT, $result["updated_date"]) : "Over two years ago") . "</td>\n";
                $output["html"] .= "</tr>\n";
            }
            $output["html"] .= "</tbody>\n";
            $output["html"] .= "</table>\n";
            foreach ($results as $key => $result) {
                $output["text"] .= "   - " . $result["file_title"] . " (" . readable_size($result["file_size"]) . ")\n";
                $output["text"] .= "     Last Updated: " . ((int) $result["updated_date"] ? date(DEFAULT_DATE_FORMAT, $result["updated_date"]) : "Over two years ago") . "\n\n";
            }
        } else {
            $output["html"] .= "<div class=\"display-red\">\n";
            $output["html"] .= "<strong>There are no resources available for download.</strong>\n";
            $output["html"] .= "<br /><br />\n";
            $output["html"] .= "Please take a moment to upload any relevant documents by <a href=\"" . ENTRADA_URL . "/admin/events?section=content&id=" . $event_id . "\" style=\"font-weight: bold\">clicking here</a>.\n";
            $output["html"] .= "</div>\n";
            $output["text"] .= "   *There are no resources available for download.*\n\n";
            $output["text"] .= "   Please take a moment to upload any relevant documents at the following URL:\n";
            $output["text"] .= "   " . ENTRADA_URL . "/admin/events?section=content&id=" . $event_id . "\n\n";
        }
    }
    return $output;
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:46,代码来源:notifications.php


示例18: theme_content

    function theme_content($map)
    {
        global $_zp_current_image, $points;
        ?>
		<!-- Colorbox section -->
		<div id="images">
			<?php 
        $points = array();
        while (next_image()) {
            if ($map) {
                $coord = getGeoCoord($_zp_current_image);
                if ($coord) {
                    $points[] = $coord;
                }
            }
            ?>
				<div class="image">
					<div class="imagethumb">
						<?php 
            if (isImagePhoto()) {
                // colorbox is only for real images
                $link = html_encode(getDefaultSizedImage()) . '" class="thickbox"';
            } else {
                $link = html_encode(getImageURL()) . '"';
            }
            ?>
						<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo getBareImageTitle();
            ?>
">
							<?php 
            printImageThumb(getImageTitle());
            ?>
						</a></div>
				</div>
				<?php 
        }
        ?>
		</div>
		<br class="clearall" />
		<?php 
        @call_user_func('printSlideShowLink');
    }
开发者ID:rb26,项目名称:zenphoto,代码行数:46,代码来源:functions.php


示例19: query

/**
 * The main query function. Runs the SQL on the connection and handles errors.
 * @param string $sql sql code
 * @param bool $noerrmsg set to false to supress the error message
 * @return results of the sql statements
 * @since 0.6
 */
function query($sql, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_conf_vars;
    if (is_null($_zp_DB_connection)) {
        db_connect();
    }
    // Changed this to mysql_query - *never* call query functions recursively...
    $result = mysql_query($sql, $_zp_DB_connection);
    if (!$result) {
        if ($errorstop) {
            $sql = html_encode($sql);
            zp_error(sprintf(gettext('MySQL Query ( <em>%1$s</em> ) failed. MySQL returned the error <em>%2$s</em>'), $sql, mysql_error()));
        }
        return false;
    }
    return $result;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:24,代码来源:functions-db-MySQL.php


示例20: getCurrentUrl

 /**
  * Get current URL.
  * @param  bool $withQuery
  * @return string
  */
 public static final function getCurrentUrl(bool $withQuery = true) : string
 {
     // filter function
     static $filter;
     if ($filter == null) {
         $filter = function ($input) {
             $input = substr($input, 0, strcspn($input, "\n\r"));
             $input = str_ireplace(['%00', '%0a', '%1a'], '', $input);
             return html_encode($input);
         };
     }
     $url = 'http' . ($_SERVER['SERVER_PORT'] == '443' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'];
     // add path
     $url .= $filter(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
     // add query
     if ($withQuery && $_SERVER['QUERY_STRING'] != '') {
         $url .= '?' . $filter($_SERVER['QUERY_STRING']);
     }
     return $url;
 }
开发者ID:froq,项目名称:froq-util,代码行数:25,代码来源:Util.php



注:本文中的html_encode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP html_encodeTagged函数代码示例发布时间:2022-05-15
下一篇:
PHP html_edit函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap