本文整理汇总了PHP中xml_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_escape函数的具体用法?PHP xml_escape怎么用?PHP xml_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_table
function print_table($name, $campaign_list)
{
echo ' <div class="BlueBox">' . "\n";
echo ' <h2>' . xml_escape($name) . '</h2>' . "\n";
echo ' <table width="90%" cellpadding="3" align="center">' . "\n";
echo ' <thead>' . "\n";
echo ' <tr>' . "\n";
echo ' <th width="80%">Name</th>' . "\n";
echo ' <th width="20%">Petitioned</th>' . "\n";
echo ' </tr>' . "\n";
echo ' </thead>' . "\n";
echo ' <tbody>' . "\n";
foreach ($campaign_list as $key => $campaign) {
echo ' <tr>' . "\n";
echo ' <td><a href="/office/campaign/editarticle/' . $key . '">' . xml_escape($campaign['name']) . '</a></td>' . "\n";
if ($campaign['has_been_petitioned'] == 1) {
echo ' <td>yes</td>' . "\n";
} else {
echo ' <td>no</td>' . "\n";
}
echo ' </tr>' . "\n";
}
echo ' </tbody>' . "\n";
echo ' </table>' . "\n";
echo ' </div>' . "\n";
}
示例2: SetWikiparser
function SetWikiparser($wiki = null, $preview = true)
{
$this->wikiparser = $wiki;
$this->preview = $preview;
// Generate preview for ajax?
if ($preview && isset($_GET['input_wikitext_preview_field']) && $_GET['input_wikitext_preview_field'] == $this->name) {
if (null === $this->wikiparser) {
get_instance()->load->library('Wikiparser');
$parser = new Wikiparser();
} else {
$parser =& $this->wikiparser;
}
if (isset($_POST['input_wikitext_preview'])) {
$xml = $parser->parse($_POST['input_wikitext_preview']);
} else {
$xml = "POST input_wikitext_preview missing";
}
header('content-type: text/xml');
?>
<<?php
?>
?xml version="1.0" encoding="UTF-8"?><?php
?>
<wikitext><?php
echo xml_escape($xml);
?>
</wikitext><?php
exit(0);
}
}
示例3: printInput
function printInput($title, $name, $type, $value, $section, $access, $user_level)
{
$name = xml_escape($name);
$title = xml_escape($title);
$value = xml_escape($value);
if ($type != 'submit') {
echo '<label for="' . $name . '">' . $title . ':</label>';
}
if ($access[$section][$user_level]) {
switch ($type) {
case 'textarea':
echo '<textarea name="' . $name . '" id="' . $name . '" cols="25" rows="5">' . $value . '</textarea>';
break;
case 'submit':
echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" value="' . $value . '" class="button" />';
break;
default:
echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" value="' . $value . '" size="30" />';
break;
}
} else {
if ($type != 'submit') {
echo '<div id="' . $name . '" style="float:left;margin:5px 10px;">' . $value . '</div>';
}
}
echo '<br />';
}
示例4: printarticlelink
function printarticlelink($article)
{
echo ' <div style="border-bottom:1px #999 solid;">' . "\n";
echo ' <a href="/news/' . $article['type_codename'] . '/';
if (!empty($article['organisation_codename'])) {
echo $article['organisation_codename'] . '/';
}
//for reviews
echo $article['id'] . '">' . "\n";
echo ' ' . $article['photo_xhtml'] . "\n";
echo ' </a>' . "\n";
echo ' <div class="ArticleEntry">' . "\n";
echo ' <h3 class="Headline">' . "\n";
if (!empty($article['organisation_codename'])) {
//If the article has an org name, it is a review.
echo ' <a href="/reviews/' . $article['type_codename'] . '/' . $article['organisation_codename'] . '/';
} else {
echo ' <a href="/news/' . $article['type_codename'] . '/';
}
echo $article['id'] . '">' . "\n";
echo ' ' . xml_escape($article['heading']) . "\n";
echo ' </a>' . "\n";
echo ' </h3>' . "\n";
echo ' <div class="Section" style="float:right;">' . xml_escape($article['type_name']) . '</div>' . "\n";
echo ' <div class="Date">' . date('D, jS F Y', $article['date']) . '</div>' . "\n";
echo ' <div class="Author">' . "\n";
foreach ($article['reporters'] as $reporter) {
echo ' <a href="/news/archive/reporter/' . $reporter['id'] . '/">' . xml_escape($reporter['name']) . '</a>' . "\n";
}
echo ' </div>' . "\n";
echo ' </div>' . "\n";
echo ' <p>' . xml_escape($article['blurb']) . '</p>' . "\n";
echo ' </div>' . "\n";
}
示例5: log
function log()
{
if (!CheckPermissions('admin')) {
return;
}
$this->load->helper('url');
$bulk = 'Valid logs are ' . anchor('admin/dev/log/web/', 'log/web') . ' and ' . anchor('admin/dev/log/irc/', 'log/irc') . '.';
$segments = $this->uri->segment_array();
switch ($this->uri->segment(4)) {
case "web":
$web = dir('../log');
while (false !== ($entry = $web->read())) {
if ($entry != '.' or $entry != '..') {
$bulk .= '<p>' . anchor('admin/dev/log/web/' . $entry, $entry) . '</p>';
}
}
if ($this->uri->segment(5)) {
$bulk .= nl2br(file_get_contents('../log/' . $this->uri->segment(5)));
}
break;
case "irc":
$irc = dir('../supybot/logs/ChannelLogger/afsmg/#theyorker');
while (false !== ($entry = $irc->read())) {
$entry = trim($entry, '#');
$bulk .= '<p>' . anchor('admin/dev/log/irc/' . $entry, $entry) . '</p>';
}
if ($this->uri->segment(5)) {
$bulk .= nl2br(xml_escape(file_get_contents('../supybot/logs/ChannelLogger/afsmg/#theyorker/#' . $this->uri->segment(5))));
}
break;
}
$this->main_frame->SetContent(new SimpleView($bulk));
$this->main_frame->SetTitle('Log Viewer');
$this->main_frame->Load();
}
示例6: printarticlelink
function printarticlelink($article)
{
echo ' <div class="Entry">' . "\n";
echo ' <a href="/news/' . $article['article_type'] . '/' . $article['id'] . '">' . "\n";
echo ' ' . $article['photo_xhtml'] . "\n";
echo ' </a>' . "\n";
if (!array_key_exists('blurb', $article)) {
echo ' <div class="ArticleEntry">' . "\n";
}
echo ' <h3 class="Headline">' . "\n";
echo ' <a href="/news/' . $article['article_type'] . '/' . $article['id'] . '">' . "\n";
echo ' ' . xml_escape($article['heading']) . "\n";
echo ' </a>' . "\n";
echo ' </h3>' . "\n";
echo ' <div class="Date">' . $article['date'] . '</div>' . "\n";
echo ' <div class="Author">' . "\n";
foreach ($article['authors'] as $reporter) {
echo ' <a href="/news/archive/reporter/' . $reporter['id'] . '/">' . xml_escape($reporter['name']) . '</a>' . "\n";
}
echo ' </div>' . "\n";
if (!array_key_exists('blurb', $article)) {
echo ' </div>' . "\n";
}
if (array_key_exists('blurb', $article) && $article['blurb'] != '') {
echo ' <p>' . xml_escape($article['blurb']) . '</p>' . "\n";
}
echo ' </div>' . "\n";
}
示例7: write_xml
function write_xml($subtags, $label = NULL)
{
if (NULL !== $subtags) {
if (NULL !== $label) {
$attributes = '';
if (is_array($subtags) && isset($subtags['_attr']) && is_array($subtags['_attr'])) {
foreach ($subtags['_attr'] as $attribute => $value) {
$attributes .= " {$attribute}=\"" . xml_escape($value) . '"';
}
}
echo '<' . $label . $attributes . '>';
}
if (is_array($subtags)) {
foreach ($subtags as $tag => $content) {
if (substr($tag, 0, 1) == '_') {
continue;
}
if (is_numeric($tag)) {
if (is_array($content) && isset($content['_tag'])) {
$tag = $content['_tag'];
} else {
$tag = NULL;
}
}
write_xml($content, $tag);
}
} else {
echo xml_escape($subtags);
}
if (NULL !== $label) {
echo '</' . $label . '>';
}
}
}
示例8: DoTeam
function DoTeam($team, $in_list = TRUE)
{
if ($in_list) {
echo '<li>';
}
if (isset($team['notices'])) {
echo '<a href="">';
}
echo xml_escape($team['name']);
if (isset($team['notices'])) {
echo ' (' . count($team['notices']) . ' notices)';
echo '</a>';
}
if (!empty($team['subteams'])) {
echo '<ul>';
foreach ($team['subteams'] as $subteam) {
DoTeam($subteam);
}
echo '</ul>';
}
if ($in_list) {
echo '</li>';
}
return count($team['subteams']);
}
示例9: dir_walk
function dir_walk($path = '', $depth = 0)
{
if ($path == '') {
$apath = './';
} else {
if (substr($path, -1, 1) != '/') {
$path .= '/';
}
$apath = $path;
}
$out = array();
$ds = utf8_encode(str_repeat("� � ", $depth));
foreach (scandir($apath) as $v) {
if (substr($v, 0, 1) == '.') {
continue;
}
if (is_dir($apath . $v)) {
printf("%s+ <b>%s</b><br/>\n", $ds, xml_escape($path . $v));
dir_walk($path . $v, $depth + 1);
print "<br/>\n";
} else {
if (ext($v) == 'pyc' || $path == '' && $v == 'index.php') {
continue;
}
$out[] = $v;
}
}
foreach ($out as $file) {
printf("%s<a href=\"?sauce=%s\">%s</a><br/>\n", $ds, urlencode($path . $file), xml_escape($file));
}
}
示例10: ArticleList
function ArticleList($section, $articles, $last = false)
{
if (count($articles) == 0) {
return;
}
?>
<div class="ArticleListBox FlexiBox Box13<?php
if ($last) {
echo ' FlexiBoxLast';
}
?>
">
<div class="ArticleListTitle">
<a href="/news/<?php
echo $articles[0]['article_type'] . '/' . $articles[0]['id'];
?>
">latest <?php
echo $section;
?>
</a>
</div>
<?php
foreach ($articles as $article) {
?>
<div>
<a href="/news/<?php
echo xml_escape($article['article_type'] . '/' . $article['id']);
?>
">
<img src="/photos/small/<?php
echo xml_escape($article['photo_id']);
?>
" alt="<?php
echo xml_escape($article['photo_title']);
?>
" title="<?php
echo xml_escape($article['photo_title']);
?>
" />
<?php
echo xml_escape($article['heading']);
?>
</a>
<div class="Date"><?php
echo xml_escape($article['date']);
?>
</div>
<div class="clear"></div>
</div>
<?php
}
?>
</div>
<?php
if ($last) {
?>
<div class="clear"></div><?php
}
}
示例11: __construct
/**
* @param $Keys array with keys 'userid', 'occid'.
*/
function __construct($Keys, $Extra = NULL)
{
parent::__construct(self::$notTypeInfo, $Keys);
if (NULL !== $Extra) {
$CI =& get_instance();
$this->SetData('Custom', '<p>Summary: <strong><a href="' . site_url($Extra['link']) . $CI->uri->uri_string() . '">' . xml_escape($Extra['name']) . '</a></strong>');
}
}
示例12: PrintTextArea
function PrintTextArea($input_name, $item, $sessionvar)
{
echo '<label for="' . $input_name . '">' . $item . '</label>';
echo '<textarea name="' . $input_name . '" id="' . $input_name . '" cols="25" rows="5">';
if (isset($_SESSION[$sessionvar][$input_name])) {
echo xml_escape($_SESSION[$sessionvar][$input_name]);
}
echo '</textarea>';
}
示例13: ListExperiments
function ListExperiments(&$list, &$query)
{
global $item_tag;
global $item_title;
foreach ($list as $eid => $exp) {
$exp_name = xml_escape($exp["name"]);
$equery = $query . "__" . $exp['start'] . "-" . $exp['stop'];
$res .= "<{$item_tag} {$item_title}=\"{$exp_name}\" id=\"SetQuery__{$equery}\"/>";
}
return $res;
}
示例14: PrintRequestList
function PrintRequestList($data, $AssignedColumn = FALSE)
{
$colCount = 5;
$colCount = floor(100 / $colCount);
echo ' <div class="ArticleBox">' . "\n";
echo ' <table>' . "\n";
echo ' <thead>' . "\n";
echo ' <tr>' . "\n";
echo ' <th style="width:' . $colCount . '%;">Request Title</th>' . "\n";
echo ' <th style="width:' . $colCount . '%;">Photographer</th>' . "\n";
echo ' <th style="width:' . $colCount . '%;">Status</th>' . "\n";
echo ' <th style="width:' . $colCount . '%;">Submission Date</th>' . "\n";
echo ' <th style="width:' . $colCount . '%;text-align:right;">Article Deadline</th>' . "\n";
echo ' </tr>' . "\n";
echo ' </thead>' . "\n";
echo ' <tbody>' . "\n";
$RowStyle = FALSE;
if (count($data) == 0) {
echo ' <tr>';
echo ' <td colspan="0" style="text-align:center; font-style:italic;">No requests in this section...</td>';
echo ' </tr>';
} else {
foreach ($data as $row) {
echo ' <tr ';
if ($RowStyle) {
echo 'class="tr2"';
}
echo '>' . "\n";
echo ' <td><a href="/office/photos/view/' . $row['id'] . '/"><img src="/images/prototype/news/photo-small.gif" alt="Photo Request" title="Photo Request" /> ' . xml_escape($row['title']) . '</a></td>' . "\n";
echo ' <td>';
if ($row['user_name'] != '') {
echo '<img src="/images/prototype/news/person.gif" alt="Photographer" title="Photographer" /> ' . xml_escape($row['user_name']);
}
echo '</td>' . "\n";
echo ' <td>';
if ($row['user_status'] != '') {
echo '<img src="/images/prototype/news/' . xml_escape($row['user_status']) . '.gif" alt="' . xml_escape($row['user_status']) . '" title="' . xml_escape($row['user_status']) . '" /> ' . xml_escape($row['user_status']);
}
echo '</td>';
echo ' <td>' . date('d/m/y @ H:i', $row['time']) . '</td>' . "\n";
echo ' <td style="text-align:right;';
if (mktime() > $row['deadline']) {
echo 'color:red;';
}
echo '">' . date('d/m/y @ H:i', $row['deadline']) . '</td>' . "\n";
echo ' </tr>' . "\n";
$RowStyle = !$RowStyle;
}
}
echo ' </tbody>' . "\n";
echo ' </table>' . "\n";
echo ' </div>' . "\n";
}
示例15: EchoTeamFilterOptions
function EchoTeamFilterOptions($team, $prefix = '', $path = '', $indentation = 0)
{
foreach ($team['subteams'] as $subteam) {
echo '<option name="team_' . $subteam['id'] . '">' . "\n";
//echo str_repeat(' ',$indentation);
echo xml_escape($prefix . $path . $subteam['name']) . "\n";
echo '</option>' . "\n";
if (!empty($subteam['subteams'])) {
EchoTeamFilterOptions($subteam, $prefix, $path . $subteam['name'] . '/', $indentation + 1);
}
}
}