本文整理汇总了PHP中html_entities函数的典型用法代码示例。如果您正苦于以下问题:PHP html_entities函数的具体用法?PHP html_entities怎么用?PHP html_entities使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_entities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: channel_select
/**
* Prints a <select> of the available channels
/**/
function channel_select($params = '', $selected = '', $id = 00)
{
$channels = Channel::getChannelList();
echo "\n<select name=\"chan_{$id}\" {$params}>";
foreach ($channels as $chanid) {
$channel =& Channel::find($chanid);
// Not visible?
if (empty($channel->visible) || $channel->chanid == 91010) {
continue;
}
// Print the option
echo '
<option value="', $channel->chanid, '"', ' title="', html_entities($channel->name), '"';
// Selected?
if ($channel->chanid == $selected || $channel->chanid == $_GET['chanid']) {
echo ' SELECTED';
}
// Print the rest of the content
echo '>';
if ($_SESSION["prefer_channum"]) {
echo $channel->channum . ' (' . html_entities($channel->callsign) . ')';
} else {
echo html_entities($channel->callsign) . ' (' . $channel->channum . ')';
}
echo '</option>';
}
echo '</select>';
}
示例2: input_select
/**
* Prints a <select> of the available recording inputs
**/
function input_select($selected, $ename = 'prefinput')
{
static $inputs;
// Gather the data
if (empty($inputs)) {
global $db;
$sh = $db->query('SELECT cardid,
IF(LENGTH(IFNULL(displayname,"")) > 0,
displayname,
CONCAT(cardid, ":", inputname)
) AS name
FROM capturecard
ORDER BY name');
while (list($id, $name) = $sh->fetch_row()) {
$inputs[$id] = $name;
}
$sh->finish();
}
// Only one input?
if (count($inputs) == 1) {
list($id, $name) = reset($inputs);
echo '<input type="hidden" name="', $ename, '" value="0">', t('Any');
} else {
echo '<select name="', $ename, '">', '<option value="0">', t('Any'), '</option>';
foreach ($inputs as $id => $name) {
echo '<option value="', $id, '"';
if ($selected && $id == $selected) {
echo ' SELECTED';
}
echo '>', html_entities($name), '</option>';
}
echo '</select>';
}
}
示例3: _generate_email_markup
function _generate_email_markup($contents)
{
$return = '';
foreach ($contents as $content) {
if (isset($content['tag'])) {
$return .= '<' . $content['tag'];
}
if (isset($content['css'])) {
$return .= ' style="' . htmlentities($content['css']) . '"';
}
if (isset($content['tag'])) {
$return .= '>';
}
foreach ($content as $i => $c) {
if ($i != 'tag' && $i != 'css') {
if (is_array($c)) {
$return .= _generate_email_markup($c);
} else {
$return .= auto_link(html_entities($c));
}
}
}
if (isset($content['tag'])) {
$return .= '</' . $content['tag'] . '>';
}
}
return $return;
}
示例4: getOptionEvent2
function getOptionEvent2()
{
extract(html_entities($_POST));
$q = mysql_query("SELECT * FROM event WHERE `status`='" . $status . "' ORDER BY kode DESC");
while ($r = mysql_fetch_array($q)) {
echo '<option value="' . $r['id'] . '">' . $r['kode'] . ' - ' . $r['nama'] . '</option>';
}
}
示例5: html_encode
function html_encode($str, $skip_html_tag_characters = false)
{
if (!$skip_html_tag_characters) {
return strtr($str, html_entities());
}
$entities = html_entities();
unset($entities['<'], $entities['>'], $entities['"'], $entities["/"]);
return strtr($str, $entities);
}
示例6: html_entities
function html_entities($str)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
$str[$key] = html_entities($val);
}
} else {
$str = htmlentities($str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
}
return $str;
}
示例7: language_select
/**
* Displays a <select> of the available languages
/**/
function language_select()
{
echo '<select name="language">';
foreach (Translate::$Languages as $lang => $details) {
// Print the option
echo '<option value="' . html_entities($lang) . '"';
if ($_SESSION['language'] == $lang) {
echo ' SELECTED';
}
echo '>' . $details[0] . '</option>';
}
echo '</select>';
}
示例8: postMarkup
public function postMarkup($text = null)
{
if ($text == null) {
return false;
}
$text = html_entities($text);
$text = preg_replace('/\\[([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s]+)\\]\\((ftp:\\/\\/|irc:\\/\\/|ircs:\\/\\/|http:\\/\\/|https:\\/\\/)([a-zA-Z0-9\\/\\.\\-_:\\?,\\=]+)\\)/i', '<a href="$2$3" target=_new>$1</a>', $text);
$text = preg_replace('/\\*\\*([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s\\)\\(\\*\\&\\^\\!\\@\\#\\$\\%\\^\\+\\=\\`\\~\\{\\}\\[\\]]+)\\*\\*/i', '<strong>$1</strong>', $text);
$text = preg_replace('/\\-\\-([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s\\)\\(\\*\\&\\^\\!\\@\\#\\$\\%\\^\\+\\=\\`\\~\\{\\}\\[\\]]+)\\-\\-/i', '<del>$1</del>', $text);
$text = preg_replace('/\\`([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s\\)\\(\\*\\&\\^\\!\\@\\#\\$\\%\\^\\+\\=\\`\\~\\{\\}\\[\\]]+)\\`/i', '<code>$1</code>', $text);
$text = preg_replace('/\\~\\~([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s\\)\\(\\*\\&\\^\\!\\@\\#\\$\\%\\^\\+\\=\\`\\~\\{\\}\\[\\]]+)\\~\\~/i', '<em>$1<\\em>', $text);
$text = preg_replace('/\\_\\_([a-zA-Z0-9\\/\\.\\-_:\\?,\\=\\s\\)\\(\\*\\&\\^\\!\\@\\#\\$\\%\\^\\+\\=\\`\\~\\{\\}\\[\\]]+)\\_\\_/i', '<u>$1</u>', $text);
return $text;
}
示例9: host_choices
/**
* Prints out the host choices for this section.
**/
function host_choices()
{
global $Settings_Hosts;
if (is_array($Settings_Hosts)) {
$s = '<form id="host_form" name="host_form" action="' . form_action . '" method="post">' . '<select name="settings_host" onchange="$(\'host_form\').submit()">';
foreach ($Settings_Hosts as $host => $name) {
$s .= '<option value="' . html_entities($host) . '"';
if ($host == $_SESSION['settings']['host']) {
$s .= ' SELECTED';
}
$s .= '>' . html_entities($name) . '</option>';
}
$s .= '<noscript><input type="submit" value="' . t('Set Host') . '"></noscript>';
return $s . '</form>';
} else {
return $Settings_Hosts;
}
}
示例10: shop_url
/**
* phpwcms content management system
*
* @author Oliver Georgi <oliver@phpwcms.de>
* @copyright Copyright (c) 2002-2015, Oliver Georgi
* @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
* @link http://www.phpwcms.de
*
**/
function shop_url($get = '', $type = 'htmlentities')
{
$base = MODULE_HREF;
if (is_array($get) && count($get)) {
$get = implode('&', $get);
} elseif (empty($get)) {
$get = '';
}
if ($get) {
$get = '&' . $get;
}
if (empty($type) || $type != 'htmlentities') {
$base = str_replace('&', '&', MODULE_HREF);
} else {
$get = html_entities($get);
}
return $base . $get;
}
示例11: display_errors
function display_errors($leading = '<p align="center">', $trailing = '</p>')
{
global $Errors, $Warnings;
// Errors or warnings from a previous page?
if (@count($_SESSION['WARNINGS'])) {
foreach ($_SESSION['WARNINGS'] as $warning) {
$Warnings[] = $warning;
}
unset($_SESSION['WARNINGS']);
}
// Nothing to show?
if (empty($Errors) && empty($Warnings)) {
return;
}
// Load the errors
$js_errstr = implode("\n", array_merge($Errors, $Warnings));
$errstr = str_replace("\n", "<br />\n", html_entities($js_errstr));
// Clean up the javascript error string
$js_errstr = str_replace("\n", "\\n", str_replace('"', '\\"', $js_errstr));
// Print
echo <<<EOF
<script language="JavaScript" type="text/javascript">
<!--
on_load.push(display_errors);
function display_errors() { alert("{$js_errstr}"); };
// -->
</script>
<noscript>
{$leading}
<div id="error">
{$errstr}
</div>
{$trailing}
</noscript>
EOF;
}
示例12: t
:</h3>
<dl class="clearfix">
<dt><?php
echo t('Find Day');
?>
:</dt>
<dd><?php
day_select($schedule->findday);
?>
</dd>
<dt><?php
echo t('Find Time');
?>
:</dt>
<dd><input type="text" name="findtime" value="<?php
echo html_entities($schedule->findtime);
?>
" /></dd>
</dl>
</div>
<div class="x-options">
<?php
require_once tmpl_dir . '_advanced_options.php';
?>
</div>
<div id="schedule_submit">
<input type="submit" class="submit" name="save" value="<?php
echo $schedule->recordid ? t('Save Schedule') : t('Create Schedule');
?>
示例13: is_checked
is_checked('1', $plugin['data']['shop_pref_terms_format']);
?>
onchange="enableSubmit();" /></td>
<td class="f10"><label for="pref_terms_html">HTML</label> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="right" class="chatlist tdtop5"><?php
echo $BLM['shopprod_terms'];
?>
: </td>
<td><textarea name="pref_terms" id="pref_terms" class="v12 width375" onchange="enableSubmit();" rows="10"><?php
echo $plugin['data']['shop_pref_terms_format'] ? html_entities($plugin['data']['shop_pref_terms']) : html_specialchars($plugin['data']['shop_pref_terms']);
?>
</textarea></td>
</tr>
<tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>
<tr>
<td align="right" class="chatlist tdtop3"><?php
echo $BLM['shopprod_api'];
?>
: </td>
<td><table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><input type="checkbox" name="pref_api_access" id="pref_api_access" value="1"<?php
is_checked('1', $plugin['data']['shop_pref_api_access']);
示例14: die
<?php
if (!defined('BASEPATH')) {
die('You are not allowed to access this page');
}
if ($_SESSION['member'] == true) {
//if session member
if ($_POST['submit']) {
extract(html_entities($_POST));
$nominal = str_replace(",", "", $nominal);
$picture = "";
$files = $_FILES['upload']['name'];
if ($files != "") {
$source = $_FILES['upload']['tmp_name'];
$ext = end(explode(".", $files));
$picture = "asset/upload/" . md5(time()) . "." . $ext;
move_uploaded_file($source, $picture);
}
$total = str_replace(",", "", $total);
$Qry = "INSERT INTO konfirmasi (order_id, member_id, bank_id, nominal, \n\t\t\ttgl_transfer, nama_akun, no_rekening, nama_bank, gambar, `status`) VALUES \n\t\t\t('" . $order_id . "', '" . $_SESSION['id'] . "', '" . $bank_id . "', \n\t\t\t'" . $nominal . "', '" . $tgl_transfer . "', '" . $nama_akun . "', \n\t\t\t'" . $no_rekening . "', '" . $nama_bank . "', '" . $picture . "', '1')";
$Res = mysql_query($Qry);
if ($Res) {
$message = "<div class='success'>Berhasil mengirim konfirmasi pembayaran..</div>";
} else {
$message = "<div class='error'>" . mysql_error() . "</div>";
}
$_SESSION['msg'] = $message;
header("Location: index.php?p=confirmpayment");
}
?>
示例15: details_list
/**
* The "details list" for each program.
**/
public function details_list()
{
// Start the list, and print the show airtime and title
$str = "<dl class=\"details_list\">\n" . "\t<dt>" . t('Airtime') . ":</dt>\n" . "\t<dd>" . t('$1 to $2', strftime($_SESSION['time_format'], $this->starttime), strftime($_SESSION['time_format'], $this->endtime)) . "</dd>\n" . "\t<dt>" . t('Channel') . ":</dt>\n" . "\t<dd>" . ($_SESSION["prefer_channum"] ? $this->channel->channum : $this->channel->callsign) . ' - ' . $this->channel->name . "</dd>\n" . "\t<dt>" . t('Title') . ":</dt>\n" . "\t<dd>" . html_entities($this->title) . "</dd>\n";
// Subtitle
if (preg_match('/\\S/', $this->subtitle)) {
$str .= "\t<dt>" . t('Subtitle') . ":</dt>\n" . "\t<dd>" . html_entities($this->subtitle) . "</dd>\n";
}
// Description
if (preg_match('/\\S/', $this->fancy_description)) {
$str .= "\t<dt>" . t('Description') . ":</dt>\n" . "\t<dd>" . nl2br(html_entities($this->fancy_description)) . "</dd>\n";
}
// Original Airdate
if (!empty($this->airdate)) {
$str .= "\t<dt>" . t('Original Airdate') . ":</dt>\n" . "\t<dd>" . html_entities($this->airdate) . "</dd>\n";
}
// Category
if (preg_match('/\\S/', $this->category)) {
$str .= "\t<dt>" . t('Category') . ":</dt>\n" . "\t<dd>" . html_entities($this->category) . "</dd>\n";
}
// Will be recorded at some point in the future?
if (!empty($this->will_record)) {
$str .= "\t<dt>" . t('Schedule') . ":</dt>\n" . "\t<dd>";
switch ($this->rectype) {
case rectype_once:
$str .= t('rectype-long: once');
break;
case rectype_daily:
$str .= t('rectype-long: daily');
break;
case rectype_always:
$str .= t('rectype-long: always');
break;
case rectype_weekly:
$str .= t('rectype-long: weekly');
break;
case rectype_findone:
$str .= t('rectype-long: findone');
break;
case rectype_override:
$str .= t('rectype-long: override');
break;
case rectype_dontrec:
$str .= t('rectype-long: dontrec');
break;
default:
$str .= t('Unknown');
}
$str .= "</dd>\n";
}
// Recording Priority
if ($this->recpriority != null) {
$str .= "\t<dt>" . t('Recording Priority') . "</dt><dd>" . $this->recpriority . "</dd>\n";
} elseif ($this->recpriority2 != null) {
$str .= "\t<dt>" . t('Recording Priority') . "</dt><dd>" . $this->recpriority2 . "</dd>\n";
}
// Recording status
if (!empty($this->recstatus)) {
$str .= "\t<dt>" . t('Notes') . ":</dt>\n" . "\t<dd>" . $GLOBALS['RecStatus_Reasons'][$this->recstatus] . "</dd>\n";
}
// Finish off the table and return
$str .= "\n</dl>";
return $str;
}