当前位置: 首页>>代码示例>>PHP>>正文


PHP html_encode函数代码示例

本文整理汇总了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.");
         }
     }
 }
开发者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


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