本文整理汇总了PHP中html_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP html_escape函数的具体用法?PHP html_escape怎么用?PHP html_escape使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->data['page_title'] = 'Контакты';
$this->form_validation->set_rules('username', 'Имя', 'trim|required|min_length[2]|max_length[100]');
$this->form_validation->set_rules('email', 'email', 'trim|required|valid_email|max_length[100]');
$this->form_validation->set_rules('mail', 'сообщение', 'trim|required|min_length[8]|max_length[500]');
$this->form_validation->set_rules('captcha', 'капча', 'trim|required|callback_validateCaptcha');
if ($this->form_validation->run()) {
$subject = 'Сообщение с сайта ' . $this->config->item('base_url');
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>' . $this->input->post('mail') . '</body>
</html>';
if ($this->email->from($this->input->post('email'), $this->input->post('username'))->to($this->siteOptions['admin_mail'])->subject($subject)->message($body)->send()) {
$this->session->set_flashdata('item', 'Ваше сообщение отправлено.');
redirect(base_url('contacts'));
} else {
print_r($this->email->print_debugger());
die;
}
}
$this->load_theme('contacts/index', $this->data);
}
示例2: form_open
function form_open($action = '', $attributes = array(), $hidden = array())
{
$CI =& get_instance();
// If no action is provided then set to the current url
if (!$action) {
$action = current_url($action);
} elseif (strpos($action, '://') === FALSE) {
$action = if_secure_site_url($action);
}
$attributes = _attributes_to_string($attributes);
if (stripos($attributes, 'method=') === FALSE) {
$attributes .= ' method="post"';
}
if (stripos($attributes, 'accept-charset=') === FALSE) {
$attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
}
$form = '<form action="' . $action . '"' . $attributes . ">\n";
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
if ($CI->config->item('csrf_protection') === TRUE && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
// Add MY CSRF token if MY CSRF library is loaded
if ($CI->load->is_loaded('tokens') && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
$hidden[$CI->tokens->name] = $CI->tokens->token();
}
if (is_array($hidden)) {
foreach ($hidden as $name => $value) {
$form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n";
}
}
return $form;
}
示例3: build_thumb_html
/**
* Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks...
*/
public function build_thumb_html(Image $image, $query = null)
{
global $config;
$h_view_link = make_link("post/view/{$image->id}", $query);
$h_thumb_link = $image->get_thumb_link();
// Removes the size tag if the file is an mp3
if ($image->ext == 'mp3') {
$iitip = $image->get_tooltip();
$mp3tip = array("0x0");
$h_tip = str_replace($mp3tip, " ", $iitip);
// Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
$justincase = array(" //", "// ", " //", "// ", " ");
if (strstr($h_tip, " ")) {
$h_tip = html_escape(str_replace($justincase, "", $h_tip));
} else {
$h_tip = html_escape($h_tip);
}
} else {
$h_tip = html_escape($image->get_tooltip());
}
// If file is flash or svg then sets thumbnail to max size.
if ($image->ext == 'swf' || $image->ext == 'svg') {
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
} else {
$tsize = get_thumbnail_size($image->width, $image->height);
}
return "<a class='thumb' href='{$h_view_link}'><img title='{$h_tip}' alt='{$h_tip}' " . "width='{$tsize[0]}' height='{$tsize[1]}' src='{$h_thumb_link}' /></a>";
}
示例4: display_aliases
public function display_aliases(Page $page, $aliases, $is_admin, $pageNumber, $totalPages)
{
if ($is_admin) {
$action = "<th width='10%'>Action</th>";
$add = "\n\t\t\t\t<tr>\n\t\t\t\t\t<form action='" . make_link("alias/add") . "' method='POST'>\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
} else {
$action = "";
$add = "";
}
$h_aliases = "";
$n = 0;
foreach ($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
$oe = $n++ % 2 == 0 ? "even" : "odd";
$h_aliases .= "<tr class='{$oe}'><td>{$h_old}</td><td>{$h_new}</td>";
if ($is_admin) {
$h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<form action='" . make_link("alias/remove") . "' method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
}
$h_aliases .= "</tr>";
}
$html = "\n\t\t\t<script>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#aliases\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t<table id='aliases' class='zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
$bulk_html = "\n\t\t\t<form enctype='multipart/form-data' action='" . make_link("alias/import") . "' method='POST'>\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
if ($is_admin) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
示例5: send
public function send()
{
$this->load->library('email');
$subject = 'This is a test';
$message = '<p>This message has been sent for testing purposes.</p>';
// Get full html:
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
' . $message . '
</body>
</html>';
// Also, for getting full html you may use the following internal method:
//$body = $this->email->full_html($subject, $message);
$result = $this->email->from('himal.shrestha@nyu.edu')->reply_to('rkshrestha.me@gmail.com')->to('rkshrestha.me@gmail.com')->subject($subject)->message($body)->send();
var_dump($result);
echo '<br />';
echo $this->email->print_debugger();
exit;
}
示例6: send
public function send()
{
$this->load->library('email');
$subject = 'Thank you for your submission';
$message = '<p>Dear Himal,</p>';
$message .= '<p>Thank you for contributing to <a href="http://translationnetwork.org">Translation Network</a>. A member of the Network will receive your submission and post it at their earliest convenience.</p>';
$message .= '<p>Check back to see if your submission has been carried over into other languages. We hope you will consider posting something again soon!</p>';
$message .= '<p>Thank You,</p>';
$message .= '<p>Translation Network </p>';
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
' . $message . '
</body>
</html>';
//echo $body;
// Also, for getting full html you may use the following internal method:
//$body = $this->email->full_html($subject, $message);
$result = $this->email->from('submissions@translationnetwork.org', "Translation Network")->reply_to('submissions@translationnetwork.org')->to('himal.shrestha@nyu.edu')->subject($subject)->message($body)->send();
var_dump($result);
echo '<br />';
echo $this->email->print_debugger();
exit;
}
示例7: test
public function test()
{
$this->load->helper('form');
//有一个破坏html的双引号
$string = 'Here is a string containing "quoted" text.';
$string2 = html_escape($string);
echo '<input type="text" name="myfield" value="' . $string2 . '" />';
echo '<br/>';
//创建一个表单
//<form action="http://cyy.com/ci_cms/email/send" method="post" accept-charset="utf-8">
echo form_open('email/send');
echo form_close();
echo '<br/>';
//增加了属性
//<form action="http://cyy.com/ci_cms/email/send" class="email" id="myform" method="post" accept-charset="utf-8">
$attributes = array('class' => 'email', 'id' => 'myform');
echo form_open('email/send', $attributes);
echo form_close();
echo '<br/>';
//给表单添加隐藏域
//
$hidden = array('username' => 'Joe', 'member_id' => '234');
echo form_open('email/send', '', $hidden);
echo form_close();
echo '<br/>';
}
示例8: social_bookmarking_toolbar
function social_bookmarking_toolbar($url, $title, $description = '')
{
$html = '';
$html .= '<!-- AddThis Button BEGIN -->';
$html .= '<div class="addthis_toolbox addthis_default_style addthis_32x32_style"';
$html .= ' addthis:url="' . html_escape($url) . '" addthis:title="' . html_escape($title) . '" addthis:description="' . html_escape($description) . '">';
$html .= '<h2>Social</h2>';
$services = social_bookmarking_get_services();
if ($services) {
$serviceSettings = social_bookmarking_get_service_settings();
$booleanFilter = new Omeka_Filter_Boolean();
foreach ($serviceSettings as $serviceCode => $value) {
if ($booleanFilter->filter($value) && array_key_exists($serviceCode, $services)) {
$html .= '<a class="addthis_button_' . html_escape($serviceCode) . '"></a>';
}
}
} else {
$html .= __('Sociale functies tijdelijk offline.');
}
$html .= '<a class="addthis_button_compact"></a>';
//$html .= '<a class="addthis_counter addthis_bubble_style"></a>';
$html .= '</div>';
$html .= '<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js"></script>';
$html .= '<!-- AddThis Button END -->';
return $html;
}
示例9: display_advanced
public function display_advanced(Page $page, $options)
{
global $user;
$rows = "";
$n = 0;
ksort($options);
foreach ($options as $name => $value) {
$h_value = html_escape($value);
$len = strlen($h_value);
$oe = $n++ % 2 == 0 ? "even" : "odd";
$box = "";
if (strpos($value, "\n") > 0) {
$box .= "<textarea cols='50' rows='4' name='_config_{$name}'>{$h_value}</textarea>";
} else {
$box .= "<input type='text' name='_config_{$name}' value='{$h_value}'>";
}
$box .= "<input type='hidden' name='_type_{$name}' value='string'>";
$rows .= "<tr class='{$oe}'><td>{$name}</td><td>{$box}</td></tr>";
}
$table = "\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#settings\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t" . make_form(make_link("setup/save")) . "\n\t\t\t\t<table id='settings' class='zebra'>\n\t\t\t\t\t<thead><tr><th width='25%'>Name</th><th>Value</th></tr></thead>\n\t\t\t\t\t<tbody>{$rows}</tbody>\n\t\t\t\t\t<tfoot><tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr></tfoot>\n\t\t\t\t</table>\n\t\t\t</form>\n\t\t\t";
$page->set_title("Shimmie Setup");
$page->set_heading("Shimmie Setup");
$page->add_block(new Block("Navigation", $this->build_navigation(), "left", 0));
$page->add_block(new Block("Setup", $table));
}
示例10: display_page
public function display_page($image, $editor_parts)
{
global $page;
$page->set_title("Image {$image->id}: " . html_escape($image->get_tag_list()));
$page->set_heading(html_escape($image->get_tag_list()));
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
}
示例11: comment_to_html
protected function comment_to_html($comment, $trim = false)
{
$inner_id = $this->inner_id;
// because custom themes can't add params, because PHP
global $user;
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
//$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
//$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = $trim ? substr($tfe->stripped, 0, 50) . "..." : $tfe->formatted;
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
$h_userlink = "<a href='" . make_link("user/{$h_name}") . "'>{$h_name}</a>";
$h_date = $comment->posted;
$h_del = $user->can("delete_comment") ? ' - <a onclick="return confirm(\'Delete comment by ' . $h_name . ':\\n' . $stripped_nonl . '\');" ' . 'href="' . make_link('comment/delete/' . $i_comment_id . '/' . $i_image_id) . '">Del</a>' : '';
$h_reply = "[<a href='" . make_link("post/view/{$i_image_id}") . "'>Reply</a>]";
if ($inner_id == 0) {
return "<div class='comment' style='margin-top: 8px;'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>";
} else {
return "<table><tr><td nowrap class='doubledash'>>></td><td>" . "<div class='reply'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>" . "</td></tr></table>";
}
}
示例12: build_navigation
protected function build_navigation($page_number, $total_pages, $search_terms)
{
$h_search_string = count($search_terms) == 0 ? "" : html_escape(implode(" ", $search_terms));
$h_search_link = make_link();
$h_search = "\n\t\t\t<p><form action='{$h_search_link}' method='GET'>\n\t\t\t\t<input name='search' type='text'\n\t\t\t\t\t\tvalue='{$h_search_string}' autocomplete='off' />\n\t\t\t\t<input type='hidden' name='q' value='/post/list'>\n\t\t\t\t<input type='submit' value='Find' style='display: none;' />\n\t\t\t</form>\n\t\t\t<div id='search_completions'></div>";
return $h_search;
}
示例13: display_aliases
/**
* Show a page of aliases.
*
* Note: $can_manage = whether things like "add new alias" should be shown
*
* @param array $aliases An array of ($old_tag => $new_tag)
* @param int $pageNumber
* @param int $totalPages
*/
public function display_aliases($aliases, $pageNumber, $totalPages)
{
global $page, $user;
$can_manage = $user->can("manage_alias_list");
if ($can_manage) {
$h_action = "<th width='10%'>Action</th>";
$h_add = "\n\t\t\t\t<tr>\n\t\t\t\t\t" . make_form(make_link("alias/add")) . "\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
} else {
$h_action = "";
$h_add = "";
}
$h_aliases = "";
foreach ($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
$h_aliases .= "<tr><td>{$h_old}</td><td>{$h_new}</td>";
if ($can_manage) {
$h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t" . make_form(make_link("alias/remove")) . "\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
}
$h_aliases .= "</tr>";
}
$html = "\n\t\t\t<table id='aliases' class='sortable zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$h_action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$h_add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
$bulk_html = "\n\t\t\t" . make_form(make_link("alias/import"), 'post', true) . "\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
if ($can_manage) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
示例14: _display_colorbox_gallery
function _display_colorbox_gallery($images, $mode = null)
{
$mode = $mode != '' ? 'colorbox-' . $mode : 'colorbox';
if (!empty($images)) {
foreach ($images as $image) {
$image_url = image_url($image['image']);
$image_thumb_url = image_process_nowm($image_url, 180, 120);
?>
<div class="image-container">
<a href="<?php
echo $image_url;
?>
" title="<?php
echo isset($image['title']) ? html_escape($image['title']) : '';
?>
" target="blank" rel="<?php
echo html_escape($mode);
?>
"><img src="<?php
echo $image_thumb_url;
?>
" /></a>
</div>
<?php
}
}
}
示例15: display_image
public function display_image(Page $page, Image $image)
{
global $config;
$ilink = $image->get_image_link();
$html = "<img id='main_image' src='{$ilink}'>";
if ($config->get_bool("image_show_meta")) {
# FIXME: only read from jpegs?
$exif = @exif_read_data($image->get_image_filename(), 0, true);
if ($exif) {
$head = "";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
if ($key == "IFD0") {
$head .= html_escape("{$name}: {$val}") . "<br>\n";
}
}
}
if ($head) {
$page->add_block(new Block("EXIF Info", $head, "left"));
}
}
}
$zoom_default = $config->get_bool("image_zoom", false) ? "scale(img);" : "";
$zoom = "<script type=\"text/javascript\">\n\t\t\t\t\timg = document.getElementById(\"main_image\");\n\t\t\t\t\t\n\t\t\t\t\tif(img) {\n\t\t\t\t\t\timg.onclick = function() {scale(img);};\n\t\t\t\t\t\n\t\t\t\t\t\tmsg_div = document.createElement(\"div\");\n\t\t\t\t\t\tmsg_div.id = \"msg_div\";\n\t\t\t\t\t\tmsg_div.appendChild(document.createTextNode(\"Note: Image has been scaled to fit the screen; click to enlarge\"));\n\t\t\t\t\t\tmsg_div.style.display=\"none\";\n\t\t\t\t\t\timg.parentNode.insertBefore(msg_div, img);\n\t\t\t\t\t\n\t\t\t\t\t\torig_width = {$image->width};\n\t\t\t\t\t\n\t\t\t\t\t\t{$zoom_default}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction scale(img) {\n\t\t\t\t\t\tif(orig_width >= img.parentNode.clientWidth * 0.9) {\n\t\t\t\t\t\t\tif(img.style.width != \"90%\") {\n\t\t\t\t\t\t\t\timg.style.width = \"90%\";\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"block\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\timg.style.width = orig_width + 'px';\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"none\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t</script>";
$page->add_block(new Block("Image", $html . $zoom, "main", 0));
}