summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2021-11-09 20:42:20 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2021-11-09 20:42:20 +0000
commitb15a095c0e5f980b63c1b229b0671227bfc64316 (patch)
treef13a3b6f1c2dbc6bca4f0fcb9f59e4a8a4b03628 /src
parent5c7b4099e2815089cb7bfe49f6b07158c23a8b2f (diff)
Use short echo tags
Diffstat (limited to 'src')
-rw-r--r--src/templates/confirm_deletion.php4
-rw-r--r--src/templates/edit.php2
-rw-r--r--src/templates/form_fields.php12
-rw-r--r--src/templates/index.php10
4 files changed, 16 insertions, 12 deletions
diff --git a/src/templates/confirm_deletion.php b/src/templates/confirm_deletion.php
index 12c5cd1..2938c4b 100644
--- a/src/templates/confirm_deletion.php
+++ b/src/templates/confirm_deletion.php
@@ -13,8 +13,8 @@
<h2>Confirm Deletion</h2>
<a href="/">Back</a>
<form action="/delete" method="POST">
- <input type="hidden" name="id" value="<?php echo $bookmark->id; ?>"/>
- <?php echo htmlentities("$bookmark->url | $bookmark->title | $bookmark->tag"); ?>
+ <input type="hidden" name="id" value="<?= $bookmark->id; ?>"/>
+ <?= htmlentities("$bookmark->url | $bookmark->title | $bookmark->tag"); ?>
<button type="submit">Delete</button>
</form>
<p>Copyright © 2021 David T. Sadler.</p>
diff --git a/src/templates/edit.php b/src/templates/edit.php
index 100cd0e..5318c2c 100644
--- a/src/templates/edit.php
+++ b/src/templates/edit.php
@@ -13,7 +13,7 @@
<h2>Edit</h2>
<a href="/">Back</a>
<form action="/update" method="POST">
- <input type="hidden" name="id" value="<?php echo $bookmark->id; ?>"/>
+ <input type="hidden" name="id" value="<?= $bookmark->id; ?>"/>
<?php require_once('form_fields.php'); ?>
<button type="submit">Update</button>
</form>
diff --git a/src/templates/form_fields.php b/src/templates/form_fields.php
index 0bfe076..224dbf4 100644
--- a/src/templates/form_fields.php
+++ b/src/templates/form_fields.php
@@ -1,12 +1,12 @@
-<label>URL<input type="text" name="url" maxlength="512" value="<?php echo htmlspecialchars($old->get('url', $bookmark->url)); ?>" autofocus></label>
+<label>URL<input type="text" name="url" maxlength="512" value="<?= htmlspecialchars($old->get('url', $bookmark->url)); ?>" autofocus></label>
<?php if ($errors->has('url')) { ?>
- <p><?php echo htmlentities(implode(', ', $errors->get('url'))); ?></p>
+ <p><?= htmlentities(implode(', ', $errors->get('url'))); ?></p>
<?php } ?>
-<label>Title<input type="text" name="title" maxlength="256" value="<?php echo htmlspecialchars($old->get('title', $bookmark->title)); ?>"></label>
+<label>Title<input type="text" name="title" maxlength="256" value="<?= htmlspecialchars($old->get('title', $bookmark->title)); ?>"></label>
<?php if ($errors->has('title')) { ?>
- <p><?php echo htmlentities(implode(', ', $errors->get('title'))); ?></p>
+ <p><?= htmlentities(implode(', ', $errors->get('title'))); ?></p>
<?php } ?>
-<label>Tag<input type="text" name="tag" maxlength="8" value="<?php echo htmlspecialchars($old->get('tag', $bookmark->tag)); ?>"></label>
+<label>Tag<input type="text" name="tag" maxlength="8" value="<?= htmlspecialchars($old->get('tag', $bookmark->tag)); ?>"></label>
<?php if ($errors->has('tag')) { ?>
- <p><?php echo htmlentities(implode(', ', $errors->get('tag'))); ?></p>
+ <p><?= htmlentities(implode(', ', $errors->get('tag'))); ?></p>
<?php } ?>
diff --git a/src/templates/index.php b/src/templates/index.php
index f078bbd..ff67458 100644
--- a/src/templates/index.php
+++ b/src/templates/index.php
@@ -11,20 +11,24 @@
<section>
<h1>Bookmarks</h1>
<?php if ($message) { ?>
- <p class="message"><?php echo $message; ?></p>
+ <p class="message"><?= $message; ?></p>
<?php } ?>
<a href="/create">Add Bookmark</a>
<h2>Tags</h2>
<ul>
<a href="/">All</a>
<?php foreach($bookmarks->tags() as $tag) { ?>
- <li><a href="/?tag=<?php echo htmlentities($tag); ?>"><?php echo htmlentities($tag); ?></a></li>
+ <li><a href="/?tag=<?= htmlentities($tag); ?>"><?= htmlentities($tag); ?></a></li>
<?php } ?>
</ul>
<h2>Bookmarks</h2>
<ol>
<?php foreach ($bookmarks as $bookmark) { ?>
- <li><a href="<?php echo htmlentities($bookmark->url); ?>"><?php echo (new DateTime($bookmark->addedAt))->format('Y-m-d'); ?> - <?php echo $bookmark->title != '' ? htmlentities($bookmark->title) : htmlentities($bookmark->url); ?></a> | <?php if ($bookmark->tag) { ?><a class="no-decoration tag" href="/?tag=<?php echo htmlentities($bookmark->tag); ?>"><?php echo htmlentities($bookmark->tag); ?></a> | <?php } ?><a class="no-decoration" href="/edit?id=<?php echo $bookmark->id; ?>">Edit</a> | <a class="no-decoration" href="/delete/confirm?id=<?php echo $bookmark->id; ?>">Delete</a></li>
+ <li>
+ <a href="<?= htmlentities($bookmark->url); ?>">
+ <?= (new DateTime($bookmark->addedAt))->format('Y-m-d'); ?> - <?= $bookmark->title != '' ? htmlentities($bookmark->title) : htmlentities($bookmark->url); ?></a> | <?php if ($bookmark->tag) { ?><a class="no-decoration tag" href="/?tag=<?= htmlentities($bookmark->tag); ?>"><?= htmlentities($bookmark->tag); ?></a> | <?php } ?><a class="no-decoration" href="/edit?id=<?= $bookmark->id; ?>">Edit</a> | <a class="no-decoration" href="/delete/confirm?id=<?= $bookmark->id; ?>">Delete
+ </a>
+ </li>
<?php } ?>
</ol>
<p>Copyright © 2021 David T. Sadler.</p>