blob: 68915e4bd2547ffb1946d6782eb105cfdfc1e3e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
if (realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME'] ?? '')) { http_response_code(404); exit; }
$journal_entries = is_file(__DIR__ . '/entries.php') ? require __DIR__ . '/entries.php' : [];
foreach ($journal_entries as $entry) {
$date = $entry['date'] ?? '';
$body = $entry['body'] ?? '';
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $date) || trim((string)$body) === '') continue;
echo ' <div class="entry"><time datetime="' . htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '">'
. htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '</time><p>'
. nl2br(htmlspecialchars((string)$body, ENT_QUOTES, 'UTF-8'), false)
. "</p></div>\n";
}
|