本文整理汇总了PHP中Fisharebest\Webtrees\Filter::escapeHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::escapeHtml方法的具体用法?PHP Filter::escapeHtml怎么用?PHP Filter::escapeHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Filter
的用法示例。
在下文中一共展示了Filter::escapeHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a branches list controller
*/
public function __construct()
{
global $WT_TREE;
parent::__construct();
$this->surname = Filter::get('surname');
$this->soundex_std = Filter::getBool('soundex_std');
$this->soundex_dm = Filter::getBool('soundex_dm');
if ($this->surname) {
$this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname)));
$this->loadIndividuals();
$self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
if ($self) {
$this->loadAncestors($self, 1);
}
} else {
$this->setPageTitle(I18N::translate('Branches'));
}
}
示例2: printSourceStructure
/**
* Print SOUR structure
* This function prints the input array of SOUR sub-records built by the
* getSourceStructure() function.
*
* @param string[] $textSOUR
*
* @return string
*/
public static function printSourceStructure($textSOUR)
{
global $WT_TREE;
$html = '';
if ($textSOUR['PAGE']) {
$html .= GedcomTag::getLabelValue('PAGE', Filter::expandUrls($textSOUR['PAGE']));
}
if ($textSOUR['EVEN']) {
$html .= GedcomTag::getLabelValue('EVEN', Filter::escapeHtml($textSOUR['EVEN']));
if ($textSOUR['ROLE']) {
$html .= GedcomTag::getLabelValue('ROLE', Filter::escapeHtml($textSOUR['ROLE']));
}
}
if ($textSOUR['DATE'] || count($textSOUR['TEXT'])) {
if ($textSOUR['DATE']) {
$date = new Date($textSOUR['DATE']);
$html .= GedcomTag::getLabelValue('DATA:DATE', $date->display());
}
foreach ($textSOUR['TEXT'] as $text) {
$html .= GedcomTag::getLabelValue('TEXT', Filter::formatText($text, $WT_TREE));
}
}
if ($textSOUR['QUAY'] != '') {
$html .= GedcomTag::getLabelValue('QUAY', GedcomCodeQuay::getValue($textSOUR['QUAY']));
}
return '<div class="indent">' . $html . '</div>';
}
示例3:
<!-- GEDCOM_MEDIA_PATH -->
<?php
if ($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) {
?>
<label>
<input type="checkbox" name="conv_path" value="<?php
echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH'));
?>
">
<?php
echo I18N::translate('Add the GEDCOM media path to filenames');
?>
</label>
<p>
<?php
echo I18N::translate('Media filenames will be prefixed by %s.', '<code dir="ltr">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</code>');
?>
</p>
<?php
}
?>
</div>
</fieldset>
<!-- PRIVACY OPTIONS -->
<fieldset class="form-group">
<legend class="control-label col-sm-3">
<?php
echo I18N::translate('Apply privacy settings');
?>
</legend>
示例4: getMenuAsList
/**
* Render this menu as an HTML list
*
* @return string
*/
public function getMenuAsList()
{
$attrs = '';
foreach ($this->attrs as $key => $value) {
$attrs .= ' ' . $key . '="' . Filter::escapeHtml($value) . '"';
}
if ($this->link) {
$link = ' href="' . $this->link . '"';
} else {
$link = '';
}
$html = '<a' . $link . $attrs . '>' . $this->label . '</a>';
if ($this->submenus) {
$html .= '<ul>';
foreach ($this->submenus as $submenu) {
$html .= $submenu->getMenuAsList();
}
$html .= '</ul>';
}
return '<li class="' . $this->class . '">' . $html . '</li>';
}
示例5: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
global $ctype, $WT_TREE;
switch (Filter::get('action')) {
case 'deletenews':
$news_id = Filter::getInteger('news_id');
if ($news_id) {
Database::prepare("DELETE FROM `##news` WHERE news_id = ?")->execute(array($news_id));
}
break;
}
$articles = Database::prepare("SELECT SQL_CACHE news_id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) + :offset AS updated, subject, body FROM `##news` WHERE user_id = :user_id ORDER BY updated DESC")->execute(array('offset' => WT_TIMESTAMP_OFFSET, 'user_id' => Auth::id()))->fetchAll();
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = $this->getTitle();
$content = '';
if (empty($articles)) {
$content .= '<p>' . I18N::translate('You have not created any journal items.') . '</p>';
}
foreach ($articles as $article) {
$content .= '<div class="journal_box">';
$content .= '<div class="news_title">' . Filter::escapeHtml($article->subject) . '</div>';
$content .= '<div class="news_date">' . FunctionsDate::formatTimestamp($article->updated) . '</div>';
if ($article->body == strip_tags($article->body)) {
$article->body = nl2br($article->body, false);
}
$content .= $article->body;
$content .= '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $article->news_id . ', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Edit') . '</a>';
$content .= ' | ';
$content .= '<a href="index.php?action=deletenews&news_id=' . $article->news_id . '&ctype=' . $ctype . '&ged=' . $WT_TREE->getNameHtml() . '" onclick="return confirm(\'' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeHtml($article->subject)) . "');\">" . I18N::translate('Delete') . '</a><br>';
$content .= '</div><br>';
}
$content .= '<p><a href="#" onclick="window.open(\'editnews.php?user_id=' . Auth::id() . '\', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Add a journal entry') . '</a></p>';
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例6: foreach
}
echo '</div>';
}
// Output Media
if ($type === 'media') {
$medialist = QueryMedia::mediaList('', 'include', 'title', $filter, '');
echo '<div id="find-output">';
if ($medialist) {
foreach ($medialist as $media) {
echo '<div class="find-media-media">';
echo '<div class="find-media-thumb">', $media->displayImage(), '</div>';
echo '<div class="find-media-details">', $media->getFullName(), '</div>';
if (!$embed) {
echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>';
} else {
echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', Filter::escapeJs($media->getFilename()), '\');">', Filter::escapeHtml($media->getFilename()), '</a></p> ';
}
if ($media->fileExists()) {
$imgsize = $media->getImageAttributes();
echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
}
echo '<ul>';
$found = false;
foreach ($media->linkedIndividuals('OBJE') as $indindividual) {
echo '<li>', $indindividual->getFullName(), '</li>';
$found = true;
}
foreach ($media->linkedFamilies('OBJE') as $family) {
echo '<li>', $family->getFullName(), '</li>';
$found = true;
}
示例7: getAlphaSurnames
/**
* Get the initial letters of surnames.
*
* @param Tree $tree
* @param string $alpha
*
* @return string
*/
private function getAlphaSurnames(Tree $tree, $alpha)
{
$surnames = QueryName::surnames($tree, '', $alpha, true, false);
$out = '<ul>';
foreach (array_keys($surnames) as $surname) {
$out .= '<li class="sb_indi_surname_li"><a href="#" data-surname="' . Filter::escapeHtml($surname) . '" data-alpha="' . Filter::escapeHtml($alpha) . '" class="sb_indi_surname">' . Filter::escapeHtml($surname) . '</a>';
$out .= '<div class="name_tree_div"></div>';
$out .= '</li>';
}
$out .= '</ul>';
return $out;
}
示例8: foreach
<?php
echo I18N::translate('Nothing found to cleanup');
?>
<?php
}
?>
</p>
</form>
<?php
break;
case 'cleanup2':
foreach (User::all() as $user) {
if (Filter::post('del_' . $user->getUserId()) == '1') {
Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
$user->delete();
I18N::translate('The user %s has been deleted.', Filter::escapeHtml($user->getUserName()));
}
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
break;
default:
$controller->setPageTitle(I18N::translate('User administration'))->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript('
jQuery(".table-user-list").dataTable({
' . I18N::datatablesI18N() . ',
stateSave: true,
stateDuration: 300,
processing: true,
serverSide: true,
ajax: {
"url": "' . WT_SCRIPT_NAME . '?action=load_json",
"type": "POST"
示例9: printTimeFact
/**
* Print a fact for an individual.
*
* @param Fact $event
*/
public function printTimeFact(Fact $event)
{
global $basexoffset, $baseyoffset, $factcount, $placements;
$desc = $event->getValue();
// check if this is a family fact
$gdate = $event->getDate();
$date = $gdate->minimumDate();
$date = $date->convertToCalendar('gregorian');
$year = $date->y;
$month = max(1, $date->m);
$day = max(1, $date->d);
$xoffset = $basexoffset + 22;
$yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
$yoffset = $yoffset + $month / 12 * $this->scale;
$yoffset = $yoffset + $day / 30 * ($this->scale / 12);
$yoffset = (int) $yoffset;
$place = (int) ($yoffset / $this->bheight);
$i = 1;
$j = 0;
$tyoffset = 0;
while (isset($placements[$place])) {
if ($i === $j) {
$tyoffset = $this->bheight * $i;
$i++;
} else {
$tyoffset = -1 * $this->bheight * $j;
$j++;
}
$place = (int) (($yoffset + $tyoffset) / $this->bheight);
}
$yoffset += $tyoffset;
$xoffset += abs($tyoffset);
$placements[$place] = $yoffset;
echo "<div id=\"fact{$factcount}\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . $xoffset : 'right: ' . $xoffset) . 'px; top:' . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">";
echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: hand;"><tr><td>';
echo '<img src="' . Theme::theme()->parameter('image-hline') . '" name="boxline' . $factcount . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-';
if (I18N::direction() === 'ltr') {
echo 'left: 3px;">';
} else {
echo 'right: 3px;">';
}
$col = array_search($event->getParent(), $this->people);
if ($col === false) {
// Marriage event - use the color of the husband
$col = array_search($event->getParent()->getHusband(), $this->people);
}
if ($col === false) {
// Marriage event - use the color of the wife
$col = array_search($event->getParent()->getWife(), $this->people);
}
$col = $col % 6;
echo '</td><td class="person' . $col . '">';
if (count($this->people) > 6) {
// We only have six colours, so show naes if more than this number
echo $event->getParent()->getFullName() . ' — ';
}
$record = $event->getParent();
echo $event->getLabel();
echo ' — ';
if ($record instanceof Individual) {
echo FunctionsPrint::formatFactDate($event, $record, false, false);
} elseif ($record instanceof Family) {
echo $gdate->display();
if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) {
$ageh = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getHusband()->getBirthDate(), $gdate));
} else {
$ageh = null;
}
if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) {
$agew = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getWife()->getBirthDate(), $gdate));
} else {
$agew = null;
}
if ($ageh && $agew) {
echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $ageh, ' ', I18N::translate('Wife’s age'), ' ', $agew, '</span>';
} elseif ($ageh) {
echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>';
} elseif ($agew) {
echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>';
}
}
echo ' ' . Filter::escapeHtml($desc);
if (!$event->getPlace()->isEmpty()) {
echo ' — ' . $event->getPlace()->getShortName();
}
// Print spouses names for family events
if ($event->getParent() instanceof Family) {
echo ' — <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>';
}
echo '</td></tr></table>';
echo '</div>';
if (I18N::direction() === 'ltr') {
$img = 'image-dline2';
$ypos = '0%';
} else {
//.........这里部分代码省略.........
示例10: getInitialLettersList
/**
* Get the list of initial letters
*
* @return string[]
*/
private function getInitialLettersList()
{
$list = array();
/** @var \Fisharebest\Webtrees\Tree $tree */
$tree = $this->data->get('tree');
$script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage';
foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) {
switch ($letter) {
case '@':
$html = I18N::translateContext('Unknown surname', '…');
break;
case ',':
$html = I18N::translate('None');
break;
default:
$html = Filter::escapeHtml($letter);
break;
}
if ($count) {
if ($letter == $this->data->get('alpha')) {
$list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>';
} else {
$list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>';
}
} else {
$list[] = $html;
}
}
// Search spiders don't get the "show all" option as the other links give them everything.
if (!Auth::isSearchEngine()) {
if ($this->data->get('show_all') === 'yes') {
$list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
} else {
$list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>';
}
}
return $list;
}
示例11: displayImage
/**
* Display an image-thumbnail or a media-icon, and add markup for image viewers such as colorbox.
*
* @return string
*/
public function displayImage()
{
if ($this->isExternal() || !file_exists($this->getServerFilename('thumb'))) {
// Use an icon
$mime_type = str_replace('/', '-', $this->mimeType());
$image = '<i' . ' dir="' . 'auto' . '"' . ' class="' . 'icon-mime-' . $mime_type . '"' . ' title="' . strip_tags($this->getFullName()) . '"' . '></i>';
} else {
$imgsize = getimagesize($this->getServerFilename('thumb'));
// Use a thumbnail image
$image = '<img' . ' dir="' . 'auto' . '"' . ' src="' . $this->getHtmlUrlDirect('thumb') . '"' . ' alt="' . strip_tags($this->getFullName()) . '"' . ' title="' . strip_tags($this->getFullName()) . '"' . ' ' . $imgsize[3] . '>';
}
return '<a' . ' class="' . 'gallery' . '"' . ' href="' . $this->getHtmlUrlDirect('main') . '"' . ' type="' . $this->mimeType() . '"' . ' data-obje-url="' . $this->getHtmlUrl() . '"' . ' data-obje-note="' . Filter::escapeHtml($this->getNote()) . '"' . ' data-title="' . Filter::escapeHtml($this->getFullName()) . '"' . '>' . $image . '</a>';
}
示例12: elseif
echo Filter::escapeHtml(Site::getPreference('STATCOUNTER_PROJECT_ID'));
?>
" maxlength="255" pattern="[0-9]+">
</div>
</div>
<!-- STATCOUNTER_SECURITY_ID -->
<div class="form-group">
<label for="STATCOUNTER_SECURITY_ID" class="col-sm-3 control-label">
<?php
echo I18N::translate('Security code');
?>
</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="STATCOUNTER_SECURITY_ID" name="STATCOUNTER_SECURITY_ID" value="<?php
echo Filter::escapeHtml(Site::getPreference('STATCOUNTER_SECURITY_ID'));
?>
" maxlength="255" pattern="[0-9a-zA-Z]+">
<p class="small text-muted">
<?php
echo I18N::translate('Tracking and analytics are not added to the control panel.');
?>
</p>
</div>
</div>
<?php
} elseif (Filter::get('action') === 'languages') {
?>
<input type="hidden" name="action" value="languages">
示例13: renderContent
//.........这里部分代码省略.........
}
if ($num == $person->getPrimaryName()) {
$class = ' class="name2"';
$sex_image = $person->getSexImage();
list($surn, $givn) = explode(',', $name['sort']);
} else {
$class = '';
$sex_image = '';
}
?>
<a <?php
echo $title . ' ' . $class;
?>
href="<?php
echo $person->getHtmlUrl();
?>
">
<?php
echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
?>
</a>
<?php
echo $sex_image . FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller');
?>
<br/>
<?php
}
echo $person->getPrimaryParentsNames('parents details1', 'none');
?>
</td>
<td style="display:none;"></td>
<td>
<?php
echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
?>
</td>
<td>
<?php
echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
?>
</td>
<td>
<?php
if ($birth_dates = $person->getAllBirthDates()) {
foreach ($birth_dates as $num => $birth_date) {
if ($num) {
?>
<br/><?php
}
?>
<?php
echo $birth_date->display(true);
}
} else {
$birth_date = new Date('');
if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
$birth_date = $person->getEstimatedBirthDate();
echo $birth_date->display(true);
} else {
echo ' ';
}
$birth_dates[0] = new Date('');
}
?>
</td>
<td><?php
示例14:
?>
</p>
<label for="GEDCOM_MEDIA_PATH">
<?php
echo I18N::translate('Remove the GEDCOM media path from filenames');
?>
</label>
<input
class="form-control"
dir="ltr"
id="GEDCOM_MEDIA_PATH"
maxlength="255"
name="GEDCOM_MEDIA_PATH"
type="text"
value="<?php
echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH'));
?>
"
>
<p class="small text-muted">
<?php
echo I18N::translate('Some genealogy software creates GEDCOM files that contain media filenames with full paths. These paths will not exist on the web-server. To allow webtrees to find the file, the first part of the path must be removed.');
?>
<?php
echo I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>');
?>
</p>
</div>
</fieldset>
<div class="form-group">
示例15: printPlace
/**
* Print places
*
* @param Place $place
* @param type $tree
* @return string
*/
private function printPlace($place, $tree)
{
if ($this->options('show_places') == true) {
$place = new Place($place, $tree);
$html = ' ' . I18N::translateContext('before placesnames', 'in ');
if ($this->options('use_gedcom_places') == true) {
$html .= $place->getShortName();
} else {
$country = $this->options('country');
$new_place = array_reverse(explode(", ", $place->getGedcomName()));
if (!empty($country) && $new_place[0] == $country) {
unset($new_place[0]);
$html .= '<span dir="auto">' . Filter::escapeHtml(implode(', ', array_reverse($new_place))) . '</span>';
} else {
$html .= $place->getFullName();
}
}
return $html;
}
}