Template escaping
This commit is contained in:
@@ -23,10 +23,11 @@ $src = null;
|
||||
$lightbox = $link->isEmpty();
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$src = $block->src();
|
||||
$src = $block->src();
|
||||
$srcValue = $src->escape('attr');
|
||||
} elseif ($image = $block->image()->toFile()) {
|
||||
$alt = $alt->or($image->alt());
|
||||
$src = $image->url();
|
||||
$src = $srcValue = $image->url();
|
||||
}
|
||||
|
||||
if ($ratio !== 'auto') {
|
||||
@@ -44,10 +45,10 @@ $attrs = attr([
|
||||
]);
|
||||
|
||||
?>
|
||||
<?php if ($src): ?>
|
||||
<?php if ($srcValue): ?>
|
||||
<figure>
|
||||
<a <?= $attrs ?>>
|
||||
<img src="<?= $src ?>" alt="<?= $alt ?>">
|
||||
<img src="<?= $srcValue ?>" alt="<?= esc($alt, 'attr') ?>">
|
||||
</a>
|
||||
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
|
@@ -23,7 +23,7 @@
|
||||
<h2>Pages</h2>
|
||||
<ul>
|
||||
<?php foreach ($site->children()->listed() as $example): ?>
|
||||
<li><a href="<?= $example->url() ?>"><?= $example->title()->html() ?></a></li>
|
||||
<li><a href="<?= $example->url() ?>"><?= $example->title()->esc() ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
site and the title of the current page
|
||||
*/
|
||||
?>
|
||||
<title><?= $site->title() ?> | <?= $page->title() ?></title>
|
||||
<title><?= $site->title()->esc() ?> | <?= $page->title()->esc() ?></title>
|
||||
|
||||
<?php
|
||||
/*
|
||||
@@ -60,7 +60,7 @@
|
||||
*/
|
||||
?>
|
||||
<a class="logo" href="<?= $site->url() ?>">
|
||||
<?= $site->title()->html() ?>
|
||||
<?= $site->title()->esc() ?>
|
||||
</a>
|
||||
|
||||
<nav class="menu">
|
||||
@@ -78,7 +78,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($site->children()->listed() as $item): ?>
|
||||
<a <?php e($item->isOpen(), 'aria-current ') ?> href="<?= $item->url() ?>"><?= $item->title()->html() ?></a>
|
||||
<a <?php e($item->isOpen(), 'aria-current ') ?> href="<?= $item->url() ?>"><?= $item->title()->esc() ?></a>
|
||||
<?php endforeach ?>
|
||||
<?php snippet('social') ?>
|
||||
</nav>
|
||||
|
@@ -13,8 +13,8 @@
|
||||
*/
|
||||
?>
|
||||
<header class="h1">
|
||||
<h1><?= $page->headline()->or($page->title())->html() ?></h1>
|
||||
<h1><?= $page->headline()->or($page->title())->esc() ?></h1>
|
||||
<?php if ($page->subheadline()->isNotEmpty()): ?>
|
||||
<p class="color-grey"><?= $page->subheadline()->html() ?></p>
|
||||
<p class="color-grey"><?= $page->subheadline()->esc() ?></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
|
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($field->toLayouts() as $layout): ?>
|
||||
<section class="grid margin-xl" id="<?= $layout->id() ?>" style="--gutter: 1.5rem">
|
||||
<section class="grid margin-xl" id="<?= esc($layout->id(), 'attr') ?>" style="--gutter: 1.5rem">
|
||||
<?php foreach ($layout->columns() as $column): ?>
|
||||
<div class="column" style="--columns:<?= $column->span() ?>">
|
||||
<div class="column" style="--columns:<?= esc($column->span(), 'css') ?>">
|
||||
<div class="text">
|
||||
<?= $column->blocks() ?>
|
||||
</div>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
|
||||
<h2 class="note-excerpt-title"><?= $note->title() ?></h2>
|
||||
<h2 class="note-excerpt-title"><?= $note->title()->esc() ?></h2>
|
||||
<time class="note-excerpt-date" datetime="<?= $note->published('c') ?>"><?= $note->published() ?></time>
|
||||
</header>
|
||||
<?php if (($excerpt ?? true) !== false): ?>
|
||||
|
@@ -33,15 +33,15 @@
|
||||
</section>
|
||||
<section class="column text" style="--columns: 4">
|
||||
<h3>Email</h3>
|
||||
<p><?= html::email($page->email()) ?></p>
|
||||
<p><?= Html::email($page->email()) ?></p>
|
||||
<h3>Phone</h3>
|
||||
<p><?= html::tel($page->phone()) ?></p>
|
||||
<p><?= Html::tel($page->phone()) ?></p>
|
||||
</section>
|
||||
<section class="column text" style="--columns: 4">
|
||||
<h3>On the web</h3>
|
||||
<ul>
|
||||
<?php foreach ($page->social()->toStructure() as $social): ?>
|
||||
<li><?= html::a($social->url(), $social->platform()) ?></li>
|
||||
<li><?= Html::a($social->url(), $social->platform()) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<?php snippet('header') ?>
|
||||
|
||||
<article>
|
||||
<h1 class="h1"><?= $page->title()->html() ?></h1>
|
||||
<h1 class="h1"><?= $page->title()->esc() ?></h1>
|
||||
<div class="text">
|
||||
<?= $page->text()->kt() ?>
|
||||
</div>
|
||||
|
@@ -48,7 +48,7 @@
|
||||
<?php endif ?>
|
||||
<figcaption>
|
||||
<span>
|
||||
<span class="example-name"><?= $album->title()->html() ?></span>
|
||||
<span class="example-name"><?= $album->title()->esc() ?></span>
|
||||
</span>
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
@@ -31,9 +31,9 @@
|
||||
|
||||
<article class="note">
|
||||
<header class="note-header h1">
|
||||
<h1 class="note-title"><?= $page->title()->html() ?></h1>
|
||||
<h1 class="note-title"><?= $page->title()->esc() ?></h1>
|
||||
<?php if ($page->subheading()->isNotEmpty()): ?>
|
||||
<p class="note-subheading"><small><?= $page->subheading()->html() ?></small></p>
|
||||
<p class="note-subheading"><small><?= $page->subheading()->esc() ?></small></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
<div class="note text">
|
||||
@@ -44,13 +44,13 @@
|
||||
<ul class="note-tags">
|
||||
<?php foreach ($tags as $tag): ?>
|
||||
<li>
|
||||
<a href="<?= $page->parent()->url(['params' => ['tag' => $tag]]) ?>"><?= html($tag) ?></a>
|
||||
<a href="<?= $page->parent()->url(['params' => ['tag' => $tag]]) ?>"><?= esc($tag) ?></a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
||||
<time class="note-date" datetime="<?= $page->date('c') ?>">Published on <?= $page->date() ?></time>
|
||||
<time class="note-date" datetime="<?= $page->date()->toDate('c') ?>">Published on <?= $page->date()->esc() ?></time>
|
||||
</footer>
|
||||
|
||||
<?php snippet('prevnext') ?>
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<?php if (empty($tag) === false): ?>
|
||||
<header class="h1">
|
||||
<h1>
|
||||
<small>Tag:</small> <?= html($tag) ?>
|
||||
<small>Tag:</small> <?= esc($tag) ?>
|
||||
<a href="<?= $page->url() ?>" aria-label="All Notes">×</a>
|
||||
</h1>
|
||||
</header>
|
||||
|
@@ -30,7 +30,7 @@
|
||||
<?= ($cover = $project->cover()) ? $cover->crop(400, 500) : null ?>
|
||||
</span>
|
||||
<figcaption class="img-caption">
|
||||
<?= $project->title()->html() ?>
|
||||
<?= $project->title()->esc() ?>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</a>
|
||||
|
Reference in New Issue
Block a user