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

PHP htmlEntities函数代码示例

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

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



在下文中一共展示了htmlEntities函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: keyword

 function keyword($word, $class)
 {
     $word = htmlEntities($word);
     if ($this->last_class == $class) {
         return $word;
     } else {
         $close = $this->close_url;
         if (isset($this->help_pages[$class])) {
             $prefix = sprintf($this->help_pages[$class], $word);
             $this->close_url = '</a>';
         } else {
             $prefix = '';
             $this->close_url = '';
         }
         if ($this->last_class == null) {
             $this->last_class = $class;
             return $prefix . '<span class="' . $class . '">' . $word;
         }
         $this->last_class = $class;
         if ($class == null) {
             return '</span>' . $close . $word;
         }
         return '</span>' . $close . $prefix . '<span class="' . $class . '">' . $word;
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:25,代码来源:HTML_HP_output.php


示例2: cleanUrl

 /**
  *	Cleans a URL so it's safe to print to the browser without issues.
  *	@param uri		String		The URL to parse
  *	@return			String		The clean URL to print
  */
 public static function cleanUrl($uri)
 {
     $result = null;
     $url = htmlEntities($uri, ENT_QUOTES, 'utf-8');
     $parse = parse_url($url);
     $result = "{$parse['scheme']}://";
     $parse['path'] = ltrim($parse['path'], '/');
     foreach (array('user', 'pass', 'path', 'query', 'fragment') as $p) {
         if (isset($parse[$p])) {
             $parse[$p] = urlEncode($parse[$p]);
         }
     }
     if (!empty($parse['user'])) {
         $result .= "{$parse['user']}";
         if (empty($parse['pass'])) {
             $result .= '@';
         } else {
             $result .= ":{$parse['pass']}@";
         }
     }
     $result .= "{$parse['host']}/{$parse['path']}";
     if (!empty($parse['query'])) {
         $result .= "?{$parse['query']}";
     }
     if (!empty($parse['fragment'])) {
         $result .= "#{$parse['fragment']}";
     }
     return $result;
 }
开发者ID:aldimol,项目名称:zf-sample,代码行数:34,代码来源:Misc.php


示例3: decorate

 /** 
  * decorate
  * 
  * @access  protected
  * @return  mixed
  * @param   mixed   $value
  */
 function decorate($value)
 {
     if (is_string($value)) {
         return htmlEntities($value, ENT_QUOTES, $this->list->getEncoding());
     } elseif (is_array($value)) {
         return array_map(array(&$this, 'decorate'), $value);
     }
     return $value;
 }
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:16,代码来源:HtmlEntities.php


示例4: renderCardDetails

 protected function renderCardDetails($data)
 {
     /* may be overriden in child class */
     $str = null;
     if ($this->showCardDescription == 1) {
         $str .= '<br>' . htmlEntities($data[TableCard::FIELD_DESCRIPTION]);
     }
     // if
     return $str;
 }
开发者ID:TheProjecter,项目名称:openface,代码行数:10,代码来源:PortletCardList.php


示例5: showResults

function showResults()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenYears, $chosenShow, $chosenSingle, $chosenAverage;
    #--- Try the cache
    tryCache('event', $chosenEventId, preg_replace('/ /', '', $chosenRegionId), $chosenYears, preg_replace('/ /', '', $chosenShow), $chosenSingle, $chosenAverage);
    #------------------------------
    # Prepare stuff for the query.
    #------------------------------
    $eventCondition = eventCondition();
    $yearCondition = yearCondition();
    $regionCondition = regionCondition('result');
    $limitCondition = '';
    if (preg_match('/^10+/', $chosenShow, $matches)) {
        $limitNumber = $matches[0];
        $limitCondition = 'LIMIT ' . 2 * $limitNumber;
    }
    $valueSource = $chosenAverage ? 'average' : 'best';
    $valueName = $chosenAverage ? 'Average' : 'Single';
    #------------------------------
    # Get results from database.
    #------------------------------
    if ($chosenShow == 'By Region') {
        require 'includes/events_regions.php';
        return;
    }
    if ($chosenShow == '100 Results' || $chosenShow == '1000 Results') {
        require 'includes/events_results.php';
    } else {
        require 'includes/events_persons.php';
    }
    #------------------------------
    # Show the table.
    #------------------------------
    startTimer();
    $event = getEvent($chosenEventId);
    tableBegin('results', 6);
    tableCaption(true, spaced(array($event['name'], chosenRegionName(), $chosenYears, $chosenShow)));
    $headerSources = $chosenAverage ? 'Result Details' : '';
    tableHeader(explode('|', "Rank|Person|Result|Citizen of|Competition|{$headerSources}"), array(0 => "class='r'", 2 => "class='R2'", 5 => 'class="f"'));
    $ctr = 0;
    foreach ($results as $result) {
        extract($result);
        $ctr++;
        $no = isset($previousValue) && $value == $previousValue ? '&nbsp;' : $ctr;
        if ($limitCondition && $no > $limitNumber) {
            break;
        }
        tableRow(array($no, personLink($personId, $personName), formatValue($value, $event['format']), htmlEntities($countryName), competitionLink($competitionId, $competitionName), formatAverageSources($chosenAverage, $result, $event['format'])));
        $previousValue = $value;
    }
    tableEnd();
    stopTimer("printing the table");
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:54,代码来源:events.php


示例6: render

 /**
  *	Renders this form for HTML viewing.
  *	@param view		Zend_View_Interface		A view controller to incorporate into
  *											the rendering scheme.
  *	@return			String					The rendered form
  */
 public function render(Zend_View_Interface $view = null)
 {
     $attribs = null;
     foreach ($this->_attribs as $key => $attrib) {
         $attrib = htmlEntities($attrib, ENT_QUOTES, 'utf-8');
         $attribs .= (empty($attribs) ? null : chr(32)) . "{$key}='{$attrib}'";
     }
     $result = "\n\t\t\t\t\t<form method='{$this->getMethod()}'{$attribs}>\n";
     foreach ($this->_elements as $element) {
         $result .= $element->render($view);
     }
     return "{$result}\n\t\t\t\t\t</form>\n\t\t\t\t";
 }
开发者ID:aldimol,项目名称:zf-sample,代码行数:19,代码来源:Forms.php


示例7: keyword

 function keyword($word, $class)
 {
     $word = htmlEntities($word, ENT_COMPAT, 'UTF-8');
     if ($this->last_class == $class) {
         return $word;
     } else {
         if ($this->last_class == null) {
             $this->last_class = $class;
             return '<span class="' . $class . '">' . $word;
         }
         $this->last_class = $class;
         if ($class == null) {
             return '</span>' . $word;
         }
         return '</span><span class="' . $class . '">' . $word;
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:17,代码来源:HTML_UTF8_output.php


示例8: choice

function choice($id, $caption, $options, $chosenOption)
{
    #----------------------------------------------------------------------
    $result = "<label for='{$id}'>";
    $result .= $caption ? "{$caption}:<br />" : '';
    $result .= "<select class='drop' id='{$id}' name='{$id}'>\n";
    $chosen = urlEncode($chosenOption);
    foreach ($options as $option) {
        $nick = urlEncode($option[0]);
        $text = htmlEntities($option[1], ENT_QUOTES, "UTF-8");
        $selected = $chosen && $nick == $chosen ? " selected='selected'" : "";
        $result .= "<option value='{$nick}'{$selected}>{$text}</option>\n";
    }
    $result .= "</select>";
    $result .= "</label>";
    return $result;
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:17,代码来源:_choices.php


示例9: renderImg

 public static function renderImg($src, $title, $htmlClass, $onclick = null)
 {
     /* src needs to be an absolute path */
     $str = '<img ';
     $str .= 'src="' . OpfApplicationConfig::APP_CALLBACK_URL . '/' . $src . '" ';
     if (!is_null($title)) {
         $str .= ' title="' . htmlEntities($title) . '" ';
     }
     // if
     if (!is_null($htmlClass)) {
         $str .= ' class="' . $htmlClass . '" ';
     }
     // if
     if (!is_null($onclick)) {
         $str .= 'style="cursor: pointer;" onclick="' . $onclick . '" ';
     }
     // if
     $str .= '>';
     return $str;
 }
开发者ID:TheProjecter,项目名称:openface,代码行数:20,代码来源:OpfHelperHtmlSite.php


示例10: outputDir

function outputDir($directory, $prefix = "")
{
    global $currentTest, $currentTestPath, $currentTestName, $currentDirPath;
    $list = scandir($directory);
    foreach ($list as $listItem) {
        if ($listItem[0] == ".") {
            continue;
        }
        $name = $listItem;
        $listItemPath = $directory . $listItem;
        $listItem = $prefix . $listItem;
        if (is_dir($directory . "/" . $listItem)) {
            $listItem .= "/";
            $listItemPath .= "/";
            $href = "?test=" . urlencode($listItem);
            $hrefAll = "?all&test=" . urlencode($listItem);
            if (substr($currentTest, 0, strlen($listItem)) != $listItem) {
                echo '<a href="' . $hrefAll . '" class="test-set-group-all">(all)</a>';
                echo '<a href="' . $href . '" class="test-set-group-name">' . htmlentities($name) . '</a>';
            } else {
                echo '<a href="' . $hrefAll . '" class="test-set-group-all">(all)</a>';
                echo '<span class="test-set-group-name selected">' . htmlentities($name) . '</span>';
                echo '<div class="test-set-group">';
                $currentTestName .= $name . " / ";
                $currentDirPath = $listItemPath;
                outputDir($listItemPath, $listItem);
                echo '</div>';
            }
        } elseif (substr($listItem, strlen($listItem) - 3) == ".js") {
            $name = substr($name, 0, strlen($name) - 3);
            if ($listItem == $currentTest) {
                $currentTestPath = $listItemPath;
                $currentTestName .= $name;
                echo '<span class="test-set selected">' . htmlEntities($name) . '</span>';
            } else {
                $href = "?test=" . urlencode($listItem);
                echo '<a href="' . $href . '" class="test-set">' . htmlEntities($name) . '</a>';
            }
        }
    }
}
开发者ID:nickl-,项目名称:jsonary,代码行数:41,代码来源:index.php


示例11: wddump

/**
 * Output debug data
 * Input var $debug_input_data must be an array
 * Recommended usage:
 * wddump( array(basename(__FILE__), $debugdata) );
 */
function wddump($debug_input_data = false)
{
    if (!WDFAQ_DEBUG or !$debug_input_data) {
        return false;
    } else {
        foreach ($debug_input_data as $debug_data) {
            echo '<div class="wdfaq-debugdata"><pre>';
            if (is_array($debug_data)) {
                echo '<ul>';
                foreach ($debug_data as $key => $value) {
                    echo '<li>Key: ' . htmlEntities($key) . '<br />Value: ' . htmlEntities($value) . '</li>';
                }
                echo '</ul>';
            } else {
                var_dump($debug_data);
            }
            echo '</pre></div>';
        }
        return true;
    }
}
开发者ID:WorkingToine,项目名称:wd-faq,代码行数:27,代码来源:functions.php


示例12: getDynaDescription

 function getDynaDescription($text = '', $excerpt_length = 25)
 {
     global $modx;
     $text = str_replace(']]>', ']]&gt;', $text);
     /* remove line breaks */
     $text = str_replace("\n", ' ', $text);
     $text = str_replace("\r", ' ', $text);
     /* entify chars */
     $text = htmlEntities($text);
     /* remove special MODx tags - chunks, snippets, etc.
      * If we don't do this they'll end up expanded in the description.
      */
     $text = $modx->stripTags($text);
     $words = preg_split("/\\s+/", $text, $excerpt_length + 1);
     if (count($words) > $excerpt_length) {
         array_pop($words);
         array_push($words, '...');
         $text = implode(' ', $words);
     }
     return trim(stripslashes($text));
 }
开发者ID:Jako,项目名称:getDynaDescription,代码行数:21,代码来源:getdynadescription.snippet.php


示例13: printBuildTable

/**
 * @brief Prints build table.
 *
 * @param buildsets Array of buildsets to display.
 * @param builders Array of builders (arrays of builds per buildset).
 */
function printBuildTable($buildsets, $builders)
{
    // sort builders by their name
    uksort($builders, "builderCmp");
    // output table header
    print '<table class="dashboard"><tr><td></td>' . "\n";
    foreach ($buildsets as $buildset) {
        $ts = gmdate('Y-m-d H:i:s', $buildset->timestamp) . ' UTC';
        print "<td class='revision' title='{$ts}'>";
        print '#' . htmlentities($buildset->buildsetid) . ': ';
        print htmlentities($buildset->revision);
        print "<br/><span class='name'>" . htmlentities($buildset->name) . '</span>';
        print "</td>\n";
    }
    foreach ($builders as $buildername => $builderinfo) {
        print "<tr>\n";
        print '<td>' . htmlentities($buildername) . "</td>\n";
        foreach ($buildsets as $buildset) {
            $buildsetid = $buildset->buildsetid;
            if (array_key_exists($buildsetid, $builderinfo)) {
                $status = $builderinfo[$buildsetid]->status;
            } else {
                $status = '-';
            }
            if (statusHasOutput($status)) {
                // FIXME: might need some kind of escaping here
                $build_url = htmlEntities(WEB_ROOT . "/builds/{$buildsetid}/{$buildername}", ENT_QUOTES);
                $cell = "<a href='{$build_url}'>{$status}</a>";
            } else {
                $cell = $status;
            }
            $class = classFromStatus($status);
            print "<td class='{$class}'>{$cell}</td>\n";
        }
        print "</tr>\n";
    }
    print "</table>\n";
}
开发者ID:xaizek,项目名称:fragile,代码行数:44,代码来源:dashboard.php


示例14: Kizano_View_Escape

function Kizano_View_Escape($input)
{
    $result = htmlEntities($input, ENT_QUOTES, 'utf-8');
    return $result;
}
开发者ID:aldimol,项目名称:zf-sample,代码行数:5,代码来源:View.php


示例15: addslashes

<?php

$titre = "Connexion";
include_once "connexion_base.php";
include_once "utile.php";
include_once "header.php";
$probleme = "";
if (isset($_POST["send"])) {
    if (isset($_POST["pseudo"]) && isset($_POST["motDePasse"]) && !empty($_POST["pseudo"]) && !empty($_POST["motDePasse"])) {
        //recuperation des données du formulaire
        $pseudo = addslashes(htmlEntities($_POST["pseudo"]));
        $motDePasse = md5(addslashes(htmlEntities($_POST["motDePasse"])));
        //requete
        $sql = "SELECT Pseudo, Nom, Prenom, Avatar, Aires, CalculsElementaires, ChangementDunites, Configurations, EcrituresLitterales, Equations, FonctionLineaire, Grandeurs, Inequations, NombresEntiers, NombresRationnels, NotionDeFonction, NotionDeProbabilite, Statistique, Volumes, Score FROM individu WHERE Pseudo='{$pseudo}' and MotDePasse='{$motDePasse}'";
        //envoi de la requete
        $resultat1 = $connexion->query($sql);
        if ($resultat1->rowCount() > 0) {
            //l'utilisateur existe
            session_start();
            $resultat2 = $resultat1->fetchALL(PDO::FETCH_ASSOC);
            foreach ($resultat2[0] as $k => $v) {
                $_SESSION[$k] = $v;
            }
            header("Location:index.php");
        } else {
            echo "<script type=\"text/javascript\">";
            echo "alert('Erreur de pseudo ou de mot de passe');";
            echo "window.history.back();";
            echo "</script>";
        }
    }
开发者ID:cmarquay,项目名称:evolution,代码行数:31,代码来源:connexion.php


示例16: dbDebug

function dbDebug ( $query ) {
#----------------------------------------------------------------------

  echo "<table border='1'>";
  foreach ( dbQuery( $query ) as $row ) {
    echo "<tr>";
    foreach ( array_values( $row ) as $value )
      echo "<td>" . htmlEntities( $value ) . "</td>"; 
    echo "</tr>";
  }
  echo "</table>";
}
开发者ID:neodude,项目名称:worldcubeassociation.org,代码行数:12,代码来源:_database.php


示例17: _formatKeyValue

 private function _formatKeyValue($key, $value)
 {
     return '<input type="hidden" name="' . $key . '" value="' . htmlEntities($value) . '"/>';
 }
开发者ID:TheProjecter,项目名称:openface,代码行数:4,代码来源:OpfFormParam.php


示例18: renderPleaseWaitDivInString

 protected function renderPleaseWaitDivInString($visible = 0)
 {
     $msg = $this->lookUpLocale(OpfLocalization::MSG_PLEASE_WAIT);
     $str = '<div id="' . $this->responseDivId . '"';
     if ($visible == 0) {
         $str .= ' style="display:none">';
     } else {
         if ($visible == 1) {
             $str .= ' style="display">';
         }
     }
     // else if
     $str .= '<img src="' . OpfApplicationConfig::APP_CALLBACK_URL . OpfConfig::IMAGES_DIRECTORY . '/' . OpfConfig::INPROGRESS_GIF . '">' . htmlEntities($msg) . '</div>';
     $this->pleaseWaitDiv = $str;
     return $str;
 }
开发者ID:TheProjecter,项目名称:openface,代码行数:16,代码来源:OpfUIObject.php


示例19: clean_text

function clean_text($text, $strip_tags = true, $limit = 2000)
{
    $text = trim($text);
    if ($strip_tags) {
        $text = strip_tags($text);
    }
    // strip excess whitespace
    $text = preg_replace('/\\s\\s+/', ' ', $text);
    $text = substr($text, 0, $limit);
    $text = str_replace(';', '', $text);
    // No semicolons makes for injection-free MySQL statements.
    $text = str_replace("'", "&#8217;", $text);
    $text = htmlEntities($text, ENT_QUOTES);
    return $text;
}
开发者ID:UTSquishy,项目名称:Grawlix-Repository,代码行数:15,代码来源:functions.inc.php


示例20: htmlEntities

	<div class="container">
		<h1>
			Quiz v<?php 
echo QUIZ_VERSION;
?>
 :: Edit quiz
		</h1>

		<form id="quizEditForm" action="" method="POST">
			<div id="quiz">
				<label for="quizData"><?php 
echo $quizTitle;
?>
 quiz content</label>
				<textarea id="quizData" name="quizData" class="quizData"><?php 
echo htmlEntities($quizData);
?>
</textarea>

				<label for="quizPassword">Update quiz password</label>
				<input type="password" id="quizPassword" name="quizPassword" value=""/>
			</div>

			<div class="buttonContainer">
				<div class="button submit">Save quiz</div>
			</div>
		</form>
	</div>
	<div class="footer">
		<?php 
if ($quizTimestamp) {
开发者ID:RichardMartin,项目名称:uQuiz,代码行数:31,代码来源:edit.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP htmlEntitiesEx函数代码示例发布时间:2022-05-15
下一篇:
PHP htmlEnt函数代码示例发布时间: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